gpridge.integrations.plumed_bias

Add a PLUMED bias to an existing oracle.

PLUMED’s internal units are kJ/mol, nanometres, and picoseconds. This adapter tells the kernel that the host speaks eV and Angstrom: the length factor is one Angstrom expressed in nanometres, and the energy factor is one eV expressed in kJ/mol. With those factors, getBias returns eV and the force buffer is in eV/Angstrom.

The physical energy and force come from the wrapped oracle. PLUMED adds the bias. The total gradient is the oracle gradient minus the bias force, because the force buffer holds -dV/dR. Fixed-atom components of the total force are cleared by the oracle base.

advance_step defaults to false, so a restraint stays on the step given at construction. A bias that deposits hills on each call sets advance_step true. timestep_ps is the PLUMED timestep in picoseconds. kT_eV is kT in eV.

Input actions use PLUMED’s nm, kJ/mol and ps convention by default. input_units="host" declares Angstrom, eV and ps for action parameters through an initial UNITS action. Engine input and output buffers keep the host convention in either case. Caller-supplied UNITS actions are rejected so each input has one declared convention.

The command order follows the embedding used by ASE’s PLUMED calculator: unit commands, setNatoms, init, then one readInputLine per action, and on each evaluation prepareCalc, performCalc, and getBias. The virial buffer is supplied and discarded. This adapter does not return a stress.

Classes

PlumedBias

Physical oracle plus one PLUMED bias.

Module Contents

class gpridge.integrations.plumed_bias.PlumedBias(inner: gpridge.integrations.oracle.Oracle, kernel, *, masses_amu, advance_step: bool = False, owns_kernel: bool = False, owns_inner: bool = False, step: int = 0)

Bases: gpridge.integrations.oracle.Oracle

Physical oracle plus one PLUMED bias.

property step: int
classmethod from_input(inner: gpridge.integrations.oracle.Oracle, lines, *, masses_amu, timestep_ps: float, kT_eV: float, charges=None, logfile: str | None = None, restart: bool = False, advance_step: bool = False, plumed_module=None, input_units: str = 'plumed') → PlumedBias

Create a PLUMED kernel and add it to inner.

lines is the PLUMED action text, one action per string. plumed_module defaults to the plumed package and is imported only on this path. The kernel is finalized when the bias is closed. inner is left open.