apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-09-25 16:02:56 -04:00
parent 2e3fc4c054
commit e1bc3a4ade

View File

@ -47,10 +47,11 @@ Copyright 2022 Yury Lysogorskiy^1, Anton Bochkarev^1, Matous Mrovec^1, Ralf Drau
//#include "compute_pace_extrapolation.h" //#include "compute_pace_extrapolation.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
struct ACEALImpl { struct ACEALImpl {
ACEALImpl() : basis_set(nullptr), ace(nullptr), ctilde_basis_set(nullptr), rec_ace(nullptr) {} ACEALImpl() : basis_set(nullptr), ace(nullptr), ctilde_basis_set(nullptr), rec_ace(nullptr) {}
~ACEALImpl() { ~ACEALImpl()
{
delete basis_set; delete basis_set;
delete ace; delete ace;
@ -62,7 +63,7 @@ namespace LAMMPS_NS {
ACEBEvaluator *ace; ACEBEvaluator *ace;
ACECTildeBasisSet *ctilde_basis_set; ACECTildeBasisSet *ctilde_basis_set;
ACERecursiveEvaluator *rec_ace; ACERecursiveEvaluator *rec_ace;
}; };
} // namespace LAMMPS_NS } // namespace LAMMPS_NS
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -78,14 +79,16 @@ static char const *const elements_pace_al[] = {
"Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr"}; "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr"};
static constexpr int elements_num_pace_al = sizeof(elements_pace_al) / sizeof(const char *); static constexpr int elements_num_pace_al = sizeof(elements_pace_al) / sizeof(const char *);
int AtomicNumberByName_pace_al(char *elname) { int AtomicNumberByName_pace_al(char *elname)
{
for (int i = 1; i < elements_num_pace_al; i++) for (int i = 1; i < elements_num_pace_al; i++)
if (strcmp(elname, elements_pace_al[i]) == 0) return i; if (strcmp(elname, elements_pace_al[i]) == 0) return i;
return -1; return -1;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairPACEExtrapolation::PairPACEExtrapolation(LAMMPS *lmp) : Pair(lmp) { PairPACEExtrapolation::PairPACEExtrapolation(LAMMPS *lmp) : Pair(lmp)
{
single_enable = 0; single_enable = 0;
restartinfo = 0; restartinfo = 0;
one_coeff = 1; one_coeff = 1;
@ -102,7 +105,8 @@ PairPACEExtrapolation::PairPACEExtrapolation(LAMMPS *lmp) : Pair(lmp) {
check if allocated, since class can be destructed when incomplete check if allocated, since class can be destructed when incomplete
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
PairPACEExtrapolation::~PairPACEExtrapolation() { PairPACEExtrapolation::~PairPACEExtrapolation()
{
if (copymode) return; if (copymode) return;
delete aceimpl; delete aceimpl;
@ -118,7 +122,8 @@ PairPACEExtrapolation::~PairPACEExtrapolation() {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairPACEExtrapolation::compute(int eflag, int vflag) { void PairPACEExtrapolation::compute(int eflag, int vflag)
{
int i, j, ii, jj, inum, jnum; int i, j, ii, jj, inum, jnum;
double delx, dely, delz, evdwl; double delx, dely, delz, evdwl;
double fij[3]; double fij[3];
@ -175,7 +180,6 @@ void PairPACEExtrapolation::compute(int eflag, int vflag) {
if (jnum > max_jnum) max_jnum = jnum; if (jnum > max_jnum) max_jnum = jnum;
} }
if (flag_compute_extrapolation_grade) if (flag_compute_extrapolation_grade)
aceimpl->ace->resize_neighbours_cache(max_jnum); aceimpl->ace->resize_neighbours_cache(max_jnum);
else else
@ -211,7 +215,8 @@ void PairPACEExtrapolation::compute(int eflag, int vflag) {
// 'compute_atom' will update the `ace->e_atom` and `ace->neighbours_forces(jj, alpha)` arrays and max_gamma_grade // 'compute_atom' will update the `ace->e_atom` and `ace->neighbours_forces(jj, alpha)` arrays and max_gamma_grade
if (flag_compute_extrapolation_grade) { if (flag_compute_extrapolation_grade) {
extrapolation_grade_gamma[i] = aceimpl->ace->max_gamma_grade;; extrapolation_grade_gamma[i] = aceimpl->ace->max_gamma_grade;
;
} }
Array2D<DOUBLE_TYPE> &neighbours_forces = Array2D<DOUBLE_TYPE> &neighbours_forces =
@ -244,7 +249,6 @@ void PairPACEExtrapolation::compute(int eflag, int vflag) {
-delz); -delz);
} }
// tally energy contribution // tally energy contribution
if (eflag) { if (eflag) {
// evdwl = energy of atom I // evdwl = energy of atom I
@ -265,7 +269,8 @@ void PairPACEExtrapolation::compute(int eflag, int vflag) {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void PairPACEExtrapolation::allocate() { void PairPACEExtrapolation::allocate()
{
allocated = 1; allocated = 1;
int n = atom->ntypes; int n = atom->ntypes;
@ -279,7 +284,8 @@ void PairPACEExtrapolation::allocate() {
global settings global settings
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairPACEExtrapolation::settings(int narg, char **arg) { void PairPACEExtrapolation::settings(int narg, char **arg)
{
if (narg > 0) { if (narg > 0) {
error->all(FLERR, error->all(FLERR,
"Illegal pair_style command. Correct form:\n\tpair_style pace/extrapolation "); "Illegal pair_style command. Correct form:\n\tpair_style pace/extrapolation ");
@ -294,7 +300,8 @@ void PairPACEExtrapolation::settings(int narg, char **arg) {
set coeffs for one or more type pairs set coeffs for one or more type pairs
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairPACEExtrapolation::coeff(int narg, char **arg) { void PairPACEExtrapolation::coeff(int narg, char **arg)
{
if (narg < 5) if (narg < 5)
error->all(FLERR, error->all(FLERR,
@ -394,7 +401,8 @@ void PairPACEExtrapolation::coeff(int narg, char **arg) {
init specific to this pair style init specific to this pair style
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void PairPACEExtrapolation::init_style() { void PairPACEExtrapolation::init_style()
{
if (atom->tag_enable == 0) error->all(FLERR, "Pair style PACE requires atom IDs"); if (atom->tag_enable == 0) error->all(FLERR, "Pair style PACE requires atom IDs");
if (force->newton_pair == 0) error->all(FLERR, "Pair style PACE requires newton pair on"); if (force->newton_pair == 0) error->all(FLERR, "Pair style PACE requires newton pair on");
@ -406,7 +414,8 @@ void PairPACEExtrapolation::init_style() {
init for one type pair i,j and corresponding j,i init for one type pair i,j and corresponding j,i
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double PairPACEExtrapolation::init_one(int i, int j) { double PairPACEExtrapolation::init_one(int i, int j)
{
if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set");
//cutoff from the basis set's radial functions settings //cutoff from the basis set's radial functions settings
scale[j][i] = scale[i][j]; scale[j][i] = scale[i][j];
@ -416,11 +425,11 @@ double PairPACEExtrapolation::init_one(int i, int j) {
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
extract method for extracting value of scale variable extract method for extracting value of scale variable
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void *PairPACEExtrapolation::extract(const char *str, int &dim) { void *PairPACEExtrapolation::extract(const char *str, int &dim)
{
//check if str=="gamma_flag" then compute extrapolation grades on this iteration //check if str=="gamma_flag" then compute extrapolation grades on this iteration
dim = 0; dim = 0;
if (strcmp(str, "gamma_flag")==0) if (strcmp(str, "gamma_flag") == 0) return (void *) &flag_compute_extrapolation_grade;
return (void *) &flag_compute_extrapolation_grade;
dim = 2; dim = 2;
if (strcmp(str, "scale") == 0) return (void *) scale; if (strcmp(str, "scale") == 0) return (void *) scale;
@ -435,7 +444,8 @@ void *PairPACEExtrapolation::extract(const char *str, int &dim) {
1 or more = # of columns in per-atom array 1 or more = # of columns in per-atom array
return NULL if str is not recognized return NULL if str is not recognized
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void *PairPACEExtrapolation::extract_peratom(const char *str, int &ncol) { void *PairPACEExtrapolation::extract_peratom(const char *str, int &ncol)
{
if (strcmp(str, "gamma") == 0) { if (strcmp(str, "gamma") == 0) {
ncol = 0; ncol = 0;
return (void *) extrapolation_grade_gamma; return (void *) extrapolation_grade_gamma;