Water Density

class mlipaudit.benchmarks.water_density.water_density.WaterDensityBenchmark(force_field: ForceField | Calculator, data_input_dir: str | PathLike = './data', run_mode: RunMode | Literal['dev', 'fast', 'standard'] = RunMode.STANDARD)

Benchmark for the equilibrium density of liquid water.

Runs the same water box NPT simulation as WaterRadialDistributionBenchmark (reusing its output when both are run together) and scores how closely the equilibrium density matches the experimental reference.

name

The unique benchmark name. The name is water_density.

Type:

str

category

The benchmark’s category, "Molecular Liquids".

Type:

str

data_name

The input-data directory shared with the water RDF benchmark.

Type:

str | None

result_class

WaterDensityResult.

Type:

type[mlipaudit.benchmark.BenchmarkResult] | None

model_output_class

WaterDensityModelOutput.

Type:

type[mlipaudit.benchmark.ModelOutput] | None

required_elements

The set of atomic element types present in the input files.

Type:

set[str] | None

reusable_output_id

Shared with WaterRadialDistributionBenchmark so the water box NPT simulation is only run once when both benchmarks are run together.

Type:

tuple[str, …] | None

__init__(force_field: ForceField | Calculator, data_input_dir: str | PathLike = './data', run_mode: RunMode | Literal['dev', 'fast', 'standard'] = RunMode.STANDARD) None

Initializes the benchmark.

Parameters:
  • force_field – The force field model to be benchmarked.

  • data_input_dir – The local input data directory. Defaults to “./data”. If the subdirectory “{data_input_dir}/{benchmark_name}” exists, the benchmark expects the relevant data to be in there, otherwise it will download it from HuggingFace.

  • run_mode – Whether to run the standard benchmark length, a faster version, or a very fast development version. Subclasses should ensure that when RunMode.DEV, their benchmark runs in a much shorter timeframe, by running on a reduced number of test cases, for instance. Implementing RunMode.FAST being different from RunMode.STANDARD is optional and only recommended for very long-running benchmarks. This argument can also be passed as a string “dev”, “fast”, or “standard”.

Raises:
  • ChemicalElementsMissingError – If initialization is attempted with a force field that cannot perform inference on the required elements.

  • ValueError – If force field type is not compatible.

run_model() None

Run an MD simulation for the water box system using the NPT ensemble.

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.

analyze() WaterDensityResult

Compute the equilibrium density and how much it deviates from the reference.

Returns:

A WaterDensityResult object.

Raises:

RuntimeError – If called before run_model().

class mlipaudit.benchmarks.water_density.water_density.WaterDensityResult(*, failed: bool = False, score: Annotated[float | None, Ge(ge=0), Le(le=1)] = None, densities: list[float] | None = None, average_density: float | None = None, density_deviation: Annotated[float, Ge(ge=0)] | None = None, reference_density: float = 0.997773)

Result object for the water density benchmark.

densities

List of per-frame densities in g/cm3.

Type:

list[float] | None

average_density

Average density over the final four fifths of the frames.

Type:

float | None

density_deviation

Absolute deviation of the average density from the experimental reference.

Type:

float | None

reference_density

The experimental reference density in g/cm3.

Type:

float

failed

Whether the simulation failed and no analysis could be performed. Defaults to False.

Type:

bool

score

The final score for the benchmark between 0 and 1.

Type:

float | None

class mlipaudit.benchmarks.water_density.water_density.WaterDensityModelOutput(*, simulation_state: SimulationState | None = None, failed: bool = False)

Model output containing the final simulation state of the water box.

Shares its field signature with WaterRadialDistributionModelOutput so that the NPT simulation can be reused between the two benchmarks (see reusable_output_id).

simulation_state

The final simulation state of the water box simulation. None if the simulation failed.

Type:

mlip.simulation.state.SimulationState | None

failed

Whether the simulation failed. Defaults to False.

Type:

bool