Fake MD
The fake MD and fake DFT modules provide interfaces to OTF, such that we can do offline training, i.e. use a given ab-initio MD trajectory to train a GP potential with active learning.
In the OTF training, instead of running a real MD step to get to the next frame, fake MD feeds the next frame from the given trajectory. And instead of using real DFT for ground truth calculation, fake DFT reads the forces from the given trajectory as ground truth.
- class flare.md.fake.FakeDFT(**kwargs)
Fake DFT to read energy/forces/stress from a trajectory file.
- Parameters
filename (str) – The name of the trajectory file to read in.
format (str) – The format supported by ASE IO.
index (float or str) – The indices of frames to read from the trajectory. Default is “:”, which reads the whole trajectory.
- calculate(atoms=None, properties=None, system_changes=None)
Do the calculation.
- properties: list of str
List of what needs to be calculated. Can be any combination of ‘energy’, ‘forces’, ‘stress’, ‘dipole’, ‘charges’, ‘magmom’ and ‘magmoms’.
- system_changes: list of str
List of what has changed since last calculation. Can be any combination of these six: ‘positions’, ‘numbers’, ‘cell’, ‘pbc’, ‘initial_charges’ and ‘initial_magmoms’.
Subclasses need to implement this, but can ignore properties and system_changes if they want. Calculated properties should be inserted into results dictionary like shown in this dummy example:
self.results = {'energy': 0.0, 'forces': np.zeros((len(atoms), 3)), 'stress': np.zeros(6), 'dipole': np.zeros(3), 'charges': np.zeros(len(atoms)), 'magmom': 0.0, 'magmoms': np.zeros(len(atoms))}
The subclass implementation should first call this implementation to set the atoms attribute and create any missing directories.
- implemented_properties: List[str] = ['energy', 'forces', 'stress']
Properties calculator can handle (energy, forces, …)
- class flare.md.fake.FakeMD(*args: Any, **kwargs: Any)
Fake MD for offline training with OTF module and AIMD trajectories
- Parameters
atoms (ASE Atoms) – The list of atoms.
timestep (float) – The time step.
filenames (list) – The name of the trajectory file to read in.
format (str) – The format supported by ASE IO.
index (float or str) – The indices of frames to read from the trajectory. Default is “:”, which reads the whole trajectory.
io_kwargs (dict) – The arguments needed for reading specific format.