From abfda5a8072dc64dc506f200e2f29cc0188646d1 Mon Sep 17 00:00:00 2001 From: kirk0830 Date: Wed, 4 Mar 2026 11:22:16 +0800 Subject: [PATCH] Fix: correct the unit conversion between Plumed and ASE in example --- interfaces/ASE_interface/examples/metadynamics.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/interfaces/ASE_interface/examples/metadynamics.py b/interfaces/ASE_interface/examples/metadynamics.py index 81142cd0c6..cab54cc368 100644 --- a/interfaces/ASE_interface/examples/metadynamics.py +++ b/interfaces/ASE_interface/examples/metadynamics.py @@ -37,7 +37,12 @@ from ase.io import read from ase.md import Bussi from ase.md.velocitydistribution import MaxwellBoltzmannDistribution -from ase.units import fs +from ase.units import ( + fs, + kJ as _kJ, + mol as _mol, +) +_ps = 1000 * fs from ase.constraints import FixCartesian from ase.calculators.plumed import Plumed from abacuslite import AbacusProfile, Abacus @@ -99,7 +104,7 @@ MaxwellBoltzmannDistribution(atoms, temperature_K=300) setup = [# define the unit within the PLUMED runtime - 'UNITS LENGTH=A TIME=fs ENERGY=eV', + f'UNITS LENGTH=A TIME={1/_ps} ENERGY={_mol/_kJ}', # define the two bond lengths 'd1: DISTANCE ATOMS=1,5', 'd2: DISTANCE ATOMS=1,6',