コード例 #1
0
    def store(self, simul):
        """Takes a simulation instance and stores a minimal representation of it.

      Args:
         simul: A simulation object.
      """

        super(InputSimulation, self).store()

        self.output.store(simul.outtemplate)
        self.prng.store(simul.prng)
        self.step.store(simul.step)
        self.total_steps.store(simul.tsteps)
        self.total_time.store(simul.ttime)
        self.paratemp.store(simul.paratemp)

        # this we pick from the messages class. kind of a "global" but it seems to
        # be the best way to pass around the (global) information on the level of output.
        if verbosity.debug:
            self.verbosity.store("debug")
        elif verbosity.high:
            self.verbosity.store("high")
        elif verbosity.medium:
            self.verbosity.store("medium")
        elif verbosity.low:
            self.verbosity.store("low")
        elif verbosity.quiet:
            self.verbosity.store("quiet")
        else:
            raise ValueError("Invalid verbosity level")

        self.mode.store(simul.mode)

        self.extra = []

        for fname in simul.fflist:
            ff = simul.fflist[fname]
            if type(ff) is eforcefields.FFSocket:
                iff = iforcefields.InputFFSocket()
                iff.store(ff)
                self.extra.append(("ffsocket", iff))
            elif type(ff) is eforcefields.FFLennardJones:
                iff = iforcefields.InputFFLennardJones()
                iff.store(ff)
                self.extra.append(("fflj", iff))
            elif type(ff) is eforcefields.FFDebye:
                iff = iforcefields.InputFFDebye()
                iff.store(ff)
                self.extra.append(("ffdebye", iff))
            elif type(ff) is eforcefields.FFYaff:
                iff = iforcefields.InputFFYaff()
                iff.store(ff)
                self.extra.append(("ffyaff", iff))

        for s in simul.syslist:
            isys = InputSystem()
            isys.store(s)
            self.extra.append(("system", isys))
コード例 #2
0
 'remd': smotion.remd.InputReplicaExchange(),
 'meta': smotion.metad.InputMetaDyn(),
 'system': system.InputSystem(),
 'ensembles': ensembles.InputEnsemble(),
 'motion': motion.motion.InputMotion(),
 'dynamics': motion.dynamics.InputDynamics(),
 'alchemy': motion.alchemy.InputAlchemy(),
 'instanton': motion.instanton.InputInst(),
 'phonons': motion.phonons.InputDynMatrix(),
 'geop': motion.geop.InputGeop(),
 'neb': motion.neb.InputNEB(),
 'thermostats': thermostats.InputThermo(),
 'forcefield': forcefields.InputForceField(),
 'ffsocket': forcefields.InputFFSocket(),
 'fflj': forcefields.InputFFLennardJones(),
 'ffdebye': forcefields.InputFFDebye(),
 'ffplumed': forcefields.InputFFPlumed(),
 'ffyaff': forcefields.InputFFYaff(),
 'forcecomponent': forces.InputForceComponent(),
 'forces': forces.InputForces(),
 'atoms': atoms.InputAtoms(),
 'beads': beads.InputBeads(),
 'prng': prng.InputRandom(),
 'normalmodes': normalmodes.InputNormalModes(),
 'nmfrequencies': normalmodes.InputNMFrequencies(),
 'init_file': initializer.InputInitFile(),
 'init_pos': initializer.InputInitPositions(),
 'init_mom': initializer.InputInitMomenta(),
 'init_lab': initializer.InputInitLabels(),
 'init_mass': initializer.InputInitMasses(),
 'init_vel': initializer.InputInitVelocities(),
