wepy.boundary_conditions.receptor module

Boundary conditions for receptor based boundary conditions including unbinding and rebinding.

class wepy.boundary_conditions.receptor.ReceptorBC(initial_states=None, initial_weights=None, ligand_idxs=None, receptor_idxs=None, **kwargs)[source]

Bases: wepy.boundary_conditions.boundary.BoundaryConditions

Abstract base class for ligand-receptor based boundary conditions.

Provides shared utilities for warping walkers to any number of optionally weighted initial structures through a shared warp_walkers method.

Non-abstract implementations of this class need only implement the _progress method which should return a boolean signalling a warping event and the dictionary-style warping record of the progress for only a single walker. These records will be collated into a single progress record across all walkers.

Additionally, the _update_bc method can be overriden to return ‘BC’ group records. That method should accept the arguments shown in this ABC and return a list of dictionary-style ‘BC’ records.

Warping of walkers with multiple initial states will be done according to a choice of initial states weighted on their weights, if given.

Base constructor for ReceptorBC.

This should be called immediately in the subclass __init__ method.

If the initial weights for each initial state are not given uniform weights are assigned to them.

Parameters
  • initial_states (list of objects implementing the State interface) – The list of possible states that warped walkers will assume.

  • initial_weights (list of float, optional) – List of normalized probabilities of the initial_states provided. If not given, uniform probabilities will be used.

  • ligand_idxs (arraylike of int) – The indices of the atom positions in the state considered the ligand.

  • receptor_idxs (arraylike of int) – The indices of the atom positions in the state considered the receptor.

Raises

AssertionError – If any of the following kwargs are not given: initial_states, ligand_idxs, receptor_idxs.

BC_FIELDS = ()

String names of fields produced in this record group.

Boundary condition (BC) records are typically used to report on changes to the state of the BC object.

Notes

These fields are not critical to the proper functioning of the rest of the wepy framework and can be modified freely.

However, reporters specific to this boundary condition probably will make use of these records.

BC_SHAPES = ()

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

BC_DTYPES = ()

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

BC_RECORD_FIELDS = ()

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

PROGRESS_FIELDS = ()

String names of fields produced in this record group.

Progress records are typically used to report on measures of walkers at each cycle.

Notes

These fields are not critical to the proper functioning of the rest of the wepy framework and can be modified freely.

However, reporters specific to this boundary condition probably will make use of these records.

PROGRESS_SHAPES = ()

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

PROGRESS_DTYPES = ()

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

PROGRESS_RECORD_FIELDS = ()

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

DISCONTINUITY_TARGET_IDXS = Ellipsis

Specifies which ‘target_idxs’ values are considered discontinuous targets.

Values are either integer indices, Ellipsis (indicating all possible values are discontinuous), or None indicating no possible value is discontinuous.

property initial_states

The possible initial states warped walkers may assume.

property initial_weights

The probabilities of each initial state being chosen during a warping.

property ligand_idxs

The indices of the atom positions in the state considered the ligand.

property receptor_idxs

The indices of the atom positions in the state considered the receptor.

_progress(walker)[source]

The method that must be implemented in non-abstract subclasses.

Should decide if a walker should be warped or not and what its progress is regardless.

Parameters

walker (object implementing the Walker interface) –

Returns

  • to_warp (bool) – Whether the walker should be warped or not.

  • progress_data (dict of str : value) – Dictionary of the progress record group fields for this walker alone.

_warp(walker)[source]

Perform the warping of a walker.

Chooses an initial state to replace the walker’s state with according to it’s given weight.

Returns a walker of the same type and weight.

Parameters

walker (object implementing the Walker interface) –

Returns

  • warped_walker (object implementing the Walker interface) – The walker with the state after the warping. Weight should be the same.

  • warping_data (dict of str : value) – The dictionary-style ‘WARPING’ record for this event. Excluding the walker index which is done in the main warp_walkers method.

_update_bc(new_walkers, warp_data, progress_data, cycle)[source]

Perform an update to the boundary conditions.

No updates to the bc are ever done in this null implementation.

Parameters
  • new_walkers (list of walkers) – The walkers after warping.

  • warp_data (list of dict) –

  • progress_data (dict) –

  • cycle (int) –

Returns

bc_data – The dictionary-style records for BC update events

Return type

list of dict

warp_walkers(walkers, cycle)[source]

