PLUMED
Introduction
Plumed is an open source library that allows implementing several kinds of enhanced sampling methods and contains a variety of tools to analyze data obtained from molecular dynamics simulations. With this calculator, You can carry out biased simulations including metadynamics, well-tempered metadynamics, among others. Besides, it is possible to compute a large set of collective variables that plumed has already implemented for being calculated on-the-fly in MD simulations or for postprocessing tasks.
Installation
The ASE-Plumed calculator uses the python wrap of Plumed. An easy way to install it using conda:
conda install -c conda-forge py-plumed
However, the installation preferences could be easier to modify using any of the others options presented in this page.
Test the installation of plumed doing this:
>>> from plumed import Plumed
>>> Plumed()
Set-up
Typically, Plumed simulations need an external file, commonly called plumed.dat for setting up its functions. In this ASE calculator interface, Plumed information is given to the calculator through a list of strings containing the lines that would be included in the plumed.dat file. For example:
setup = [f"UNITS LENGTH=A TIME={1/(1000 * units.fs)} ENERGY={units.mol/units.kJ}",
"d: DISTANCE ATOMS=1,2",
"PRINT ARG=d STRIDE=10 FILE=COLVAR"]
For a complete explanation of the plumed keywords, visit the official web of plumed plug-in.
Units
Note that the first line of setup list of the previous example is referred to units. That is because Plumed will consider all quantities of input and outputs in plumed internal units. Then, it is necessary to add this line in order to remain the units same as ASE. You can ignore this line, but be aware of the units changes.
See also
Visit this Metadynamics tutorial for further explanation of the Plumed calculator.
Plumed Calculator Class
- class ase.calculators.plumed.Plumed(calc, input, timestep, atoms=None, kT=1.0, log='', restart=False, use_charge=False, update_charge=False)[source]
Plumed calculator is used for simulations of enhanced sampling methods with the open-source code PLUMED (plumed.org).
[1] The PLUMED consortium, Nat. Methods 16, 670 (2019) [2] Tribello, Bonomi, Branduardi, Camilloni, and Bussi, Comput. Phys. Commun. 185, 604 (2014)
- Parameters:
calc (Calculator object) – It computes the unbiased forces
input (List of strings) – It contains the setup of plumed actions
timestep (float) – Time step of the simulated dynamics
atoms (Atoms) – Atoms object to be attached
kT (float. Default 1.) – Value of the thermal energy in eV units. It is important for some methods of plumed like Well-Tempered Metadynamics.
log (string) – Log file of the plumed calculations
restart (boolean. Default False) – True if the simulation is restarted.
use_charge (boolean. Default False) – True if you use some collective variable which needs charges. If use_charges is True and update_charge is False, you have to define initial charges and then this charge will be used during all simulation.
update_charge (boolean. Default False) – True if you want the charges to be updated each time step. This will fail in case that calc does not have ‘charges’ in its properties.
Note
For this case, the calculator is defined strictly with the object atoms inside. This is necessary for initializing the Plumed object. For conserving ASE convention, it can be initialized as atoms.calc = (…, atoms=atoms, …)
Note
In order to guarantee a proper restart, the user has to fix momenta, positions and Plumed.istep, where the positions and momenta corresponds to the last configuration in the previous simulation, while Plumed.istep is the number of timesteps performed previously. This can be done using ase.calculators.plumed.restart_from_trajectory.
Note
Periodic Boundary Conditions (PBC) fixed in ASE has nothing to do with PBC
of PLUMED. If you set a cell in ASE, PLUMED will assume PBC in all
directions -at least you specify something different in your plumed set up-
independently of your set_pbc
election.