Beispiel #1
0
 def __init__(self,
              origin=(0.0, 0.0, 0.0),
              normal=(0.0, 0.0, 1.0),
              inside=True):
     self._origin = _hoomd.make_scalar3(*origin)
     self._normal = _hoomd.make_scalar3(*normal)
     self.inside = inside
Beispiel #2
0
 def __init__(self,
              r=0.0,
              origin=(0.0, 0.0, 0.0),
              axis=(0.0, 0.0, 1.0),
              inside=True):
     self.r = r
     self._origin = _hoomd.make_scalar3(*origin)
     self._axis = _hoomd.make_scalar3(*axis)
     self.inside = inside
Beispiel #3
0
    def __init__(self, group, constraint_vector=[0, 0, 1]):

        if (constraint_vector[0]**2 + constraint_vector[1]**2 +
                constraint_vector[2]**2) < 1e-10:
            raise RuntimeError("The one dimension constraint vector is zero")

        constraint_vector = _hoomd.make_scalar3(constraint_vector[0],
                                                constraint_vector[1],
                                                constraint_vector[2])

        hoomd.util.print_status_line()

        # initialize the base class
        _constraint_force.__init__(self)

        # create the c++ mirror class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _md.OneDConstraint(
                hoomd.context.current.system_definition, group.cpp_group,
                constraint_vector)
        else:
            self.cpp_force = _md.OneDConstraintGPU(
                hoomd.context.current.system_definition, group.cpp_group,
                constraint_vector)

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

        # store metadata
        self.group = group
        self.constraint_vector = constraint_vector
        self.metadata_fields = ['group', 'constraint_vector']
Beispiel #4
0
    def process_coeff(self, coeff):
        r_cut = coeff['r_cut'];
        epsilon = coeff['epsilon'];
        sigma = coeff['sigma'];
        alpha = coeff['alpha'];

        lj1 = 4.0 * epsilon * math.pow(sigma, 12.0);
        lj2 = alpha * 4.0 * epsilon * math.pow(sigma, 6.0);
        return _hoomd.make_scalar3(lj1, lj2,r_cut);
Beispiel #5
0
    def process_coeff(self, coeff):
        epsilon = coeff['epsilon']
        sigma = coeff['sigma']
        delta = coeff['delta']
        alpha = coeff['alpha']

        lj1 = 4.0 * epsilon * math.pow(sigma, 12.0)
        lj2 = alpha * 4.0 * epsilon * math.pow(sigma, 6.0)
        return _hoomd.make_scalar3(lj1, lj2, delta)
Beispiel #6
0
    def process_coeff(self, coeff):
        r_cut = coeff['r_cut'];
        epsilon = coeff['epsilon'];
        sigma = coeff['sigma'];
        alpha = coeff['alpha'];

        lj1 = 4.0 * epsilon * math.pow(sigma, 12.0);
        lj2 = alpha * 4.0 * epsilon * math.pow(sigma, 6.0);
        r_cut_squared = r_cut * r_cut
        return _hoomd.make_scalar3(lj1, lj2, r_cut_squared);
Beispiel #7
0
 def process_coeff(self, coeff):
     amplitude = coeff['amp']
     exponent = coeff['m']
     r_start = coeff['r_start']
     r_start_sq = r_start*r_start
     if exponent<2.0:
         hoomd.context.msg.error('azplugins.pair.spline: Exponent for spline needs to be >= 2.\n')
         raise ValueError('Exponent for spline needs to be >= 2')
     if r_start>=self.r_cut:
         hoomd.context.msg.error('azplugins.pair.spline: r_start needs to be smaller than r_cut.\n')
         raise ValueError('r_start needs to be smaller than r_cut')
     return _hoomd.make_scalar3(amplitude, exponent,r_start_sq)
Beispiel #8
0
    def _attach(self):
        # initialize the reflected c++ class
        if isinstance(self._simulation.device, hoomd.device.CPU):
            my_class = _md.ActiveForceCompute
        else:
            my_class = _md.ActiveForceComputeGPU

        self._cpp_obj = my_class(
            self._simulation.state._cpp_sys_def,
            self._simulation.state._get_group(self.filter), self.seed,
            self.rotation_diff, _hoomd.make_scalar3(0, 0, 0), 0, 0, 0)

        # Attach param_dict and typeparam_dict
        super()._attach()
