mdsuite.transformations.transformations 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 transformations.

exception mdsuite.transformations.transformations.CannotFindPropertyError[source]

Bases: Exception

Exception for when a property cannot be found.

exception mdsuite.transformations.transformations.CannotFindTransformationError[source]

Bases: Exception

Exception for when a transformation cannot be found.

class mdsuite.transformations.transformations.MultiSpeciesTrafo(input_properties: Optional[Iterable[PropertyInfo]] = None, output_property: Optional[PropertyInfo] = None, scale_function=None, dtype=tf.float64)[source]

Bases: Transformations

Base class for all transformations, where information of multiple species is combined in the transformation of a new property.

run_transformation(species: Optional[Iterable[str]] = None) None[source]

Perform the batching and data loading for the transformation, then calls transform_batch :param species: Names of the species on which to perform the transformation. :type species: Iterable[str]

abstract transform_batch(batch: Dict[str, Dict[str, tf.Tensor]], carryover: Any = None) tf.Tensor | Tuple[tf.Tensor, Any][source]

Do the actual transformation.

Parameters:
  • batch (dict) – The batch to be transformed. structure is {‘Species1’: {‘Property1’: tensordata, …}, …}

  • carryover (any) – if the transformation batching is only possible with carryover, this argument will provide it, see below.

Returns:

  • Either the transformed batch (tf.Tensor)

  • Or tuple of (<transformed batch>, <carryover>),

  • where the carryover can have any type.

  • The carryover will be used as the optional argument for the next batch

class mdsuite.transformations.transformations.SingleSpeciesTrafo(input_properties: Optional[Iterable[PropertyInfo]] = None, output_property: Optional[PropertyInfo] = None, scale_function=None, dtype=tf.float64)[source]

Bases: Transformations

Base class for transformations where the transformation is applied to each species separately.

run_transformation(species: Optional[Iterable[str]] = None)[source]

Perform the batching and data loading for the transformation, then calls transform_batch :param species: Names of the species on which to perform the transformation. :type species: Iterable[str]

abstract transform_batch(batch: Dict[str, Tensor], carryover: Optional[Any] = None) Union[Tensor, Tuple[Tensor, Any]][source]

Do the actual transformation.

Parameters:
  • batch (dict) – The batch to be transformed. structure is {‘Property1’: tansordata, …}

  • carryover (any) – if the transformation batching is only possible with carryover, this argument will provide it.

Returns:

  • Either the transformed batch (tf.Tensor)

  • Or tuple of (<transformed batch>, <carryover>),

  • where the carryover can have any type.

  • The carryover will be used as the optional argument for the next batch

class mdsuite.transformations.transformations.Transformations(input_properties: Optional[Iterable[PropertyInfo]] = None, output_property: Optional[PropertyInfo] = None, scale_function=None, dtype=tf.float64)[source]

Bases: object

Parent class for MDSuite transformations.

database

database class object for data loading and storing

Type:

Database

experiment

Experiment class instance to update

Type:

object

batch_size

batch size for the computation

Type:

int

n_batches

Number of batches to be looped over

Type:

int

remainder

Remainder amount to add after the batches are looped over.

Type:

int

data_manager

data manager for handling the data transfer

Type:

DataManager

memory_manager

memory manager for the computation.

Type:

MemoryManager

property database

Update the database.

replace for https://github.com/zincware/MDSuite/issues/404

property experiment: Experiment

//github.com/zincware/MDSuite/issues/404.

Type:

TODO replace for https

find_property_per_config(sp_name, prop) Union[None, str][source]
find_property_single_val(sp_name, prop)[source]
get_generator_type_spec_and_const_data(species_names)[source]
get_prop_through_transformation(sp_name, prop)[source]
abstract run_transformation(species: Optional[Iterable[str]] = None)[source]