Test the progress of all the walkers, warp if required, and update the boundary conditions.

Parameters
  • walkers (list of objects implementing the Walker interface) –

  • cycle (int) – The index of the cycle.

Returns

  • new_walkers (list of objects implementing the Walker interface) – The new set of walkers that may have been warped.

  • warp_data (list of dict of str : value) – The dictionary-style records for WARPING update events

bc_datalist of dict of strvalue

The dictionary-style records for BC update events

progress_datadict of strarraylike

The dictionary-style records for PROGRESS update events

classmethod warping_discontinuity(warping_record)[source]

Tests whether a warping record generated by this class is discontinuous or not.

Parameters

warping_record (tuple) – The WARPING type record.

Returns

is_discontinuous – True if a discontinuous warp False if continuous.

Return type

bool

WARPING_DTYPES = (<class 'int'>, <class 'int'>, <class 'float'>)

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

WARPING_FIELDS = ('walker_idx', 'target_idx', 'weight')

String names of fields produced in this record group.

Warping records are typically used to report whenever a walker satisfied the boundary conditions and was warped and had its state changed.

Warning

Be careful when modifying these fields as they may be integrated with other wepy framework features. Namely recognition of discontinuous warping events for making contiguous trajectories from cloning and merging lineages.

The behavior of whether or not a warping event is discontinuous is given by a BoundaryCondition class’s warping_discontinuity which likely depends on the existence of particular fields.

WARPING_RECORD_FIELDS = ('walker_idx', 'target_idx', 'weight')

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

WARPING_SHAPES = ((1,), (1,), (1,))

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

bc_field_dtypes()

Access the class level DTYPES constant for this record group.

bc_field_names()

Access the class level FIELDS constant for this record group.

bc_field_shapes()

Access the class level SHAPES constant for this record group.

bc_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

bc_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

progress_field_dtypes()

Access the class level DTYPES constant for this record group.

progress_field_names()

Access the class level FIELDS constant for this record group.

progress_field_shapes()

Access the class level SHAPES constant for this record group.

progress_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

progress_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

warping_field_dtypes()

Access the class level DTYPES constant for this record group.

warping_field_names()

Access the class level FIELDS constant for this record group.

warping_field_shapes()

Access the class level SHAPES constant for this record group.

warping_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

warping_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

class wepy.boundary_conditions.receptor.RebindingBC(native_state=None, cutoff_rmsd=0.2, initial_states=None, initial_weights=None, ligand_idxs=None, binding_site_idxs=None, **kwargs)[source]

Bases: wepy.boundary_conditions.receptor.ReceptorBC

Boundary condition for doing re-binding simulations of ligands to a receptor.

Implements the ReceptorBC superclass.

This boundary condition will warp walkers to a number of initial states whenever a walker becomes very close to the native (bound) state.

Thus the choice of the ‘initial_states’ argument should be walkers which are completely unbound (the choice of which are weighted by ‘initial_weight’) and the choice of ‘native_state’ should be of a ligand bound to the receptor, e.g. X-ray crystallography or docked structure.

The cutoff for the boundary is an RMSD of the walker to the native state which is calculated by first aligning and superimposing the entire structure according the atom indices specified in ‘binding_site_idxs’, and as the name suggests should correspond to some approximation of the binding site of the ligand that occurs in the native state. Then the raw RMSD of the native and walker ligands is calculated. If this RMSD is less than the ‘cutoff_rmsd’ argument the walker is warped.

PROGRESS is reported for each walker from this rmsd.

The BC records are never updated.

Constructor for RebindingBC.

Parameters
  • native_state (object implementing the State interface) – The reference bound state. Will be automatically centered.

  • cutoff_rmsd (float) – The cutoff RMSD for considering a walker bound.

  • initial_states (list of objects implementing the State interface) – The list of possible states that warped walkers will assume.

  • initial_weights (list of float, optional) – List of normalized probabilities of the initial_states provided. If not given, uniform probabilities will be used.

  • ligand_idxs (arraylike of int) – The indices of the atom positions in the state considered the ligand.

  • binding_site_idxs (arraylike of int) – The indices of the atom positions in the state considered the binding site.

Raises

AssertionError – If any of the following kwargs are not given: native_state, initial_states, ligand_idxs, receptor_idxs.

BC_FIELDS = ('native_rmsd_cutoff',)

