def __init__(self, file, type, nlist): c = hoomd.cite.article( cite_key='lin2017', author=['L Yang', 'F Zhang', 'K M Ho', 'C Z Wang', 'A Travesset'], title='Implementation of EAM and FS potentials in HOOMD-blue', journal='Computer Physics Communications', volume=0, number=0, pages='0--0', year='2017', doi='0', feature='EAM') hoomd.cite._ensure_global_bib().add(c) hoomd.util.print_status_line() # Error out in MPI simulations if (_hoomd.is_MPI_available()): if hoomd.context.current.system_definition.getParticleData( ).getDomainDecomposition(): hoomd.context.msg.error( "pair.eam is not supported in multi-processor simulations.\n\n" ) raise RuntimeError("Error setting up pair potential.") # initialize the base class force._force.__init__(self) # Translate type if (type == 'Alloy'): type_of_file = 0 elif (type == 'FS'): type_of_file = 1 else: raise RuntimeError('Unknown EAM input file type') # create the c++ mirror class if not hoomd.context.exec_conf.isCUDAEnabled(): self.cpp_force = _metal.EAMForceCompute( hoomd.context.current.system_definition, file, type_of_file) else: self.cpp_force = _metal.EAMForceComputeGPU( hoomd.context.current.system_definition, file, type_of_file) #After load EAMForceCompute we know r_cut from EAM potential`s file. We need update neighbor list. self.r_cut_new = self.cpp_force.get_r_cut() self.nlist = nlist self.nlist.subscribe(lambda: self.get_rcut()) self.nlist.update_rcut() #Load neighbor list to compute. self.cpp_force.set_neighbor_list(self.nlist.cpp_nlist) if hoomd.context.exec_conf.isCUDAEnabled(): self.nlist.cpp_nlist.setStorageMode( _md.NeighborList.storageMode.full) hoomd.context.msg.notice( 2, "Set r_cut = " + str(self.r_cut_new) + " from potential`s file '" + str(file) + "'.\n") hoomd.context.current.system.addCompute(self.cpp_force, self.force_name) self.pair_coeff = hoomd.md.pair.coeff()
def __init__(self, file, type, nlist): # 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( "pair.eam is not supported in multi-processor simulations.\n\n" ) raise RuntimeError("Error setting up pair potential.") # initialize the base class force._force.__init__(self) # Translate type if (type == 'Alloy'): type_of_file = 0 elif (type == 'FS'): type_of_file = 1 else: raise RuntimeError('Unknown EAM input file type') # create the c++ mirror class if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled(): self.cpp_force = _metal.EAMForceCompute( hoomd.context.current.system_definition, file, type_of_file) else: self.cpp_force = _metal.EAMForceComputeGPU( hoomd.context.current.system_definition, file, type_of_file) #After load EAMForceCompute we know r_cut from EAM potential`s file. We need update neighbor list. self.r_cut_new = self.cpp_force.get_r_cut() self.nlist = nlist self.nlist.subscribe(lambda: self.get_rcut()) self.nlist.update_rcut() #Load neighbor list to compute. self.cpp_force.set_neighbor_list(self.nlist.cpp_nlist) if hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled(): self.nlist.cpp_nlist.setStorageMode( _md.NeighborList.storageMode.full) hoomd.context.current.device.cpp_msg.notice( 2, "Set r_cut = " + str(self.r_cut_new) + " from potential`s file '" + str(file) + "'.\n") hoomd.context.current.system.addCompute(self.cpp_force, self.force_name) self.pair_coeff = hoomd.md.pair.coeff()
def __init__(self, file, type, nlist): c = hoomd.cite.article( cite_key='morozov2011', author=[ 'I V Morozov', 'A M Kazennova', 'R G Bystryia', 'G E Normana', 'V V Pisareva', 'V V Stegailova' ], title= 'Molecular dynamics simulations of the relaxation processes in the condensed matter on GPUs', journal='Computer Physics Communications', volume=182, number=9, pages='1974--1978', year='2011', doi='10.1016/j.cpc.2010.12.026', feature='EAM') hoomd.cite._ensure_global_bib().add(c) hoomd.util.print_status_line() # Error out in MPI simulations if (_hoomd.is_MPI_available()): if hoomd.context.current.system_definition.getParticleData( ).getDomainDecomposition(): hoomd.context.msg.error( "pair.eam is not supported in multi-processor simulations.\n\n" ) raise RuntimeError("Error setting up pair potential.") # initialize the base class force._force.__init__(self) # Translate type if (type == 'Alloy'): type_of_file = 0 elif (type == 'FS'): type_of_file = 1 else: raise RuntimeError('Unknown EAM input file type') # create the c++ mirror class if not hoomd.context.exec_conf.isCUDAEnabled(): self.cpp_force = _metal.EAMForceCompute( hoomd.context.current.system_definition, file, type_of_file) else: self.cpp_force = _metal.EAMForceComputeGPU( hoomd.context.current.system_definition, file, type_of_file) #After load EAMForceCompute we know r_cut from EAM potential`s file. We need update neighbor list. r_cut_new = self.cpp_force.get_r_cut() self.nlist = nlist self.nlist.subscribe(lambda: r_cut_new) self.nlist.update_rcut() #Load neighbor list to compute. self.cpp_force.set_neighbor_list(self.nlist) if hoomd.context.exec_conf.isCUDAEnabled(): self.nlist.setStorageMode(_md.NeighborList.storageMode.full) hoomd.context.msg.notice( 2, "Set r_cut = " + str(r_cut_new) + " from potential`s file '" + str(file) + "'.\n") hoomd.context.current.system.addCompute(self.cpp_force, self.force_name) self.pair_coeff = coeff()