Simulation (mofa.simulation
)#
Interfaces for functions which run physics simulation codes
DFT (m.simulation.dft
)#
Interfaces for performing DFT calculations
- mofa.simulation.dft.compute_partial_charges(cp2k_path: Path, threads: int | None = 2)#
Compute partial charges with DDEC
- Parameters:
cp2k_path – Path to a CP2K computation which wrote a CUBE file
threads – Number of threads to use for chargemol
- mofa.simulation.dft.load_atoms_with_charges(cp2k_path) Atoms #
Load the structure labeled with partial charges from a DDEC run
Assumes chargemol has already been run
- Parameters:
cp2k_path – Path to the CP2K run
- Returns:
Atoms object complete with charges
MACE (m.simulation.mace
)#
Run computations backed by MACE
- class mofa.simulation.mace.MACERunner(lammps_cmd: list[str] | None = None, model_path: Path | None = None, run_dir: Path = PosixPath('mace-runs'), traj_name: str = 'mace_mp', md_supercell: int = 2, device: str = 'cpu', delete_finished: bool = False, lammps_pkg: str = 'ml-iap')#
Bases:
MDInterface
Interface for running pre-defined MACE workflows
Employs ASE for geometry relaxations and LAMMPS for NPT MD.
- lammps_pkg: str = 'ml-iap'#
Which LAMMPS pair_style package to use for running MACE.
Note: You will need to save the model in the appropriate format with
mace_create_lammps_model
- run_md_with_lammps(name: str, atoms: Atoms, min_steps: int, timesteps: int, write_freq: int) list[tuple[int, Atoms]] #
- run_molecular_dynamics(mof: MOFRecord, timesteps: int, report_frequency: int) list[tuple[int, Atoms]] #
Run NPT molecular dynamics
Start from the last structure of the previous trajectory
- Parameters:
mof – Record describing the MOF. Includes the structure in CIF format, which includes the bonding information used by UFF
timesteps – How many total timesteps to run
report_frequency – How often to report structures
- Returns:
Structures produced at specified intervals
- run_optimization(mof: MOFRecord, level: str = 'default', structure_source: tuple[str, int] | None = None, steps: int = 8, fmax: float = 0.01) tuple[Atoms, Path] #
Perform a geometry optimization computation
- Parameters:
mof – Structure to be run
level – Name of the level of computation to perform
structure_source – Name of the MD trajectory and frame ID from which to source the input structure. Default is to use the as-assembled structure
steps – Maximum number of optimization steps
fmax – Convergence threshold for optimization
- Returns:
Relaxed structure
Path to the run directory
- run_single_point(mof: MOFRecord, level: str = 'default', structure_source: tuple[str, int] | None = None) tuple[Atoms, Path] #
Perform a single-point computation at a certain level
- Parameters:
mof – Structure to be run
level – Name of the level of computation to perform
structure_source – Name of the MD trajectory and frame ID from which to source the input structure. Default is to use the as-assembled structure
- Returns:
Structure with computed properties
Path to the run directory