Example #1
0
    def __init__(self, Lx = None, Ly = None, Lz = None, xy = None, xz = None, yz = None, period = 1, L = None, phase=0, scale_particles=True):
        hoomd.util.print_status_line();

        # initialize base class
        _updater.__init__(self);

        self.metadata_fields = ['period']

        if L is not None:
            Lx = L;
            Ly = L;
            Lz = L;

        if Lx is None and Ly is None and Lz is None and xy is None and xz is None and yz is None:
            hoomd.context.msg.warning("update.box_resize: Ignoring request to setup updater without parameters\n")
            return


        box = hoomd.context.current.system_definition.getParticleData().getGlobalBox();
        # setup arguments
        if Lx is None:
            Lx = box.getL().x;
        if Ly is None:
            Ly = box.getL().y;
        if Lz is None:
            Lz = box.getL().z;

        if xy is None:
            xy = box.getTiltFactorXY();
        if xz is None:
            xz = box.getTiltFactorXZ();
        if yz is None:
            yz = box.getTiltFactorYZ();

        Lx = hoomd.variant._setup_variant_input(Lx);
        Ly = hoomd.variant._setup_variant_input(Ly);
        Lz = hoomd.variant._setup_variant_input(Lz);

        xy = hoomd.variant._setup_variant_input(xy);
        xz = hoomd.variant._setup_variant_input(xz);
        yz = hoomd.variant._setup_variant_input(yz);

        # store metadata
        self.Lx = Lx
        self.Ly = Ly
        self.Lz = Lz
        self.xy = xy
        self.xz = xz
        self.yz = yz
        self.metadata_fields = ['Lx','Ly','Lz','xy','xz','yz']

        # create the c++ mirror class
        self.cpp_updater = _hoomd.BoxResizeUpdater(hoomd.context.current.system_definition, Lx.cpp_variant, Ly.cpp_variant, Lz.cpp_variant,
                                                  xy.cpp_variant, xz.cpp_variant, yz.cpp_variant);
        self.cpp_updater.setParams(scale_particles);

        if period is None:
            self.cpp_updater.update(hoomd.context.current.system.getCurrentTimeStep());
        else:
            self.setupUpdater(period, phase);
Example #2
0
 def _attach(self):
     self._cpp_obj = _hoomd.BoxResizeUpdater(
         self._simulation.state._cpp_sys_def,
         self.box1,
         self.box2,
         self.variant)
     super()._attach()
Example #3
0
    def update(state, box):
        """Immediately scale the particle in the system state to the given box.

        Args:
            box (Box): New box.
        """
        updater = _hoomd.BoxResizeUpdater(state._cpp_sys_def, state.box, box,
                                          Constant(1))
        updater.update(state._simulation.timestep)
Example #4
0
 def _attach(self):
     group = self._simulation.state._get_group(self.filter)
     self._cpp_obj = _hoomd.BoxResizeUpdater(
         self._simulation.state._cpp_sys_def,
         self.box1,
         self.box2,
         self.variant,
         group
     )
     super()._attach()
Example #5
0
    def update(state, box, filter=All()):
        """Immediately scale the particle in the system state to the given box.

        Args:
            state (State): System state to scale.
            box (Box): New box.
            filter (hoomd.filter.ParticleFilter): The subset of particles to
                update.
        """
        group = state._get_group(filter)
        updater = _hoomd.BoxResizeUpdater(state._cpp_sys_def, state.box, box,
                                          Constant(1), group)
        updater.update(state._simulation.timestep)