spainn.interface

aseinterface.NacCalculator

class interface.aseinterface.NacCalculator(model_file: str, neighbor_list: ~schnetpack.transform.base.Transform, energy_key: str = 'energy', force_key: str = 'forces', nac_key: str = 'nacs', dipole_key: str = 'dipoles', soc_key: str = 'socs', smooth_nac_key: str = 'smooth_nacs', energy_unit: str | float = 'Ha', position_unit: str | float = 'Bohr', soc_unit: str = 'eV', dipole_unit: str = 'eV', nac_unit: str = 'eV', snac_unit: str = 'eV', device: str | ~torch.device = 'cpu', dtype: ~torch.dtype = torch.float64, converter: ~schnetpack.interfaces.ase_interface.AtomsConverter = <class 'schnetpack.interfaces.ase_interface.AtomsConverter'>, **kwargs)[source]

Adapted SpkCalculator for predicting NACs (and other properties)

Parameters:
  • model_file – Path to trained model

  • neighbor_list – Neighborlist transform

  • energy_key – Name of energy property in provided model

  • force_key – Name of force property in provided model

  • nac_key – Name of NAC property in provided model

  • dipole_key – Name of dipole property in provided model

  • soc_key – Name of SOC property in provided model

  • smooth_nac_key – Name of smooth NAC property in provided model

  • energy_unit – Energy unit used by model

  • position_unit – Unit used for positions

  • soc_unit – SOC unit used by model

  • dipole_unit – Dipole unit used by model

  • nac_unit – NAC unit used by model, default eV to avoid conversion by schnetpack

  • device – Device on which model operates

  • dtype – Data type for model input

  • converter – Converter used to set up input batches

  • **kwargs – Additional arguments for Calculator class

Basic calculator implementation.

restart: str

Prefix for restart file. May contain a directory. Default is None: don’t restart.

ignore_bad_restart_file: bool

Deprecated, please do not use. Passing more than one positional argument to Calculator() is deprecated and will stop working in the future. Ignore broken or missing restart file. By default, it is an error if the restart file is missing or broken.

directory: str or PurePath

Working directory in which to read and write files and perform calculations.

label: str

Name used for all files. Not supported by all calculators. May contain a directory, but please use the directory parameter for that instead.

atoms: Atoms object

Optional Atoms object to which the calculator will be attached. When restarting, atoms will get its positions and unit-cell updated from file.

implemented_properties: List[str] = ['energy', 'forces', 'nacs', 'dipoles', 'socs', 'smooth_nacs']

Properties calculator can handle (energy, forces, …)

calculate(atoms: Atoms | None = None, properties: List[str] | None = None, system_changes: List[str] = ['positions', 'numbers', 'cell', 'pbc', 'initial_charges', 'initial_magmoms'])[source]
Parameters:
  • atoms (ase.Atoms) – ASE atoms object.

  • properties (list of str) – select properties computed and stored to results.

  • system_changes (list of str) – List of changes for ASE.

calculate_properties(atoms: Atoms, properties: List[str]) ndarray[source]

Wrapper function to return NACs (and other properties) Called by ase.Atoms.get_properties() This is the easiest approach to add NAC prediction without touching ase.Atoms class

sharcinterface.SHARC_NN

class interface.sharcinterface.SHARC_NN(*args: Any, **kwargs: Any)[source]

Class for SHARC NN