Beispiel #9
0
    def __init__(self, F):

        try:
            if len(F) != 3:
                hoomd.context.current.device.cpp_msg.error('mpcd.force.constant: field must be a 3-component vector.\n')
                raise ValueError('External field must be a 3-component vector')
        except TypeError:
            hoomd.context.current.device.cpp_msg.error('mpcd.force.constant: field must be a 3-component vector.\n')
            raise ValueError('External field must be a 3-component vector')

        # initialize python level
        _force.__init__(self)
        self._F = F

        # initialize c++
        self._cpp.ConstantForce(_hoomd.make_scalar3(self.F[0], self.F[1], self.F[2]))
Beispiel #10
0
    def __init__(self, group, r=None, rx=None, ry=None, rz=None, P=(0, 0, 0)):
        period = 1

        # Error out in MPI simulations
        if (hoomd.version.mpi_enabled):
            if hoomd.context.current.system_definition.getParticleData(
            ).getDomainDecomposition():
                hoomd.context.current.device.cpp_msg.error(
                    "constrain.ellipsoid is not supported in multi-processor "
                    "simulations.\n\n")
                raise RuntimeError("Error initializing updater.")

        # Error out if no radii are set
        if (r is None and rx is None and ry is None and rz is None):
            hoomd.context.current.device.cpp_msg.error(
                "no radii were defined in update.constraint_ellipsoid.\n\n")
            raise RuntimeError("Error initializing updater.")

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

        # Set parameters
        P = _hoomd.make_scalar3(P[0], P[1], P[2])
        if (r is not None):
            rx = ry = rz = r

        # create the c++ mirror class
        if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled():
            self.cpp_updater = _md.ConstraintEllipsoid(
                hoomd.context.current.system_definition, group.cpp_group, P, rx,
                ry, rz)
        else:
            self.cpp_updater = _md.ConstraintEllipsoidGPU(
                hoomd.context.current.system_definition, group.cpp_group, P, rx,
                ry, rz)

        self.setupUpdater(period)

        # store metadata
        self.group = group
        self.P = P
        self.rx = rx
        self.ry = ry
        self.rz = rz
        self.metadata_fields = ['group', 'P', 'rx', 'ry', 'rz']
Beispiel #11
0
    def __init__(self, F):
        hoomd.util.print_status_line()

        try:
            if len(F) != 3:
                hoomd.context.msg.error('mpcd.force.constant: field must be a 3-component vector.\n')
                raise ValueError('External field must be a 3-component vector')
        except TypeError:
            hoomd.context.msg.error('mpcd.force.constant: field must be a 3-component vector.\n')
            raise ValueError('External field must be a 3-component vector')

        # initialize python level
        _force.__init__(self)
        self.metadata_fields += ['F']
        self._F = F

        # initialize c++
        self._cpp.ConstantForce(_hoomd.make_scalar3(self.F[0], self.F[1], self.F[2]))
Beispiel #12
0
    def __init__(self, group, P, r):

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

        # create the c++ mirror class
        P = _hoomd.make_scalar3(P[0], P[1], P[2]);
        if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled():
            self.cpp_force = _md.ConstraintSphere(hoomd.context.current.system_definition, group.cpp_group, P, r);
        else:
            self.cpp_force = _md.ConstraintSphereGPU(hoomd.context.current.system_definition, group.cpp_group, P, r);

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

        # store metadata
        self.group = group
        self.P = P
        self.r = r
        self.metadata_fields = ['group','P', 'r']
Beispiel #13
0
    def __call__(self, r):
        """ Computes the velocity profile

        Args:
            r (list): Position to evaluate profile

        Example::

            >>> u = azplugins.flow.parabolic(U = 2.0, H = 0.5)
            >>> print u([0.0, 0.1, 0.3])
            2.0
            >>> print u((0.5, -0.2, 1.6))
            0.0

        """
        hoomd.util.print_status_line()

        u = self._cpp(_hoomd.make_scalar3(r[0], r[1], r[2]))
        return (u.x, u.y, u.z)
Beispiel #14
0
    def __init__(self, group, P, r):
        hoomd.util.print_status_line();

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

        # create the c++ mirror class
        P = _hoomd.make_scalar3(P[0], P[1], P[2]);
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _md.ConstraintSphere(hoomd.context.current.system_definition, group.cpp_group, P, r);
        else:
            self.cpp_force = _md.ConstraintSphereGPU(hoomd.context.current.system_definition, group.cpp_group, P, r);

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

        # store metadata
        self.group = group
        self.P = P
        self.r = r
        self.metadata_fields = ['group','P', 'r']
