Skip to content

Handle boundary conditions internally#919

Draft
giacomofiorin wants to merge 15 commits into
masterfrom
internal_pbcs
Draft

Handle boundary conditions internally#919
giacomofiorin wants to merge 15 commits into
masterfrom
internal_pbcs

Conversation

@giacomofiorin

@giacomofiorin giacomofiorin commented Feb 12, 2026

Copy link
Copy Markdown
Member

This PR removes all calls to MD engines' codes for computing distances using the minimum-image convention. Now, the periodic boundary conditions are copied by the respective proxy class into a single object of type colvarmodule::system_boundary_conditions.

This class should be trivially copyable, and it is implemented in a single header file that uses the COLVARS_HOST_DEVICE macro. Therefore, the same code should work in both host and device, and could assist in computing PBC-aware distances on the device without duplicating existing code.

TODO: more tests are required with triclinic cells, or mixed periodicity as allowed by the engines.

@giacomofiorin

Copy link
Copy Markdown
Member Author

Note: I have confirmed by manually changing the unit cell vectors in the GROMACS input files, that the box matrix is correctly converted into three vectors:

https://manual.gromacs.org/current/reference-manual/algorithms/periodic-boundary-conditions.html

@giacomofiorin giacomofiorin force-pushed the internal_pbcs branch 2 times, most recently from 109617b to 7cc62b1 Compare June 16, 2026 22:26
@giacomofiorin giacomofiorin changed the title WIP: Handle boundary conditions internally Handle boundary conditions internally Jun 16, 2026
@giacomofiorin giacomofiorin force-pushed the internal_pbcs branch 2 times, most recently from 4d1fed3 to c214448 Compare June 17, 2026 03:48
Comment thread src/colvarcomp.cpp
{
if (!is_enabled(f_cvc_pbc_minimum_image)) {
// Copy boundary conditions from the proxy
boundary_conditions = cvm::main()->proxy->get_system_boundaries();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to use cvmodule->proxy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants