Example #1
0
    def __init__(self, r_cut, 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 not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = _custom_pair_potentials.PotentialPairLowe(
                globals.system_definition, neighbor_list.cpp_nlist, self.name)
            self.cpp_class = _custom_pair_potentials.PotentialPairLowe
        else:
            neighbor_list.cpp_nlist.setStorageMode(
                hoomd.NeighborList.storageMode.full)
            self.cpp_force = _custom_pair_potentials.PotentialPairLoweGPU(
                globals.system_definition, neighbor_list.cpp_nlist, self.name)
            self.cpp_class = _custom_pair_potentials.PotentialPairLoweGPU
            self.cpp_force.setBlockSize(
                tune._get_optimal_block_size('pair.dpd_conservative'))
            self.cpp_force.setBlockSize(64)

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

        # setup the coefficent options
        self.required_coeffs = ['A']
Example #2
0
	def __init__(self, r_cut=1.2, name=None):
		util.print_status_line();
		
		self.r_cut = r_cut;
		# 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 not globals.exec_conf.isCUDAEnabled():
			self.cpp_force = _martini_plugin.PotentialPairLJM(globals.system_definition, neighbor_list.cpp_nlist, self.name);
			self.cpp_class = _martini_plugin.PotentialPairLJM;
		else:
			neighbor_list.cpp_nlist.setStorageMode(hoomd.NeighborList.storageMode.full);
			self.cpp_force = _martini_plugin.PotentialPairLJMGPU(globals.system_definition, neighbor_list.cpp_nlist, self.name);
			self.cpp_class = _martini_plugin.PotentialPairLJMGPU;
			self.cpp_force.setBlockSize(tune._get_optimal_block_size('pair.lj'));
	
		globals.system.addCompute(self.cpp_force, self.force_name);

		# setup the coefficent options
		self.required_coeffs = ['epsilon', 'sigma',];
Example #3
0
    def __init__(self, name=None):
        util.print_status_line()

        # check that some bonds are defined
        if globals.system_definition.getBondData().getNumBonds() == 0:
            globals.msg.error("No bonds are defined.\n")
            raise RuntimeError("Error creating bond forces")

        # initialize the base class
        bond._bond.__init__(self, name)

        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = _custom_pair_potentials.PotentialBondFENENOLJ(
                globals.system_definition, self.name)
        else:
            self.cpp_force = _custom_pair_potentials.PotentialBondFENENOLJGPU(
                globals.system_definition, self.name)
            self.cpp_force.setBlockSize(
                tune._get_optimal_block_size('bond.fene'))

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

        # setup the coefficient options
        self.required_coeffs = ['k', 'r0', 'roff']
Example #4
0
    def __init__(self):
        util.print_status_line()
        # check that some angles are defined
        if globals.system_definition.getAngleData().getNumAngles() == 0:
            print >> sys.stderr, "\n***Error! No angles are defined.\n"
            raise RuntimeError("Error creating angle forces")

        # initialize the base class
        force._force.__init__(self)

        # append compute to stress array
        #globals.stress.append(self);

        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = _martini_plugin.CosineAngleForceCompute(
                globals.system_definition)
        else:
            self.cpp_force = _martini_plugin.CosineAngleForceComputeGPU(
                globals.system_definition)
            self.cpp_force.setBlockSize(
                tune._get_optimal_block_size('angle.harmonic'))

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

        # variable for tracking which angle type coefficients have been set
        self.angle_types_set = []
Example #5
0
    def __init__(self, width, name=None):
        util.print_status_line()

        # initialize the base class
        force._force.__init__(self, name)

        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = hoomd.BondTablePotential(globals.system_definition, int(width), self.name)
        else:
            self.cpp_force = hoomd.BondTablePotentialGPU(globals.system_definition, int(width), self.name)
            self.cpp_force.setBlockSize(tune._get_optimal_block_size("bond.table"))

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

        # setup the coefficent matrix
        self.bond_coeff = coeff()

        # stash the width for later use
        self.width = width
Example #6
0
    def __init__(self):
        util.print_status_line();
        # check that some angles are defined
        if globals.system_definition.getAngleData().getNumAngles() == 0:
            globals.msg.error("No angles are defined.\n");
            raise RuntimeError("Error creating angle forces");
        
        # initialize the base class
        force._force.__init__(self);
        
        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = hoomd.HarmonicAngleForceCompute(globals.system_definition);
        else:
            self.cpp_force = hoomd.HarmonicAngleForceComputeGPU(globals.system_definition);
            self.cpp_force.setBlockSize(tune._get_optimal_block_size('angle.harmonic'));

        globals.system.addCompute(self.cpp_force, self.force_name);
        
        # variable for tracking which angle type coefficients have been set
        self.angle_types_set = [];
Example #7
0
    def __init__(self, width, name=None):
        util.print_status_line();

        # initialize the base class
        force._force.__init__(self, name);


        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = hoomd.BondTablePotential(globals.system_definition, int(width), self.name);
        else:
            self.cpp_force = hoomd.BondTablePotentialGPU(globals.system_definition, int(width), self.name);
            self.cpp_force.setBlockSize(tune._get_optimal_block_size('bond.table')); 

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

        # setup the coefficent matrix
        self.bond_coeff = coeff();

        # stash the width for later use
        self.width = width;
Example #8
0
    def __init__(self, width, name=None):
        util.print_status_line();

        # initialize the base class
        force._force.__init__(self, name);


        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = hoomd.TableDihedralForceCompute(globals.system_definition, int(width), self.name);
        else:
            self.cpp_force = hoomd.TableDihedralForceComputeGPU(globals.system_definition, int(width), self.name);
            self.cpp_force.setBlockSize(tune._get_optimal_block_size('dihedral.table'));

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

        # setup the coefficent matrix
        self.dihedral_coeff = coeff();

        # stash the width for later use
        self.width = width;
Example #9
0
    def __init__(self, name=None):
        util.print_status_line()

        # check that some bonds are defined
        if globals.system_definition.getBondData().getN() == 0:
            globals.msg.error("No bonds are defined.\n")
            raise RuntimeError("Error creating bond forces")

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

        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = hoomd.PotentialBondFENE(globals.system_definition, self.name)
        else:
            self.cpp_force = hoomd.PotentialBondFENEGPU(globals.system_definition, self.name)
            self.cpp_force.setBlockSize(tune._get_optimal_block_size("bond.fene"))

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

        # setup the coefficient options
        self.required_coeffs = ["k", "r0", "epsilon", "sigma"]
Example #10
0
    def __init__(self,name=None):
        util.print_status_line();

        # initiailize the base class
        _bond.__init__(self);

        # check that some bonds are defined
        if globals.system_definition.getBondData().getNumBonds() == 0:
            globals.msg.error("No bonds are defined.\n");
            raise RuntimeError("Error creating bond forces");
        
        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = hoomd.PotentialBondHarmonic(globals.system_definition,self.name);
        else:
            self.cpp_force = hoomd.PotentialBondHarmonicGPU(globals.system_definition,self.name);
            self.cpp_force.setBlockSize(tune._get_optimal_block_size('bond.harmonic'));

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

        # setup the coefficient options
        self.required_coeffs = ['k','r0'];
Example #11
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)
Example #12
0
    def __init__(self):
        util.print_status_line();
        # check that some dihedrals are defined
        if globals.system_definition.getDihedralData().getNumDihedrals() == 0:
            globals.msg.error("No dihedrals are defined.\n");
            raise RuntimeError("Error creating dihedral forces");
        
        # initialize the base class
        force._force.__init__(self);
        
        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            #print "CPU Version of dihedral used"
            self.cpp_force = _martini_plugin.HarmonicDihedralMForceCompute(globals.system_definition);
        else:
            #print "GPU Version of dihedral used"
            self.cpp_force = _martini_plugin.HarmonicDihedralMForceComputeGPU(globals.system_definition);
            self.cpp_force.setBlockSize(tune._get_optimal_block_size('dihedral.harmonic'));

        globals.system.addCompute(self.cpp_force, self.force_name);
        
        # variable for tracking which dihedral type coefficients have been set
        self.dihedral_types_set = [];
Example #13
0
    def __init__(self):
        util.print_status_line()
        # check that some impropers are defined
        if globals.system_definition.getImproperData().getNumDihedrals() == 0:
            globals.msg.error("No impropers are defined.\n")
            raise RuntimeError("Error creating improper forces")

        # initialize the base class
        force._force.__init__(self)

        # create the c++ mirror class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = hoomd.HarmonicImproperForceCompute(
                globals.system_definition)
        else:
            self.cpp_force = hoomd.HarmonicImproperForceComputeGPU(
                globals.system_definition)
            self.cpp_force.setBlockSize(
                tune._get_optimal_block_size('improper.harmonic'))

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

        # variable for tracking which improper type coefficients have been set
        self.improper_types_set = []