Beispiel #15
0
    def __init__(self, group, r=None, rx=None, ry=None, rz=None, P=(0,0,0)):
        hoomd.util.print_status_line();
        period = 1;

        # Error out in MPI simulations
        if (_hoomd.is_MPI_available()):
            if context.current.system_definition.getParticleData().getDomainDecomposition():
                context.msg.error("constrain.ellipsoid is not supported in multi-processor simulations.\n\n")
                raise RuntimeError("Error initializing updater.")

        # Error out if no radii are set
        if (r is None and rx is None and ry is None and rz is None):
            context.msg.error("no radii were defined in update.constraint_ellipsoid.\n\n")
            raise RuntimeError("Error initializing updater.")

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

        # Set parameters
        P = _hoomd.make_scalar3(P[0], P[1], P[2]);
        if (r is not None): rx = ry = rz = r

        # create the c++ mirror class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_updater = _md.ConstraintEllipsoid(hoomd.context.current.system_definition, group.cpp_group, P, rx, ry, rz);
        else:
            self.cpp_updater = _md.ConstraintEllipsoidGPU(hoomd.context.current.system_definition, group.cpp_group, P, rx, ry, rz);

        self.setupUpdater(period);

        # store metadata
        self.group = group
        self.P = P
        self.rx = rx
        self.ry = ry
        self.rz = rz
        self.metadata_fields = ['group','P', 'rx', 'ry', 'rz']
Beispiel #16
0
    def __init__(self, group, constraint_vector=[0,0,1]):

        if (constraint_vector[0]**2 + constraint_vector[1]**2 + constraint_vector[2]**2) < 1e-10:
            raise RuntimeError("The one dimension constraint vector is zero");

        constraint_vector = _hoomd.make_scalar3(constraint_vector[0], constraint_vector[1], constraint_vector[2]);

        hoomd.util.print_status_line();

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

        # create the c++ mirror class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _md.OneDConstraint(hoomd.context.current.system_definition, group.cpp_group, constraint_vector);
        else:
            self.cpp_force = _md.OneDConstraintGPU(hoomd.context.current.system_definition, group.cpp_group, constraint_vector);

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

        # store metadata
        self.group = group
        self.constraint_vector = constraint_vector
        self.metadata_fields = ['group','constraint_vector']
Beispiel #17
0
 def process_field_coeff(self, field):
     return _hoomd.make_scalar3(field[0],field[1],field[2])
Beispiel #18
0
 def process_field_coeff(self, field):
     return _hoomd.make_scalar3(field[0], field[1], field[2])
Beispiel #19
0
 def __init__(self, r=0.0, origin=(0.0, 0.0, 0.0), axis=(0.0, 0.0, 1.0), inside=True):
     self.r = r;
     self._origin = _hoomd.make_scalar3(*origin);
     self._axis = _hoomd.make_scalar3(*axis);
     self.inside = inside;
