How to use the openpathsampling.engines function in openpathsampling

To help you get started, we’ve selected a few openpathsampling examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpathsampling / openpathsampling / openpathsampling / engines / external / testexternal_engine.py View on Github external
def setUp(self):
        slow_options = {
            'n_frames_max' : 10000, 
            'engine_sleep' : 100,
            'name_prefix' : "test"
        }
        fast_options = {
            'n_frames_max' : 10000, 
            'engine_sleep' : 0,
            'name_prefix' : "test"
        }
        self.template = peng.toy.Snapshot(coordinates=np.array([[0.0]]),
                                          velocities=np.array([[1.0]]))
        self.slow_engine = ExternalEngine(slow_options, self.template)
        self.fast_engine = ExternalEngine(fast_options, self.template)
        self.ensemble = paths.LengthEnsemble(5)
github openpathsampling / openpathsampling / openpathsampling / storage / distributed.py View on Github external
def _create_storages(self):
        """
        Register all Stores used in the OpenPathSampling Storage

        """

        # objects with special storages

        self.create_store('trajectories', paths.storage.TrajectoryStore())
        self.create_store('snapshots', SnapshotWrapperStore())

        # normal objects

        self.create_store('topologies', NamedObjectStore(peng.Topology))
        self.create_store('engines', NamedObjectStore(peng.DynamicsEngine))

        # special stores

        self.create_store('tag', ImmutableDictStore())
github openpathsampling / openpathsampling / openpathsampling / storage / storage.py View on Github external
def _create_storages(self):
        """
        Register all Stores used in the OpenPathSampling Storage

        """

        # objects with special storages
        self.create_store('trajectories', paths.storage.TrajectoryStore())

        # topologies might be needed fot CVs so put them here
        self.create_store('topologies', NamedObjectStore(peng.Topology))

        snapshotstore = SnapshotWrapperStore()
        self.create_store('snapshots', snapshotstore)

        self.create_store('samples', paths.storage.SampleStore())
        self.create_store('samplesets', paths.storage.SampleSetStore())
        self.create_store('movechanges',
                          paths.storage.MoveChangeStore())
        self.create_store('steps', paths.storage.MCStepStore())

        # normal objects
        self.create_store('details', ObjectStore(paths.Details))
        self.create_store('pathmovers', NamedObjectStore(paths.PathMover))
        self.create_store('shootingpointselectors',
                          NamedObjectStore(paths.ShootingPointSelector))
        self.create_store('engines', NamedObjectStore(peng.DynamicsEngine))
