QM_engines.ase_wrapper module¶
Description¶
This module defines the ParaMol.QM_engines.ase_wrapper.ASEWrapper class, which is a ParaMol implementation of a ASE wrapper.
-
class
ParaMol.QM_engines.ase_wrapper.ASEWrapper(system_name, interface, calculator, n_atoms, atom_list, n_calculations, cell, calc_dir_prefix='ase_', work_dir_prefix='ASEWorkDir_', view_atoms=False, optimizer=<class 'ase.optimize.bfgs.BFGS'>, opt_fmax=0.01, opt_log_file='-', opt_traj_prefix='traj_', shake_threshold=1e-07, md_steps=100, md_dt=0.09822694788464063, md_initial_temperature=0.02585199101165164, md_integrator=<class 'ase.md.verlet.VelocityVerlet'>, md_integrator_args={})¶ Bases:
objectParaMol implementation of an ASE wrapper.
- Parameters
system_name (str) – Name of the system to which this wrapper is associated.
interface (
ParaMol.Utils.interface.ParaMolInterface) – ParaMol interface object instance.calculator (Any ASE calculator defined in the modules of the subpackage
ase.calculators.) – ASE calculator instance.n_atoms (int) – Number of atoms of the system.
atom_list (list of str) – Atom list symbols.
n_calculations (int) – Number of calculations
cell (np.ndarray, shape=(3,3), dtype=float) – Box cell vectors.
work_dir_prefix (str, default="ASEWorkDir") – Path to the working directory.
optimizer (any ase.optimizer, default=:obj:ase.optimize.bfgs.BFGS*) – ASE optimizer instance. For more info see: https://wiki.fysik.dtu.dk/ase/ase/optimize.html
opt_fmax (float, default=1e-2) – The convergence criterion to stop the optimization is that the force on all individual atoms should be less than fmax.
opt_log_file (str, default="-") – File where optimization log will be stored. Use ‘-‘ for stdout.
opt_traj_prefix (str, default=”traj_”) – Prefix given to the pickle file used to store the trajectory during optimization.
view_atoms (bool, default=`False`) – Whether or not to view atoms after a calculation.
calc_dir_prefix (str, default="ase_") – Prefix given to the directories where the calculations will be performed.
-
_prepare_workdir()¶ Method that prepares the working directory.
- Returns
None
-
run_calculation(coords, label, calc_type='single_point', calculate_force=True, dihedral_freeze=None, ase_constraints=None)¶ Method that runs an ASE calculation.
- Parameters
coords (np.ndarray, shape=(n_atoms,3), dtype=float) – Coordinates array.
label (str or int) – Label of the calculation.
calc_type (str, default="single_point") – Available options are “single_point” and “optimization”.
calculate_force (bool) – Whether to calculate forces.
dihedral_freeze (list of list of int, default=None) – List of lists of wherein each inner list should contain 4 integers defining a torsion to be kept fixed.
ase_constraints (list of ASE constraints, default=None) – List of ASE constraints to be applied during the scans. More information: https://wiki.fysik.dtu.dk/ase/ase/constraints.html
- Returns
coord (np.ndarray, shape=(n_atoms,3), dtype=float) – Coordinate array in nanometers.
energy (float) – Energy value in kJ/mol.
forces (np.ndarray, shape=(n_atoms,3), dtype=float) – Forces array, kJ/mol/nm.
-
run_md(coords, label, steps=None, dt=None, initial_temperature=None, integrator=None, integrator_args=None, dihedral_freeze=None, ase_constraints=None)¶ Method that runs an ASE calculation.
- Parameters
coords (np.ndarray, shape=(n_atoms,3), dtype=float) – Coordinates array.
label (str or int) – Label of the calculation.
steps (int) – Number of steps to take.
dt (unit.Quantity) – MD Time step.
initial_temperature (float with ase.unit) – Temperature of MD.
integrator (ase.md integrator) – ASE integrator.
integrator_args (dict) – Additional integrator options.
dihedral_freeze (list of list of int, default=None) – List of lists of wherein each inner list should contain 4 integers defining a torsion to be kept fixed.
ase_constraints (list of ASE constraints, default=None) – List of ASE constraints to be applied during the scans. More information: https://wiki.fysik.dtu.dk/ase/ase/constraints.html
- Returns
coord (np.ndarray, shape=(n_atoms,3), dtype=float) – Coordinate array in nanometers.
energy (float) – Energy value in kJ/mol.
forces (np.ndarray, shape=(n_atoms,3), dtype=float) – Forces array, kJ/mol/nm.