pyretis.orderparameter package

Definition of order parameters.

This package defines order parameters for use with PyRETIS.

Package structure

Modules

orderparameter.py (pyretis.orderparameter.orderparameter)
Defines the base class for order parameters and some simple example order parameters.

Important methods defined here

order_factory (order_factory())
A method to create order parameters from settings.
pyretis.orderparameter.order_factory(settings)[source]

Create order parameters according to the given settings.

This function is included as a convenient way of setting up and selecting the order parameter.

Parameters:settings (dict) – This defines how we set up and select the order parameter.
Returns:out – An object representing the orderparameter.
Return type:object like OrderParameter

pyretis.orderparameter.orderparameter module

This file contains classes to represent order parameters.

The order parameters are assumed to all be completely determined by the system properties and they will all return at least one value - the order parameter it self. The order parameters can also return several order parameters which can be used for further analysis.

Important classes defined here

OrderParameter (OrderParameter)
Base class for the order parameters.
OrderParameterPosition (OrderParameterPosition)
A class for a simple position dependent order parameter.
OrderParameterDistance (OrderParameterDistance)
A class for a particle-particle distance order parameter.
CompositeOrderParameter (CompositeOrderParameter)
A class for an order parameter which is made up of several order parameters, i.e. of several objects like OrderParameter.
class pyretis.orderparameter.orderparameter.OrderParameter(description='Generic order parameter')[source]

Bases: object

Base class for order parameters.

This class represents an order parameter and other collective variables (CV’s). The order parameter is assumed to be a function that can uniquely be determined by the system object and its attributes.

description

string – This is a short description of the order parameter.

extra

list of functions – This is a list of extra order parameters to calculate. We will assume that this list contains functions that all accept an object like System as input and return a single float.

__str__()[source]

Return a simple string representation of the order parameter.

add_orderparameter(orderp)[source]

Add an extra order parameter to calculate.

The given function should accept an object like py:class:.System as parameter.

Parameters:orderp (callable) – Extra function for calculation of an extra order parameter. It is assumed to accept only a System object as its parameter.
Returns:out – Return True if we added the function, False otherwise.
Return type:boolean
calculate(system)[source]

Calculate the main order parameter and return it.

This is defined as a method just to ensure that at least this method will be defined in the different order parameters.

Parameters:system (object like System) – This object is used for the actual calculation, typically only system.particles.pos and/or system.particles.vel will be used. In some cases system.forcefield can also be used to include specific energies for the order parameter.
Returns:out – The order parameter(s). The first order parameter returned is used as the progress coordinate in path sampling simulations!
Return type:list of floats
calculate_all(system)[source]

Call calculate() and calculate other CV’s.

It will also call the additional order parameters defined in self.extra, if any.

Parameters:system (object like System) – This object is used for the actual calculation.
Returns:
  • out[0] (float) – The order parameter.
  • out[1] (float) – The velocity of the order parameter.
  • out[2, …] (float(s)) – Additional order parameters, if any.
class pyretis.orderparameter.orderparameter.OrderParameterPosition(index, dim='x', periodic=False)[source]

Bases: pyretis.orderparameter.orderparameter.OrderParameter

A positional order parameter.

This class defines a very simple order parameter which is just the position of a given particle.

name

string – A human readable name for the order parameter

index

integer – This is the index of the atom which will be used, i.e. system.particles.pos[index] will be used.

dim

integer – This is the dimension of the coordinate to use. 0, 1 or 2 for ‘x’, ‘y’ or ‘z’.

periodic

boolean – This determines if periodic boundaries should be applied to the position or not.

calculate(system)[source]

Calculate the order parameter.

Here, the order parameter is just the coordinate of one of the particles.

Parameters:system (object like System) – This object is used for the actual calculation, typically only system.particles.pos and/or system.particles.vel will be used. In some cases system.forcefield can also be used to include specific energies for the order parameter.
Returns:out – The order parameter.
Return type:float
class pyretis.orderparameter.orderparameter.OrderParameterDistance(index, periodic=True)[source]

Bases: pyretis.orderparameter.orderparameter.OrderParameter

A distance order parameter.

This class defines a very simple order parameter which is just the scalar distance between two particles.

name

string – A human readable name for the order parameter

index

tuple of integers – These are the indices used for the two particles. system.particles.pos[index[0]] and system.particles.pos[index[1]] will be used.

periodic

boolean – This determines if periodic boundaries should be applied to the position or not.

calculate(system)[source]

Calculate the order parameter.

Here, the order parameter is just the distance between two particles.

Parameters:system (object like System) – This object is used for the actual calculation, typically only system.particles.pos and/or system.particles.vel will be used. In some cases system.forcefield can also be used to include specific energies for the order parameter.
Returns:out – The order parameter.
Return type:float