Exemple #1
0
    def set_params(self, T=None):
        util.print_status_line();
        self.check_initialization();

        if T is not None:
            T = variant._setup_variant_input(T);
            self.cpp_updater.setT(T.cpp_variant);
Exemple #2
0
    def set_params(self, T=None):
        util.print_status_line()
        self.check_initialization()

        # change the parameters
        if T is not None:
            # setup the variant inputs
            T = variant._setup_variant_input(T)
            self.cpp_force.setT(T.cpp_variant)
Exemple #3
0
    def __init__(self, Lx = None, Ly = None, Lz = None, xy = None, xz = None, yz = None, period = 1, L = None, phase=-1):
        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:
            globals.msg.warning("update.box_resize: Ignoring request to setup updater without parameters\n")
            return


        box = globals.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 = variant._setup_variant_input(Lx);
        Ly = variant._setup_variant_input(Ly);
        Lz = variant._setup_variant_input(Lz);

        xy = variant._setup_variant_input(xy);
        xz = variant._setup_variant_input(xz);
        yz = 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(globals.system_definition, Lx.cpp_variant, Ly.cpp_variant, Lz.cpp_variant,
                                                  xy.cpp_variant, xz.cpp_variant, yz.cpp_variant);
        if period is None:
            self.cpp_updater.update(globals.system.getCurrentTimeStep());
        else:
            self.setupUpdater(period, phase);
Exemple #4
0
    def __init__(self, T, period=1):
        util.print_status_line();

        # initialize base class
        _updater.__init__(self);

        # setup the variant inputs
        T = variant._setup_variant_input(T);

        # create the compute thermo
        thermo = compute._get_unique_thermo(group=globals.group_all);

        # create the c++ mirror class
        self.cpp_updater = hoomd.TempRescaleUpdater(globals.system_definition, thermo.cpp_compute, T.cpp_variant);
        self.setupUpdater(period);
Exemple #5
0
    def __init__(self, group, P, tau, bk, mode, dt, period=1):
        util.print_status_line();
    
        # initialize base class
        _updater.__init__(self);
        
		# setup the variant inputs
        P = variant._setup_variant_input(P);
		
        # create the compute thermo
        thermo_all = compute._get_unique_thermo(group=globals.group_all);
        
		# Get deltaT
        deltaT = dt;

        # initialize the reflected c++ class
        if not globals.exec_conf.isCUDAEnabled():
            if (mode == "isotropic"):
                cpp_mode = _custom_updaters.PressBerendsenUpdater.integrationMode.isotropic;
            elif (mode == "anisotropic"):
                cpp_mode = _custom_updaters.PressBerendsenUpdater.integrationMode.anisotropic;
            elif (mode == "semi-isotropic"):
                cpp_mode = _custom_updaters.PressBerendsenUpdater.integrationMode.semi_isotropic;
            elif (mode == "uniaxial"):
                cpp_mode = _custom_updaters.PressBerendsenUpdater.integrationMode.one_dimensional;
            else:
                print >> sys.stderr, "\n***Error! Invalid mode\n";
                raise RuntimeError("Error changing parameters in update.press_berendsen");
            self.cpp_updater = _custom_updaters.PressBerendsenUpdater(globals.system_definition, group.cpp_group, thermo_all.cpp_compute, tau, P.cpp_variant, bk, deltaT, cpp_mode);
        else:
            if (mode == "isotropic"):
                cpp_mode = _custom_updaters.PressBerendsenUpdaterGPU.integrationMode.isotropic;
            elif (mode == "anisotropic"):
                cpp_mode = _custom_updaters.PressBerendsenUpdaterGPU.integrationMode.anisotropic;
            elif (mode == "semi-isotropic"):
                cpp_mode = _custom_updaters.PressBerendsenUpdaterGPU.integrationMode.semi_isotropic;
            elif (mode == "uniaxial"):
                cpp_mode = _custom_updaters.PressBerendsenUpdaterGPU.integrationMode.one_dimensional;
            else:
                print >> sys.stderr, "\n***Error! Invalid mode\n";
                raise RuntimeError("Error changing parameters in update.press_berendsen");
            self.cpp_updater = _custom_updaters.PressBerendsenUpdaterGPU(globals.system_definition, group.cpp_group, thermo_all.cpp_compute, tau, P.cpp_variant, bk, deltaT, cpp_mode);
        self.setupUpdater(period);