The ‘native_rmsd_cutoff’ is the cutoff used to determine when walkers have re-bound to the receptor, which is defined as the RMSD of the ligand to the native ligand bound state, when the binding sites are aligned and superimposed.

BC_SHAPES = ((1,),)

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

BC_DTYPES = (<class 'float'>,)

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

BC_RECORD_FIELDS = ('native_rmsd_cutoff',)

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

WARPING_FIELDS = ('walker_idx', 'target_idx', 'weight')

String names of fields produced in this record group.

Warping records are typically used to report whenever a walker satisfied the boundary conditions and was warped and had its state changed.

Warning

Be careful when modifying these fields as they may be integrated with other wepy framework features. Namely recognition of discontinuous warping events for making contiguous trajectories from cloning and merging lineages.

The behavior of whether or not a warping event is discontinuous is given by a BoundaryCondition class’s warping_discontinuity which likely depends on the existence of particular fields.

WARPING_SHAPES = ((1,), (1,), (1,))

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

WARPING_DTYPES = (<class 'int'>, <class 'int'>, <class 'float'>)

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

WARPING_RECORD_FIELDS = ('walker_idx', 'target_idx', 'weight')

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

PROGRESS_FIELDS = ('native_rmsd',)

String names of fields produced in this record group.

Progress records are typically used to report on measures of walkers at each cycle.

Notes

These fields are not critical to the proper functioning of the rest of the wepy framework and can be modified freely.

However, reporters specific to this boundary condition probably will make use of these records.

PROGRESS_SHAPES = (Ellipsis,)

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

PROGRESS_DTYPES = (<class 'float'>,)

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

PROGRESS_RECORD_FIELDS = ('native_rmsd',)

Records for the state of this record group.

The ‘native_rmsd’ is the is the RMSD of the ligand to the native ligand bound state, when the binding sites are aligned and superimposed.

property native_state

The reference bound state to which walkers are compared.

property cutoff_rmsd

The cutoff RMSD for considering a walker bound.

property binding_site_idxs

The indices of the atom positions in the state considered the binding site.

_progress(walker)[source]

Calculate if the walker has bound and provide progress record.

Parameters

walker (object implementing the Walker interface) –

Returns

  • is_bound (bool) – Whether the walker is unbound (warped) or not

  • progress_data (dict of str : value) – Dictionary of the progress record group fields for this walker alone.

DISCONTINUITY_TARGET_IDXS = Ellipsis

Specifies which ‘target_idxs’ values are considered discontinuous targets.

Values are either integer indices, Ellipsis (indicating all possible values are discontinuous), or None indicating no possible value is discontinuous.

_update_bc(new_walkers, warp_data, progress_data, cycle)

Perform an update to the boundary conditions.

No updates to the bc are ever done in this null implementation.

Parameters
  • new_walkers (list of walkers) – The walkers after warping.

  • warp_data (list of dict) –

  • progress_data (dict) –

  • cycle (int) –

Returns

bc_data – The dictionary-style records for BC update events

Return type

list of dict

_warp(walker)

Perform the warping of a walker.

Chooses an initial state to replace the walker’s state with according to it’s given weight.

Returns a walker of the same type and weight.

Parameters

walker (object implementing the Walker interface) –

Returns

  • warped_walker (object implementing the Walker interface) – The walker with the state after the warping. Weight should be the same.

  • warping_data (dict of str : value) – The dictionary-style ‘WARPING’ record for this event. Excluding the walker index which is done in the main warp_walkers method.

bc_field_dtypes()

Access the class level DTYPES constant for this record group.

bc_field_names()

Access the class level FIELDS constant for this record group.

bc_field_shapes()

Access the class level SHAPES constant for this record group.

bc_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

bc_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

property initial_states

The possible initial states warped walkers may assume.

property initial_weights

The probabilities of each initial state being chosen during a warping.

property ligand_idxs

The indices of the atom positions in the state considered the ligand.

progress_field_dtypes()

Access the class level DTYPES constant for this record group.

progress_field_names()

Access the class level FIELDS constant for this record group.

progress_field_shapes()

Access the class level SHAPES constant for this record group.

progress_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

progress_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

property receptor_idxs

The indices of the atom positions in the state considered the receptor.

warp_walkers(walkers, cycle)

Test the progress of all the walkers, warp if required, and update the boundary conditions.

