コード例 #1
0
    def __init__(self, group,flow_target,slab_direction,flow_direction,n_slabs,max_slab=-1,min_slab=-1):
        period=1 # This updater has to be applied every timestep
        assert (n_slabs > 0 ),"Invalid negative number of slabs."
        if min_slab < 0:
            min_slab = 0
        if max_slab < 0:
            max_slab = n_slabs/2

        #Cast input to int to avoid mismatch of types in calling the constructor
        n_slabs = int(n_slabs)
        min_slab = int(min_slab)
        max_slab = int(max_slab)

        assert (max_slab>-1 and max_slab < n_slabs),"Invalid max_slab in [0,"+str(n_slabs)+")."
        assert (min_slab>-1 and min_slab < n_slabs),"Invalid min_slab in [0,"+str(n_slabs)+")."
        assert (min_slab != max_slab),"Invalid min/max slabs. Both have the same value."

        # initialize the base class
        _updater.__init__(self);

        self._flow_target = hoomd.variant._setup_variant_input(flow_target);


        # create the c++ mirror class
        if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled():
            self.cpp_updater = _md.MuellerPlatheFlow(hoomd.context.current.system_definition, group.cpp_group,flow_target.cpp_variant,slab_direction,flow_direction,n_slabs,min_slab,max_slab);
        else:
            self.cpp_updater = _md.MuellerPlatheFlowGPU(hoomd.context.current.system_definition, group.cpp_group,flow_target.cpp_variant,slab_direction,flow_direction,n_slabs,min_slab,max_slab);

        self.setupUpdater(period);
コード例 #2
0
ファイル: update.py プロジェクト: devitrification/hoomd-blue
 def _attach(self):
     group = self._simulation.state._get_group(self.filter)
     sys_def = self._simulation.state._cpp_sys_def
     if isinstance(self._simulation.device, hoomd.device.CPU):
         self._cpp_obj = _md.MuellerPlatheFlow(
             sys_def, self.trigger, group, self.flow_target,
             self.slab_direction, self.flow_direction, self.n_slabs,
             self.min_slab, self.max_slab, self.flow_epsilon)
     else:
         self._cpp_obj = _md.MuellerPlatheFlowGPU(
             sys_def, self.trigger, group, self.flow_target,
             self.slab_direction, self.flow_direction, self.n_slabs,
             self.min_slab, self.max_slab, self.flow_epsilon)
     super()._attach()
コード例 #3
0
    def __init__(self,
                 group,
                 flow_target,
                 slab_direction,
                 flow_direction,
                 n_slabs,
                 max_slab=-1,
                 min_slab=-1):
        hoomd.util.print_status_line()
        period = 1  # This updater has to be applied every timestep
        assert (n_slabs > 0), "Invalid negative number of slabs."
        if min_slab < 0:
            min_slab = 0
        if max_slab < 0:
            max_slab = n_slabs / 2

        assert (max_slab > -1 and max_slab < n_slabs
                ), "Invalid max_slab in [0," + str(n_slabs) + ")."
        assert (min_slab > -1 and min_slab < n_slabs
                ), "Invalid min_slab in [0," + str(n_slabs) + ")."
        assert (min_slab !=
                max_slab), "Invalid min/max slabs. Both have the same value."

        # initialize the base class
        _updater.__init__(self)

        self._flow_target = hoomd.variant._setup_variant_input(flow_target)

        # create the c++ mirror class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_updater = _md.MuellerPlatheFlow(
                hoomd.context.current.system_definition, group.cpp_group,
                flow_target.cpp_variant, slab_direction, flow_direction,
                n_slabs, min_slab, max_slab)
        else:
            self.cpp_updater = _md.MuellerPlatheFlowGPU(
                hoomd.context.current.system_definition, group.cpp_group,
                flow_target.cpp_variant, slab_direction, flow_direction,
                n_slabs, min_slab, max_slab)

        self.setupUpdater(period)