Exemple #6
0
    def __init__(self, Lx=None, Ly=None, Lz=None, xy=None, xz=None, yz=None, period=1):
        util.print_status_line()

        # initialize base class
        _updater.__init__(self)

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

        # setup arguments
        if Lx is None:
            # use current box length in x-direction
            Lx = globals.system_definition.getParticleData().getGlobalBox().getL().x
        if Ly is None:
            Ly = Lx
        if Lz is None:
            Lz = Lx

        if xy is None:
            xy = 0.0
        if xz is None:
            xz = 0.0
        if yz is None:
            yz = 0.0

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

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

        # create the c++ mirror class
        self.cpp_updater = hoomd.BoxResizeUpdater(
            globals.system_definition,
            Lx.cpp_variant,
            Ly.cpp_variant,
            Lz.cpp_variant,
            xy.cpp_variant,
            xz.cpp_variant,
            yz.cpp_variant,
        )
        if period is None:
            self.cpp_updater.update(globals.system.getCurrentTimeStep())
        else:
            self.setupUpdater(period)
Exemple #7
0
    def __init__(self, T, period=1):
        util.print_status_line()

        # Error out in MPI simulations
        if hoomd.is_MPI_available():
            if globals.system_definition.getParticleData().getDomainDecomposition():
                globals.msg.error("update.rescale_temp not supported in multi-processor simulations.\n\n")
                raise RuntimeError("Error setting up updater.")

        # initialize base class
        _updater.__init__(self)

        # setup the variant inputs
        T = variant._setup_variant_input(T)

        # create the compute thermo
        thermo = compute._get_unique_thermo(group=globals.group_all)

        # create the c++ mirror class
        self.cpp_updater = hoomd.TempRescaleUpdater(globals.system_definition, thermo.cpp_compute, T.cpp_variant)
        self.setupUpdater(period)
Exemple #8
0
    def __init__(self, T, period=1):
        util.print_status_line();

        # Error out in MPI simulations
        if (hoomd.is_MPI_available()):
            if globals.system_definition.getParticleData().getDomainDecomposition():
                globals.msg.error("update.rescale_temp not supported in multi-processor simulations.\n\n")
                raise RuntimeError("Error setting up updater.")
 
        # initialize base class
        _updater.__init__(self);
        
        # setup the variant inputs
        T = variant._setup_variant_input(T);
        
        # create the compute thermo
        thermo = compute._get_unique_thermo(group=globals.group_all);
        
        # create the c++ mirror class
        self.cpp_updater = hoomd.TempRescaleUpdater(globals.system_definition, thermo.cpp_compute, T.cpp_variant);
        self.setupUpdater(period);
Exemple #9
0
    def __init__(self, Lx = None, Ly = None, Lz = None, xy = None, xz = None, yz = None, period = 1, L = None):
        util.print_status_line();

        # initialize base class
        _updater.__init__(self);

        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:
            globals.msg.warning("update.box_resize: Ignoring request to setup updater without parameters\n")
            return


        box = globals.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 = variant._setup_variant_input(Lx);
        Ly = variant._setup_variant_input(Ly);
        Lz = variant._setup_variant_input(Lz);

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

        # create the c++ mirror class
        self.cpp_updater = hoomd.BoxResizeUpdater(globals.system_definition, Lx.cpp_variant, Ly.cpp_variant, Lz.cpp_variant,
                                                  xy.cpp_variant, xz.cpp_variant, yz.cpp_variant);
        if period is None:
            self.cpp_updater.update(globals.system.getCurrentTimeStep());
        else:
            self.setupUpdater(period);
