recipe

recipe

Contains the Reaction Recipe, RecipeStep and RecipeCollection.

Classes

Name Description
Bind Change topology to form a bond
BondOperation Handle a bond operation on the recipe step.
Break Change topology to break a bond
CustomTopMod A custom recipe step that can be used to define a custom topology modification.
Place Change topology and/or coordinates to place an atom.
Recipe A reaction path defined by one series of RecipeSteps.
RecipeCollection A RecipeCollection encompasses a number of reaction paths.
RecipeStep Base class for all RecipeSteps.
Relax Start a relaxation MD.

Bind

recipe.Bind(self, atom_ix_1=None, atom_ix_2=None, atom_id_1=None, atom_id_2=None)

Change topology to form a bond

Parameters

Name Type Description Default
atom_ix_1 int The index of the first atom. zero-based, by default None None
atom_ix_2 int The index of the second atom. zero-based, by default None None
atom_id_1 str The ID of the first atom. one-based, by default None None
atom_id_2 str The ID of the second atom. one-based, by default None None

BondOperation

recipe.BondOperation(self, atom_ix_1=None, atom_ix_2=None, atom_id_1=None, atom_id_2=None)

Handle a bond operation on the recipe step.

This class takes in either zero-based indices or one-base IDs for two atoms.

Parameters

Name Type Description Default
atom_ix_1 int The index of the first atom. zero-based, by default None None
atom_ix_2 int The index of the second atom. zero-based, by default None None
atom_id_1 str The ID of the first atom. one-based, by default None None
atom_id_2 str The ID of the second atom. one-based, by default None None

Raises

Type Description
ValueError If neither an index nor an ID is provided for any of the atoms.

Notes

Internally, this class stores the atom indices and converts IDs to indices as needed.

Break

recipe.Break(self, atom_ix_1=None, atom_ix_2=None, atom_id_1=None, atom_id_2=None)

Change topology to break a bond

Parameters

Name Type Description Default
atom_ix_1 int The index of the first atom. zero-based, by default None None
atom_ix_2 int The index of the second atom. zero-based, by default None None
atom_id_1 str The ID of the first atom. one-based, by default None None
atom_id_2 str The ID of the second atom. one-based, by default None None

CustomTopMod

recipe.CustomTopMod(self, f)

A custom recipe step that can be used to define a custom topology modification.

Parameters

Name Type Description Default
f Callable[[Topology], Topology] A function that takes a Topology object and modifies it in place. required

Place

recipe.Place(self, new_coords, ix_to_place=None, id_to_place=None)

Change topology and/or coordinates to place an atom.

Either provide the index (ix_to_place) or the ID (id_to_place) of the atom to place.

Parameters

Name Type Description Default
new_coords tuple[float, float, float] New xyz coordinates for atom to place to. Valid for the end point of the recipe timespan. required
ix_to_place int Index of atom to place. 0-based. None
id_to_place str Index of atom to place. 1-based None

Recipe

recipe.Recipe(self, recipe_steps, rates, timespans)

A reaction path defined by one series of RecipeSteps. Defines everything necessart to build the product state from the educt state.

Parameters

Name Type Description Default
recipe_steps list[RecipeStep] Single sequence of RecipeSteps to build product required
rates list[float] Reaction rates corresponding 1:1 to timespans. required
timespans list[list[float, float]] List of half-open timespans (t1, t2] in ps, at which this rate is valid. Recipe steps which change the coordinates only need to be applicable at the first time in the interval. Must have same number of timespans as rates. t1 can equal t2 for the last frame. required

Methods

Name Description
check_consistency Run consistency checks for correct size of variables
combine_with Combines this Recipe with another with the same RecipeSteps.
check_consistency

recipe.Recipe.check_consistency()

Run consistency checks for correct size of variables

combine_with

recipe.Recipe.combine_with(other)

Combines this Recipe with another with the same RecipeSteps.

Parameters
Name Type Description Default
other Recipe required

RecipeCollection

recipe.RecipeCollection(self, recipes)

A RecipeCollection encompasses a number of reaction paths. They can originate from multiple reaction plugins, but do not need to.

Returns

Type Description
unique_recipes_ixs List of lists binning the old recipe indices and maps to the new recipes list.

Methods

Name Description
aggregate_reactions Combines reactions having the same sequence of RecipeSteps.
calc_cumprob Calculate cumulative probability of all contained recipe steps.
calc_ratesum Calculate the sum of rates over all timesteps
from_csv Create a RecipeCollection object from a CSV file
plot Plot reaction rates over time
to_csv Write a ReactionResult as defined in the reaction module to a csv file
aggregate_reactions

recipe.RecipeCollection.aggregate_reactions()

Combines reactions having the same sequence of RecipeSteps.

calc_cumprob

recipe.RecipeCollection.calc_cumprob()

Calculate cumulative probability of all contained recipe steps. Sums up to 1 over all recipes. Assumes constant rate for given timespan and rate zero otherwise.

calc_ratesum

recipe.RecipeCollection.calc_ratesum()

Calculate the sum of rates over all timesteps

Returns
Type Description
boarders flat list containing times of rate changes marking the boarders of the windows
rate_windows flat list containing all rates in between the boarders. Each window is orderd as in recipe_windows
recipe_windows flat list containing the recipes of the corresponding window. Each window is orderd as in rate_windows
from_csv

recipe.RecipeCollection.from_csv(path)

Create a RecipeCollection object from a CSV file Returns the recipe collection and a single recipe that was picked, otherwise None

plot

recipe.RecipeCollection.plot(outfile, highlight_r=None, highlight_t=None)

Plot reaction rates over time

Parameters
Name Type Description Default
outfile Path Where to save the plot, must have compatible suffix. required
highlight_r Recipe Recipe to highlight, by default None None
highlight_t float Time at which the reactions starts None
to_csv

recipe.RecipeCollection.to_csv(path, picked_recipe=None)

Write a ReactionResult as defined in the reaction module to a csv file

RecipeStep

recipe.RecipeStep()

Base class for all RecipeSteps. Indices can be accessed as 0-based or 1-based. ix: 0-based, int id: 1-based, str

Relax

recipe.Relax(self)

Start a relaxation MD.

The molecular system coordinates are far out of equilibrium after most topology changes. A relaxtion MD simulation using for example the slow growth method helps to reach the new equilibrium.

Back to top