asimtools.asimmodules.active_learning package

asimtools.asimmodules.active_learning.ase_md module

Describe the script briefly here. If this is a script that runs multiple steps, describe it here using reStructuredText to generate autodocs

Cite the papers where the method/script was first introduced here as well

Author: mkphuthi@github.com

asimtools.asimmodules.active_learning.ase_md.ase_md(calc_spec: Dict, image: Dict, timestep: float, nsteps: int = 100, dynamics: str = 'npt', temp: float | None = None, friction: float | None = 0.01, ttime: float | None = 2.455673697116016, pfactor: float | None = None, externalstress: float | None = 0, plot: bool | None = True) Dict[source]

Runs ASE MD simulations. This is only recommended for small systems and for testing. For larger systems, use LAMMPS or more purpose-built code

Parameters:
  • calc_spec (Dict) – calc specification, any entries specified with asterisk wildcards will be expanded

  • image (Dict) – Image specification, see asimtools.utils.get_atoms()

  • timestep (float) – Timestep in ASE time units

  • temp (float) – Temperature in Kelvin

  • dynamics (str, optional) – Type of dynamics to run from ‘nvt’, ‘langevin’ and ‘nvt’, defaults to ‘npt’

  • friction (float, optional) – Friction parameter, defaults to 1e-2

  • ttime (float, optional) – Thermostat time constant, defaults to 25*fs

  • pfactor (float, optional) – Pressure factor, defaults to None

  • nsteps (int, optional) – Number of steps to run, defaults to 100

  • externalstress (float, optional) – External stress to apply, defaults to 0

  • plot (bool, optional) – Whether to plot thermodynamic properties, defaults to True

Returns:

Results dictionary

Return type:

Dict

asimtools.asimmodules.active_learning.ase_md.langevin_nvt(atoms: Atoms, temp: float, nsteps: int, traj_file: str | None = None, friction: float = 0.01, timestep: float = 0.09822694788464063)[source]

Does Langevin dynamics

Parameters:
  • atoms (ase.Atoms) – atoms object

  • temp (float) – Temperature in Kelvin

  • nsteps (int) – Number of steps to run

  • traj_file (str, optional) – trajectory file name, defaults to None

  • friction (float, optional) – friction parameter, defaults to 1e-2

  • timestep (float, optional) – Timestep in ASE time units, defaults to 1*fs

Returns:

final atoms object and trajectory object

Return type:

ase.Atoms, Trajectory

asimtools.asimmodules.active_learning.ase_md.npt(atoms: Atoms, temp: float, nsteps: int, timestep: float, externalstress: float = 0, traj_file: str | None = None, ttime: float = 2.455673697116016, pfactor: float | None = None)[source]

Does NPT dynamics

Parameters:
  • atoms (ase.Atoms) – input atoms object

  • temp (float) – Temperature in Kelvin

  • nsteps (int) – Number of steps to run

  • timestep (float) – Timestep in ASE time units

  • externalstress (float, optional) – External pressure to apply, defaults to 0

  • traj_file (str, optional) – trajectory file name, defaults to None

  • ttime (float, optional) – thermostat time constant, defaults to 25*fs

Returns:

final atoms object and trajectory object

Return type:

ase.Atoms, Trajectory

asimtools.asimmodules.active_learning.ase_md.plot_thermo(images: Dict, props: Sequence = ['epot', 'temp', 'ekin', 'etot', 'press'], prefix: str = 'ase_md')[source]

Plots thermodynamic properties of a trajectory

Parameters:
  • images (Dict) – Dictionary of images to read from

  • props (Sequence, optional) – Properties to plot, defaults to [‘epot’, ‘temp’, ‘ekin’, ‘etot’, ‘press’]

  • prefix (str, optional) – Prefix for output file names, defaults to ‘ase_md’

asimtools.asimmodules.active_learning.compute_deviation module

asimtools.asimmodules.active_learning.compute_deviation.compute_deviation(images: Dict, template_calc_params: Dict | None = None, model_weights_key_sequence: Sequence | None = None, model_weights_pattern: PathLike | None = None, calculators: Sequence | None = None) Dict[source]

Computes variance of properties from a trajectory file

Parameters:
  • images (Dict) – Images specification, see asimtools.utils.get_images()

  • template_calc_params (Optional[Dict]) – Template calc_params, defaults to None

  • model_weights_key_sequence (Optional[Sequence]) – Sequence of keys to change in the template calc_params

  • model_weights_pattern (Optional[os.PathLike]) – Pattern of model weights files, defaults to None

  • calculators (Optional[Sequence]) – List of calculator dicts, each with ‘calc_id’ or ‘calc_params’ key. If provided, all other arguments are ignored, defaults to None

asimtools.asimmodules.active_learning.direct_sample module

asimtools.asimmodules.active_learning.direct_sample.direct_sample(images: dict, n: int | None = None, threshold_init: float = 0.2, k: int = 1) dict[source]
asimtools.asimmodules.active_learning.direct_sample.plot_PCAfeature_coverage(all_features, selected_indexes, method='DIRECT')[source]

asimtools.asimmodules.active_learning.select_images module

asimtools.asimmodules.active_learning.select_images.select_images(image_file: PathLike, deviation_csv: PathLike, thresholds: Sequence[float], column: str | None = 'force_mean_std', max_images: int | None = None) Dict[source]

Select images based on deviation values

Parameters:
  • image_file (os.PathLike) – Path to image_file with images to select from

  • deviation_csv (os.PathLike) – Path to csv file from compute_deviation, row indices should match indices in image_file

  • thresholds (Sequence[float]) – Thresholds for selection provided as (min,max)

  • column (str, optional) – Column of csv to use, defaults to ‘force_mean_std’

  • max_images (int, optional) – Maximum number of images to select, defaults to None

Returns:

Dictionary with stats on selected images

Return type:

Dict

Module contents