Beispiel #20
0
    def set_param(self,
                  type_name,
                  types,
                  positions,
                  orientations=None,
                  charges=None,
                  diameters=None):
        R""" Set constituent particle types and coordinates for a rigid body.

        Args:
            type_name (str): The type of the central particle
            types (list): List of types of constituent particles
            positions (list): List of relative positions of constituent particles
            orientations (list): List of orientations of constituent particles (**optional**)
            charge (list): List of charges of constituent particles (**optional**)
            diameters (list): List of diameters of constituent particles (**optional**)

        .. caution::
            The constituent particle type must be exist.
            If it does not exist, it can be created on the fly using
            ``system.particles.types.add('A_const')`` (see :py:mod:`hoomd.data`).

        Example::

            rigid = constrain.rigd()
            rigid.set_param('A', types = ['A_const', 'A_const'], positions = [(0,0,1),(0,0,-1)])
            rigid.set_param('B', types = ['B_const', 'B_const'], positions = [(0,0,.5),(0,0,-.5)])

        """
        # get a list of types from the particle data
        ntypes = hoomd.context.current.system_definition.getParticleData(
        ).getNTypes()
        type_list = []
        for i in range(0, ntypes):
            type_list.append(hoomd.context.current.system_definition.
                             getParticleData().getNameByType(i))

        if type_name not in type_list:
            hoomd.context.msg.error('Type '
                                    '{}'
                                    ' not found.\n'.format(type_name))
            raise RuntimeError(
                'Error setting up parameters for constrain.rigid()')

        type_id = type_list.index(type_name)

        if not isinstance(types, list):
            hoomd.context.msg.error('Expecting list of particle types.\n')
            raise RuntimeError(
                'Error setting up parameters for constrain.rigid()')

        type_vec = _hoomd.std_vector_uint()
        for t in types:
            if t not in type_list:
                hoomd.context.msg.error('Type ' '{}' ' not found.\n'.format(t))
                raise RuntimeError(
                    'Error setting up parameters for constrain.rigid()')
            constituent_type_id = type_list.index(t)

            type_vec.append(constituent_type_id)

        pos_vec = _hoomd.std_vector_scalar3()
        positions_list = list(positions)
        for p in positions_list:
            p = tuple(p)
            if len(p) != 3:
                hoomd.context.msg.error(
                    'Particle position is not a coordinate triple.\n')
                raise RuntimeError(
                    'Error setting up parameters for constrain.rigid()')
            pos_vec.append(_hoomd.make_scalar3(p[0], p[1], p[2]))

        orientation_vec = _hoomd.std_vector_scalar4()
        if orientations is not None:
            orientations_list = list(orientations)
            for o in orientations_list:
                o = tuple(o)
                if len(o) != 4:
                    hoomd.context.msg.error(
                        'Particle orientation is not a 4-tuple.\n')
                    raise RuntimeError(
                        'Error setting up parameters for constrain.rigid()')
                orientation_vec.append(
                    _hoomd.make_scalar4(o[0], o[1], o[2], o[3]))
        else:
            for p in positions:
                orientation_vec.append(_hoomd.make_scalar4(1, 0, 0, 0))

        charge_vec = _hoomd.std_vector_scalar()
        if charges is not None:
            charges_list = list(charges)
            for c in charges_list:
                charge_vec.append(float(c))
        else:
            for p in positions:
                charge_vec.append(0.0)

        diameter_vec = _hoomd.std_vector_scalar()
        if diameters is not None:
            diameters_list = list(diameters)
            for d in diameters_list:
                diameter_vec.append(float(d))
        else:
            for p in positions:
                diameter_vec.append(1.0)

        # set parameters in C++ force
        self.cpp_force.setParam(type_id, type_vec, pos_vec, orientation_vec,
                                charge_vec, diameter_vec)
Beispiel #21
0
 def normal(self, normal):
     self._normal = _hoomd.make_scalar3(*normal)
Beispiel #22
0
 def origin(self, origin):
     self._origin = _hoomd.make_scalar3(*origin);
