forked from deepmodeling/deepmd-kit
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix dplr: support initializing from a restart file (deepmodeling#4084)
Thie PR aims at fixing deepmodeling#3679. The `get_valid_pairs` will raise an error when 1) reading a restart file written from previous dplr jobs 2) reading a data file written from previous dplr jobs 3) executing 'run 0' for twice The origin is that the check in `get_valid_pairs` is too strict for the initialization process. The check requires that a pair of real and virtual atoms found by iterating over the bondlist to be the local atoms of the same processor. This requirement is automatically satisfied during the running of MD because the positions of virtual atoms are set equal to those of real atoms before rebuilding bondlists. However, during initialization (`Verlet::setup(int flag)`), the bondlist is built based on the initial configuration provided by the user. If the user provides a configuration in which the virtual atoms are placed at the Wannier centroids, it is possible that a bond formed by a pair of real and virtual atoms are between a local and a ghost atom, which triggers this error. This PR loosens the requirement on the initial configuration provided by the user. In the `setup_post_neighbor` function, the `get_valid_pairs` function searches for bonded pairs but skips the aforementioned check. It sets the coordinates of the virtual atoms to the coordinates of the real atoms, and then rebuilds the bondlist. Afterwards, the check can be passed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new method for setting up pre-exchange operations, enhancing simulation lifecycle management. - **Changes** - Renamed the `post_integrate` method to `pre_exchange` to better reflect its role in the simulation process. - Updated mask settings to improve clarity and context within the simulation lifecycle. - **Chores** - Updated ownership context for Docker image in the build workflow configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
430dfa9
commit 9699349
Showing
3 changed files
with
86 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters