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(eim,PairEIM); 17 // clang-format on 18 #else 19 20 #ifndef LMP_PAIR_EIM_H 21 #define LMP_PAIR_EIM_H 22 23 #include "pair.h" 24 25 #include <map> 26 #include <utility> 27 28 namespace LAMMPS_NS { 29 30 class PairEIM : public Pair { 31 public: 32 PairEIM(class LAMMPS *); 33 virtual ~PairEIM(); 34 virtual void compute(int, int); 35 void settings(int, char **); 36 void coeff(int, char **); 37 void init_style(); 38 double init_one(int, int); 39 40 int pack_forward_comm(int, int *, double *, int, int *); 41 void unpack_forward_comm(int, int, double *); 42 int pack_reverse_comm(int, int, double *); 43 void unpack_reverse_comm(int, int *, double *); 44 double memory_usage(); 45 46 struct Setfl { 47 double division, rbig, rsmall; 48 int nr; 49 int *ielement, *tp; 50 double *mass, *negativity, *ra, *ri, *Ec, *q0; 51 double *rcutphiA, *rcutphiR, *Eb, *r0, *alpha, *beta, *rcutq, *Asigma, *rq, *rcutsigma, *Ac, 52 *zeta, *rs; 53 double dr, cut; 54 double ***Fij, ***Gij, ***phiij; 55 double **cuts; 56 }; 57 58 protected: 59 double **cutforcesq, cutmax; 60 int nmax; 61 double *rho, *fp; 62 int rhofp; 63 64 Setfl *setfl; 65 66 // potentials as array data 67 68 int nr; 69 int nFij, nGij, nphiij; 70 double **Fij, **Gij, **phiij; 71 int **type2Fij, **type2Gij, **type2phiij; 72 73 // potentials in spline form used for force computation 74 75 double dr, rdr; 76 double *negativity, *q0; 77 double ***Fij_spline, ***Gij_spline, ***phiij_spline; 78 79 void allocate(); 80 void array2spline(); 81 void interpolate(int, double, double *, double **, double); 82 83 double funccutoff(double, double, double); 84 double funcphi(int, int, double); 85 double funcsigma(int, int, double); 86 double funccoul(int, int, double); 87 88 void read_file(char *); 89 void deallocate_setfl(); 90 void file2array(); 91 }; 92 93 class EIMPotentialFileReader : protected Pointers { 94 std::string filename; 95 static const int MAXLINE = 1024; 96 char line[MAXLINE]; 97 double conversion_factor; 98 99 void parse(FILE *fp); 100 char *next_line(FILE *fp); 101 std::pair<std::string, std::string> get_pair(const std::string &a, const std::string &b); 102 103 public: 104 EIMPotentialFileReader(class LAMMPS *lmp, const std::string &filename, 105 const int auto_convert = 0); 106 107 void get_global(PairEIM::Setfl *setfl); 108 void get_element(PairEIM::Setfl *setfl, int i, const std::string &name); 109 void get_pair(PairEIM::Setfl *setfl, int ij, const std::string &elemA, const std::string &elemB); 110 111 private: 112 // potential parameters 113 double division; 114 double rbig; 115 double rsmall; 116 117 struct ElementData { 118 int ielement; 119 double mass; 120 double negativity; 121 double ra; 122 double ri; 123 double Ec; 124 double q0; 125 }; 126 127 struct PairData { 128 double rcutphiA; 129 double rcutphiR; 130 double Eb; 131 double r0; 132 double alpha; 133 double beta; 134 double rcutq; 135 double Asigma; 136 double rq; 137 double rcutsigma; 138 double Ac; 139 double zeta; 140 double rs; 141 int tp; 142 }; 143 144 std::map<std::string, ElementData> elements; 145 std::map<std::pair<std::string, std::string>, PairData> pairs; 146 }; 147 148 } // namespace LAMMPS_NS 149 150 #endif 151 #endif 152 153 /* ERROR/WARNING messages: 154 155 E: Illegal ... command 156 157 Self-explanatory. Check the input script syntax and compare to the 158 documentation for the command. You can use -echo screen as a 159 command-line option when running LAMMPS to see the offending line. 160 161 E: Incorrect args for pair coefficients 162 163 Self-explanatory. Check the input script or data file. 164 165 E: Cannot open EIM potential file %s 166 167 The specified EIM potential file cannot be opened. Check that the 168 path and name are correct. 169 170 E: Could not grab global entry from EIM potential file 171 172 Self-explanatory. 173 174 E: Could not grab element entry from EIM potential file 175 176 Self-explanatory 177 178 E: Could not grab pair entry from EIM potential file 179 180 Self-explanatory. 181 182 */ 183