Beispiel #23
0
    def set_param(self,type_name, types, positions, orientations=None, charges=None, diameters=None):
        R""" Set constituent particle types and coordinates for a rigid body.

        Args:
            type_name (str): The type of the central particle
            types (list): List of types of constituent particles
            positions (list): List of relative positions of constituent particles
            orientations (list): List of orientations of constituent particles (**optional**)
            charge (list): List of charges of constituent particles (**optional**)
            diameters (list): List of diameters of constituent particles (**optional**)

        .. caution::
            The constituent particle type must be exist.
            If it does not exist, it can be created on the fly using
            ``system.particles.types.add('A_const')`` (see :py:mod:`hoomd.data`).

        Example::

            rigid = constrain.rigd()
            rigid.set_param('A', types = ['A_const', 'A_const'], positions = [(0,0,1),(0,0,-1)])
            rigid.set_param('B', types = ['B_const', 'B_const'], positions = [(0,0,.5),(0,0,-.5)])

        """
        # get a list of types from the particle data
        ntypes = hoomd.context.current.system_definition.getParticleData().getNTypes();
        type_list = [];
        for i in range(0,ntypes):
            type_list.append(hoomd.context.current.system_definition.getParticleData().getNameByType(i));

        if type_name not in type_list:
            hoomd.context.msg.error('Type ''{}'' not found.\n'.format(type_name))
            raise RuntimeError('Error setting up parameters for constrain.rigid()')

        type_id = type_list.index(type_name)

        if not isinstance(types, list):
            hoomd.context.msg.error('Expecting list of particle types.\n')
            raise RuntimeError('Error setting up parameters for constrain.rigid()')

        type_vec = _hoomd.std_vector_uint()
        for t in types:
            if t not in type_list:
                hoomd.context.msg.error('Type ''{}'' not found.\n'.format(t))
                raise RuntimeError('Error setting up parameters for constrain.rigid()')
            constituent_type_id = type_list.index(t)

            type_vec.append(constituent_type_id)

        pos_vec = _hoomd.std_vector_scalar3()
        positions_list = list(positions)
        for p in positions_list:
            p = tuple(p)
            if len(p) != 3:
                hoomd.context.msg.error('Particle position is not a coordinate triple.\n')
                raise RuntimeError('Error setting up parameters for constrain.rigid()')
            pos_vec.append(_hoomd.make_scalar3(p[0],p[1],p[2]))

        orientation_vec = _hoomd.std_vector_scalar4()
        if orientations is not None:
            orientations_list = list(orientations)
            for o in orientations_list:
                o = tuple(o)
                if len(o) != 4:
                    hoomd.context.msg.error('Particle orientation is not a 4-tuple.\n')
                    raise RuntimeError('Error setting up parameters for constrain.rigid()')
                orientation_vec.append(_hoomd.make_scalar4(o[0], o[1], o[2], o[3]))
        else:
            for p in positions:
                orientation_vec.append(_hoomd.make_scalar4(1,0,0,0))

        charge_vec = _hoomd.std_vector_scalar()
        if charges is not None:
            charges_list = list(charges)
            for c in charges_list:
                charge_vec.append(float(c))
        else:
            for p in positions:
                charge_vec.append(0.0)

        diameter_vec = _hoomd.std_vector_scalar()
        if diameters is not None:
            diameters_list = list(diameters)
            for d in diameters_list:
                diameter_vec.append(float(d))
        else:
            for p in positions:
                diameter_vec.append(1.0)

        # set parameters in C++ force
        self.cpp_force.setParam(type_id, type_vec, pos_vec, orientation_vec, charge_vec, diameter_vec)
Beispiel #24
0
 def __init__(self, origin=(0.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0), inside=True):
     self._origin = _hoomd.make_scalar3(*origin);
     self._normal = _hoomd.make_scalar3(*normal);
     self.inside = inside;
Beispiel #25
0
 def process_coeff(self, coeff):
     a = coeff['A']
     gamma = coeff['gamma']
     s = coeff['s']
     return _hoomd.make_scalar3(a, gamma, s)
Beispiel #26
0
    def _attach(self):
        self._cpp_obj = _md.ManifoldSphere(self.r, _hoomd.make_scalar3( self.P[0], self.P[1], self.P[2]) );

        super()._attach()
Beispiel #27
0
 def axis(self, axis):
     self._axis = _hoomd.make_scalar3(*axis);
Beispiel #28
0
    def __init__(self,
                 seed,
                 group,
                 f_lst=None,
                 t_lst=None,
                 orientation_link=True,
                 orientation_reverse_link=False,
                 rotation_diff=0,
                 constraint=None):
        hoomd.util.print_status_line()

        # initialize the base class
        _force.__init__(self)

        if (f_lst is None) and (t_lst is None):
            raise RuntimeError('No forces or torques are being set')

        # input check
        if (f_lst is not None):
            for element in f_lst:
                if type(element) != tuple or len(element) != 3:
                    raise RuntimeError(
                        "Active force passed in should be a list of 3-tuples (fx, fy, fz)"
                    )
        else:
            f_lst = []
            for element in t_lst:
                f_lst.append((0, 0, 0))

        if (t_lst is not None):
            for element in t_lst:
                if type(element) != tuple or len(element) != 3:
                    raise RuntimeError(
                        "Active torque passed in should be a list of 3-tuples (tx, ty, tz)"
                    )
        else:
            t_lst = []
            for element in f_lst:
                t_lst.append((0, 0, 0))

        # assign constraints
        if (constraint is not None):
            if (constraint.__class__.__name__ == "constraint_ellipsoid"):
                P = constraint.P
                rx = constraint.rx
                ry = constraint.ry
                rz = constraint.rz
            else:
                raise RuntimeError(
                    "Active force constraint is not accepted (currently only accepts ellipsoids)"
                )
        else:
            P = _hoomd.make_scalar3(0, 0, 0)
            rx = 0
            ry = 0
            rz = 0

        # create the c++ mirror class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _md.ActiveForceCompute(
                hoomd.context.current.system_definition, group.cpp_group, seed,
                f_lst, t_lst, orientation_link, orientation_reverse_link,
                rotation_diff, P, rx, ry, rz)

        else:
            self.cpp_force = _md.ActiveForceComputeGPU(
                hoomd.context.current.system_definition, group.cpp_group, seed,
                f_lst, t_lst, orientation_link, orientation_reverse_link,
                rotation_diff, P, rx, ry, rz)

        # store metadata
        self.metadata_fields = [
            'group', 'seed', 'orientation_link', 'rotation_diff', 'constraint'
        ]
        self.group = group
        self.seed = seed
        self.orientation_link = orientation_link
        self.orientation_reverse_link = orientation_reverse_link
        self.rotation_diff = rotation_diff
        self.constraint = constraint

        hoomd.context.current.system.addCompute(self.cpp_force,
                                                self.force_name)
