def __init__(self, group,flow_target,slab_direction,flow_direction,n_slabs,max_slab=-1,min_slab=-1): hoomd.util.print_status_line(); period=1 # This updater has to be applied every timestep assert (n_slabs > 0 ),"Invalid negative number of slabs." if min_slab < 0: min_slab = 0 if max_slab < 0: max_slab = n_slabs/2 assert (max_slab>-1 and max_slab < n_slabs),"Invalid max_slab in [0,"+str(n_slabs)+")." assert (min_slab>-1 and min_slab < n_slabs),"Invalid min_slab in [0,"+str(n_slabs)+")." assert (min_slab != max_slab),"Invalid min/max slabs. Both have the same value." # initialize the base class _updater.__init__(self); self._flow_target = hoomd.variant._setup_variant_input(flow_target); # create the c++ mirror class if not hoomd.context.exec_conf.isCUDAEnabled(): self.cpp_updater = _md.MuellerPlatheFlow(hoomd.context.current.system_definition, group.cpp_group,flow_target.cpp_variant,slab_direction,flow_direction,n_slabs,min_slab,max_slab); else: self.cpp_updater = _md.MuellerPlatheFlowGPU(hoomd.context.current.system_definition, group.cpp_group,flow_target.cpp_variant,slab_direction,flow_direction,n_slabs,min_slab,max_slab); self.setupUpdater(period);
def __init__(self, group,flow_target,slab_direction,flow_direction,n_slabs,max_slab=-1,min_slab=-1): period=1 # This updater has to be applied every timestep assert (n_slabs > 0 ),"Invalid negative number of slabs." if min_slab < 0: min_slab = 0 if max_slab < 0: max_slab = n_slabs/2 #Cast input to int to avoid mismatch of types in calling the constructor n_slabs = int(n_slabs) min_slab = int(min_slab) max_slab = int(max_slab) assert (max_slab>-1 and max_slab < n_slabs),"Invalid max_slab in [0,"+str(n_slabs)+")." assert (min_slab>-1 and min_slab < n_slabs),"Invalid min_slab in [0,"+str(n_slabs)+")." assert (min_slab != max_slab),"Invalid min/max slabs. Both have the same value." # initialize the base class _updater.__init__(self); self._flow_target = hoomd.variant._setup_variant_input(flow_target); # create the c++ mirror class if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled(): self.cpp_updater = _md.MuellerPlatheFlow(hoomd.context.current.system_definition, group.cpp_group,flow_target.cpp_variant,slab_direction,flow_direction,n_slabs,min_slab,max_slab); else: self.cpp_updater = _md.MuellerPlatheFlowGPU(hoomd.context.current.system_definition, group.cpp_group,flow_target.cpp_variant,slab_direction,flow_direction,n_slabs,min_slab,max_slab); self.setupUpdater(period);
def __init__(self, mc, walls, py_updater, move_probability, seed, period=1): # initialize base class _updater.__init__(self) cls = None if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterExternalFieldWallSphere elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterExternalFieldWallConvexPolyhedron elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterExternalFieldWallSpheropolyhedron else: hoomd.context.current.device.cpp_msg.error( "update.wall: Unsupported integrator.\n") raise RuntimeError("Error initializing update.wall") self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, walls.cpp_compute, py_updater, move_probability, seed) self.setupUpdater(period)
def __init__(self): period = 1; # initialize base class _updater.__init__(self); # create the c++ mirror class if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled(): self.cpp_updater = _md.Enforce2DUpdater(hoomd.context.current.system_definition); else: self.cpp_updater = _md.Enforce2DUpdaterGPU(hoomd.context.current.system_definition); self.setupUpdater(period);
def __init__(self, period=1, phase=0): # initialize base class _updater.__init__(self); # create the c++ mirror class self.cpp_updater = _md.ZeroMomentumUpdater(hoomd.context.current.system_definition); self.setupUpdater(period, phase); # store metadata self.period = period self.metadata_fields = ['period']
def __init__(self): hoomd.util.print_status_line(); period = 1; # initialize base class _updater.__init__(self); # create the c++ mirror class if not hoomd.context.exec_conf.isCUDAEnabled(): self.cpp_updater = _md.Enforce2DUpdater(hoomd.context.current.system_definition); else: self.cpp_updater = _md.Enforce2DUpdaterGPU(hoomd.context.current.system_definition); self.setupUpdater(period);
def __init__(self, period=1, phase=0): hoomd.util.print_status_line(); # initialize base class _updater.__init__(self); # create the c++ mirror class self.cpp_updater = _md.ZeroMomentumUpdater(hoomd.context.current.system_definition); self.setupUpdater(period, phase); # store metadata self.period = period self.metadata_fields = ['period']
def __init__(self, mc, betaP, seed): hoomd.util.print_status_line(); # initialize base class _updater.__init__(self); # Updater gets called at every timestep. Whether to perform a move is determined independently # according to frequency parameter. period = 1 if not isinstance(mc, integrate.mode_hpmc): hoomd.context.msg.warning("update.boxmc: Must have a handle to an HPMC integrator.\n"); return; self.betaP = hoomd.variant._setup_variant_input(betaP); self.seed = int(seed) # create the c++ mirror class self.cpp_updater = _hpmc.UpdaterBoxMC(hoomd.context.current.system_definition, mc.cpp_integrator, self.betaP.cpp_variant, 1, self.seed, ); self.setupUpdater(period); self.volume_delta = 0.0; self.volume_weight = 0.0; self.ln_volume_delta = 0.0; self.ln_volume_weight = 0.0; self.length_delta = [0.0, 0.0, 0.0]; self.length_weight = 0.0; self.shear_delta = [0.0, 0.0, 0.0]; self.shear_weight = 0.0; self.shear_reduce = 0.0; self.aspect_delta = 0.0; self.aspect_weight = 0.0; self.metadata_fields = ['betaP', 'seed', 'volume_delta', 'volume_weight', 'ln_volume_delta', 'ln_volume_weight', 'length_delta', 'length_weight', 'shear_delta', 'shear_weight', 'shear_reduce', 'aspect_delta', 'aspect_weight']
def __init__(self): hoomd.util.print_status_line() period = 1 # initialize base class _updater.__init__(self) # create the c++ mirror class if not hoomd.context.exec_conf.isCUDAEnabled(): self.cpp_updater = _md.Enforce2DUpdater( hoomd.context.current.system_definition) else: self.cpp_updater = _md.Enforce2DUpdaterGPU( hoomd.context.current.system_definition) self.setupUpdater(period)
def __init__(self, mc, walls, py_updater, move_ratio, seed, period=1): hoomd.util.print_status_line(); # initialize base class _updater.__init__(self); cls = None; if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterExternalFieldWallSphere; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterExternalFieldWallConvexPolyhedron; else: hoomd.context.msg.error("update.wall: Unsupported integrator.\n"); raise RuntimeError("Error initializing update.wall"); self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, walls.cpp_compute, py_updater, move_ratio, seed); self.setupUpdater(period);
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']
def __init__(self, mc, walls, py_updater, move_ratio, seed, period=1): hoomd.util.print_status_line(); # initialize base class _updater.__init__(self); cls = None; if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterExternalFieldWallSphere; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterExternalFieldWallConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterExternalFieldWallSpheropolyhedron; else: hoomd.context.msg.error("update.wall: Unsupported integrator.\n"); raise RuntimeError("Error initializing update.wall"); self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, walls.cpp_compute, py_updater, move_ratio, seed); self.setupUpdater(period);
def __init__(self, kT, period=1, phase=0): # initialize base class _updater.__init__(self); # setup the variant inputs kT = hoomd.variant._setup_variant_input(kT); # create the compute thermo thermo = hoomd.compute._get_unique_thermo(group=hoomd.context.current.group_all); # create the c++ mirror class self.cpp_updater = _md.TempRescaleUpdater(hoomd.context.current.system_definition, thermo.cpp_compute, kT.cpp_variant); self.setupUpdater(period, phase); # store metadata self.kT = kT self.period = period self.metadata_fields = ['kT','period']
def __init__(self, mc, seed, period=1): if not isinstance(mc, integrate.mode_hpmc): hoomd.context.current.device.cpp_msg.warning("update.clusters: Must have a handle to an HPMC integrator.\n"); return # initialize base class _updater.__init__(self); if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterClustersSphere; elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterClustersConvexPolygon; elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterClustersSimplePolygon; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterClustersConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterClustersSpheropolyhedron; elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterClustersEllipsoid; elif isinstance(mc, integrate.convex_spheropolygon): cls =_hpmc.UpdaterClustersSpheropolygon; elif isinstance(mc, integrate.faceted_sphere): cls =_hpmc.UpdaterClustersFacetedEllipsoid; elif isinstance(mc, integrate.sphere_union): cls =_hpmc.UpdaterClustersSphereUnion; elif isinstance(mc, integrate.convex_spheropolyhedron_union): cls =_hpmc.UpdaterClustersConvexPolyhedronUnion; elif isinstance(mc, integrate.faceted_ellipsoid_union): cls =_hpmc.UpdaterClustersFacetedEllipsoidUnion; elif isinstance(mc, integrate.polyhedron): cls =_hpmc.UpdaterClustersPolyhedron; elif isinstance(mc, integrate.sphinx): cls =_hpmc.UpdaterClustersSphinx; else: raise RuntimeError("Unsupported integrator.\n"); self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed)) # register the clusters updater self.setupUpdater(period)
def __init__(self, mc, external_lattice, period=1): #initialize base class _updater.__init__(self) cls = None if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled(): if isinstance(mc, integrate.sphere): cls = _hpmc.RemoveDriftUpdaterSphere elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.RemoveDriftUpdaterConvexPolygon elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.RemoveDriftUpdaterSimplePolygon elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.RemoveDriftUpdaterConvexPolyhedron elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.RemoveDriftUpdaterSpheropolyhedron elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.RemoveDriftUpdaterEllipsoid elif isinstance(mc, integrate.convex_spheropolygon): cls = _hpmc.RemoveDriftUpdaterSpheropolygon elif isinstance(mc, integrate.faceted_sphere): cls = _hpmc.RemoveDriftUpdaterFacetedEllipsoid elif isinstance(mc, integrate.polyhedron): cls = _hpmc.RemoveDriftUpdaterPolyhedron elif isinstance(mc, integrate.sphinx): cls = _hpmc.RemoveDriftUpdaterSphinx elif isinstance(mc, integrate.sphere_union): cls = _hpmc.RemoveDriftUpdaterSphereUnion elif isinstance(mc, integrate.convex_spheropolyhedron_union): cls = _hpmc.RemoveDriftUpdaterConvexPolyhedronUnion elif isinstance(mc, integrate.faceted_ellipsoid_union): cls = _hpmc.RemoveDriftUpdaterFacetedEllipsoidUnion else: hoomd.context.current.device.cpp_msg.error( "update.remove_drift: Unsupported integrator.\n") raise RuntimeError("Error initializing update.remove_drift") else: raise RuntimeError( "update.remove_drift: Error! GPU not implemented.") self.cpp_updater = cls(hoomd.context.current.system_definition, external_lattice.cpp_compute, mc.cpp_integrator) self.setupUpdater(period)
def __init__(self, kT, period=1, phase=0): hoomd.util.print_status_line(); # initialize base class _updater.__init__(self); # setup the variant inputs kT = hoomd.variant._setup_variant_input(kT); # create the compute thermo thermo = hoomd.compute._get_unique_thermo(group=hoomd.context.current.group_all); # create the c++ mirror class self.cpp_updater = _md.TempRescaleUpdater(hoomd.context.current.system_definition, thermo.cpp_compute, kT.cpp_variant); self.setupUpdater(period, phase); # store metadta self.kT = kT self.period = period self.metadata_fields = ['kT','period']
def __init__(self, group, flow_target, slab_direction, flow_direction, n_slabs, max_slab=-1, min_slab=-1): hoomd.util.print_status_line() period = 1 # This updater has to be applied every timestep assert (n_slabs > 0), "Invalid negative number of slabs." if min_slab < 0: min_slab = 0 if max_slab < 0: max_slab = n_slabs / 2 assert (max_slab > -1 and max_slab < n_slabs ), "Invalid max_slab in [0," + str(n_slabs) + ")." assert (min_slab > -1 and min_slab < n_slabs ), "Invalid min_slab in [0," + str(n_slabs) + ")." assert (min_slab != max_slab), "Invalid min/max slabs. Both have the same value." # initialize the base class _updater.__init__(self) self._flow_target = hoomd.variant._setup_variant_input(flow_target) # create the c++ mirror class if not hoomd.context.exec_conf.isCUDAEnabled(): self.cpp_updater = _md.MuellerPlatheFlow( hoomd.context.current.system_definition, group.cpp_group, flow_target.cpp_variant, slab_direction, flow_direction, n_slabs, min_slab, max_slab) else: self.cpp_updater = _md.MuellerPlatheFlowGPU( hoomd.context.current.system_definition, group.cpp_group, flow_target.cpp_variant, slab_direction, flow_direction, n_slabs, min_slab, max_slab) self.setupUpdater(period)
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']
def __init__(self, mc, external_lattice, period=1): hoomd.util.print_status_line() #initiliaze base class _updater.__init__(self) cls = None if not hoomd.context.exec_conf.isCUDAEnabled(): if isinstance(mc, integrate.sphere): cls = _hpmc.RemoveDriftUpdaterSphere elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.RemoveDriftUpdaterConvexPolygon elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.RemoveDriftUpdaterSimplePolygon elif isinstance(mc, integrate.convex_polyhedron): cls = integrate._get_sized_entry( 'RemoveDriftUpdaterConvexPolyhedron', mc.max_verts) elif isinstance(mc, integrate.convex_spheropolyhedron): cls = integrate._get_sized_entry( 'RemoveDriftUpdaterSpheropolyhedron', mc.max_verts) elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.RemoveDriftUpdaterEllipsoid elif isinstance(mc, integrate.convex_spheropolygon): cls = _hpmc.RemoveDriftUpdaterSpheropolygon elif isinstance(mc, integrate.faceted_sphere): cls = _hpmc.RemoveDriftUpdaterFacetedSphere elif isinstance(mc, integrate.polyhedron): cls = _hpmc.RemoveDriftUpdaterPolyhedron elif isinstance(mc, integrate.sphinx): cls = _hpmc.RemoveDriftUpdaterSphinx elif isinstance(mc, integrate.sphere_union): cls = integrate._get_sized_entry( 'RemoveDriftUpdaterSphereUnion', mc.max_members) else: hoomd.context.msg.error( "update.remove_drift: Unsupported integrator.\n") raise RuntimeError("Error initializing update.remove_drift") else: raise RuntimeError( "update.remove_drift: Error! GPU not implemented.") # if isinstance(mc, integrate.sphere): # cls = _hpmc.RemoveDriftUpdaterGPUSphere; # elif isinstance(mc, integrate.convex_polygon): # cls = _hpmc.RemoveDriftUpdaterGPUConvexPolygon; # elif isinstance(mc, integrate.simple_polygon): # cls = _hpmc.RemoveDriftUpdaterGPUSimplePolygon; # elif isinstance(mc, integrate.convex_polyhedron): # cls = integrate._get_sized_entry('RemoveDriftUpdaterGPUConvexPolyhedron', mc.max_verts); # elif isinstance(mc, integrate.convex_spheropolyhedron): # cls = integrate._get_sized_entry('RemoveDriftUpdaterGPUSpheropolyhedron',mc.max_verts); # elif isinstance(mc, integrate.ellipsoid): # cls = _hpmc.RemoveDriftUpdaterGPUEllipsoid; # elif isinstance(mc, integrate.convex_spheropolygon): # cls =_hpmc.RemoveDriftUpdaterGPUSpheropolygon; # elif isinstance(mc, integrate.faceted_sphere): # cls =_hpmc.RemoveDriftUpdaterGPUFacetedSphere; # elif isinstance(mc, integrate.polyhedron): # cls =_hpmc.RemoveDriftUpdaterGPUPolyhedron; # elif isinstance(mc, integrate.sphinx): # cls =_hpmc.RemoveDriftUpdaterGPUSphinx; # elif isinstance(mc, integrate.sphere_union): # cls =_hpmc.RemoveDriftUpdaterGPUSphereUnion; # else: # hoomd.context.msg.error("update.remove_drift: Unsupported integrator.\n"); # raise RuntimeError("Error initializing update.remove_drift"); self.cpp_updater = cls(hoomd.context.current.system_definition, external_lattice.cpp_compute, mc.cpp_integrator) self.setupUpdater(period)
def __init__(self, mc, seed, period=1, transfer_types=None, ngibbs=1): hoomd.util.print_status_line() if not isinstance(mc, integrate.mode_hpmc): hoomd.context.msg.warning( "update.muvt: Must have a handle to an HPMC integrator.\n") return self.mc = mc # initialize base class _updater.__init__(self) if ngibbs > 1: self.gibbs = True else: self.gibbs = False # 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)) # by default, transfer all types if transfer_types is None: transfer_types = type_list cls = None if self.mc.implicit is True: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterMuVTImplicitSphere elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterMuVTImplicitConvexPolygon elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterMuVTImplicitSimplePolygon elif isinstance(mc, integrate.convex_polyhedron): cls = integrate._get_sized_entry( 'UpdaterMuVTImplicitConvexPolyhedron', mc.max_verts) elif isinstance(mc, integrate.convex_spheropolyhedron): cls = integrate._get_sized_entry( 'UpdaterMuVTImplicitSpheropolyhedron', mc.max_verts) elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterMuVTImplicitEllipsoid elif isinstance(mc, integrate.convex_spheropolygon): cls = _hpmc.UpdaterMuVTImplicitSpheropolygon elif isinstance(mc, integrate.faceted_sphere): cls = _hpmc.UpdaterMuVTImplicitFacetedSphere elif isinstance(mc, integrate.sphere_union): cls = integrate._get_sized_entry( 'UpdaterMuVTImplicitSphereUnion', mc.max_members) elif isinstance(mc, integrate.polyhedron): cls = _hpmc.UpdaterMuVTImplicitPolyhedron else: hoomd.context.msg.error( "update.muvt: Unsupported integrator.\n") raise RuntimeError("Error initializing update.muvt") else: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterMuVTSphere elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterMuVTConvexPolygon elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterMuVTSimplePolygon elif isinstance(mc, integrate.convex_polyhedron): cls = integrate._get_sized_entry('UpdaterMuVTConvexPolyhedron', mc.max_verts) elif isinstance(mc, integrate.convex_spheropolyhedron): cls = integrate._get_sized_entry('UpdaterMuVTSpheropolyhedron', mc.max_verts) elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterMuVTEllipsoid elif isinstance(mc, integrate.convex_spheropolygon): cls = _hpmc.UpdaterMuVTSpheropolygon elif isinstance(mc, integrate.faceted_sphere): cls = _hpmc.UpdaterMuVTFacetedSphere elif isinstance(mc, integrate.sphere_union): cls = integrate._get_sized_entry('UpdaterMuVTSphereUnion', mc.max_members) elif isinstance(mc, integrate.polyhedron): cls = _hpmc.UpdaterMuVTPolyhedron else: hoomd.context.msg.error( "update.muvt: Unsupported integrator.\n") raise RuntimeError("Error initializing update.muvt") if self.mc.implicit: self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed), ngibbs) else: self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed), ngibbs) # register the muvt updater self.setupUpdater(period) # set the list of transfered types if not isinstance(transfer_types, list): hoomd.context.msg.error( "update.muvt: Need list of types to transfer.\n") raise RuntimeError("Error initializing update.muvt") cpp_transfer_types = _hoomd.std_vector_uint() for t in transfer_types: if t not in type_list: hoomd.context.msg.error("Trying to transfer unknown type " + str(t) + "\n") raise RuntimeError("Error setting muVT parameters") else: type_id = hoomd.context.current.system_definition.getParticleData( ).getTypeByName(t) cpp_transfer_types.append(type_id) self.cpp_updater.setTransferTypes(cpp_transfer_types)
def __init__(self, mc, external_lattice, period=1): hoomd.util.print_status_line(); #initiliaze base class _updater.__init__(self); cls = None; if not hoomd.context.exec_conf.isCUDAEnabled(): if isinstance(mc, integrate.sphere): cls = _hpmc.RemoveDriftUpdaterSphere; elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.RemoveDriftUpdaterConvexPolygon; elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.RemoveDriftUpdaterSimplePolygon; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.RemoveDriftUpdaterConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.RemoveDriftUpdaterSpheropolyhedron; elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.RemoveDriftUpdaterEllipsoid; elif isinstance(mc, integrate.convex_spheropolygon): cls =_hpmc.RemoveDriftUpdaterSpheropolygon; elif isinstance(mc, integrate.faceted_sphere): cls =_hpmc.RemoveDriftUpdaterFacetedSphere; elif isinstance(mc, integrate.polyhedron): cls =_hpmc.RemoveDriftUpdaterPolyhedron; elif isinstance(mc, integrate.sphinx): cls =_hpmc.RemoveDriftUpdaterSphinx; elif isinstance(mc, integrate.sphere_union): cls = integrate._get_sized_entry('RemoveDriftUpdaterSphereUnion', mc.capacity); else: hoomd.context.msg.error("update.remove_drift: Unsupported integrator.\n"); raise RuntimeError("Error initializing update.remove_drift"); else: raise RuntimeError("update.remove_drift: Error! GPU not implemented."); # if isinstance(mc, integrate.sphere): # cls = _hpmc.RemoveDriftUpdaterGPUSphere; # elif isinstance(mc, integrate.convex_polygon): # cls = _hpmc.RemoveDriftUpdaterGPUConvexPolygon; # elif isinstance(mc, integrate.simple_polygon): # cls = _hpmc.RemoveDriftUpdaterGPUSimplePolygon; # elif isinstance(mc, integrate.convex_polyhedron): # cls = integrate._get_sized_entry('RemoveDriftUpdaterGPUConvexPolyhedron', mc.max_verts); # elif isinstance(mc, integrate.convex_spheropolyhedron): # cls = integrate._get_sized_entry('RemoveDriftUpdaterGPUSpheropolyhedron',mc.max_verts); # elif isinstance(mc, integrate.ellipsoid): # cls = _hpmc.RemoveDriftUpdaterGPUEllipsoid; # elif isinstance(mc, integrate.convex_spheropolygon): # cls =_hpmc.RemoveDriftUpdaterGPUSpheropolygon; # elif isinstance(mc, integrate.faceted_sphere): # cls =_hpmc.RemoveDriftUpdaterGPUFacetedSphere; # elif isinstance(mc, integrate.polyhedron): # cls =_hpmc.RemoveDriftUpdaterGPUPolyhedron; # elif isinstance(mc, integrate.sphinx): # cls =_hpmc.RemoveDriftUpdaterGPUSphinx; # elif isinstance(mc, integrate.sphere_union): # cls =_hpmc.RemoveDriftUpdaterGPUSphereUnion; # else: # hoomd.context.msg.error("update.remove_drift: Unsupported integrator.\n"); # raise RuntimeError("Error initializing update.remove_drift"); self.cpp_updater = cls(hoomd.context.current.system_definition, external_lattice.cpp_compute, mc.cpp_integrator); self.setupUpdater(period);
def __init__(self, mc, seed, period=1, transfer_types=None,ngibbs=1): hoomd.util.print_status_line(); if not isinstance(mc, integrate.mode_hpmc): hoomd.context.msg.warning("update.muvt: Must have a handle to an HPMC integrator.\n"); return; self.mc = mc # initialize base class _updater.__init__(self); if ngibbs > 1: self.gibbs = True; else: self.gibbs = False; # 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)); # by default, transfer all types if transfer_types is None: transfer_types = type_list cls = None; if self.mc.implicit is True: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterMuVTImplicitSphere; elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterMuVTImplicitConvexPolygon; elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterMuVTImplicitSimplePolygon; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterMuVTImplicitConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterMuVTImplicitSpheropolyhedron; elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterMuVTImplicitEllipsoid; elif isinstance(mc, integrate.convex_spheropolygon): cls =_hpmc.UpdaterMuVTImplicitSpheropolygon; elif isinstance(mc, integrate.faceted_sphere): cls =_hpmc.UpdaterMuVTImplicitFacetedSphere; elif isinstance(mc, integrate.sphere_union): cls = integrate._get_sized_entry('UpdaterMuVTImplicitSphereUnion', mc.capacity); elif isinstance(mc, integrate.polyhedron): cls =_hpmc.UpdaterMuVTImplicitPolyhedron; else: hoomd.context.msg.error("update.muvt: Unsupported integrator.\n"); raise RuntimeError("Error initializing update.muvt"); else: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterMuVTSphere; elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterMuVTConvexPolygon; elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterMuVTSimplePolygon; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterMuVTConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterMuVTSpheropolyhedron; elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterMuVTEllipsoid; elif isinstance(mc, integrate.convex_spheropolygon): cls =_hpmc.UpdaterMuVTSpheropolygon; elif isinstance(mc, integrate.faceted_sphere): cls =_hpmc.UpdaterMuVTFacetedSphere; elif isinstance(mc, integrate.sphere_union): cls = integrate._get_sized_entry('UpdaterMuVTSphereUnion', mc.capacity); elif isinstance(mc, integrate.polyhedron): cls =_hpmc.UpdaterMuVTPolyhedron; else: hoomd.context.msg.error("update.muvt: Unsupported integrator.\n"); raise RuntimeError("Error initializing update.muvt"); if self.mc.implicit: self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed), ngibbs); else: self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed), ngibbs); # register the muvt updater self.setupUpdater(period); # set the list of transfered types if not isinstance(transfer_types,list): hoomd.context.msg.error("update.muvt: Need list of types to transfer.\n"); raise RuntimeError("Error initializing update.muvt"); cpp_transfer_types = _hoomd.std_vector_uint(); for t in transfer_types: if t not in type_list: hoomd.context.msg.error("Trying to transfer unknown type " + str(t) + "\n"); raise RuntimeError("Error setting muVT parameters"); else: type_id = hoomd.context.current.system_definition.getParticleData().getTypeByName(t); cpp_transfer_types.append(type_id) self.cpp_updater.setTransferTypes(cpp_transfer_types)
def __init__(self, mc, seed, period=1): hoomd.util.print_status_line() if not isinstance(mc, integrate.mode_hpmc): hoomd.context.msg.warning( "update.clusters: Must have a handle to an HPMC integrator.\n") return # initialize base class _updater.__init__(self) if not mc.implicit: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterClustersSphere elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterClustersConvexPolygon elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterClustersSimplePolygon elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterClustersConvexPolyhedron elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterClustersSpheropolyhedron elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterClustersEllipsoid elif isinstance(mc, integrate.convex_spheropolygon): cls = _hpmc.UpdaterClustersSpheropolygon elif isinstance(mc, integrate.faceted_sphere): cls = _hpmc.UpdaterClustersFacetedSphere elif isinstance(mc, integrate.sphere_union): cls = _hpmc.UpdaterClustersSphereUnion elif isinstance(mc, integrate.convex_polyhedron_union): cls = _hpmc.UpdaterClustersConvexPolyhedronUnion elif isinstance(mc, integrate.polyhedron): cls = _hpmc.UpdaterClustersPolyhedron elif isinstance(mc, integrate.sphinx): cls = _hpmc.UpdaterClustersSphinx else: raise RuntimeError("Unsupported integrator.\n") else: if mc.depletant_mode == 'overlap_regions': if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterClustersImplicitNewSphere elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterClustersImplicitNewConvexPolygon elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterClustersImplicitNewSimplePolygon elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterClustersImplicitNewConvexPolyhedron elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterClustersImplicitNewSpheropolyhedron elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterClustersImplicitNewEllipsoid elif isinstance(mc, integrate.convex_spheropolygon): cls = _hpmc.UpdaterClustersImplicitNewSpheropolygon elif isinstance(mc, integrate.faceted_sphere): cls = _hpmc.UpdaterClustersImplicitNewFacetedSphere elif isinstance(mc, integrate.sphere_union): cls = _hpmc.UpdaterClustersImplicitNewSphereUnion elif isinstance(mc, integrate.convex_polyhedron_union): cls = _hpmc.UpdaterClustersImplicitNewConvexPolyhedronUnion elif isinstance(mc, integrate.polyhedron): cls = _hpmc.UpdaterClustersImplicitNewPolyhedron elif isinstance(mc, integrate.sphinx): cls = _hpmc.UpdaterClustersImplicitNewSphinx else: raise RuntimeError("Unsupported integrator.\n") else: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterClustersImplicitSphere elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterClustersImplicitConvexPolygon elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterClustersImplicitSimplePolygon elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterClustersImplicitConvexPolyhedron elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterClustersImplicitSpheropolyhedron elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterClustersImplicitEllipsoid elif isinstance(mc, integrate.convex_spheropolygon): cls = _hpmc.UpdaterClustersImplicitSpheropolygon elif isinstance(mc, integrate.faceted_sphere): cls = _hpmc.UpdaterClustersImplicitFacetedSphere elif isinstance(mc, integrate.sphere_union): cls = _hpmc.UpdaterClustersImplicitSphereUnion elif isinstance(mc, integrate.convex_polyhedron_union): cls = _hpmc.UpdaterClustersImplicitConvexPolyhedronUnion elif isinstance(mc, integrate.polyhedron): cls = _hpmc.UpdaterClustersImplicitPolyhedron elif isinstance(mc, integrate.sphinx): cls = _hpmc.UpdaterClustersImplicitSphinx else: raise RuntimeError("Unsupported integrator.\n") self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed)) # register the clusters updater self.setupUpdater(period)
def __init__(self, mc, seed, period=1, transfer_types=None,ngibbs=1): if not isinstance(mc, integrate.mode_hpmc): hoomd.context.current.device.cpp_msg.warning("update.muvt: Must have a handle to an HPMC integrator.\n"); return; self.mc = mc # initialize base class _updater.__init__(self); if ngibbs > 1: self.gibbs = True; else: self.gibbs = False; # 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)); # by default, transfer all types if transfer_types is None: transfer_types = type_list cls = None; if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterMuVTSphere; elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterMuVTConvexPolygon; elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterMuVTSimplePolygon; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterMuVTConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterMuVTSpheropolyhedron; elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterMuVTEllipsoid; elif isinstance(mc, integrate.convex_spheropolygon): cls =_hpmc.UpdaterMuVTSpheropolygon; elif isinstance(mc, integrate.faceted_sphere): cls =_hpmc.UpdaterMuVTFacetedEllipsoid; elif isinstance(mc, integrate.sphere_union): cls = _hpmc.UpdaterMuVTSphereUnion; elif isinstance(mc, integrate.convex_spheropolyhedron_union): cls = _hpmc.UpdaterMuVTConvexPolyhedronUnion; elif isinstance(mc, integrate.faceted_ellipsoid_union): cls = _hpmc.UpdaterMuVTFacetedEllipsoidUnion; elif isinstance(mc, integrate.polyhedron): cls =_hpmc.UpdaterMuVTPolyhedron; else: hoomd.context.current.device.cpp_msg.error("update.muvt: Unsupported integrator.\n"); raise RuntimeError("Error initializing update.muvt"); self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed), ngibbs); # register the muvt updater self.setupUpdater(period); # set the list of transferred types if not isinstance(transfer_types,list): hoomd.context.current.device.cpp_msg.error("update.muvt: Need list of types to transfer.\n"); raise RuntimeError("Error initializing update.muvt"); cpp_transfer_types = _hoomd.std_vector_uint(); for t in transfer_types: if t not in type_list: hoomd.context.current.device.cpp_msg.error("Trying to transfer unknown type " + str(t) + "\n"); raise RuntimeError("Error setting muVT parameters"); else: type_id = hoomd.context.current.system_definition.getParticleData().getTypeByName(t); cpp_transfer_types.append(type_id) self.cpp_updater.setTransferTypes(cpp_transfer_types)
def __init__(self, mc, seed, period=1): hoomd.util.print_status_line(); if not isinstance(mc, integrate.mode_hpmc): hoomd.context.msg.warning("update.clusters: Must have a handle to an HPMC integrator.\n"); return # initialize base class _updater.__init__(self); if not mc.implicit: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterClustersSphere; elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterClustersConvexPolygon; elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterClustersSimplePolygon; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterClustersConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterClustersSpheropolyhedron; elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterClustersEllipsoid; elif isinstance(mc, integrate.convex_spheropolygon): cls =_hpmc.UpdaterClustersSpheropolygon; elif isinstance(mc, integrate.faceted_sphere): cls =_hpmc.UpdaterClustersFacetedEllipsoid; elif isinstance(mc, integrate.sphere_union): cls =_hpmc.UpdaterClustersSphereUnion; elif isinstance(mc, integrate.convex_polyhedron_union): cls =_hpmc.UpdaterClustersConvexPolyhedronUnion; elif isinstance(mc, integrate.faceted_ellipsoid_union): cls =_hpmc.UpdaterClustersFacetedEllipsoidUnion; elif isinstance(mc, integrate.polyhedron): cls =_hpmc.UpdaterClustersPolyhedron; elif isinstance(mc, integrate.sphinx): cls =_hpmc.UpdaterClustersSphinx; else: raise RuntimeError("Unsupported integrator.\n"); else: if isinstance(mc, integrate.sphere): cls = _hpmc.UpdaterClustersImplicitSphere; elif isinstance(mc, integrate.convex_polygon): cls = _hpmc.UpdaterClustersImplicitConvexPolygon; elif isinstance(mc, integrate.simple_polygon): cls = _hpmc.UpdaterClustersImplicitSimplePolygon; elif isinstance(mc, integrate.convex_polyhedron): cls = _hpmc.UpdaterClustersImplicitConvexPolyhedron; elif isinstance(mc, integrate.convex_spheropolyhedron): cls = _hpmc.UpdaterClustersImplicitSpheropolyhedron; elif isinstance(mc, integrate.ellipsoid): cls = _hpmc.UpdaterClustersImplicitEllipsoid; elif isinstance(mc, integrate.convex_spheropolygon): cls =_hpmc.UpdaterClustersImplicitSpheropolygon; elif isinstance(mc, integrate.faceted_sphere): cls =_hpmc.UpdaterClustersImplicitFacetedEllipsoid; elif isinstance(mc, integrate.sphere_union): cls =_hpmc.UpdaterClustersImplicitSphereUnion; elif isinstance(mc, integrate.convex_polyhedron_union): cls =_hpmc.UpdaterClustersImplicitConvexPolyhedronUnion; elif isinstance(mc, integrate.faceted_ellipsoid_union): cls =_hpmc.UpdaterClustersImplicitFacetedEllipsoidUnion; elif isinstance(mc, integrate.polyhedron): cls =_hpmc.UpdaterClustersImplicitPolyhedron; elif isinstance(mc, integrate.sphinx): cls =_hpmc.UpdaterClustersImplicitSphinx; else: raise RuntimeError("Unsupported integrator.\n"); self.cpp_updater = cls(hoomd.context.current.system_definition, mc.cpp_integrator, int(seed)) # register the clusters updater self.setupUpdater(period)