00001 /* ---------------------------------------------------------------------- 00002 miniMD is a simple, parallel molecular dynamics (MD) code. miniMD is 00003 an MD microapplication in the Mantevo project at Sandia National 00004 Laboratories ( http://software.sandia.gov/mantevo/ ). The primary 00005 authors of miniMD are Steve Plimpton and Paul Crozier 00006 (pscrozi@sandia.gov). 00007 00008 Copyright (2008) Sandia Corporation. Under the terms of Contract 00009 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains 00010 certain rights in this software. This library is free software; you 00011 can redistribute it and/or modify it under the terms of the GNU Lesser 00012 General Public License as published by the Free Software Foundation; 00013 either version 3 of the License, or (at your option) any later 00014 version. 00015 00016 This library is distributed in the hope that it will be useful, but 00017 WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public 00022 License along with this software; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00024 USA. See also: http://www.gnu.org/licenses/lgpl.txt . 00025 00026 For questions, contact Paul S. Crozier (pscrozi@sandia.gov). 00027 00028 Please read the accompanying README and LICENSE files. 00029 ---------------------------------------------------------------------- */ 00030 00031 #ifndef NEIGHBOR_H 00032 #define NEIGHBOR_H 00033 00034 #include "atom.h" 00035 00036 class Neighbor { 00037 public: 00038 int every; // re-neighbor every this often 00039 int nbinx,nbiny,nbinz; // # of global bins 00040 double cutneigh; // neighbor cutoff 00041 double cutneighsq; // neighbor cutoff squared 00042 int ncalls; // # of times build has been called 00043 int max_totalneigh; // largest # of neighbors ever stored 00044 00045 int *numneigh; // # of neighbors for each atom 00046 int **firstneigh; // ptr to 1st neighbor of each atom 00047 00048 Neighbor(); 00049 ~Neighbor(); 00050 int setup(Atom &); // setup bins based on box and cutoff 00051 void build(Atom &); // create neighbor list 00052 00053 private: 00054 double xprd,yprd,zprd; // box size 00055 int npage; // current page in page list 00056 int maxpage; // # of pages currently allocated 00057 int **pages; // neighbor list pages 00058 00059 int nmax; // max size of atom arrays in neighbor 00060 int *binhead; // ptr to 1st atom in each bin 00061 int *bins; // ptr to next atom in each bin 00062 00063 int nstencil; // # of bins in stencil 00064 int *stencil; // stencil list of bin offsets 00065 00066 int mbins; // binning parameters 00067 int mbinx,mbiny,mbinz; 00068 int mbinxlo,mbinylo,mbinzlo; 00069 double binsizex,binsizey,binsizez; 00070 double bininvx,bininvy,bininvz; 00071 00072 void binatoms(Atom &); // bin all atoms 00073 double bindist(int, int, int); // distance between binx 00074 int coord2bin(double, double, double); // mapping atom coord to a bin 00075 }; 00076 00077 #endif