Parameters
  • walkers (list of objects implementing the Walker interface) –

  • cycle (int) – The index of the cycle.

Returns

  • new_walkers (list of objects implementing the Walker interface) – The new set of walkers that may have been warped.

  • warp_data (list of dict of str : value) – The dictionary-style records for WARPING update events

bc_datalist of dict of strvalue

The dictionary-style records for BC update events

progress_datadict of strarraylike

The dictionary-style records for PROGRESS update events

classmethod warping_discontinuity(warping_record)

Tests whether a warping record generated by this class is discontinuous or not.

Parameters

warping_record (tuple) – The WARPING type record.

Returns

is_discontinuous – True if a discontinuous warp False if continuous.

Return type

bool

warping_field_dtypes()

Access the class level DTYPES constant for this record group.

warping_field_names()

Access the class level FIELDS constant for this record group.

warping_field_shapes()

Access the class level SHAPES constant for this record group.

warping_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

warping_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

class wepy.boundary_conditions.receptor.UnbindingBC(initial_state=None, cutoff_distance=1.0, topology=None, ligand_idxs=None, receptor_idxs=None, periodic=True, **kwargs)[source]

Bases: wepy.boundary_conditions.receptor.ReceptorBC

Boundary condition for ligand unbinding.

Walkers will be warped (discontinuously) if all atoms in the ligand are at least a certain distance away from the atoms in the receptor (i.e. the min-min of ligand-receptor distances > cutoff).

Warping will replace the walker state with the initial state given as a parameter to this class.

Also reports on the progress of that min-min for each walker.

Constructor for UnbindingBC class.

All the key-word arguments are necessary.

The ‘initial_state’ should be the initial state of your simulation for proper non-equilibrium simulations.

Parameters
  • initial_state (object implementing State interface) – The state walkers will take on after unbinding.

  • cutoff_distance (float) – The distance that specifies the boundary condition. When the min-min ligand-receptor distance is less than this it will be warped.

  • topology (str) – A JSON string of topology.

  • ligand_idxs (list of int) – Indices of the atoms in the topology that correspond to the ligands.

  • receptor_idxs (list of int) – Indices of the atoms in the topology that correspond to the receptor for the ligand.

Raises
  • AssertionError – If any of the following are not provided: initial_state, topology, ligand_idxs, receptor_idxs

  • AssertionError – If the cutoff distance is not a float.

Warning

The ‘initial_state’ should be the initial state of your simulation for proper non-equilibrium simulations.

Notes

The topology argument is necessary due to an implementation detail that uses mdtraj and may not be required in the future.

BC_FIELDS = ('boundary_distance',)

Only occurs at the start of the simulation and just reports on the min-min cutoff distance.

BC_SHAPES = ((1,),)

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

BC_DTYPES = (<class 'float'>,)

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

BC_RECORD_FIELDS = ('boundary_distance',)

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

WARPING_FIELDS = ('walker_idx', 'target_idx', 'weight')

String names of fields produced in this record group.

Warping records are typically used to report whenever a walker satisfied the boundary conditions and was warped and had its state changed.

Warning

Be careful when modifying these fields as they may be integrated with other wepy framework features. Namely recognition of discontinuous warping events for making contiguous trajectories from cloning and merging lineages.

The behavior of whether or not a warping event is discontinuous is given by a BoundaryCondition class’s warping_discontinuity which likely depends on the existence of particular fields.

WARPING_SHAPES = ((1,), (1,), (1,))

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

WARPING_DTYPES = (<class 'int'>, <class 'int'>, <class 'float'>)

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

WARPING_RECORD_FIELDS = ('walker_idx', 'target_idx', 'weight')

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

PROGRESS_FIELDS = ('min_distances',)

The ‘min_distances’ field reports on the min-min ligand-receptor distance for each walker.

PROGRESS_SHAPES = (Ellipsis,)

Numpy-style shapes of all fields produced in records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A tuple of ints that specify the shape of the field element array.

  2. Ellipsis, indicating that the field is variable length and limited to being a rank one array (e.g. (3,) or (1,)).

  3. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

Note that the shapes must be tuple and not simple integers for rank-1 arrays.

Option B will result in the special h5py datatype ‘vlen’ and should not be used for large datasets for efficiency reasons.

PROGRESS_DTYPES = (<class 'float'>,)

Specifies the numpy dtypes to be used for records.

There should be the same number of elements as there are in the corresponding ‘FIELDS’ class constant.

