wfl.generate.md package#

Submodules#

wfl.generate.md.abort module#

Communly used and/or examples of classes that can be used to abort an MD sampling run under specified conditions

class wfl.generate.md.abort.AbortOnCollision(collision_radius, n_failed_steps=3)#

Bases: AbortSimBase

Abort an MD run if a collision (two atoms closer than some distance) happens for a number of steps in a row

Parameters
  • collision_radius (float) – distance for atoms to be considered a collision

  • n_failed_steps (int, default 1) – how many steps in a row any atom pairs have to be too cloe

atoms_ok(at)#
Method returning a boolean indicating whether this trajectory step is acceptable.

All derived classes must implement this method.

Parameters

at (Atoms) – atomic configuration

Returns

is_ok

Return type

bool containing status

wfl.generate.md.abort_base module#

class wfl.generate.md.abort_base.AbortSimBase(n_failed_steps=1)#

Bases: ABC

Base class used for checking and aborting MD simulation of wfl.generate.md.sample(). See stop method docstring for its default behavior.

abstract atoms_ok(at)#
Method returning a boolean indicating whether this trajectory step is acceptable.

All derived classes must implement this method.

Parameters

at (Atoms) – atomic configuration

Returns

is_ok

Return type

bool containing status

stop(at)#

Returns a boolean indicating whether wfl.generate.md.sample() should stop the simulation. Defaults to aborting if n_failed_steps in a row atoms_ok() are evaluated to False. Derrived classes may overwrite this.

Module contents#

wfl.generate.md.md(*args, **kwargs)#

runs an MD trajectory with aggresive, not necessarily physical, integrators for sampling configs

Parameters
  • inputs (iterable(Atoms)) – input quantities of type Atoms

  • outputs (OutputSpec or None) – where to write output atomic configs, or None for no output (i.e. only side-effects)

  • calculator (Calculator / (initializer, args, kwargs)) – ASE calculator or routine to call to create calculator

  • dt (float) – time step (fs)

  • integrator (str, default "NVTBerendsen") – Select integrator. Default is Berendsen but also langevin can be used

  • steps (int) – number of steps

  • temperature (float or (float, float, [int]]), or list of dicts default None) – temperature control (Kelvin) - float: constant T - tuple/list of float, float, [int=10]: T_init, T_final, and optional number of stages for ramp - [ {‘T_i’: float, ‘T_f’ : float, ‘traj_frac’ : flot, ‘n_stages’: int=10}, … ] list of stages, each one a ramp, with duration defined as fraction of total number of steps

  • temperature_tau (float, default None) – Time scale for thermostat (fs). Directly used for Berendsen integrator, or as 1/friction for Langevin integrator.

  • pressure (None / float / tuple) – applied pressure distribution (GPa) as parsed by wfl.utils.pressure.sample_pressure() enabled Berendsen constant P volume rescaling

  • pressure_tau (float, default None) – time scale for Berendsen constant P volume rescaling (fs) ignored if pressure is None, defaults to 3*temperature_tau

  • compressibility_fd_displ (float, default 0.01) – finite difference in strain to use when computing compressibility for NPTBerendsen

  • traj_step_interval (int, default 1) – interval between trajectory snapshots

  • skip_failures (bool, default True) – just skip minimizations that raise an exception

  • verbose (bool, default False) – verbose output MD logs are not printed unless this is True

  • update_config_type (bool, default True) – append “MD” to at.info[‘config_type’]

  • traj_select_during_func (func(Atoms), default func(Atoms) -> bool=True) – Function to sub-select configs from the first trajectory. Used during MD loop with one config at a time, returning True/False

  • traj_select_after_func (func(list(Atoms)), default None) – Function to sub-select configs from the first trajectory. Used at end of MD loop with entire trajectory as list, returns subset

  • abort_check (default None,) – wfl.generate.md.abort_base.AbortBase - derived class that checks the MD snapshots and aborts the simulation on some condition.

  • rng (numpy.random.Generator, default None) – random number generator to use (needed for pressure sampling, initial temperature, or Langevin dynamics)

  • _autopara_per_item_info (dict) – INTERNALLY used by autoparallelization framework to make runs reproducible (see wfl.autoparallelize.autoparallelize() docs)

  • autopara_info (AutoParaInfo / dict, optional) – information for automatic parallelization

Returns

co – output configs

Return type

ConfigSet