1 /* -*- c++ -*- ---------------------------------------------------------- 2 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator 3 https://www.lammps.org/, Sandia National Laboratories 4 Steve Plimpton, sjplimp@sandia.gov 5 6 Copyright (2003) Sandia Corporation. Under the terms of Contract 7 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains 8 certain rights in this software. This software is distributed under 9 the GNU General Public License. 10 11 See the README file in the top-level LAMMPS directory. 12 ------------------------------------------------------------------------- */ 13 14 #ifdef PAIR_CLASS 15 // clang-format off 16 PairStyle(gw,PairGW); 17 // clang-format on 18 #else 19 20 #ifndef LMP_PAIR_GW_H 21 #define LMP_PAIR_GW_H 22 23 #include "pair.h" 24 25 namespace LAMMPS_NS { 26 27 class PairGW : public Pair { 28 public: 29 PairGW(class LAMMPS *); 30 virtual ~PairGW(); 31 virtual void compute(int, int); 32 void settings(int, char **); 33 void coeff(int, char **); 34 void init_style(); 35 double init_one(int, int); 36 37 static constexpr int NPARAMS_PER_LINE = 17; 38 39 protected: 40 struct Param { 41 double lam1, lam2, lam3; 42 double c, d, h; 43 double gamma, powerm; 44 double powern, beta; 45 double biga, bigb, bigd, bigr; 46 double cut, cutsq; 47 double c1, c2, c3, c4; 48 int ielement, jelement, kelement; 49 int powermint; 50 double Z_i, Z_j; 51 double ZBLcut, ZBLexpscale; 52 }; 53 54 Param *params; // parameter set for an I-J-K interaction 55 double cutmax; // max cutoff for all elements 56 57 int **pages; // neighbor list pages 58 int maxlocal; // size of numneigh, firstneigh arrays 59 int maxpage; // # of pages currently allocated 60 int pgsize; // size of neighbor page 61 int oneatom; // max # of neighbors for one atom 62 63 int *GW_numneigh; // # of pair neighbors for each atom 64 int **GW_firstneigh; // ptr to 1st neighbor of each atom 65 66 void GW_neigh(); 67 void add_pages(int howmany = 1); 68 69 void allocate(); 70 virtual void read_file(char *); 71 void setup_params(); 72 virtual void repulsive(Param *, double, double &, int, double &); 73 double zeta(Param *, double, double, double *, double *); 74 virtual void force_zeta(Param *, double, double, double &, double &, int, double &); 75 void attractive(Param *, double, double, double, double *, double *, double *, double *, 76 double *); 77 78 double gw_fc(double, Param *); 79 double gw_fc_d(double, Param *); 80 virtual double gw_fa(double, Param *); 81 virtual double gw_fa_d(double, Param *); 82 double gw_bij(double, Param *); 83 double gw_bij_d(double, Param *); 84 85 void gw_zetaterm_d(double, double *, double, double *, double, double *, double *, double *, 86 Param *); 87 void costheta_d(double *, double, double *, double, double *, double *, double *); 88 89 // inlined functions for efficiency 90 gw_gijk(const double costheta,const Param * const param)91 inline double gw_gijk(const double costheta, const Param *const param) const 92 { 93 const double gw_c = param->c * param->c; 94 const double gw_d = param->d * param->d; 95 const double hcth = param->h - costheta; 96 97 //printf("gw_gijk: gw_c=%f gw_d=%f hcth=%f=%f-%f\n", gw_c, gw_d, hcth, param->h, costheta); 98 99 return param->gamma * (1.0 + gw_c / gw_d - gw_c / (gw_d + hcth * hcth)); 100 } 101 gw_gijk_d(const double costheta,const Param * const param)102 inline double gw_gijk_d(const double costheta, const Param *const param) const 103 { 104 const double gw_c = param->c * param->c; 105 const double gw_d = param->d * param->d; 106 const double hcth = param->h - costheta; 107 const double numerator = -2.0 * gw_c * hcth; 108 const double denominator = 1.0 / (gw_d + hcth * hcth); 109 return param->gamma * numerator * denominator * denominator; 110 } 111 }; 112 113 } // namespace LAMMPS_NS 114 115 #endif 116 #endif 117 118 /* ERROR/WARNING messages: 119 120 E: Illegal ... command 121 122 Self-explanatory. Check the input script syntax and compare to the 123 documentation for the command. You can use -echo screen as a 124 command-line option when running LAMMPS to see the offending line. 125 126 E: Incorrect args for pair coefficients 127 128 Self-explanatory. Check the input script or data file. 129 130 E: Pair style GW requires atom IDs 131 132 This is a requirement to use the GW potential. 133 134 E: Pair style GW requires newton pair on 135 136 See the newton command. This is a restriction to use the GW 137 potential. 138 139 E: All pair coeffs are not set 140 141 All pair coefficients must be set in the data file or by the 142 pair_coeff command before running a simulation. 143 144 E: Cannot open GW potential file %s 145 146 The specified GW potential file cannot be opened. Check that the 147 path and name are correct. 148 149 E: Incorrect format in GW potential file 150 151 Incorrect number of words per line in the potential file. 152 153 E: Illegal GW parameter 154 155 One or more of the coefficients defined in the potential file is 156 invalid. 157 158 E: Potential file has duplicate entry 159 160 The potential file has more than one entry for the same element. 161 162 E: Potential file is missing an entry 163 164 The potential file does not have a needed entry. 165 166 */ 167