Esempio n. 1
0
 def __init__(self):
     self._scheduled = False
     self._simulation = None
     self._updaters = syncedlist.SyncedList(Updater,
                                            _triggered_op_conversion)
     self._writers = syncedlist.SyncedList(Writer, _triggered_op_conversion)
     self._tuners = syncedlist.SyncedList(
         Tuner, syncedlist._PartialGetAttr('_cpp_obj'))
     self._computes = syncedlist.SyncedList(
         Compute, syncedlist._PartialGetAttr('_cpp_obj'))
     self._integrator = None
     self._tuners.append(ParticleSorter())
Esempio n. 2
0
    def __init__(self, forces, constraints, methods):
        forces = [] if forces is None else forces
        constraints = [] if constraints is None else constraints
        methods = [] if methods is None else methods
        self._forces = syncedlist.SyncedList(
            Force, syncedlist._PartialGetAttr('_cpp_obj'), iterable=forces)

        self._constraints = syncedlist.SyncedList(
            ConstraintForce,
            syncedlist._PartialGetAttr('_cpp_obj'),
            iterable=constraints)

        self._methods = syncedlist.SyncedList(
            Method, syncedlist._PartialGetAttr('_cpp_obj'), iterable=methods)
Esempio n. 3
0
    def __init__(self, forces, constraints, methods, rigid):
        forces = [] if forces is None else forces
        constraints = [] if constraints is None else constraints
        methods = [] if methods is None else methods
        self._forces = syncedlist.SyncedList(
            Force, syncedlist._PartialGetAttr('_cpp_obj'), iterable=forces)

        self._constraints = syncedlist.SyncedList(
            OnlyTypes(Constraint, disallow_types=(Rigid,)),
            syncedlist._PartialGetAttr('_cpp_obj'),
            iterable=constraints)

        self._methods = syncedlist.SyncedList(
            Method, syncedlist._PartialGetAttr('_cpp_obj'), iterable=methods)

        param_dict = ParameterDict(rigid=OnlyTypes(Rigid, allow_none=True))
        if rigid is not None and rigid._added:
            raise ValueError("Rigid object can only belong to one integrator.")
        param_dict["rigid"] = rigid
        self._param_dict.update(param_dict)
Esempio n. 4
0
    def __init__(self,
                 dt,
                 force_tol,
                 angmom_tol,
                 energy_tol,
                 integrate_rotational_dof=False,
                 forces=None,
                 constraints=None,
                 methods=None,
                 rigid=None,
                 min_steps_adapt=5,
                 finc_dt=1.1,
                 fdec_dt=0.5,
                 alpha_start=0.1,
                 fdec_alpha=0.99,
                 min_steps_conv=10):

        super().__init__(forces, constraints, methods, rigid)

        pdict = ParameterDict(
            dt=float(dt),
            integrate_rotational_dof=bool(integrate_rotational_dof),
            min_steps_adapt=OnlyTypes(int, preprocess=positive_real),
            finc_dt=float(finc_dt),
            fdec_dt=float(fdec_dt),
            alpha_start=float(alpha_start),
            fdec_alpha=float(fdec_alpha),
            force_tol=float(force_tol),
            angmom_tol=float(angmom_tol),
            energy_tol=float(energy_tol),
            min_steps_conv=OnlyTypes(int, preprocess=positive_real),
            _defaults={
                'min_steps_adapt': 5,
                'min_steps_conv': 10
            })

        self._param_dict.update(pdict)

        # set these values explicitly so they can be validated
        self.min_steps_adapt = min_steps_adapt
        self.min_steps_conv = min_steps_conv

        # have to remove methods from old syncedlist so new syncedlist doesn't
        # think members are attached to multiple syncedlists
        self._methods.clear()

        methods_list = syncedlist.SyncedList(
            OnlyTypes((hoomd.md.methods.NVE, hoomd.md.methods.NPH,
                       hoomd.md.methods.rattle.NVE)),
            syncedlist._PartialGetAttr("_cpp_obj"),
            iterable=methods)
        self._methods = methods_list
Esempio n. 5
0
 def __init__(self, alchemical_dof):
     self._alchemical_dof = syncedlist.SyncedList(
         AlchemicalDOF, syncedlist._PartialGetAttr("_cpp_obj"))
     if alchemical_dof is not None:
         self._alchemical_dof.extend(alchemical_dof)