2006-09-28 03:51:33 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
2007-01-30 08:22:05 +08:00
|
|
|
http://lammps.sandia.gov, Sandia National Laboratories
|
|
|
|
Steve Plimpton, sjplimp@sandia.gov
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
|
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
|
|
|
certain rights in this software. This software is distributed under
|
|
|
|
the GNU General Public License.
|
|
|
|
|
|
|
|
See the README file in the top-level LAMMPS directory.
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#ifndef NEIGHBOR_H
|
|
|
|
#define NEIGHBOR_H
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
#include "pointers.h"
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
namespace LAMMPS_NS {
|
|
|
|
|
|
|
|
class Neighbor : protected Pointers {
|
2006-09-28 03:51:33 +08:00
|
|
|
public:
|
2007-10-04 00:22:30 +08:00
|
|
|
int style; // 0,1,2 = nsq, bin, multi
|
2006-09-28 03:51:33 +08:00
|
|
|
int every; // build every this many steps
|
|
|
|
int delay; // delay build for this many steps
|
|
|
|
int dist_check; // 0 = always build, 1 = only if 1/2 dist
|
|
|
|
int ago; // how many steps ago neighboring occurred
|
|
|
|
int pgsize; // size of neighbor page
|
|
|
|
int oneatom; // max # of neighbors for one atom
|
2008-10-22 23:51:31 +08:00
|
|
|
int includegroup; // only build pairwise lists for this group
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
double skin; // skin distance
|
2008-08-21 21:53:19 +08:00
|
|
|
double cutneighmin; // min neighbor cutoff for all type pairs
|
|
|
|
double cutneighmax; // max neighbor cutoff for all type pairs
|
2007-03-27 05:30:26 +08:00
|
|
|
double *cuttype; // for each type, max neigh cut w/ others
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
int ncalls; // # of times build has been called
|
|
|
|
int ndanger; // # of dangerous builds
|
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
int nrequest; // requests for pairwise neighbor lists
|
|
|
|
class NeighRequest **requests; // from Pair, Fix, Compute, Command classes
|
|
|
|
int maxrequest;
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
int old_style; // previous run info to avoid
|
|
|
|
int old_nrequest; // re-creation of pairwise neighbor lists
|
|
|
|
class NeighRequest **old_requests;
|
|
|
|
|
|
|
|
int nlist; // pairwise neighbor lists
|
|
|
|
class NeighList **lists;
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
int nbondlist; // list of bonds to compute
|
|
|
|
int **bondlist;
|
|
|
|
int nanglelist; // list of angles to compute
|
|
|
|
int **anglelist;
|
|
|
|
int ndihedrallist; // list of dihedrals to compute
|
|
|
|
int **dihedrallist;
|
|
|
|
int nimproperlist; // list of impropers to compute
|
|
|
|
int **improperlist;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
Neighbor(class LAMMPS *);
|
2006-09-28 03:51:33 +08:00
|
|
|
~Neighbor();
|
|
|
|
void init();
|
2007-10-05 07:59:26 +08:00
|
|
|
int request(void *); // another class requests a neighbor list
|
|
|
|
void print_lists_of_lists(); // debug print out
|
|
|
|
int decide(); // decide whether to build or not
|
|
|
|
int check_distance(); // check max distance moved since last build
|
|
|
|
void setup_bins(); // setup bins based on box and cutoff
|
|
|
|
void build(); // create all neighbor lists (pair,bond)
|
|
|
|
void build_one(int); // create a single neighbor list
|
|
|
|
void set(int, char **); // set neighbor style and skin distance
|
2007-10-04 00:22:30 +08:00
|
|
|
void modify_params(int, char**); // modify parameters that control builds
|
2007-10-05 01:57:04 +08:00
|
|
|
double memory_usage();
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
int me,nprocs;
|
|
|
|
|
2007-10-23 01:45:06 +08:00
|
|
|
int maxlocal; // size of atom-based NeighList arrays
|
2006-09-28 03:51:33 +08:00
|
|
|
int maxbond,maxangle,maxdihedral,maximproper; // size of bond lists
|
|
|
|
|
2009-02-20 01:03:24 +08:00
|
|
|
int build_once; // 1 if only build lists once per run
|
2006-09-28 03:51:33 +08:00
|
|
|
int must_check; // 1 if must check other classes to reneigh
|
|
|
|
int restart_check; // 1 if restart enabled, 0 if no
|
|
|
|
int fix_check; // # of fixes that induce reneigh
|
|
|
|
int *fixchecklist; // which fixes to check
|
|
|
|
|
2007-03-27 05:30:26 +08:00
|
|
|
double **cutneighsq; // neighbor cutneigh sq for each type pair
|
|
|
|
double cutneighmaxsq; // cutneighmax squared
|
|
|
|
double *cuttypesq; // cuttype squared
|
|
|
|
|
|
|
|
double triggersq; // trigger = build when atom moves this dist
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
double **xhold; // atom coords at last neighbor build
|
|
|
|
int maxhold; // size of xhold array
|
|
|
|
|
|
|
|
int nbinx,nbiny,nbinz; // # of global bins
|
|
|
|
int *bins; // ptr to next atom in each bin
|
|
|
|
int maxbin; // size of bins array
|
|
|
|
|
|
|
|
int *binhead; // ptr to 1st atom in each bin
|
|
|
|
int maxhead; // size of binhead array
|
|
|
|
|
|
|
|
int mbins; // # of local bins and offset
|
|
|
|
int mbinx,mbiny,mbinz;
|
|
|
|
int mbinxlo,mbinylo,mbinzlo;
|
|
|
|
|
2007-12-07 00:50:01 +08:00
|
|
|
int binsizeflag; // user-chosen bin size
|
|
|
|
double binsize_user;
|
|
|
|
|
|
|
|
double binsizex,binsizey,binsizez; // actual bin sizes and inverse sizes
|
2006-09-28 03:51:33 +08:00
|
|
|
double bininvx,bininvy,bininvz;
|
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
int sx,sy,sz,smax; // bin stencil extents
|
|
|
|
|
2007-08-11 06:59:04 +08:00
|
|
|
int dimension; // 2/3 for 2d/3d
|
2007-03-08 08:54:02 +08:00
|
|
|
int triclinic; // 0 if domain is orthog, 1 if triclinic
|
2007-10-04 00:22:30 +08:00
|
|
|
int newton_pair; // 0 if newton off, 1 if on for pairwise
|
|
|
|
|
2007-03-09 06:07:17 +08:00
|
|
|
double *bboxlo,*bboxhi; // copy of full domain bounding box
|
2007-03-08 08:54:02 +08:00
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
double inner[2],middle[2]; // rRESPA cutoffs for extra lists
|
|
|
|
double cut_inner_sq; // outer cutoff for inner neighbor list
|
|
|
|
double cut_middle_sq; // outer cutoff for middle neighbor list
|
|
|
|
double cut_middle_inside_sq; // inner cutoff for middle neighbor list
|
|
|
|
|
|
|
|
int special_flag[4]; // flags for 1-2, 1-3, 1-4 neighbors
|
|
|
|
|
|
|
|
int exclude; // 0 if no type/group exclusions, 1 if yes
|
|
|
|
|
|
|
|
int nex_type; // # of entries in type exclusion list
|
|
|
|
int maxex_type; // max # in type list
|
|
|
|
int *ex1_type,*ex2_type; // pairs of types to exclude
|
|
|
|
int **ex_type; // 2d array of excluded type pairs
|
|
|
|
|
|
|
|
int nex_group; // # of entries in group exclusion list
|
|
|
|
int maxex_group; // max # in group list
|
|
|
|
int *ex1_group,*ex2_group; // pairs of group #'s to exclude
|
|
|
|
int *ex1_bit,*ex2_bit; // pairs of group bits to exclude
|
|
|
|
|
|
|
|
int nex_mol; // # of entries in molecule exclusion list
|
|
|
|
int maxex_mol; // max # in molecule list
|
|
|
|
int *ex_mol_group; // molecule group #'s to exclude
|
|
|
|
int *ex_mol_bit; // molecule group bits to exclude
|
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
int nblist,nglist,nslist; // # of pairwise neigh lists of various kinds
|
|
|
|
int *blist; // lists to build every reneighboring
|
|
|
|
int *glist; // lists to grow atom arrays every reneigh
|
|
|
|
int *slist; // lists to grow stencil arrays every reneigh
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void bin_atoms(); // bin all atoms
|
|
|
|
double bin_distance(int, int, int); // distance between binx
|
|
|
|
int coord2bin(double *); // mapping atom coord to a bin
|
|
|
|
int find_special(int, int); // look for special neighbor
|
|
|
|
int exclusion(int, int, int, int, int *, int *); // test for pair exclusion
|
|
|
|
void choose_build(int, class NeighRequest *);
|
|
|
|
void choose_stencil(int, class NeighRequest *);
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
// pairwise build functions
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
typedef void (Neighbor::*PairPtr)(class NeighList *);
|
|
|
|
PairPtr *pair_build;
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void half_nsq_no_newton(class NeighList *);
|
|
|
|
void half_nsq_newton(class NeighList *);
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void half_bin_no_newton(class NeighList *);
|
|
|
|
void half_bin_newton(class NeighList *);
|
|
|
|
void half_bin_newton_tri(class NeighList *);
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void half_multi_no_newton(class NeighList *);
|
|
|
|
void half_multi_newton(class NeighList *);
|
|
|
|
void half_multi_newton_tri(class NeighList *);
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void full_nsq(class NeighList *);
|
|
|
|
void full_bin(class NeighList *);
|
|
|
|
void full_multi(class NeighList *);
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-05 07:59:26 +08:00
|
|
|
void half_from_full_no_newton(class NeighList *);
|
|
|
|
void half_from_full_newton(class NeighList *);
|
2007-10-04 00:22:30 +08:00
|
|
|
void skip_from(class NeighList *);
|
2007-10-05 07:59:26 +08:00
|
|
|
void skip_from_granular(class NeighList *);
|
|
|
|
void skip_from_respa(class NeighList *);
|
2007-10-04 00:22:30 +08:00
|
|
|
void copy_from(class NeighList *);
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void granular_nsq_no_newton(class NeighList *);
|
|
|
|
void granular_nsq_newton(class NeighList *);
|
|
|
|
void granular_bin_no_newton(class NeighList *);
|
|
|
|
void granular_bin_newton(class NeighList *);
|
|
|
|
void granular_bin_newton_tri(class NeighList *);
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void respa_nsq_no_newton(class NeighList *);
|
|
|
|
void respa_nsq_newton(class NeighList *);
|
|
|
|
void respa_bin_no_newton(class NeighList *);
|
|
|
|
void respa_bin_newton(class NeighList *);
|
|
|
|
void respa_bin_newton_tri(class NeighList *);
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
// pairwise stencil creation functions
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
typedef void (Neighbor::*StencilPtr)(class NeighList *, int, int, int);
|
|
|
|
StencilPtr *stencil_create;
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void stencil_half_bin_2d_no_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_bin_3d_no_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_bin_2d_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_bin_3d_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_bin_2d_newton_tri(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_bin_3d_newton_tri(class NeighList *, int, int, int);
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void stencil_half_multi_2d_no_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_multi_3d_no_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_multi_2d_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_multi_3d_newton(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_multi_2d_newton_tri(class NeighList *, int, int, int);
|
|
|
|
void stencil_half_multi_3d_newton_tri(class NeighList *, int, int, int);
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
void stencil_full_bin_2d(class NeighList *, int, int, int);
|
|
|
|
void stencil_full_bin_3d(class NeighList *, int, int, int);
|
|
|
|
void stencil_full_multi_2d(class NeighList *, int, int, int);
|
|
|
|
void stencil_full_multi_3d(class NeighList *, int, int, int);
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
// topology build functions
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
typedef void (Neighbor::*BondPtr)(); // ptrs to topology build functions
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
BondPtr bond_build; // ptr to bond list functions
|
|
|
|
void bond_all(); // bond list with all bonds
|
|
|
|
void bond_partial(); // exclude certain bonds
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
BondPtr angle_build; // ptr to angle list functions
|
|
|
|
void angle_all(); // angle list with all angles
|
|
|
|
void angle_partial(); // exclude certain angles
|
|
|
|
|
|
|
|
BondPtr dihedral_build; // ptr to dihedral list functions
|
|
|
|
void dihedral_all(); // dihedral list with all dihedrals
|
|
|
|
void dihedral_partial(); // exclude certain dihedrals
|
|
|
|
|
|
|
|
BondPtr improper_build; // ptr to improper list functions
|
|
|
|
void improper_all(); // improper list with all impropers
|
|
|
|
void improper_partial(); // exclude certain impropers
|
2007-03-27 05:30:26 +08:00
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
};
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
#endif
|