Example #1
0
    def __init__(self, name=None):
        hoomd.util.print_status_line()

        # check that some bonds are defined
        if hoomd.context.current.system_definition.getBondData().getNGlobal(
        ) == 0:
            hoomd.context.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 hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _md.PotentialBondFENE(
                hoomd.context.current.system_definition, self.name)
        else:
            self.cpp_force = _md.PotentialBondFENEGPU(
                hoomd.context.current.system_definition, self.name)

        hoomd.context.current.system.addCompute(self.cpp_force,
                                                self.force_name)

        # setup the coefficient options
        self.required_coeffs = ['k', 'r0', 'epsilon', 'sigma']
Example #2
0
    def __init__(self, name=None):

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

        # create the c++ mirror class
        if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled():
            self.cpp_force = _md.PotentialBondFENE(
                hoomd.context.current.system_definition, self.name)
        else:
            self.cpp_force = _md.PotentialBondFENEGPU(
                hoomd.context.current.system_definition, self.name)

        hoomd.context.current.system.addCompute(self.cpp_force,
                                                self.force_name)

        # setup the coefficient options
        self.required_coeffs = ['k', 'r0', 'epsilon', 'sigma']