mdsuite.calculators.calculator 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¶
Parent class for the calculators.
- class mdsuite.calculators.calculator.Calculator(experiment: Experiment = None, experiments: List[Experiment] = None)[source]¶
Bases:
CalculatorDatabase
Parent class for analysis modules.
- experiment¶
Experiment for which the calculator will be run.
- Type:
- experiments¶
List of experiments on which to run the calculator.
- Type:
List[Experiment]
- system_property¶
If the calculator returns a value for the whole system such as ionic conductivity or viscosity as opposed to a species-specific number.
- Type:
bool (default = False)
- experimental¶
If true, a warning is raised upon calling this calculator with more information about why it is experimental.
- Type:
bool (default = False)
- time¶
Time array over which to integrate and plot.
- Type:
np.ndarray
- plotter¶
Data visualizer class for use in the plotting.
- Type:
- result_keys¶
keys to use when storing the results. e.g. [“diffusion_coefficient”, “uncertainty”]
- Type:
- _dtype¶
dtype required by the analysis.
- Type:
object = tf.float64
- property dtype¶
Get the dtype used for the calculator.
- plot_data(data)[source]¶
Plot the data coming from the database.
- Parameters:
data (db.Compution.data_dict) – associated with the current project
- run_visualization(x_data: ndarray, y_data: ndarray, title: str, layouts: Optional[object] = None)[source]¶
Run a visualization session on the data.
- Parameters:
layouts (object) – Additional plot features that may be added. See https://docs.bokeh.org/en/latest/docs/reference/models.html for more information.
x_data (np.ndarray) – Data to be plotted along the x axis
y_data (np.ndarray) – Data to be plotted along the y-axis
title (str) – Title of the analysis.
- Return type:
Updates the plot array with a Bokeh plot object.
- mdsuite.calculators.calculator.call(func)[source]¶
Decorator for the calculator call method.
This decorator provides a unified approach for handling run_computation and load_data for a single or multiple experiments. It handles the run.<calc>() method, iterates over experiments and loads data if requested! Therefore, the __call__ method does not and can not return any values anymore!
Notes
When calling the calculator it will check if a computation with the given user arguments was already performed: >>> Calculator.get_computation_data() is not None
if no computations are available it will 1. prepare a database entry >>> Calculator.prepare_db_entry() 2. save the user arguments >>> Calculator.save_computation_args() 3. Run the analysis >>> Calculator.run_analysis() 4. Save all the data to the database >>> Calculator.save_db_data() 5. Finally query the the data from the database and pass them to the user / plotting >>> data = Calculator.get_computation_data()
- Parameters:
func (Calculator.__call__ method) –
- Return type:
decorated __call__ method