Skip to content

Feature: PLUMED interface for the MD driver - #382

Closed
MarkYoungIV wants to merge 2 commits into
abacusmodeling:developfrom
MarkYoungIV:plumed-interface-develop
Closed

MarkYoungIV wants to merge 2 commits into
abacusmodeling:developfrom
MarkYoungIV:plumed-interface-develop

Conversation

@MarkYoungIV

Copy link
Copy Markdown

Summary

This PR adds PLUMED support to ABACUS molecular dynamics: collective variables, biasing potentials (metadynamics, walls, umbrella sampling, ...) and the PLUMED post-processing workflow can now be used together with calculation md. Feedback on design and scope is very welcome.

Usage

plumed                 1
plumed_file            plumed.dat

with a standard PLUMED input file, e.g. well-tempered metadynamics along a distance:

UNITS LENGTH=A TIME=fs ENERGY=eV
d: DISTANCE ATOMS=1,2
metad: METAD ARG=d PACE=100 HEIGHT=0.05 SIGMA=0.1 BIASFACTOR=10 TEMP=300 FILE=HILLS
PRINT ARG=d,metad.bias FILE=COLVAR STRIDE=10

What is included

  • new module source/source_plumed/ wrapping the PLUMED C API (plumed_create / plumed_cmd / plumed_finalize), driven from the shared MD loop in source_md/run_md.cpp, so all integrators (md_type) are covered;
  • two new INPUT items: plumed (Boolean) and plumed_file (String);
  • optional build support: cmake -DPLUMED_ROOT=<plumed-install>; when unset, nothing changes and PLUMED is not required at all;
  • documentation: docs/parameters.yaml and docs/advanced/input_files/input-main.md regenerated with the branch binary (--generate-parameters-yaml), plus a new page docs/advanced/interface/plumed.md.

Design notes

  • The ABACUS atomic units (Bohr, Hartree, atomic time unit) are declared to PLUMED through setMD*Units; positions, cell, forces, potential energy and masses are exchanged in native units and PLUMED converts them internally, so no manual conversion is needed.
  • The call sequence follows the reference implementations shipped with PLUMED (setPositions/setBox/setEnergy -> prepareCalc -> setForces/setVirial -> performCalc); the virial is handed over whenever the MD provides it.
  • Every MD step is flagged as a checkpointing step, so PLUMED flushes COLVAR/HILLS continuously and the run can be followed live.
  • Current limitation: a single MPI rank is required for the MD part (the atoms owned by the master rank are handed over to PLUMED). This covers typical serial/OpenMP production runs; multi-rank support would require gathering the distributed atoms, which is left for a future PR.

Testing

  • Builds: (a) a workstation build with GCC + CUDA (GPU, cusolver) and (b) an HPC CPU cluster build (GCC toolchain, OpenMP + ELPA, ks_solver genelpa), both against PLUMED 2.10.1.
  • Validation: LCAO MD metadynamics of the ethane torsion (following the ABACUS example of the DP-GEN tutorial): the COLVAR values are bitwise identical between the plain CPU, the cluster (OpenMP/ELPA) and the GPU builds; the reconstructed FES reproduces the three-fold torsion profile with a barrier of ~12 kJ/mol.
  • Application: metadynamics of HNO3 dissociation on a graphene flake at 600 K (3 coordination-number CVs + a spherical wall; 70 atoms, gamma-only LCAO) - the interface has been running for >10k MD steps with stable SCF and continuous HILLS/COLVAR output.
  • Documentation CI: parameters.yaml and input-main.md were regenerated with the branch binary and are consistent with the source.

Notes for reviewers

  • The feature is compile-gated (-DPLUMED_ROOT), so all existing CI configurations are unaffected.
  • Automated tests were not added because the CI builds do not provide a PLUMED installation; the feature was validated manually as described above.
  • Happy to adjust naming/placement (e.g. INPUT keyword names) to project conventions.

Port of the PLUMED interface to the MDCell-based MD driver of the
develop branch:

- new INPUT items 'plumed' and 'plumed_file'
- new module source/source_plumed wrapping the PLUMED C API
  (plumed_create / plumed_cmd / plumed_finalize); the interface is driven
  from the shared MD loop in source_md/run_md.cpp, so all the integrators
  are supported
- ABACUS atomic units are declared to PLUMED through setMD*Units; the
  positions/cell (Bohr), forces (Hartree/Bohr), potential energy (Hartree)
  and masses are handed over in native units, and PLUMED converts them
  internally
- the call sequence follows the reference implementations distributed with
  PLUMED (values, prepareCalc, setForces/setVirial, performCalc); every
  step is flagged as a checkpointing step so that PLUMED flushes its
  output files (COLVAR, ...) while the run is in progress
- build with -DPLUMED_ROOT=<prefix of an installed PLUMED>
- current limitation: a single MPI rank is required (the atoms owned by
  the master rank are handed over), which covers the standard
  serial/OpenMP MD runs
@MarkYoungIV

Copy link
Copy Markdown
Author

Thanks for the guidance — closing this PR as advised. Two compliance issues:

  1. the submission should target deepmodeling/abacus-develop (the active development repo), not this one;
  2. the new top-level source/source_plumed/ folder violates the no-new-folder policy under source/.

I will rebase onto the latest deepmodeling/abacus-develop:develop, move the PLUMED interface into source/source_md/ (it is driven from the MD loop), rebuild and re-verify on our CPU cluster, and open a fresh PR against the correct repository. Sorry for the noise, and thanks for the review!

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.

1 participant