def __init__(self, order_parameters, lattice_vectors, phases, interface_width, name):
        # initialize the base class
        force._force.__init__(self, name);

        self.cpp_force = None;

        cpp_order_parameters = hoomd.std_vector_scalar()
        for l in order_parameters:
            cpp_order_parameters.append(l)

        cpp_lattice_vectors = _external.std_vector_int3()
        for l in lattice_vectors:
            if len(l) != 3:
                globals.msg.error("List of input lattice vectors not a list of triples.\n")
                raise RuntimeError('Error creating external ordering potential.')
            cpp_lattice_vectors.append(hoomd.make_int3(l[0], l[1], l[2]))

        cpp_phases = hoomd.std_vector_scalar()
        for l in phases:
            cpp_phases.append(l)

        cpp_interface_width = float(interface_width)

        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = _external.OrderingExternal(globals.system_definition, cpp_order_parameters, cpp_lattice_vectors, cpp_phases, cpp_interface_width, self.name)
        else:
            self.cpp_force = _external.OrderingExternalGPU(globals.system_definition, cpp_order_parameters, cpp_lattice_vectors, cpp_phases, cpp_interface_width, self.name)

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

        self.enabled = True;
Exemplo n.º 2
0
    def __init__(self, mode, lattice_vectors, name=None, sigma=1.0):
        hoomd.util.print_status_line()

        if name is not None:
            name = "_" + name
            suffix = name
        else:
            suffix = ""

        _collective_variable.__init__(self, sigma, name)

        if len(lattice_vectors) == 0:
            hoomd.context.msg.error(
                "cv.lamellar: List of supplied latice vectors is empty.\n")
            raise RuntimeEror('Error creating collective variable.')

        if type(mode) != type(dict()):
            hoomd.context.msg.error(
                "cv.lamellar: Mode amplitudes specified incorrectly.\n")
            raise RuntimeEror('Error creating collective variable.')

        cpp_mode = _hoomd.std_vector_scalar()
        for i in range(
                0,
                hoomd.context.current.system_definition.getParticleData().
                getNTypes()):
            t = hoomd.context.current.system_definition.getParticleData(
            ).getNameByType(i)

            if t not in mode.keys():
                hoomd.context.msg.error(
                    "cv.lamellar: Missing mode amplitude for particle type " +
                    t + ".\n")
                raise RuntimeEror('Error creating collective variable.')
            cpp_mode.append(mode[t])

        cpp_lattice_vectors = _metadynamics.std_vector_int3()
        for l in lattice_vectors:
            if len(l) != 3:
                hoomd.context.msg.error(
                    "cv.lamellar: List of input lattice vectors not a list of triples.\n"
                )
                raise RuntimeError('Error creating collective variable.')
            cpp_lattice_vectors.append(hoomd.make_int3(l[0], l[1], l[2]))

        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _metadynamics.LamellarOrderParameter(
                hoomd.context.current.system_definition, cpp_mode,
                cpp_lattice_vectors, suffix)
        else:
            self.cpp_force = _metadynamics.LamellarOrderParameterGPU(
                hoomd.context.current.system_definition, cpp_mode,
                cpp_lattice_vectors, suffix)

        hoomd.context.current.system.addCompute(self.cpp_force,
                                                self.force_name)
    def __init__(self, filename, mode, lattice_vectors, phases, grid, period=1, endtime=1, overwrite=False):
        util.print_status_line();
    
        # initialize base class
        _analyzer.__init__(self);
       
        if len(lattice_vectors) == 0:
                globals.msg.error("analyze.sq: List of supplied latice vectors is empty.\n")
                raise RuntimeEror('Error creating collective variable.')

        if len(lattice_vectors) != len(phases):
                globals.msg.error("analyze.sq: #phases is not equal to #lattice_vectors.\n")
                raise RuntimeEror('Error creating collective variable.')

        if type(mode) != type(dict()):
                globals.msg.error("analyze.sq: Mode amplitudes specified incorrectly.\n")
                raise RuntimeEror('Error creating collective variable.')

        cpp_mode = hoomd.std_vector_scalar()
        for i in range(0, globals.system_definition.getParticleData().getNTypes()):
            t = globals.system_definition.getParticleData().getNameByType(i)

            if t not in mode.keys():
                globals.msg.error("cv.lamellar: Missing mode amplitude for particle type " + t + ".\n")
                raise RuntimeEror('Error creating collective variable.')
            cpp_mode.append(mode[t])

        cpp_lattice_vectors = _CollectiveVariable_plugin.std_vector_int3()
        for l in lattice_vectors:
            if len(l) != 3:
                globals.msg.error("cv.lamellar: List of input lattice vectors not a list of triples.\n")
                raise RuntimeError('Error creating collective variable.')
            cpp_lattice_vectors.append(hoomd.make_int3(l[0], l[1], l[2]))

        cpp_phases = _CollectiveVariable_plugin.std_vector_scalar()
        for l in phases:
            cpp_phases.append(l)

        cpp_grid = _CollectiveVariable_plugin.std_vector_uint()
        for l in grid:
            cpp_grid.append(l)

        # initialize the reflected c++ class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_analyzer = _CollectiveVariable_plugin.CollectiveVariable(globals.system_definition, cpp_mode, cpp_lattice_vectors, cpp_phases, cpp_grid, endtime, filename, overwrite);
        else:
            self.cpp_analyzer = _CollectiveVariable_plugin.CollectiveVariableGPU(globals.system_definition, cpp_mode, cpp_lattice_vectors, cpp_phases, cpp_grid, endtime,filename, overwrite);

        self.setupAnalyzer(period)