Exemple #10
0
    def __init__(self, group, T, tau, dt, period=1):
        util.print_status_line();
    
        # initialize base class
        _updater.__init__(self);
        
		# setup the variant inputs
        T = variant._setup_variant_input(T);
		
        # create the compute thermo
        thermo = compute._get_unique_thermo(group = group);
		
		# Get deltaT
        deltaT = dt;

        # initialize the reflected c++ class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_updater = _custom_updaters.TempBerendsenUpdater(globals.system_definition,group.cpp_group,thermo.cpp_compute,tau,T.cpp_variant,deltaT);
        else:
            self.cpp_updater = _custom_updaters.TempBerendsenUpdaterGPU(globals.system_definition,group.cpp_group,thermo.cpp_compute,tau,T.cpp_variant,deltaT);

        self.setupUpdater(period);
Exemple #11
0
    def __init__(self, T, period=1, phase=-1):
        util.print_status_line()

        # initialize base class
        _updater.__init__(self)

        # setup the variant inputs
        T = variant._setup_variant_input(T)

        # create the compute thermo
        thermo = compute._get_unique_thermo(group=globals.group_all)

        # create the c++ mirror class
        self.cpp_updater = hoomd.TempRescaleUpdater(globals.system_definition,
                                                    thermo.cpp_compute,
                                                    T.cpp_variant)
        self.setupUpdater(period, phase)

        # store metadta
        self.T = T
        self.period = period
        self.metadata_fields = ['T', 'period']
Exemple #12
0
    def __init__(self, r_cut, T, seed=1, name=None):
        util.print_status_line()

        # tell the base class how we operate

        # initialize the base class
        pair.pair.__init__(self, r_cut, name)

        # update the neighbor list
        neighbor_list = pair._update_global_nlist(r_cut)
        neighbor_list.subscribe(lambda: self.log * self.get_max_rcut())

        # create the c++ mirror class
        if globals.exec_conf.isCUDAEnabled():
            self.cpp_force = _custom_pair_potentials.PotentialPairLoweThermoLowe(
                globals.system_definition, neighbor_list.cpp_nlist, self.name)
            self.cpp_class = _custom_pair_potentials.PotentialPairLoweThermoLowe
        else:
            neighbor_list.cpp_nlist.setStorageMode(
                hoomd.NeighborList.storageMode.full)
            self.cpp_force = _custom_pair_potentials.PotentialPairLoweThermoLoweGPU(
                globals.system_definition, neighbor_list.cpp_nlist, self.name)
            self.cpp_class = _custom_pair_potentials.PotentialPairLoweThermoLoweGPU
            self.cpp_force.setBlockSize(
                tune._get_optimal_block_size('pair.dpd'))

        globals.system.addCompute(self.cpp_force, self.force_name)

        # setup the coefficent options
        self.required_coeffs = ['A', 'gamma']

        # set the seed for dpd thermostat
        self.cpp_force.setSeed(seed)

        # set the temperature
        # setup the variant inputs
        T = variant._setup_variant_input(T)
        self.cpp_force.setT(T.cpp_variant)
Exemple #13
0
    def __init__(self,
                 Lx=None,
                 Ly=None,
                 Lz=None,
                 xy=None,
                 xz=None,
                 yz=None,
                 period=1,
                 L=None,
                 phase=-1):
        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:
            globals.msg.warning(
                "update.box_resize: Ignoring request to setup updater without parameters\n"
            )
            return

        box = globals.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 = variant._setup_variant_input(Lx)
        Ly = variant._setup_variant_input(Ly)
        Lz = variant._setup_variant_input(Lz)

        xy = variant._setup_variant_input(xy)
        xz = variant._setup_variant_input(xz)
        yz = 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(
            globals.system_definition, Lx.cpp_variant, Ly.cpp_variant,
            Lz.cpp_variant, xy.cpp_variant, xz.cpp_variant, yz.cpp_variant)
        if period is None:
            self.cpp_updater.update(globals.system.getCurrentTimeStep())
        else:
            self.setupUpdater(period, phase)