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_¶
- class mdsuite.calculators.radial_distribution_function.RadialDistributionFunction(**kwargs)[source]¶
Bases:
TrajectoryCalculator
,ABC
Class for the calculation of the radial distribution function.
- data_range¶
Number of configurations to use in each ensemble
- 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.
- 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.
- 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:
- 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:
- property particles_list¶
List of number of atoms of each species being studied.
- Return type:
——-.
- 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.