コード例 #1
0
    def __init__(self, options, topology):
        if 'n_spatial' not in options:
            options['n_spatial'] = topology.n_spatial

        options['n_atoms'] = 1

        snapshot_dimensions = {
            'n_atoms': topology.n_atoms,
            'n_spatial': topology.n_spatial
        }

        descriptor = SnapshotDescriptor.construct(
            snapshot_class=Snapshot, snapshot_dimensions=snapshot_dimensions)

        super(ToyEngine, self).__init__(options=options, descriptor=descriptor)

        self.topology = topology

        self._mass = None
        self._minv = None

        self.positions = None
        self.velocities = None

        self._mass = np.array(topology.masses)
        self._pes = topology.pes
        self._minv = 1.0 / self._mass
コード例 #2
0
ファイル: engine.py プロジェクト: dwhswenson/openpathsampling
    def __init__(self, options, topology):
        if 'n_spatial' not in options:
            options['n_spatial'] = topology.n_spatial

        options['n_atoms'] = 1

        snapshot_dimensions = {
            'n_atoms': topology.n_atoms,
            'n_spatial': topology.n_spatial
        }

        descriptor = SnapshotDescriptor.construct(
            snapshot_class=Snapshot,
            snapshot_dimensions=snapshot_dimensions
        )

        super(ToyEngine, self).__init__(
            options=options,
            descriptor=descriptor
        )

        self.topology = topology

        self._mass = None
        self._minv = None

        self.positions = None
        self.velocities = None

        self._mass = np.array(topology.masses)
        self._pes = topology.pes
        self._minv = 1.0 / self._mass
コード例 #3
0
ファイル: tools.py プロジェクト: pk-organics/openpathsampling
    def __init__(self, topology):

        descriptor = SnapshotDescriptor.construct(
            Snapshot, {
                'n_atoms': topology.n_atoms,
                'n_spatial': topology.n_spatial
            })

        super(NoEngine, self).__init__(descriptor=descriptor)

        self.topology = topology
コード例 #4
0
    def to_descriptor(self):
        """
        Helper function to fast create a descriptor

        Returns
        -------
        :obj:`SnapshotDescriptor`

        """
        return SnapshotDescriptor.construct(ToySnapshot, {
            'n_atoms': self.n_atoms,
            'n_spatial': self.n_spatial
        })
コード例 #5
0
    def __init__(self, topology):

        descriptor = SnapshotDescriptor.construct(
            Snapshot,
            {
                'n_atoms': topology.n_atoms,
                'n_spatial': topology.n_spatial
            }
        )

        super(NoEngine, self).__init__(
            descriptor=descriptor
        )

        self.topology = topology
コード例 #6
0
ファイル: topology.py プロジェクト: jchodera/openpathsampling
    def to_descriptor(self):
        """
        Helper function to fast create a descriptor

        Returns
        -------
        :obj:`SnapshotDescriptor`

        """
        return SnapshotDescriptor.construct(
            ToySnapshot,
            {
                'n_atoms': self.n_atoms,
                'n_spatial': self.n_spatial
            }
        )
コード例 #7
0
ファイル: engine.py プロジェクト: jchodera/openpathsampling
    def __init__(
            self,
            topology,
            system,
            integrator,
            openmm_properties=None,
            options=None):
        """
        Parameters
        ----------
        topology : openpathsampling.engines.openmm.MDTopology
            a template snapshots which provides the topology object to be used
            to create the openmm engine
        system : simtk.openmm.app.System
            the openmm system object
        integrator : simtk.openmm.Integrator
            the openmm integrator object
        openmm_properties : dict
            optional setting for creating the openmm simuation object. Typical
            keys include GPU floating point precision
        options : dict
            a dictionary that provides additional settings for the OPS engine.
            Allowed are

                'n_steps_per_frame' : int, default: 10
                    the number of integration steps per returned snapshot
                'n_frames_max' : int or None, default: 5000,
                    the maximal number of frames allowed for a returned
                    trajectory object
                `platform` : str, default: `fastest`,
                    the openmm specification for the platform to be used,
                    also 'fastest' is allowed   which will pick the currently
                    fastest one available

        Notes
        -----
        the `n_frames_max` does not limit Trajectory objects in length. It only
        limits the maximal length of returned trajectory objects when this
        engine is used.
        """

        self.system = system
        self.integrator = integrator
        self.topology = topology

        dimensions = {
            'n_atoms': topology.n_atoms,
            'n_spatial': topology.n_spatial
        }

        descriptor = SnapshotDescriptor.construct(
            Snapshot,
            dimensions
        )

        super(OpenMMEngine, self).__init__(
            options=options,
            descriptor=descriptor
        )

        if openmm_properties is None:
            openmm_properties = {}

        self.openmm_properties = openmm_properties

        # set no cached snapshot
        self._current_snapshot = None
        self._current_momentum = None
        self._current_configuration = None
        self._current_box_vectors = None

        self._simulation = None
コード例 #8
0
    def __init__(self,
                 topology,
                 system,
                 integrator,
                 openmm_properties=None,
                 options=None):
        """
        Parameters
        ----------
        topology : openpathsampling.engines.openmm.MDTopology
            a template snapshots which provides the topology object to be used
            to create the openmm engine
        system : simtk.openmm.app.System
            the openmm system object
        integrator : simtk.openmm.Integrator
            the openmm integrator object
        openmm_properties : dict
            optional setting for creating the openmm simuation object. Typical
            keys include GPU floating point precision
        options : dict
            a dictionary that provides additional settings for the OPS engine.
            Allowed are

                'n_steps_per_frame' : int, default: 10
                    the number of integration steps per returned snapshot
                'n_frames_max' : int or None, default: 5000,
                    the maximal number of frames allowed for a returned
                    trajectory object
                `platform` : str, default: `fastest`,
                    the openmm specification for the platform to be used,
                    also 'fastest' is allowed   which will pick the currently
                    fastest one available

        Notes
        -----
        the `n_frames_max` does not limit Trajectory objects in length. It only
        limits the maximal length of returned trajectory objects when this
        engine is used.
        """

        self.system = system
        self.integrator = integrator
        self.topology = topology

        dimensions = {
            'n_atoms': topology.n_atoms,
            'n_spatial': topology.n_spatial
        }

        descriptor = SnapshotDescriptor.construct(Snapshot, dimensions)

        super(OpenMMEngine, self).__init__(options=options,
                                           descriptor=descriptor)

        if openmm_properties is None:
            openmm_properties = {}

        self.openmm_properties = openmm_properties

        # set no cached snapshot
        self._current_snapshot = None
        self._current_momentum = None
        self._current_configuration = None
        self._current_box_vectors = None

        self._simulation = None