Exemplo n.º 4
0
    def __init__(self, mode, nx, ny=None, nz=None, name=None, sigma=1.0, zero_modes=None):
        hoomd.util.print_status_line()

        if name is not None:
            name = "_" + name
            suffix = name
        else:
            suffix = ""

        if ny is None:
            ny = nx

        if nz is None:
            nz = nx

        _collective_variable.__init__(self, sigma, name)

        if type(mode) != type(dict()):
            hoomd.context.msg.error("cv.mesh: Mode amplitudes specified incorrectly.\n")
            raise RuntimeEror('Error creating collective variable.')

        cpp_mode = _hoomd.std_vector_scalar()
        for i in range(0, hoomd.context.current.system_definition.getParticleData().getNTypes()):
            t = hoomd.context.current.system_definition.getParticleData().getNameByType(i)

            if t not in mode.keys():
                hoomd.context.msg.error("cv.mesh: Missing mode amplitude for particle type " + t + ".\n")
                raise RuntimeEror('Error creating collective variable.')
            cpp_mode.append(mode[t])

        cpp_zero_modes = _metadynamics.std_vector_int3()
        if zero_modes is not None:
            for l in zero_modes:
                if len(l) != 3:
                    hoomd.context.msg.error("cv.lamellar: List of modes to zero not a list of triples.\n")
                    raise RuntimeError('Error creating collective variable.')
                cpp_zero_modes.append(hoomd.make_int3(l[0], l[1], l[2]))

        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _metadynamics.OrderParameterMesh(
                hoomd.context.current.system_definition, nx, ny, nz, cpp_mode, cpp_zero_modes)
        else:
            self.cpp_force = _metadynamics.OrderParameterMeshGPU(
                hoomd.context.current.system_definition, nx, ny, nz, cpp_mode, cpp_zero_modes)

        hoomd.context.current.system.addCompute(self.cpp_force, self.force_name)
Exemplo n.º 5
0
    def __init__(self, mode, lattice_vectors, name=None, sigma=1.0):
        hoomd.util.print_status_line()

        if name is not None:
            name = "_" + name
            suffix = name
        else:
            suffix = ""

        _collective_variable.__init__(self, sigma, name)

        if len(lattice_vectors) == 0:
            hoomd.context.msg.error("cv.lamellar: List of supplied latice vectors is empty.\n")
            raise RuntimeEror('Error creating collective variable.')

        if type(mode) != type(dict()):
            hoomd.context.msg.error("cv.lamellar: Mode amplitudes specified incorrectly.\n")
            raise RuntimeEror('Error creating collective variable.')

        cpp_mode = _hoomd.std_vector_scalar()
        for i in range(0, hoomd.context.current.system_definition.getParticleData().getNTypes()):
            t = hoomd.context.current.system_definition.getParticleData().getNameByType(i)

            if t not in mode.keys():
                hoomd.context.msg.error("cv.lamellar: Missing mode amplitude for particle type " + t + ".\n")
                raise RuntimeEror('Error creating collective variable.')
            cpp_mode.append(mode[t])

        cpp_lattice_vectors = _metadynamics.std_vector_int3()
        for l in lattice_vectors:
            if len(l) != 3:
                hoomd.context.msg.error("cv.lamellar: List of input lattice vectors not a list of triples.\n")
                raise RuntimeError('Error creating collective variable.')
            cpp_lattice_vectors.append(hoomd.make_int3(l[0], l[1], l[2]))

        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _metadynamics.LamellarOrderParameter(
                hoomd.context.current.system_definition, cpp_mode, cpp_lattice_vectors, suffix)
        else:
            self.cpp_force = _metadynamics.LamellarOrderParameterGPU(
                hoomd.context.current.system_definition, cpp_mode, cpp_lattice_vectors, suffix)

        hoomd.context.current.system.addCompute(self.cpp_force, self.force_name)
    def __init__(self, order_parameters, lattice_vectors, phases,
                 interface_width, name):
        # initialize the base class
        force._force.__init__(self, name)

        self.cpp_force = None

        cpp_order_parameters = hoomd.std_vector_scalar()
        for l in order_parameters:
            cpp_order_parameters.append(l)

        cpp_lattice_vectors = _external.std_vector_int3()
        for l in lattice_vectors:
            if len(l) != 3:
                globals.msg.error(
                    "List of input lattice vectors not a list of triples.\n")
                raise RuntimeError(
                    'Error creating external ordering potential.')
            cpp_lattice_vectors.append(hoomd.make_int3(l[0], l[1], l[2]))

        cpp_phases = hoomd.std_vector_scalar()
        for l in phases:
            cpp_phases.append(l)

        cpp_interface_width = float(interface_width)

        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_force = _external.OrderingExternal(
                globals.system_definition, cpp_order_parameters,
                cpp_lattice_vectors, cpp_phases, cpp_interface_width,
                self.name)
        else:
            self.cpp_force = _external.OrderingExternalGPU(
                globals.system_definition, cpp_order_parameters,
                cpp_lattice_vectors, cpp_phases, cpp_interface_width,
                self.name)

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

        self.enabled = True
