コード例 #1
0
    def __init__(self,
                 r_buff=0.4,
                 check_period=1,
                 d_max=None,
                 dist_check=True,
                 name=None):
        nlist.__init__(self)

        # create the C++ mirror class
        if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled():
            self.cpp_nlist = _md.NeighborListTree(
                hoomd.context.current.system_definition, 0.0, r_buff)
        else:
            self.cpp_nlist = _md.NeighborListGPUTree(
                hoomd.context.current.system_definition, 0.0, r_buff)

        self.cpp_nlist.setEvery(check_period, dist_check)

        if name is None:
            self.name = "tree_nlist_%d" % tree.cur_id
            tree.cur_id += 1
        else:
            self.name = name

        hoomd.context.current.system.addCompute(self.cpp_nlist, self.name)

        # register this neighbor list with the context
        hoomd.context.current.neighbor_lists += [self]

        # save the user defined parameters
        self.set_params(r_buff, check_period, d_max, dist_check)
コード例 #2
0
ファイル: nlist.py プロジェクト: phmalek/hoomd-blue
    def __init__(self,
                 r_buff=0.4,
                 check_period=1,
                 d_max=None,
                 dist_check=True,
                 name=None):
        hoomd.util.print_status_line()

        # register the citation
        c = hoomd.cite.article(
            cite_key='howard2016',
            author=[
                'M P Howard', 'J A Anderson', 'A Nikoubashman', 'S C Glotzer',
                'A Z Panagiotopoulos'
            ],
            title=
            'Efficient neighbor list calculation for molecular simulation of colloidal systems using graphics processing units',
            journal='Computer Physics Communications',
            volume=203,
            pages='45--52',
            month='Mar',
            year='2016',
            doi='10.1016/j.cpc.2016.02.003',
            feature='tree neighbor lists')
        hoomd.cite._ensure_global_bib().add(c)

        nlist.__init__(self)

        # create the C++ mirror class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            self.cpp_nlist = _md.NeighborListTree(
                hoomd.context.current.system_definition, 0.0, r_buff)
        else:
            self.cpp_nlist = _md.NeighborListGPUTree(
                hoomd.context.current.system_definition, 0.0, r_buff)

        self.cpp_nlist.setEvery(check_period, dist_check)

        if name is None:
            self.name = "tree_nlist_%d" % tree.cur_id
            tree.cur_id += 1
        else:
            self.name = name

        hoomd.context.current.system.addCompute(self.cpp_nlist, self.name)

        # register this neighbor list with the context
        hoomd.context.current.neighbor_lists += [self]

        # save the user defined parameters
        hoomd.util.quiet_status()
        self.set_params(r_buff, check_period, d_max, dist_check)
        hoomd.util.unquiet_status()
コード例 #3
0
ファイル: nlist.py プロジェクト: etomica/hoomd-blue
    def __init__(self, r_buff=0.4, check_period=1, d_max=None, dist_check=True, name=None):

        # register the citation
        c1 = hoomd.cite.article(cite_key='howard2016',
                         author=['M P Howard', 'J A Anderson', 'A Nikoubashman', 'S C Glotzer', 'A Z Panagiotopoulos'],
                         title='Efficient neighbor list calculation for molecular simulation of colloidal systems using graphics processing units',
                         journal='Computer Physics Communications',
                         volume=203,
                         pages='45--52',
                         month='Mar',
                         year='2016',
                         doi='10.1016/j.cpc.2016.02.003',
                         feature='tree neighbor lists')
        c2 = hoomd.cite.article(cite_key='howard2019',
                         author=['M P Howard', 'A Statt', 'F Madutsa', 'T M Truskett', 'A Z Panagiotopoulos'],
                         title='Quantized bounding volume hierarchies for neighbor search in molecular simulations on graphics processing units',
                         journal='Computational Materials Science',
                         volume=164,
                         pages='139--146',
                         month='Jun',
                         year='2019',
                         doi='10.1016/j.commatsci.2019.04.004',
                         feature='tree neighbor lists')
        hoomd.cite._ensure_global_bib().add((c1,c2))

        nlist.__init__(self)

        # create the C++ mirror class
        if not hoomd.context.current.device.cpp_exec_conf.isCUDAEnabled():
            self.cpp_nlist = _md.NeighborListTree(hoomd.context.current.system_definition, 0.0, r_buff)
        else:
            self.cpp_nlist = _md.NeighborListGPUTree(hoomd.context.current.system_definition, 0.0, r_buff)

        self.cpp_nlist.setEvery(check_period, dist_check)

        if name is None:
            self.name = "tree_nlist_%d" % tree.cur_id
            tree.cur_id += 1
        else:
            self.name = name

        hoomd.context.current.system.addCompute(self.cpp_nlist, self.name)

        # register this neighbor list with the context
        hoomd.context.current.neighbor_lists += [self]

        # save the user defined parameters
        self.set_params(r_buff, check_period, d_max, dist_check)
