From 769183c94f1f39dbe2c18042b43bb1da154d7abd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 26 May 2021 15:40:15 -0400 Subject: [PATCH] simplify and reformat --- src/USER-RANN/rann_fingerprint.cpp | 78 +++++++------------------- src/USER-RANN/rann_fingerprint.h | 88 +++++++++++++++++++----------- 2 files changed, 76 insertions(+), 90 deletions(-) diff --git a/src/USER-RANN/rann_fingerprint.cpp b/src/USER-RANN/rann_fingerprint.cpp index c417a0c497..b90e04f9a5 100644 --- a/src/USER-RANN/rann_fingerprint.cpp +++ b/src/USER-RANN/rann_fingerprint.cpp @@ -1,4 +1,4 @@ -/* -*- c++ -*- ---------------------------------------------------------- +/* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/ Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov @@ -43,74 +43,36 @@ Fingerprint::Fingerprint(PairRANN *_pair) pair = _pair; } -Fingerprint::~Fingerprint() { +// Smooth cutoff, goes from 1 to zero over the interval rc-dr to rc. +// Same as MEAM uses. Used by generateradialtable and generatexpcuttable. -} - -bool Fingerprint::parse_values(std::string line,std::vector line1) { - return false; -} - -void Fingerprint::init(int *i,int id) { - -} - -void Fingerprint::allocate() { - -} - -void Fingerprint::compute_fingerprint(double *features,double *dfeaturesx,double *dfeaturesy,double * dfeaturesz, int ii,int sid,double *xn,double *yn,double*zn,int *tn,int jnum,int *jl) { - -} - -void Fingerprint::compute_fingerprint(double *features,double *dfeaturesx,double *dfeaturesy,double * dfeaturesz,double *Sik, double *dSikx, double*dSiky, double *dSikz, double *dSijkx, double *dSijky, double *dSijkz, bool *Bij, int ii,int sid,double *xn,double *yn,double*zn,int *tn,int jnum,int *jl) { - -} - -void Fingerprint::compute_fingerprint(double *features,double *dfeaturesx,double *dfeaturesy,double * dfeaturesz,double *sx, double *sy, double *sz, int ii,int sid,double *xn,double *yn,double*zn,int *tn,int jnum,int *jl) { - -} - -void Fingerprint::compute_fingerprint(double *features,double *dfeaturesx,double *dfeaturesy,double * dfeaturesz,double *sx, double *sy, double *sz, double *Sik, double *dSikx, double*dSiky, double *dSikz, double *dSijkx, double *dSijky, double *dSijkz, bool *Bij, int ii,int sid,double *xn,double *yn,double*zn,int *tn,int jnum,int *jl) { - -} - -void Fingerprint::write_values(FILE *fid) { - -} - -int Fingerprint::get_length() { - return 0; -} - -//Smooth cutoff, goes from 1 to zero over the interval rc-dr to rc. Same as MEAM uses. Used by generateradialtable and generatexpcuttable. -double Fingerprint::cutofffunction(double r,double rc, double dr) { +double Fingerprint::cutofffunction(double r, double rc, double dr) +{ double out; - if (r < (rc -dr))out=1; - else if (r>rc)out=0; + if (r < (rc - dr)) + out = 1; + else if (r > rc) + out = 0; else { - out = 1-(rc-r)/dr; - out *= out; - out *= out; - out = 1-out; - out *= out; + out = 1 - (rc - r) / dr; + out *= out; + out *= out; + out = 1 - out; + out *= out; } return out; } -void Fingerprint::generate_rinvssqrttable() { +void Fingerprint::generate_rinvssqrttable() +{ int buf = 5; int m; double r1; double cutmax = pair->cutmax; int res = pair->res; - rinvsqrttable = new double[res+buf]; - for (m=0;m<(res+buf);m++) { - r1 = cutmax*cutmax*(double)(m)/(double)(res); - rinvsqrttable[m] = 1/sqrt(r1); + rinvsqrttable = new double[res + buf]; + for (m = 0; m < (res + buf); m++) { + r1 = cutmax * cutmax * (double) (m) / (double) (res); + rinvsqrttable[m] = 1 / sqrt(r1); } } - - - - diff --git a/src/USER-RANN/rann_fingerprint.h b/src/USER-RANN/rann_fingerprint.h index ef362cc1c4..e4ca22ffe1 100644 --- a/src/USER-RANN/rann_fingerprint.h +++ b/src/USER-RANN/rann_fingerprint.h @@ -35,38 +35,62 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 #include "pair_rann.h" namespace LAMMPS_NS { - namespace RANN { - class Fingerprint { - public: - Fingerprint(PairRANN *); - virtual ~Fingerprint(); - virtual bool parse_values(std::string,std::vector); - virtual void write_values(FILE *); - virtual void init(int*,int); - virtual void allocate(); - void init_screen(int); - virtual void compute_fingerprint(double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);//no screen,no spin - virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);//screen - virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,int,int,double*,double*,double*,int*,int,int*);//spin - virtual void compute_fingerprint(double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,double*,bool*,int,int,double*,double*,double*,int*,int,int*);//spin,screen - virtual int get_length(); - virtual double cutofffunction(double,double, double); - virtual void generate_rinvssqrttable(); - bool spin; - bool screen; - int n_body_type;//i-j vs. i-j-k vs. i-j-k-l, etc. - bool empty; - bool fullydefined; - int startingneuron; - int id;//based on ordering of fingerprints listed for i-j in potential file - const char *style; - int* atomtypes; - double *rinvsqrttable; - double rc; - PairRANN *pair; - }; - } -} +namespace RANN { + class Fingerprint { + public: + Fingerprint(PairRANN *); + virtual ~Fingerprint() {} + virtual bool parse_values(std::string, std::vector) { return false; } + virtual void write_values(FILE *) {} + + virtual void init(int *, int) {} + virtual void allocate() {} + + void init_screen(int); + + //no screen,no spin + virtual void compute_fingerprint(double *, double *, double *, double *, int, int, double *, + double *, double *, int *, int, int *) + { + } + //screen + virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, bool *, int, + int, double *, double *, double *, int *, int, int *) + { + } + //spin + virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *, + double *, int, int, double *, double *, double *, int *, int, + int *) + { + } + //spin,screen + virtual void compute_fingerprint(double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, + double *, double *, bool *, int, int, double *, double *, + double *, int *, int, int *) + { + } + + virtual int get_length(){return 0}; + virtual double cutofffunction(double, double, double); + virtual void generate_rinvssqrttable(); + bool spin; + bool screen; + int n_body_type; //i-j vs. i-j-k vs. i-j-k-l, etc. + bool empty; + bool fullydefined; + int startingneuron; + int id; //based on ordering of fingerprints listed for i-j in potential file + const char *style; + int *atomtypes; + double *rinvsqrttable; + double rc; + PairRANN *pair; + }; +} // namespace RANN +} // namespace LAMMPS_NS #endif /* RANN_FINGERPRINT_H_ */