Water Radial Distribution

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

Benchmark for water radial distribution function.

name

The unique benchmark name that should be used to run the benchmark from the CLI and that will determine the output folder name for the result file. The name is water_radial_distribution.

Type:

str

category

A string that describes the category of the benchmark, used for example, in the UI app for grouping. Default, if not overridden, is “General”. This benchmark’s category is “Molecular Liquids”.

Type:

str

result_class

A reference to the type of BenchmarkResult that will determine the return type of self.analyze(). The result class type is WaterRadialDistributionResult.

Type:

type[mlipaudit.benchmark.BenchmarkResult] | None

model_output_class

A reference to the WaterRadialDistributionModelOutput class.

Type:

type[mlipaudit.benchmark.ModelOutput] | None

required_elements

The set of atomic element types that are present in the benchmark’s input files.

Type:

set[str] | None

skip_if_elements_missing

Whether the benchmark should be skipped entirely if there are some atomic element types that the model cannot handle. If False, the benchmark must have its own custom logic to handle missing atomic element types. For this benchmark, the attribute is set to True.

Type:

bool

__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 each structure.

The MD simulation is performed using the JAX MD engine and starts from the reference structure. NOTE: This benchmark runs a simulation in the NVT ensemble, which is not recommended for a water RDF calculation.

analyze() WaterRadialDistributionResult

Calculate how much the radial distribution deviates from the reference.

Returns:

A WaterRadialDistributionResult object.

Raises:

RuntimeError – If called before run_model().

class mlipaudit.benchmarks.water_radial_distribution.water_radial_distribution.WaterRadialDistributionResult(*, failed: bool = False, score: Annotated[float | None, Ge(ge=0), Le(le=1)] = None, radii: list[float] | None = None, rdf: list[float] | None = None, mae: float | None = None, rmse: float | None = None, first_solvent_peak: float | None = None, peak_deviation: Annotated[float, Ge(ge=0)] | None = None, range_of_interest: tuple[Annotated[float, Ge(ge=0)], Annotated[float, Ge(ge=0)]] = (2.5, 10.0))

Result object for the water radial distribution benchmark.

radii

The radii values in Angstrom.

Type:

list[float] | None

rdf

The radial distribution function values at the radii.

Type:

list[float] | None

mae

The MAE of the radial distribution function values.

Type:

float | None

rmse

The RMSE of the radial distribution function values.

Type:

float | None

first_solvent_peak

The first solvent peak, i.e. the radius at which the rdf is the maximum.

Type:

float | None

peak_deviation

The deviation of the first solvent peak from the reference.

Type:

float | None

range_of_interest

The range of interest for the radial distribution function error metrics.

Type:

tuple[float, float]

failed

Whether all the simulations 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_radial_distribution.water_radial_distribution.WaterRadialDistributionModelOutput(*, simulation_state: SimulationState | None = None, failed: bool = False)

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

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