openpathsampling.collectivevariables.MDTrajFunctionCV
- class openpathsampling.collectivevariables.MDTrajFunctionCV(name, f, topology, cv_requires_lists=True, cv_wrap_numpy_array=True, cv_scalarize_numpy_singletons=True, **kwargs)[source]
Make
CollectiveVariablefromfthat takesmdtraj.Trajectoryas input.This is identical to FunctionCV except that the function is called with an
mdtraj.Trajectoryobject instead of theopenpathsampling.Trajectoryone usingf(traj.to_mdtraj(), **kwargs)Examples
>>> # To create an order parameter which calculates the dihedral formed >>> # by atoms [7,9,15,17] (psi in Ala dipeptide): >>> import mdtraj as md >>> traj = 'paths.Trajectory()' >>> psi_atoms = [7,9,15,17] >>> psi_orderparam = FunctionCV("psi", md.compute_dihedrals, >>> indices=[[2,4,6,8]]) >>> print psi_orderparam( traj )
- __init__(name, f, topology, cv_requires_lists=True, cv_wrap_numpy_array=True, cv_scalarize_numpy_singletons=True, **kwargs)[source]
- Parameters:
name (str)
f
topology (
openpathsampling.engines.topology.MDTrajTopology) – the mdtraj topology wrapper from OPS that is used to initialize the featurizer inpyemma.coordinates.featurizer(topology)cv_requires_lists
cv_wrap_numpy_array
cv_scalarize_numpy_singletons
scalarize_numpy_singletons (bool, default: True) – If
Truethen arrays of length 1 will be treated as array with one dimension less. e.g.[[1], [2], [3]]will be turned into[1, 2, 3]. This is often useful, when you use en external function from mdtraj to get only a single value.
Methods
__init__(name, f, topology[, ...])args()Return a list of args of the __init__ function of a class
base()Return the most parent class actually derived from StorableObject
cache_all()Sync this CV with attached storages
count_weaks()Return number of objects subclassed from StorableObject still in memory
descendants()Return a list of all subclassed objects
disable_diskcache()enable_diskcache()fix_name()Set the objects name to be immutable.
from_dict(dct)Reconstruct an object from a dictionary representaiton
get_uuid()idx(store)Return the index which is used for the object in the given store.
named(name)Name an unnamed object.
objects()Returns a dictionary of all storable objects
reverse_uuid()ruuid(uid)set_cache_store(value_store)Attach store variables to the collective variables.
set_observer(active)(De-)Activate observing creation of storable objects
str_chain()Return a string representation of the chain of dicts called.
sync()Sync this CV with the attached storages
to_dict()Convert object into a dictionary representation
with_diskcache([template, chunksize, ...])Attributes
ACTIVE_LONGCREATION_COUNTINSTANCE_UUIDbase_clsReturn the base class
base_cls_nameReturn the name of the base class
clsReturn the class name as a string
default_nameReturn the default name.
fis_namedTrue if this object has a custom name.
mdtraj_functionnameReturn the current name of the object.
observe_objectspassing_chainReturn a list of chaindicts in order they will be tried.