コード例 #3
0
 "motion": motion.motion.InputMotion(),
 "dynamics": motion.dynamics.InputDynamics(),
 "t_ramp": motion.ramp.InputTemperatureRamp(),
 "p_ramp": motion.ramp.InputPressureRamp(),
 "alchemy": motion.alchemy.InputAlchemy(),
 "planetary": motion.planetary.InputPlanetary(),
 "atomswap": motion.atomswap.InputAtomSwap(),
 "instanton": motion.instanton.InputInst(),
 "phonons": motion.phonons.InputDynMatrix(),
 "geop": motion.geop.InputGeop(),
 "neb": motion.neb.InputNEB(),
 "thermostats": thermostats.InputThermo(),
 "forcefield": forcefields.InputForceField(),
 "ffsocket": forcefields.InputFFSocket(),
 "fflj": forcefields.InputFFLennardJones(),
 "ffdebye": forcefields.InputFFDebye(),
 "ffplumed": forcefields.InputFFPlumed(),
 "ffyaff": forcefields.InputFFYaff(),
 "ffsgdml": forcefields.InputFFsGDML(),
 "forcecomponent": forces.InputForceComponent(),
 "forces": forces.InputForces(),
 "atoms": atoms.InputAtoms(),
 "beads": beads.InputBeads(),
 "prng": prng.InputRandom(),
 "normalmodes": normalmodes.InputNormalModes(),
 "nmfrequencies": normalmodes.InputNMFrequencies(),
 "init_file": initializer.InputInitFile(),
 "init_pos": initializer.InputInitPositions(),
 "init_mom": initializer.InputInitMomenta(),
 "init_lab": initializer.InputInitLabels(),
 "init_mass": initializer.InputInitMasses(),
コード例 #4
0
    def store(self, simul):
        """Takes a simulation instance and stores a minimal representation of it.

        Args:
           simul: A simulation object.
        """

        super(InputSimulation, self).store()

        self.output.store(simul.outtemplate)
        self.prng.store(simul.prng)
        self.step.store(simul.step)
        self.total_steps.store(simul.tsteps)
        self.total_time.store(simul.ttime)
        self.smotion.store(simul.smotion)
        self.threading.store(simul.threading)

        # this we pick from the messages class. kind of a "global" but it seems to
        # be the best way to pass around the (global) information on the level of output.
        if verbosity.debug:
            self.verbosity.store("debug")
        elif verbosity.high:
            self.verbosity.store("high")
        elif verbosity.medium:
            self.verbosity.store("medium")
        elif verbosity.low:
            self.verbosity.store("low")
        elif verbosity.quiet:
            self.verbosity.store("quiet")
        else:
            raise ValueError("Invalid verbosity level")

        self.mode.store(simul.mode)

        _fflist = [v for k, v in sorted(simul.fflist.items())]
        if len(self.extra) != len(_fflist) + len(simul.syslist):
            self.extra = [0] * (len(_fflist) + len(simul.syslist))

        for _ii, _obj, in enumerate(_fflist + simul.syslist):
            if self.extra[_ii] == 0:
                if isinstance(_obj, eforcefields.FFSocket):
                    _iobj = iforcefields.InputFFSocket()
                    _iobj.store(_obj)
                    self.extra[_ii] = ("ffsocket", _iobj)
                elif isinstance(_obj, eforcefields.FFLennardJones):
                    _iobj = iforcefields.InputFFLennardJones()
                    _iobj.store(_obj)
                    self.extra[_ii] = ("fflj", _iobj)
                elif isinstance(_obj, eforcefields.FFDebye):
                    _iobj = iforcefields.InputFFDebye()
                    _iobj.store(_obj)
                    self.extra[_ii] = ("ffdebye", _iobj)
                elif isinstance(_obj, eforcefields.FFPlumed):
                    _iobj = iforcefields.InputFFPlumed()
                    _iobj.store(_obj)
                    self.extra[_ii] = ("ffplumed", _iobj)
                elif isinstance(_obj, eforcefields.FFYaff):
                    _iobj = iforcefields.InputFFYaff()
                    _iobj.store(_obj)
                    self.extra[_ii] = ("ffyaff", _iobj)
                elif isinstance(_obj, eforcefields.FFsGDML):
                    _iobj = iforcefields.InputFFsGDML()
                    _iobj.store(_obj)
                    self.extra[_ii] = ("ffsgdml", _iobj)
                elif isinstance(_obj, System):
                    _iobj = InputSystem()
                    _iobj.store(_obj)
                    self.extra[_ii] = ("system", _iobj)
            else:
                self.extra[_ii][1].store(_obj)