Each entry should either be:

  1. A numpy.dtype object.

  1. None, indicating that the first instance of this field will not be known until runtime. Any field that is returned by a record producing method will automatically interpreted as None if not specified here.

PROGRESS_RECORD_FIELDS = ('min_distances',)

Optional, names of fields to be selected for truncated representation of the record group.

These entries should be strings that are previously contained in the ‘FIELDS’ class constant.

While strictly no constraints on to which fields can be added here you should only choose those fields whose features could fit into a plaintext csv or similar format.

DISCONTINUITY_TARGET_IDXS = Ellipsis

Specifies which ‘target_idxs’ values are considered discontinuous targets.

Values are either integer indices, Ellipsis (indicating all possible values are discontinuous), or None indicating no possible value is discontinuous.

_warp(walker)

Perform the warping of a walker.

Chooses an initial state to replace the walker’s state with according to it’s given weight.

Returns a walker of the same type and weight.

Parameters

walker (object implementing the Walker interface) –

Returns

  • warped_walker (object implementing the Walker interface) – The walker with the state after the warping. Weight should be the same.

  • warping_data (dict of str : value) – The dictionary-style ‘WARPING’ record for this event. Excluding the walker index which is done in the main warp_walkers method.

bc_field_dtypes()

Access the class level DTYPES constant for this record group.

bc_field_names()

Access the class level FIELDS constant for this record group.

bc_field_shapes()

Access the class level SHAPES constant for this record group.

bc_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

bc_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

property initial_states

The possible initial states warped walkers may assume.

property initial_weights

The probabilities of each initial state being chosen during a warping.

property ligand_idxs

The indices of the atom positions in the state considered the ligand.

progress_field_dtypes()

Access the class level DTYPES constant for this record group.

progress_field_names()

Access the class level FIELDS constant for this record group.

progress_field_shapes()

Access the class level SHAPES constant for this record group.

progress_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

progress_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

property receptor_idxs

The indices of the atom positions in the state considered the receptor.

warp_walkers(walkers, cycle)

Test the progress of all the walkers, warp if required, and update the boundary conditions.

Parameters
  • walkers (list of objects implementing the Walker interface) –

  • cycle (int) – The index of the cycle.

Returns

  • new_walkers (list of objects implementing the Walker interface) – The new set of walkers that may have been warped.

  • warp_data (list of dict of str : value) – The dictionary-style records for WARPING update events

bc_datalist of dict of strvalue

The dictionary-style records for BC update events

progress_datadict of strarraylike

The dictionary-style records for PROGRESS update events

classmethod warping_discontinuity(warping_record)

Tests whether a warping record generated by this class is discontinuous or not.

Parameters

warping_record (tuple) – The WARPING type record.

Returns

is_discontinuous – True if a discontinuous warp False if continuous.

Return type

bool

warping_field_dtypes()

Access the class level DTYPES constant for this record group.

warping_field_names()

Access the class level FIELDS constant for this record group.

warping_field_shapes()

Access the class level SHAPES constant for this record group.

warping_fields()

Returns a list of zipped field specs.

Returns

record_specs – A list of the specs for each field, a spec is a tuple of type (field_name, shape_spec, dtype_spec)

Return type

list of tuple

warping_record_field_names()

Access the class level RECORD_FIELDS constant for this record group.

property cutoff_distance

The distance a ligand must be to be unbound.

property topology

JSON string topology of the system.

_calc_min_distance(walker)[source]

Min-min distance for a walker.

Parameters

walker (object implementing the Walker interface) –

Returns

min_distance

Return type

float

_progress(walker)[source]

Calculate whether a walker has unbound and also provide a dictionary for a single walker in the progress records.

Parameters

walker (object implementing the Walker interface) –

Returns

  • is_unbound (bool) – Whether the walker is unbound (warped) or not

  • progress_data (dict of str : value) – Dictionary of the progress record group fields for this walker alone.

_update_bc(new_walkers, warp_data, progress_data, cycle)[source]

Perform an update to the boundary conditions.

This is only used on the first cycle to keep a record of the cutoff parameter.

Parameters
  • new_walkers (list of walkers) – The walkers after warping.

  • warp_data (list of dict) –

  • progress_data (dict) –

  • cycle (int) –

Returns

bc_data – The dictionary-style records for BC update events

Return type

list of dict