github openpathsampling / openpathsampling / openpathsampling / collectivevariable.py View on Github external
Finally an instance ``instance = cls(**kwargs)`` is create when
            the CV is created and using the CV will call
            ``instance(snapshots)``

        Notes
        -----
        All trajectories or snapshots passed in kwargs will be converted
        to mdtraj objects for convenience
        """

        md_kwargs = dict()
        md_kwargs.update(kwargs)

        # turn Snapshot and Trajectory into md.trajectory
        for key in md_kwargs:
            if isinstance(md_kwargs[key], peng.BaseSnapshot):
                md_kwargs[key] = md_kwargs[key].to_mdtraj()
            elif isinstance(md_kwargs[key], peng.Trajectory):
                md_kwargs[key] = md_kwargs[key].to_mdtraj()

        self.topology = topology

        import pyemma.coordinates
        self._instance = pyemma.coordinates.featurizer(self.topology.mdtraj)

        featurizer(self._instance, **md_kwargs)

        super(GeneratorCV, self).__init__(
            name,
            cv_callable=featurizer,
            cv_requires_lists=True,
            cv_wrap_numpy_array=True,
github openpathsampling / openpathsampling / openpathsampling / collectivevariable.py View on Github external
def _eval(self, items):
        trajectory = peng.Trajectory(items)

        t = trajectory_to_mdtraj(trajectory, self.topology.mdtraj)
        return self.cv_callable(t, **self.kwargs)
github openpathsampling / openpathsampling / openpathsampling / storage / remote.py View on Github external
# objects with special storages

        stores = {
            'trajectories' : paths.Trajectory,
            'snapshots' : paths.BaseSnapshot,
            'samples' : paths.Sample,
            'samplesets' : paths.SampleSet,
            'pathmovechanges' : paths.PathMoveChange,
            'steps' : paths.MCStep,
            'cvs' : paths.CollectiveVariable,
            'details' : paths.Details,
            'topologies' : peng.Topology,
            'pathmovers' : paths.PathMover,
            'shootingpointselectors' : paths.ShootingPointSelector,
            'engines' : peng.DynamicsEngine,
            'pathsimulators' : paths.PathSimulator,
            'transitions' : paths.Transition,
            'schemes' : paths.MoveScheme,
            'volumes' : paths.Volume,
            'ensembles' : paths.Ensemble,
            'statics' : paths.engines.openmm.features.StaticContainer,
            'kinetics' : paths.engines.openmm.features.KineticContainer
        }

        for name, obj in stores.iteritems():
            self.create_store(name, RemoteMasterObject(obj))
github openpathsampling / openpathsampling / openpathsampling / storage / stores / snapshot_base.py View on Github external
def all(self):
        return peng.Trajectory(map(self.proxy, range(len(self))))
github openpathsampling / openpathsampling / openpathsampling / storage / remote.py View on Github external
'samplesets' : paths.SampleSet,
            'pathmovechanges' : paths.PathMoveChange,
            'steps' : paths.MCStep,
            'cvs' : paths.CollectiveVariable,
            'details' : paths.Details,
            'topologies' : peng.Topology,
            'pathmovers' : paths.PathMover,
            'shootingpointselectors' : paths.ShootingPointSelector,
            'engines' : peng.DynamicsEngine,
            'pathsimulators' : paths.PathSimulator,
            'transitions' : paths.Transition,
            'schemes' : paths.MoveScheme,
            'volumes' : paths.Volume,
            'ensembles' : paths.Ensemble,
            'statics' : paths.engines.openmm.features.StaticContainer,
            'kinetics' : paths.engines.openmm.features.KineticContainer
        }

        for name, obj in stores.iteritems():
            self.create_store(name, RemoteMasterObject(obj))
github openpathsampling / openpathsampling / openpathsampling / storage / stores / snapshot_wrapper.py View on Github external
def __init__(self):
        super(SnapshotWrapperStore, self).__init__(
            peng.BaseSnapshot,
            json=False
        )

        self.type_list = {}
        self.store_snapshot_list = []
        self.store_cv_list = []
        self.cv_list = {}
        self._store = {}

        # default way to handle unknown snapshot types is to create
        # a single store for the first type tried to be stored
        # if you want to store more than one snapshots you
        # need to add them manually
        self._treat_missing_snapshot_type = 'single'

        # if set to true snapshots will not be stored but merely registered
github openpathsampling / openpathsampling / openpathsampling / storage / remote.py View on Github external
'samples' : paths.Sample,
            'samplesets' : paths.SampleSet,
            'pathmovechanges' : paths.PathMoveChange,
            'steps' : paths.MCStep,
            'cvs' : paths.CollectiveVariable,
            'details' : paths.Details,
            'topologies' : peng.Topology,
            'pathmovers' : paths.PathMover,
            'shootingpointselectors' : paths.ShootingPointSelector,
            'engines' : peng.DynamicsEngine,
            'pathsimulators' : paths.PathSimulator,
            'transitions' : paths.Transition,
            'schemes' : paths.MoveScheme,
            'volumes' : paths.Volume,
            'ensembles' : paths.Ensemble,
            'statics' : paths.engines.openmm.features.StaticContainer,
            'kinetics' : paths.engines.openmm.features.KineticContainer
        }

        for name, obj in stores.iteritems():
            self.create_store(name, RemoteMasterObject(obj))