mdsuite.calculators.radial_distribution_function module

MDSuite: A Zincwarecode package.

License

This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html

SPDX-License-Identifier: EPL-2.0

Copyright Contributors to the Zincwarecode Project.

Contact Information

email: zincwarecode@gmail.com github: https://github.com/zincware web: https://zincwarecode.com/

Citation

If you use this module please cite us with:

Summary

MDSuite module for the computation of the radial distribution function (RDF). An RDF describes the probability of finding a particle of species b at a distance r of species a.

class mdsuite.calculators.radial_distribution_function.Args(number_of_bins: int, number_of_configurations: int, correlation_time: int, atom_selection: np.s_, data_range: int, cutoff: float, start: int, stop: int, species: list, molecules: bool)[source]

Bases: object

Data class for the saved properties.

atom_selection: np.s_
correlation_time: int
cutoff: float
data_range: int
molecules: bool
number_of_bins: int
number_of_configurations: int
species: list
start: int
stop: int
class mdsuite.calculators.radial_distribution_function.RadialDistributionFunction(**kwargs)[source]

Bases: TrajectoryCalculator, ABC

Class for the calculation of the radial distribution function.

experiment

Experiment class to call from

Type:

object

data_range

Number of configurations to use in each ensemble

x_label

X label of the tensor_values when plotted

Type:

str

y_label

Y label of the tensor_values when plotted

Type:

str

analysis_name

Name of the analysis

Type:

str

loaded_property

Property loaded from the database_path for the analysis

Type:

str

minibatch

Size of an individual minibatch, if set. By default mini-batching is not applied

Type:

int, default None

Examples

project = mdsuite.Project()
project.run.RadialDistributionFunction(number_of_configurations=500)
static bin_minibatch(start, stop, indices, d_ij, bin_range, number_of_bins, cutoff) tf.Tensor[source]

Compute the minibatch histogram.

Parameters:
  • start (list) –

  • stop (list) –

  • indices (tf.Tensor) –

  • d_ij (tf.Tensor) –

  • bin_range

  • number_of_bins (int) –

  • cutoff (float) – Cutoff to enforce on the distance tensor.

check_input()[source]

Check the input of the call method and store defaults if needed.

Return type:

Updates class attributes if required.

static combine_dictionaries(dict_a: dict, dict_b: dict)[source]

Combine two dictionaries in a tf.function call.

Parameters:
compute_species_values(indices: Tensor, start_batch, d_ij: Tensor) dict[source]

Compute species-wise histograms.

Parameters:
  • indices (tf.Tensor) – indices of the d_ij distances in the shape (x, 2)

  • start_batch (int) – starts from 0 and increments by atoms_per_batch every batch

  • d_ij (tf.Tensor) – d_ij matrix in the shape (x, batches) where x comes from the triu computation

  • start_batch – Atom index within a single configuration from to start the computation based on the current minibatch that is being computed.

Returns:

rdf – Dict of rdf values for each combination of species, e.g.: {‘H-O’: tf.Tensor(…), ‘H-H’: …, ‘O-O’: …}

Return type:

dict

static get_dij(indices, positions_tensor, atoms, box_array)[source]

Compute the distance matrix for the minibatch.

Parameters:
  • indices (tf.Tensor) –

  • positions_tensor (tf.Tensor) –

  • atoms (tf.Tensor) –

  • box_array (tf.Tensor) –

property ideal_correction: float

Get the correct ideal gas term.

In the case of a cutoff value greater than half of the box size, the ideal gas term of the experiment must be corrected due to the lack of spherical symmetry in the experiment.

Returns:

correction – Correct ideal gas term for the RDF prefactor

Return type:

float

property particles_list

List of number of atoms of each species being studied.

Return type:

——-.

plot_data(data)[source]

Plot the RDF data.

prepare_computation()[source]

Run the steps necessary to prepare for the RDF computation.

Returns:

  • dict_keys (list) – dict keys to use when selecting data from the output.

  • split_arr (np.ndarray) – Array of indices to load from the database split into sub-arrays which fulfill the necessary batch size.

  • batch_tqdm (bool) – If true, the main tqdm loop over batches is disabled and only the mini-batch loop will be displayed.

run_calculator()[source]

Run the analysis.

run_minibatch_loop(atoms, stop, n_atoms, minibatch_start, positions_tensor)[source]

Run a minibatch loop.

Parameters:
  • atoms (tf.Tensor) –

  • stop (int) –

  • n_atoms (int) –

  • minibatch_start (int) –

  • positions_tensor (tf.Tensor) –