mdsuite.transformations package

Submodules

Module contents

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

class mdsuite.transformations.CoordinateUnwrapper[source]

Bases: SingleSpeciesTrafo

Unwrap coordinates by checking if particles moved from one side of the box to the other within one time step.

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

Implement parent class abstract method.

class mdsuite.transformations.CoordinateWrapper(center_box: bool = True)[source]

Bases: SingleSpeciesTrafo

Wrap coordinates into the simulation box.

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

Implement parent class abstract method.

class mdsuite.transformations.IntegratedHeatCurrent[source]

Bases: MultiSpeciesTrafo

Transformation to calculate the integrated heat current (positions * energies).

transform_batch(batch: Dict[str, Dict[str, Tensor]], carryover: Optional[Any] = None) Tensor[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.IonicCurrent[source]

Bases: MultiSpeciesTrafo

Transformation to calculate the ionic current (charge * velocities).

transform_batch(batch: Dict[str, Dict[str, Tensor]], carryover: Optional[Any] = None) Tensor[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.KinaciIntegratedHeatCurrent[source]

Bases: MultiSpeciesTrafo

Transformation to calculate the Kinaci integrated heat current.

transform_batch(batch: Dict[str, Dict[str, Tensor]], carryover: Optional[Tensor] = None) Tuple[Tensor, Tensor][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.MolecularMap[source]

Bases: Transformations

Class for mapping atoms in a database to molecules.

scale_function

A dictionary referencing the memory/time scaling function of the transformation.

Type:

dict

molecules

Molecule dictionary to use as reference. e.g.

{'emim': {'smiles': 'CCN1C=C[N+](+C1)C', 'amount': 20}, 'PF6':
{'smiles': 'F[P-](F)(F)(F)(F)F', 'amount': 20}}

would be the input for the emim-PF6 ionic liquid.

Type:

dict

run_transformation(molecules: List[Molecule])[source]

Perform the transformation.

Parameters:

molecules (List[Molecule]) – A list of MDSuite Molecule objects. For each, a molecule will be mapped.

Return type:

Update the experiment database.

class mdsuite.transformations.MomentumFlux[source]

Bases: MultiSpeciesTrafo

Transformation to calculate the momentum flux.

transform_batch(batch: Dict[str, Dict[str, Tensor]], carryover: Optional[Any] = None) Tensor[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.ScaleCoordinates[source]

Bases: SingleSpeciesTrafo

Scale coordinates by multiplying them with the box size.

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

Implement parent class abstract method.

class mdsuite.transformations.ThermalFlux[source]

Bases: MultiSpeciesTrafo

Transformation to calculate the integrated heat current (positions * energies).

transform_batch(batch: Dict[str, Dict[str, Tensor]], carryover: Optional[Any] = None) Tensor[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(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]
class mdsuite.transformations.TranslationalDipoleMoment[source]

Bases: MultiSpeciesTrafo

Transformation to compute the translational dipole moment (charge * positions).

transform_batch(batch: Dict[str, Dict[str, Tensor]], carryover: Optional[Any] = None) Tensor[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.UnwrapViaIndices[source]

Bases: SingleSpeciesTrafo

Unwrap corrdinates via the box images (pos + box_length * box_image_idx).

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

Implement parent class abstract method.

class mdsuite.transformations.VelocityFromPositions[source]

Bases: SingleSpeciesTrafo

Calculate the velocity based on the particle positions via simple forward derivative, i.e. v(t) = (x(t+dt)-x(t))/dt. The last velocity of the trajectory cannot be computed and is copied from the second to last.

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

Implement parent class abstract method.