matcalc.backend package
Provides various backends of running simulations.
- is_lammps_backend() bool[source]
Whether calculations run with the LAMMPS backend (
MATCALC_BACKENDis notASE).
- run_pes_calc(*arg, **kwargs) SimulationResult[source]
Executes the potential energy surface (PES) calculation using the appropriate backend.
This function determines the backend to use for the PES calculation based on the environment variable MATCALC_BACKEND. If the variable is set to “ASE” (case-insensitive) or is not explicitly provided, the ASE backend is used. Otherwise, the LAMMPS backend is selected. The function then forwards the arguments and keyword arguments to the respective backend function for execution.
- Parameters:
*arg – Positional arguments forwarded to the selected backend.
**kwargs – Keyword arguments forwarded to the selected backend.
- Returns:
SimulationResult from the ASE or LAMMPS backend.
- to_backend_calculator(calculator: str | Calculator) Calculator[source]
Return the calculator to use with the active backend.
Under the ASE backend, a model name is loaded with
PESCalculator.load_universaland a calculator is returned unchanged. Under the LAMMPS backend the result is aLAMMPSCalculator, so that the force field is resolved once (e.g. a MatGL model exported to TorchScript), unsupported models fail immediately, and code that evaluates the calculator directly through ASE also uses LAMMPS: a model name is built directly withload_lammps_calculator()(no ASE calculator is created), and a calculator object is converted withto_lammps_calculator().- Parameters:
calculator – Model name or ASE calculator.
- Returns:
Calculator for the active backend.
- Raises:
TypeError – Under the LAMMPS backend, if the model or calculator has no LAMMPS representation.
Submodules
- matcalc.backend._ase module
- matcalc.backend._base module
SimulationResultSimulationResult._asdict()SimulationResult._field_defaultsSimulationResult._fieldsSimulationResult._make()SimulationResult._replace()SimulationResult.convergedSimulationResult.energySimulationResult.forcesSimulationResult.kinetic_energySimulationResult.potential_energySimulationResult.stressSimulationResult.structure
- matcalc.backend._lammps module
- matcalc.backend._lammps_engine module