コード例 #4
0
    def __init__(self, group, T, seed=0, xi = 0.5, error = 0.001, function_form = None, max_strain = 0.5, nlist_type = "cell" ):

  # Print the status of the initialization        
        hoomd.util.print_status_line();
        
        # initialize base class
        hoomd.md.integrate._integration_method.__init__(self);
        
        # setup the variant inputs
        T = hoomd.variant._setup_variant_input(T);
        
        # create the compute thermo
        compute._get_unique_thermo(group=group);
        
        # Real space neighborlist cutoff based on error estimate for spectral sums
        self.rcut = math.sqrt( - math.log( error ) ) / xi;
        # If this line is changed, remember to change in C++ code as well!!
        
        # initialize the reflected c++ class
        if not hoomd.context.exec_conf.isCUDAEnabled():
            hoomd.context.msg.error("Sorry, we have not written CPU code for PSE RPY simulation. \n");
            raise RuntimeError('Error creating Stokes');
        else:
      
      # Create a neighborlist exclusively for real space interactions. Use cell lists by 
      # default, but also allow the user to specify
            if ( nlist_type.upper() == "CELL" ):

                cl_stokes = _hoomd.CellListGPU(hoomd.context.current.system_definition);
                hoomd.context.current.system.addCompute(cl_stokes, "stokes_cl")
                self.neighbor_list = _md.NeighborListGPUBinned(hoomd.context.current.system_definition, self.rcut, 0.4, cl_stokes);

            elif ( nlist_type.upper() == "TREE" ):

                self.neighbor_list = _md.NeighborListGPUTree(hoomd.context.current.system_definition, self.rcut, 0.4)

            elif ( nlist_type.upper() == "STENCIL" ):

                cl_stokes  = _hoomd.CellListGPU(hoomd.context.current.system_definition)
                hoomd.context.current.system.addCompute(cl_stokes, "stokes_cl")
                cls_stokes = _hoomd.CellListStencil( hoomd.context.current.system_definition, cl_stokes )
                hoomd.context.current.system.addCompute( cls_stokes, "stokes_cls")
                self.neighbor_list = _md.NeighborListGPUStencil(hoomd.context.current.system_definition, self.rcut, 0.4, cl_stokes, cls_stokes)

            else:
                hoomd.context.msg.error("Invalid neighborlist method specified. Valid options are: cell, tree, stencil. \n");
                raise RuntimeError('Error constructing neighborlist');

            # Set neighborlist properties
            self.neighbor_list.setEvery(1, True);
            hoomd.context.current.system.addCompute(self.neighbor_list, "stokes_nlist")
            self.neighbor_list.countExclusions();
        
            # Call the stokes integrator
            self.cpp_method = _PSEv1.Stokes(hoomd.context.current.system_definition, group.cpp_group, T.cpp_variant, seed, self.neighbor_list, xi, error);

        self.cpp_method.validateGroup()

        if function_form is not None:
            self.cpp_method.setShear(function_form.cpp_function, max_strain)
        else:
            no_shear_function = shear_function.steady(dt = 0)
            self.cpp_method.setShear(no_shear_function.cpp_function, max_strain)

        self.cpp_method.setParams()