1 /* ----------------------------------------------------------------------
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    Contributing authors: Christopher Barrett (MSU) barrett@me.msstate.edu
15                               Doyl Dickel (MSU) doyl@me.msstate.edu
16     ----------------------------------------------------------------------*/
17 /*
18 “The research described and the resulting data presented herein, unless
19 otherwise noted, was funded under PE 0602784A, Project T53 "Military
20 Engineering Applied Research", Task 002 under Contract No. W56HZV-17-C-0095,
21 managed by the U.S. Army Combat Capabilities Development Command (CCDC) and
22 the Engineer Research and Development Center (ERDC).  The work described in
23 this document was conducted at CAVS, MSU.  Permission was granted by ERDC
24 to publish this information. Any opinions, findings and conclusions or
25 recommendations expressed in this material are those of the author(s) and
26 do not necessarily reflect the views of the United States Army.​”
27 
28 DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
29  */
30 
31 #include "rann_fingerprint.h"
32 #include "pair_rann.h"
33 
34 #include <cmath>
35 
36 using namespace LAMMPS_NS::RANN;
37 
Fingerprint(PairRANN * _pair)38 Fingerprint::Fingerprint(PairRANN *_pair)
39 {
40   spin = false;
41   screen = false;
42   empty = true;
43   fullydefined = false;
44   n_body_type = 0;
45   style = "empty";
46   pair = _pair;
47 }
48 
49 // Smooth cutoff, goes from 1 to zero over the interval rc-dr to rc.
50 // Same as MEAM uses. Used by generateradialtable and generatexpcuttable.
51 
cutofffunction(double r,double rc,double dr)52 double Fingerprint::cutofffunction(double r, double rc, double dr)
53 {
54   double out;
55   if (r < (rc - dr))
56     out = 1;
57   else if (r > rc)
58     out = 0;
59   else {
60     out = 1 - (rc - r) / dr;
61     out *= out;
62     out *= out;
63     out = 1 - out;
64     out *= out;
65   }
66   return out;
67 }
68 
generate_rinvssqrttable()69 void Fingerprint::generate_rinvssqrttable()
70 {
71   int buf = 5;
72   int m;
73   double r1;
74   double cutmax = pair->cutmax;
75   int res = pair->res;
76   rinvsqrttable = new double[res + buf];
77   for (m = 0; m < (res + buf); m++) {
78     r1 = cutmax * cutmax * (double) (m) / (double) (res);
79     rinvsqrttable[m] = 1 / sqrt(r1);
80   }
81 }
82