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.
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2010-01-12 09:37:48 +08:00
|
|
|
#ifndef LMP_PAIR_H
|
|
|
|
#define LMP_PAIR_H
|
2006-09-28 03:51:33 +08:00
|
|
|
|
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 Pair : protected Pointers {
|
2007-12-01 05:54:30 +08:00
|
|
|
friend class BondQuartic;
|
|
|
|
friend class DihedralCharmm;
|
2010-11-23 08:42:11 +08:00
|
|
|
friend class FixGPU;
|
2007-12-01 05:54:30 +08:00
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
public:
|
2007-01-30 08:22:05 +08:00
|
|
|
double eng_vdwl,eng_coul; // accumulated energies
|
|
|
|
double virial[6]; // accumulated virial
|
2007-12-01 05:54:30 +08:00
|
|
|
double *eatom,**vatom; // accumulated per-atom energy/virial
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
double cutforce; // max cutoff for all atom pairs
|
2011-03-18 23:09:03 +08:00
|
|
|
double **cutsq; // cutoff sq for each atom pair
|
2007-01-30 08:22:05 +08:00
|
|
|
int **setflag; // 0/1 = whether each i,j has been set
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
int comm_forward; // size of forward communication (0 if none)
|
|
|
|
int comm_reverse; // size of reverse communication (0 if none)
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
int single_enable; // 1 if single() routine exists
|
|
|
|
int respa_enable; // 1 if inner/middle/outer rRESPA routines
|
|
|
|
int one_coeff; // 1 if allows only one coeff * * call
|
2008-08-13 22:39:45 +08:00
|
|
|
int no_virial_compute; // 1 if does not invoke virial_compute()
|
2011-03-18 23:09:03 +08:00
|
|
|
int ghostneigh; // 1 if pair style needs neighbors of ghosts
|
|
|
|
double **cutghost; // cutoff for each ghost pair
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
int tail_flag; // pair_modify flag for LJ tail correction
|
|
|
|
double etail,ptail; // energy/pressure tail corrections
|
|
|
|
double etail_ij,ptail_ij;
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2010-10-19 01:00:05 +08:00
|
|
|
int nextra; // # of extra quantities pair style calculates
|
|
|
|
double *pvector; // vector of extra pair quantities
|
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
class NeighList *list; // standard neighbor list used by most pairs
|
|
|
|
class NeighList *listhalf; // half list used by some pairs
|
|
|
|
class NeighList *listfull; // full list used by some pairs
|
2009-01-06 06:26:08 +08:00
|
|
|
class NeighList *listgranhistory; // granular history list used by some pairs
|
2007-10-04 00:22:30 +08:00
|
|
|
class NeighList *listinner; // rRESPA lists used by some pairs
|
|
|
|
class NeighList *listmiddle;
|
|
|
|
class NeighList *listouter;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
Pair(class LAMMPS *);
|
2007-12-01 05:54:30 +08:00
|
|
|
virtual ~Pair();
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
// top-level Pair methods
|
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
void init();
|
2010-10-22 22:31:20 +08:00
|
|
|
void reinit();
|
2006-09-28 03:51:33 +08:00
|
|
|
double mix_energy(double, double, double, double);
|
|
|
|
double mix_distance(double, double);
|
|
|
|
void write_file(int, char **);
|
|
|
|
void init_bitmap(double, double, int, int &, int &, int &, int &);
|
|
|
|
virtual void modify_params(int, char **);
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
// general child-class methods
|
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
virtual void compute(int, int) = 0;
|
|
|
|
virtual void compute_inner() {}
|
|
|
|
virtual void compute_middle() {}
|
|
|
|
virtual void compute_outer(int, int) {}
|
2007-10-04 00:22:30 +08:00
|
|
|
|
2008-01-03 03:24:46 +08:00
|
|
|
virtual double single(int, int, int, int,
|
2010-09-04 07:12:51 +08:00
|
|
|
double, double, double, double &) {return 0.0;}
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-10-04 00:22:30 +08:00
|
|
|
virtual void settings(int, char **) = 0;
|
|
|
|
virtual void coeff(int, char **) = 0;
|
|
|
|
|
|
|
|
virtual void init_style();
|
|
|
|
virtual void init_list(int, class NeighList *);
|
|
|
|
virtual double init_one(int, int) {return 0.0;}
|
|
|
|
|
2006-09-28 03:51:33 +08:00
|
|
|
virtual void write_restart(FILE *) {}
|
|
|
|
virtual void read_restart(FILE *) {}
|
|
|
|
virtual void write_restart_settings(FILE *) {}
|
|
|
|
virtual void read_restart_settings(FILE *) {}
|
|
|
|
|
2007-03-16 05:49:48 +08:00
|
|
|
virtual int pack_comm(int, int *, double *, int, int *) {return 0;}
|
2006-09-28 03:51:33 +08:00
|
|
|
virtual void unpack_comm(int, int, double *) {}
|
|
|
|
virtual int pack_reverse_comm(int, int, double *) {return 0;}
|
|
|
|
virtual void unpack_reverse_comm(int, int *, double *) {}
|
2007-12-01 05:54:30 +08:00
|
|
|
virtual double memory_usage();
|
2007-01-30 08:22:05 +08:00
|
|
|
|
|
|
|
// specific child-class methods for certain Pair styles
|
|
|
|
|
2010-10-23 05:27:35 +08:00
|
|
|
virtual void *extract(char *, int &) {return NULL;}
|
2007-10-05 01:57:04 +08:00
|
|
|
virtual void swap_eam(double *, double **) {}
|
2007-10-11 06:22:16 +08:00
|
|
|
virtual void reset_dt() {}
|
2010-08-26 01:03:55 +08:00
|
|
|
virtual void min_xf_pointers(int, double **, double **) {}
|
|
|
|
virtual void min_xf_get(int) {}
|
|
|
|
virtual void min_x_set(int) {}
|
2007-01-30 08:22:05 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int allocated; // 0/1 = whether arrays are allocated
|
|
|
|
|
|
|
|
// pair_modify settings
|
|
|
|
int offset_flag,mix_flag; // flags for offset and mixing
|
|
|
|
int ncoultablebits; // size of Coulomb table
|
|
|
|
double tabinner; // inner cutoff for Coulomb table
|
2009-10-30 05:53:53 +08:00
|
|
|
|
|
|
|
// custom data type for accessing Coulomb tables
|
|
|
|
|
2009-10-30 06:03:02 +08:00
|
|
|
typedef union {int i; float f;} union_int_float_t;
|
2007-12-01 05:54:30 +08:00
|
|
|
|
|
|
|
double THIRD;
|
|
|
|
|
|
|
|
int evflag; // energy,virial settings
|
|
|
|
int eflag_either,eflag_global,eflag_atom;
|
|
|
|
int vflag_either,vflag_global,vflag_atom;
|
|
|
|
int vflag_fdotr;
|
|
|
|
int maxeatom,maxvatom;
|
|
|
|
|
|
|
|
void ev_setup(int, int);
|
|
|
|
void ev_tally(int, int, int, int, double, double, double,
|
|
|
|
double, double, double);
|
2009-11-03 04:59:26 +08:00
|
|
|
void ev_tally_full(int, double, double, double, double, double, double);
|
2007-12-01 05:54:30 +08:00
|
|
|
void ev_tally_xyz(int, int, int, int, double, double,
|
|
|
|
double, double, double, double, double, double);
|
2010-08-09 22:42:03 +08:00
|
|
|
void ev_tally_xyz_full(int, double, double,
|
|
|
|
double, double, double, double, double, double);
|
2007-12-01 05:54:30 +08:00
|
|
|
void ev_tally3(int, int, int, double, double,
|
|
|
|
double *, double *, double *, double *);
|
2008-01-18 01:01:57 +08:00
|
|
|
void ev_tally4(int, int, int, int, double,
|
|
|
|
double *, double *, double *, double *, double *, double *);
|
|
|
|
void ev_tally_list(int, int *, double, double *);
|
|
|
|
void v_tally2(int, int, double, double *);
|
|
|
|
void v_tally3(int, int, int, double *, double *, double *, double *);
|
|
|
|
void v_tally4(int, int, int, int, double *, double *, double *,
|
2007-12-01 05:54:30 +08:00
|
|
|
double *, double *, double *);
|
2009-06-09 02:29:00 +08:00
|
|
|
void v_tally_tensor(int, int, int, int,
|
|
|
|
double, double, double, double, double, double);
|
2007-12-01 05:54:30 +08:00
|
|
|
void virial_compute();
|
2011-04-06 03:10:43 +08:00
|
|
|
|
|
|
|
inline int sbmask(int j) {
|
|
|
|
return j >> SBBITS & 3;
|
|
|
|
}
|
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
|