Exemplo n.º 7
0
    def __init__(self, filename_sq, filename_vh, mode, lattice_vectors, period=1, vanhove_endtime=1, overwrite=False):
        util.print_status_line();
    
        # initialize base class
        _analyzer.__init__(self);
       
        if len(lattice_vectors) == 0:
                globals.msg.error("analyze.sq: List of supplied latice vectors is empty.\n")
                raise RuntimeEror('Error creating collective variable.')

        if type(mode) != type(dict()):
                globals.msg.error("analyze.sq: Mode amplitudes specified incorrectly.\n")
                raise RuntimeEror('Error creating collective variable.')

        cpp_mode = hoomd.std_vector_scalar()
        for i in range(0, globals.system_definition.getParticleData().getNTypes()):
            t = globals.system_definition.getParticleData().getNameByType(i)

            if t not in mode.keys():
                globals.msg.error("cv.lamellar: Missing mode amplitude for particle type " + t + ".\n")
                raise RuntimeEror('Error creating collective variable.')
            cpp_mode.append(mode[t])

        cpp_lattice_vectors = _sq_plugin.std_vector_int3()
        for l in lattice_vectors:
            if len(l) != 3:
                globals.msg.error("cv.lamellar: List of input lattice vectors not a list of triples.\n")
                raise RuntimeError('Error creating collective variable.')
            cpp_lattice_vectors.append(hoomd.make_int3(l[0], l[1], l[2]))

        # initialize the reflected c++ class
        if not globals.exec_conf.isCUDAEnabled():
            self.cpp_analyzer = _sq_plugin.StructureFactor(globals.system_definition, cpp_mode, cpp_lattice_vectors, vanhove_endtime, filename_sq, filename_vh, overwrite);
        else:
            self.cpp_analyzer = _sq_plugin.StructureFactorGPU(globals.system_definition, cpp_mode, cpp_lattice_vectors, vanhove_endtime, filename_sq, filename_vh, overwrite);

        self.setupAnalyzer(period)
Exemplo n.º 8
0
    def __init__(self,
                 mode,
                 nx,
                 ny=None,
                 nz=None,
                 name=None,
                 sigma=1.0,
                 zero_modes=None):
        hoomd.util.print_status_line()

        if name is not None:
            name = "_" + name
            suffix = name
        else:
            suffix = ""

        if ny is None:
            ny = nx

        if nz is None:
            nz = nx

        _collective_variable.__init__(self, sigma, name)

        if type(mode) != type(dict()):
            hoomd.context.msg.error(
                "cv.mesh: Mode amplitudes specified incorrectly.\n")
            raise RuntimeEror('Error creating collective variable.')

        cpp_mode = _hoomd.std_vector_scalar()
        for i in range(
                0,
                hoomd.context.current.system_definition.getParticleData().
                getNTypes()):
            t = hoomd.context.current.system_definition.getParticleData(
            ).getNameByType(i)

            if t not in mode.keys():
                hoomd.context.msg.error(
                    "cv.mesh: Missing mode amplitude for particle type " + t +
                    ".\n")
                raise RuntimeEror('Error creating collective variable.')
            cpp_mode.append(mode[t])

        cpp_zero_modes = _metadynamics.std_vector_int3()
        if zero_modes is not None:
            for l in zero_modes:
                if len(l) != 3:
                    hoomd.context.msg.error(
                        "cv.lamellar: List of modes to zero not a list of triples.\n"
                    )
                    raise RuntimeError('Error creating collective variable.')
                cpp_zero_modes.append(hoomd.make_int3(l[0], l[1], l[2]))

        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_force = _metadynamics.OrderParameterMesh(
                hoomd.context.current.system_definition, nx, ny, nz, cpp_mode,
                cpp_zero_modes)
        else:
            self.cpp_force = _metadynamics.OrderParameterMeshGPU(
                hoomd.context.current.system_definition, nx, ny, nz, cpp_mode,
                cpp_zero_modes)

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