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 /* ----------------------------------------------------------------------
15    Contributing author: Mingjian Wen (University of Minnesota)
16    e-mail: wenxx151@umn.edu
17 
18    This implements the DRIP model as described in
19    M. Wen, S. Carr, S. Fang, E. Kaxiras, and E. B. Tadmor,
20    Phys. Rev. B, 98, 235404 (2018).
21 ------------------------------------------------------------------------- */
22 
23 #ifdef PAIR_CLASS
24 // clang-format off
25 PairStyle(drip, PairDRIP);
26 // clang-format on
27 #else
28 
29 #ifndef LMP_PAIR_DRIP_H
30 #define LMP_PAIR_DRIP_H
31 
32 #include "pair.h"
33 
34 namespace LAMMPS_NS {
35 
36 class PairDRIP : public Pair {
37  public:
38   PairDRIP(class LAMMPS *);
39   virtual ~PairDRIP();
40 
41   virtual void compute(int, int);
42   void settings(int, char **);
43   void coeff(int, char **);
44   double init_one(int, int);
45   void init_style();
46 
47   static constexpr int NPARAMS_PER_LINE = 15;
48   typedef double V3[3];
49 
50  protected:
51   struct Param {
52     int ielement, jelement;
53     double C0, C2, C4, C, delta, lambda, A, z0, B, eta, rhocut, rcut, ncut;
54     double rhocutsq, rcutsq, ncutsq;
55   };
56   Param *params;          // parameter set for I-J interactions
57   int **nearest3neigh;    // nearest 3 neighbors of atoms
58   double cutmax;          // max cutoff for all species
59 
60   void read_file(char *);
61   void allocate();
62 
63   // DRIP specific functions
64   double calc_attractive(Param &, double const, double const *, double *const, double *const);
65 
66   double calc_repulsive(int const, int const, Param &, double const, double const *, double const *,
67                         V3 const *, V3 const *, V3 const *, V3 const *, double *const,
68                         double *const);
69 
70   void find_nearest3neigh();
71 
72   void calc_normal(int const, double *const, V3 *const, V3 *const, V3 *const, V3 *const);
73 
74   void get_drhosqij(double const *, double const *, V3 const *, V3 const *, V3 const *, V3 const *,
75                     double *const, double *const, double *const, double *const, double *const);
76 
77   double td(double, double, double, double, double const *const, double, const double *const,
78             double &, double &);
79 
80   double dihedral(const int, const int, Param &, double const, double &, double *const,
81                   double *const, double *const, double *const, double *const, double *const,
82                   double *const, double *const);
83 
84   double deriv_cos_omega(double const *, double const *, double const *, double const *,
85                          double *const, double *const, double *const, double *const);
86 
87   double tap(double, double, double &);
88 
89   double tap_rho(double, double, double &);
90 
91   void deriv_cross(double const *, double const *, double const *, double *const, V3 *const,
92                    V3 *const, V3 *const);
93 };
94 }    // namespace LAMMPS_NS
95 
96 #endif
97 #endif
98 
99 /* ERROR/WARNING messages:
100 
101 E: Illegal ... command
102 
103 Self-explanatory.  Check the input script syntax and compare to the
104 documentation for the command.  You can use -echo screen as a
105 command-line option when running LAMMPS to see the offending line.
106 
107 E: Incorrect args for pair coefficients
108 
109 Self-explanatory.  Check the input script or data file.
110 
111 E: All pair coeffs are not set
112 
113 All pair coefficients must be set in the data file or by the
114 pair_coeff command before running a simulation.
115 
116 E: No enough neighbors to construct normal
117 
118 Cannot find three neighbors within cutoff of the target atom.
119 Check the configuration.
120 
121 */
122