ase_calculator

ASE calculator for MALA predictions.

class MALA(*args: Any, **kwargs: Any)[source]

Bases: Calculator

Implements an ASE calculator based on MALA predictions.

With this, MD simulations can be performed.

Parameters:
  • params (mala.common.parametes.Parameters) – Parameters used to create this Interface.

  • network (mala.network.network.Network) – Network which is being used for the run.

  • data (mala.datahandling.data_handler.DataHandler) – DataHandler; not really used in the classical sense, more as a collector of properties and objects (such as a target calculator).

  • reference_data (list) –

    A list containing

    • [0]: A type of additional calculation data

    • [1]: A path to it.

    With this additonal calculation data (preferably from the training of the neural network), calculator can access all important data such as temperature, number of electrons, etc. that might not be known simply from the atomic positions.

  • predictor (mala.network.predictor.Predictor) – A Predictor class object to be used for the underlying MALA predictions.

mala_parameters

MALA parameters used for predictions.

Type:

mala.common.parameters.Parameters

last_energy_contributions

Contains all total energy contributions for the last prediction.

Type:

dict

calculate(atoms=None, properties=['energy'], system_changes=ase.calculators.calculator.all_changes)[source]

Perform the calculations.

Parameters:
  • atoms (ase.Atoms) – Atoms object for which to perform 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’.

calculate_properties(atoms, properties)[source]

After a calculation, calculate additional properties.

This is separate from the calculate function because of MALA-MC simulations. For these energy and additional property calculation need to be separate.

Parameters:
  • atoms (ase.Atoms) – Atoms object for which to perform the calculation. No needed per se, we can use it for a correctness check eventually.

  • properties (list of str) – List of what needs to be calculated. Can be any combination of “rdf”, …

classmethod load_model(run_name, path='./')[source]

Load a model to use for the calculator (DEPRECATED).

MALA.load_model() will be deprecated in MALA v1.4.0. Please use MALA.load_run() instead.

Parameters:
  • run_name (str) – Name under which the model is saved.

  • path (str) – Path where the model is saved.

Returns:

calculator – The calculator object.

Return type:

mala.interfaces.calculator.Calculator

classmethod load_run(run_name, path='./')[source]

Load a model to use for the calculator.

Only supports zipped models with .json parameters. No legacy models supported.

Parameters:
  • run_name (str) – Name under which the model is saved.

  • path (str) – Path where the model is saved.

Returns:

calculator – The calculator object.

Return type:

mala.interfaces.calculator.Calculator

save_calculator(filename, path='./')[source]

Save parameters used for this calculator.

This is useful for e.g. checkpointing.

Parameters:
  • filename (string) – Name of the file in which to store the calculator.

  • path (string) – Path where the calculator should be saved.

implemented_properties = ['energy']