Molecular Liquids Helpers

mlipaudit.utils.molecular_liquids.compute_densities(simulation_state: SimulationState, molecule_weight: float, atoms_per_molecule: int) ndarray

Compute the density (g/cm3) for each frame of the simulation.

Parameters:
  • simulation_state – The final simulation state.

  • molecule_weight – Molecular weight of each solvent molecule.

  • atoms_per_molecule – Number of atoms in each solvent molecule.

Returns:

The computed density (g/cm3) for each frame of the simulation.

mlipaudit.utils.molecular_liquids.average_equilibrated_density(densities: ndarray) float

Average the density over the final four fifths of the frames.

The first fifth of the trajectory is treated as equilibration and discarded.

Parameters:

densities – Per-frame densities (g/cm3).

Returns:

The average equilibrated density (g/cm3).

mlipaudit.utils.molecular_liquids.run_water_npt_simulation(force_field: ForceField | Calculator, data_dir: str | PathLike, run_mode: RunMode) SimulationState | None

Run the water box NPT simulation.

The MD simulation is performed using the JAX MD engine and starts from the reference structure. The NPT integrator uses Langevin dynamics with a Monte Carlo barostat.

Parameters:
  • force_field – The force field to run the simulation with.

  • data_dir – The directory holding the water input data.

  • run_mode – The run mode controlling the simulation length.

Returns:

The final simulation state, or None if the simulation failed.

mlipaudit.utils.molecular_liquids.run_solvent_npt_simulations(force_field: ForceField | Calculator, data_dir: str | PathLike, run_mode: RunMode) tuple[list[str], list[SimulationState | None]]

Run one NPT simulation per solvent system.

Parameters:
  • force_field – The force field to run the simulations with.

  • data_dir – The directory holding the solvent input data.

  • run_mode – The run mode controlling the simulation length and system count.

Returns:

A tuple of (system names, simulation states) in matching order. A simulation state is None if the corresponding simulation failed.

mlipaudit.utils.molecular_liquids.get_solvent_system_names(run_mode: RunMode) list[str]

Return the solvent system names to run for the given run mode.

Returns:

The solvent system names.