Beispiel #29
0
 def axis(self, axis):
     self._axis = _hoomd.make_scalar3(*axis)
Beispiel #30
0
 def normal(self, normal):
     self._normal = _hoomd.make_scalar3(*normal);
Beispiel #31
0
 def origin(self, origin):
     self._origin = _hoomd.make_scalar3(*origin)
Beispiel #32
0
    def _attach(self):
        self._cpp_obj = _md.ManifoldEllipsoid(
            self.a, self.b, self.c,
            _hoomd.make_scalar3(self.P[0], self.P[1], self.P[2]))

        super()._attach()
Beispiel #33
0
    def __init__(self, seed, group, f_lst=None, t_lst=None, orientation_link=True, orientation_reverse_link=False, rotation_diff=0, constraint=None):
        hoomd.util.print_status_line();

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

        if (f_lst is None) and (t_lst is None):
            raise RuntimeError('No forces or torques are being set')

        # input check
        if (f_lst is not None):
            for element in f_lst:
                if type(element) != tuple or len(element) != 3:
                    raise RuntimeError("Active force passed in should be a list of 3-tuples (fx, fy, fz)")
        else:
            f_lst = []
            for element in t_lst:
                f_lst.append((0,0,0))

        if (t_lst is not None):
            for element in t_lst:
                if type(element) != tuple or len(element) != 3:
                    raise RuntimeError("Active torque passed in should be a list of 3-tuples (tx, ty, tz)")
        else:
            t_lst = []
            for element in f_lst:
                t_lst.append((0,0,0))

        # assign constraints
        if (constraint is not None):
            if (constraint.__class__.__name__ is "constraint_ellipsoid"):
                P = constraint.P
                rx = constraint.rx
                ry = constraint.ry
                rz = constraint.rz
            else:
                raise RuntimeError("Active force constraint is not accepted (currently only accepts ellipsoids)")
        else:
            P = _hoomd.make_scalar3(0, 0, 0)
            rx = 0
            ry = 0
            rz = 0

        # create the c++ mirror class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _md.ActiveForceCompute(hoomd.context.current.system_definition, group.cpp_group, seed, f_lst, t_lst,
                                                      orientation_link, orientation_reverse_link, rotation_diff, P, rx, ry, rz);

        else:
            self.cpp_force = _md.ActiveForceComputeGPU(hoomd.context.current.system_definition, group.cpp_group, seed, f_lst, t_lst,
                                                         orientation_link, orientation_reverse_link, rotation_diff, P, rx, ry, rz);


        # store metadata
        self.metdata_fields = ['group', 'seed', 'orientation_link', 'rotation_diff', 'constraint']
        self.group = group
        self.seed = seed
        self.orientation_link = orientation_link
        self.orientation_reverse_link = orientation_reverse_link
        self.rotation_diff = rotation_diff
        self.constraint = constraint

        hoomd.context.current.system.addCompute(self.cpp_force, self.force_name);
Beispiel #34
0
    def _attach(self):
        self._cpp_obj = _md.ManifoldZCylinder(
            self.r, _hoomd.make_scalar3(self.P[0], self.P[1], self.P[2]))

        super()._attach()
Beispiel #35
0
 def __init__(self, r=0.0, origin=(0.0, 0.0, 0.0), inside=True):
     self.r = r;
     self._origin = _hoomd.make_scalar3(*origin);
     self.inside = inside;
Beispiel #36
0
    def process_coeff(self, coeff):
        v0 = coeff['v0']
        eps = coeff['eps']
        scaledr_cut = coeff['scaledr_cut']

        return _hoomd.make_scalar3(v0, eps, scaledr_cut)