コード例 #1
0
ファイル: loggers.py プロジェクト: dallonasnes/RLMM
 def report(self, topology, state, currentStep, stepsize):
     if self._dcd is None:
         self._dcd = DCDFile(
             self._out, topology, stepsize,
             currentStep, self._reportInterval, self._append
         )
     self._dcd.writeModel(state.getPositions(), periodicBoxVectors=state.getPeriodicBoxVectors())
コード例 #2
0
ファイル: loggers.py プロジェクト: dallonasnes/RLMM
    def report_ns(self, topology, pos, boxvec, currentStep, stepsize):

        if self._dcd is None:
            self._dcd = DCDFile(
                self._out, topology, stepsize,
                currentStep, self._reportInterval, self._append
            )
        self._dcd.writeModel(pos, boxvec)
コード例 #3
0
 def report(self, simulation, state):
     """Generate a report.
     Parameters
     ----------
     simulation : Simulation
         The Simulation to generate a report for
     state : State
         The current state of the simulation
     """
     state = simulation.context.getState(getPositions=True, enforcePeriodicBox=self._enforcePeriodicBox)
     if self._dcd is None:
         self._dcd = DCDFile(self._out, simulation.topology, simulation.integrator.getStepSize(), 0, self._reportInterval)
     self._dcd.writeModel(state.getPositions(), periodicBoxVectors=state.getPeriodicBoxVectors())
コード例 #4
0
ファイル: dcdreporter.py プロジェクト: kpolok/openmm
    def report(self, simulation, state):
        """Generate a report.

        Parameters
        ----------
        simulation : Simulation
            The Simulation to generate a report for
        state : State
            The current state of the simulation
        """

        if self._dcd is None:
            self._dcd = DCDFile(self._out, simulation.topology, simulation.integrator.getStepSize(), 0, self._reportInterval)
        a,b,c = state.getPeriodicBoxVectors()
        self._dcd.writeModel(state.getPositions(), mm.Vec3(a[0].value_in_unit(nanometer), b[1].value_in_unit(nanometer), c[2].value_in_unit(nanometer))*nanometer)
コード例 #5
0
    def report(self, simulation, state):
        """Generate a report.

        Parameters
        ----------
        simulation : Simulation
            The Simulation to generate a report for
        state : State
            The current state of the simulation
        """

        if self._dcd is None:
            self._dcd = DCDFile(self._out, simulation.topology,
                                simulation.integrator.getStepSize(),
                                simulation.currentStep, self._reportInterval,
                                self._append)
        self._dcd.writeModel(state.getPositions(),
                             periodicBoxVectors=state.getPeriodicBoxVectors())
コード例 #6
0
    def report(self, simulation, state):
        """Generate a report.

        Parameters
        ----------
        simulation : Simulation
            The Simulation to generate a report for
        state : State
            The current state of the simulation
        """
        if self._tempDCD is None:

            # Create DCDFile object
            self._tempDCD = DCDFile(self._tempOut, simulation.topology,
                                    simulation.integrator.getStepSize(),
                                    simulation.currentStep,
                                    self._reportInterval, False)

            # Save molecules and masses
            for molecule in simulation.context.getMolecules():
                self._reportedMolecules.append(np.array(molecule))
                self._reportedMoleculesMass.append(
                    self._getMoleculeMass(simulation.system, molecule))

            # Create temporary pdb file
            PDBFile.writeFile(simulation.topology, state.getPositions(),
                              open(self._tempPDBFileName, 'w'))

        # Get time and step from simulation
        self._times.append(state.getTime().value_in_unit(unit.picosecond))
        if self._step:
            self._steps.append(simulation.currentStep)

        # Write to dcd file
        self._tempDCD.writeModel(
            state.getPositions(),
            periodicBoxVectors=state.getPeriodicBoxVectors())