From 6dded43b2c6681a56bb2c03b25dd5966c6cfe93c Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 12:07:18 -0400 Subject: [PATCH 01/65] Added ml-uf3 src files --- src/ML-UF3/pair_uf3.cpp | 1312 ++++++++++++++++++++++++++++ src/ML-UF3/pair_uf3.h | 88 ++ src/ML-UF3/uf3_bspline_basis2.cpp | 88 ++ src/ML-UF3/uf3_bspline_basis2.h | 32 + src/ML-UF3/uf3_bspline_basis3.cpp | 324 +++++++ src/ML-UF3/uf3_bspline_basis3.h | 33 + src/ML-UF3/uf3_pair_bspline.cpp | 144 +++ src/ML-UF3/uf3_pair_bspline.h | 55 ++ src/ML-UF3/uf3_triplet_bspline.cpp | 347 ++++++++ src/ML-UF3/uf3_triplet_bspline.h | 56 ++ 10 files changed, 2479 insertions(+) create mode 100644 src/ML-UF3/pair_uf3.cpp create mode 100644 src/ML-UF3/pair_uf3.h create mode 100644 src/ML-UF3/uf3_bspline_basis2.cpp create mode 100644 src/ML-UF3/uf3_bspline_basis2.h create mode 100644 src/ML-UF3/uf3_bspline_basis3.cpp create mode 100644 src/ML-UF3/uf3_bspline_basis3.h create mode 100644 src/ML-UF3/uf3_pair_bspline.cpp create mode 100644 src/ML-UF3/uf3_pair_bspline.h create mode 100644 src/ML-UF3/uf3_triplet_bspline.cpp create mode 100644 src/ML-UF3/uf3_triplet_bspline.h diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp new file mode 100644 index 0000000000..4188c51ac0 --- /dev/null +++ b/src/ML-UF3/pair_uf3.cpp @@ -0,0 +1,1312 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + * Contributing authors: Ajinkya Hire (U of Florida), + * Hendrik Kraß (U of Constance), + * Richard Hennig (U of Florida) + * ---------------------------------------------------------------------- */ + +#include "pair_uf3.h" +#include "uf3_pair_bspline.h" +#include "uf3_triplet_bspline.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" +#include "text_file_reader.h" + +#include + +using namespace LAMMPS_NS; +using namespace MathConst; + +PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp) +{ + single_enable = 1; // 1 if single() routine exists + restartinfo = 0; // 1 if pair style writes restart info + maxshort = 10; + neighshort = nullptr; + centroidstressflag = CENTROID_AVAIL; + manybody_flag = 1; + one_coeff = 0; //if 1 then allow only one coeff call of form 'pair_coeff * *' + //by setting it to 0 we will allow multiple 'pair_coeff' calls + bsplines_created = 0; +} + +PairUF3::~PairUF3() +{ + if (copymode) return; + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(cut); + + if (pot_3b) { + memory->destroy(setflag_3b); + memory->destroy(cut_3b); + memory->destroy(cut_3b_list); + memory->destroy(min_cut_3b); + memory->destroy(neighshort); + } + } +} + +/* ---------------------------------------------------------------------- + * global settings + * ---------------------------------------------------------------------- */ + +void PairUF3::settings(int narg, char **arg) +{ + + if (narg != 2) + error->all(FLERR, "UF3: Invalid number of argument in pair settings\n\ + Are you running 2-body or 2 & 3-body UF potential\n\ + Also how many elements?"); + nbody_flag = utils::numeric(FLERR, arg[0], true, lmp); + num_of_elements = utils::numeric(FLERR, arg[1], true, lmp); // atom->ntypes; + if (num_of_elements != atom->ntypes) { + if (comm->me == 0) + utils::logmesg(lmp, "\nUF3: Number of elements provided in the input file and \ +number of elements detected by lammps in the structure are not same\n\ + proceed with caution\n"); + } + if (nbody_flag == 2) { + pot_3b = false; + n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; + tot_pot_files = n2body_pot_files; + } else if (nbody_flag == 3) { + pot_3b = true; + n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; + n3body_pot_files = num_of_elements * (num_of_elements * (num_of_elements + 1) / 2); + tot_pot_files = n2body_pot_files + n3body_pot_files; + } else + error->all(FLERR, "UF3: UF3 not yet implemented for {}-body", nbody_flag); +} + +/* ---------------------------------------------------------------------- + * set coeffs for one or more type pairs + * ---------------------------------------------------------------------- */ +void PairUF3::coeff(int narg, char **arg) +{ + if (!allocated) allocate(); + + if (narg != 3 && narg != 5){ + /*error->warning(FLERR, "\nUF3: WARNING!! It seems that you are using the \n\ + older style of specifying UF3 POT files. This style of listing \n\ + all the potential files on a single line will be depcrecated in \n\ + the next version of ML-UF3");*/ + if (narg == tot_pot_files + 2) + error->all(FLERR, "UF3 The old style of listing all the potential files\n\ + on a single line is depcrecated"); + else + error->all(FLERR, "UF3: Invalid number of argument in pair coeff;\n\ + Provide the species number followed by the LAMMPS POT file\n\ + Eg. 'pair_coeff 1 1 POT_FILE' for 2-body and \n\ + 'pair_coeff 3b 1 2 2 POT_FILE' for 3-body."); + } + if (narg == 3 || narg == 5){ + int ilo, ihi, jlo, jhi, klo, khi; + if (narg == 3){ + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); + } + + if (narg == 5){ + utils::bounds(FLERR, arg[1], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[2], 1, atom->ntypes, jlo, jhi, error); + utils::bounds(FLERR, arg[3], 1, atom->ntypes, klo, khi, error); + } + + if (narg == 3){ + if (utils::strmatch(arg[0],".*\\*.*") || utils::strmatch(arg[1],".*\\*.*")){ + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { + if (comm->me == 0) + utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[2]); + uf3_read_pot_file(i,j,arg[2]); + } + } + } + + else{ + int i = utils::inumeric(FLERR, arg[0], true, lmp); + int j = utils::inumeric(FLERR, arg[1], true, lmp); + if (comm->me == 0) + utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[2]); + uf3_read_pot_file(i,j,arg[2]); + } + } + + if (narg == 5){ + if (!utils::strmatch(arg[0],"3b")) + error->all(FLERR, "UF3: Invalid argument. For 3-body the first argument\n\ + argument to pair_coeff needs to be 3b.\n\ + Example pair_coeff 3b 1 2 2 A_B_B."); + if (utils::strmatch(arg[1],".*\\*.*") || utils::strmatch(arg[2],".*\\*.*") || utils::strmatch(arg[3],".*\\*.*")){ + for (int i = ilo; i <= ihi; i++) { + for (int j = jlo; j <= jhi; j++) { + for (int k = MAX(klo, jlo); k <= khi; k++) { + if (comm->me == 0) + utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[4]); + uf3_read_pot_file(i,j,k,arg[4]); + } + } + } + } + else{ + if (comm->me == 0) + utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[4]); + int i = utils::inumeric(FLERR, arg[1], true, lmp); + int j = utils::inumeric(FLERR, arg[2], true, lmp); + int k = utils::inumeric(FLERR, arg[3], true, lmp); + uf3_read_pot_file(i,j,k,arg[4]); + } + } + } + + /*else{ + if (narg != tot_pot_files + 2) + error->all(FLERR,"UF3: Invalid number of argument in pair coeff; \n\ + Number of potential files provided is not correct"); + + error->warning(FLERR, "\nUF3: WARNING!! It seems that you are using the \n\ + older style of specifying UF3 POT files. This style of listing \n\ + all the potential files on a single line will be depcrecated in \n\ + the next version of ML-UF3"); + + // open UF3 potential file on all proc + for (int i = 2; i < narg; i++) { uf3_read_pot_file(arg[i]); } + if (!bsplines_created) create_bsplines(); + + // setflag check needed here + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + if (setflag[i][j] != 1) + error->all(FLERR,"UF3: Not all 2-body UF potentials are set, \n\ + missing potential file for {}-{} interaction",i, j); + } + } + + if (pot_3b) { + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = 1; k < num_of_elements + 1; k++) { + if (setflag_3b[i][j][k] != 1) + error->all(FLERR,"UF3: Not all 3-body UF potentials are set, \n\ + missing potential file for {}-{}-{} interaction", i, j, k); + } + } + } + } + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knot[i][j], n2b_coeff[i][j]); + UFBS2b[j][i] = UFBS2b[i][j]; + } + if (pot_3b) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = j; k < num_of_elements + 1; k++) { + std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); + UFBS3b[i][j][k] = + uf3_triplet_bspline(lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key]); + UFBS3b[i][k][j] = UFBS3b[i][j][k]; + } + } + } + } + }*/ +} + +void PairUF3::allocate() +{ + allocated = 1; + + // Contains info about wether UF potential were found for type i and j + memory->create(setflag, num_of_elements + 1, num_of_elements + 1, "pair:setflag"); + + // Contains info about 2-body cutoff distance for type i and j + // cutsq is the global variable + // Even though we are making cutsq don't manually change the default values + // Lammps take care of setting the value + memory->create(cutsq, num_of_elements + 1, num_of_elements + 1, "pair:cutsq"); + // cut is specific to this pair style. We will set the values in cut + memory->create(cut, num_of_elements + 1, num_of_elements + 1, "pair:cut"); + //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) + //1 = non-uniform knot spacing + memory->create(knot_spacing_type_2b, num_of_elements + 1, num_of_elements + 1, "pair:knot_spacing_2b"); + + // Contains knot_vect of 2-body potential for type i and j + n2b_knot.resize(num_of_elements + 1); + n2b_coeff.resize(num_of_elements + 1); + UFBS2b.resize(num_of_elements + 1); + for (int i = 1; i < num_of_elements + 1; i++) { + n2b_knot[i].resize(num_of_elements + 1); + n2b_coeff[i].resize(num_of_elements + 1); + UFBS2b[i].resize(num_of_elements + 1); + } + if (pot_3b) { + // Contains info about wether UF potential were found for type i, j and k + memory->create(setflag_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, + "pair:setflag_3b"); + // Contains info about 3-body cutoff distance for type i, j and k + memory->create(cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, + "pair:cut_3b"); + // Contains info about 3-body cutoff distance for type i, j and k + // for constructing 3-body list + memory->create(cut_3b_list, num_of_elements + 1, num_of_elements + 1, "pair:cut_3b_list"); + // Contains info about minimum 3-body cutoff distance for type i, j and k + memory->create(min_cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, 3, + "pair:min_cut_3b"); + //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) + //1 = non-uniform knot spacing + memory->create(knot_spacing_type_3b, num_of_elements + 1, num_of_elements + 1, + num_of_elements + 1, "pair:knot_spacing_3b"); + + + // setting cut_3b and setflag = 0 + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + cut_3b_list[i][j] = 0; + for (int k = 1; k < num_of_elements + 1; k++) { + cut_3b[i][j][k] = 0; + min_cut_3b[i][j][k][0] = 0; + min_cut_3b[i][j][k][1] = 0; + min_cut_3b[i][j][k][2] = 0; + } + } + } + n3b_knot_matrix.resize(num_of_elements + 1); + UFBS3b.resize(num_of_elements + 1); + for (int i = 1; i < num_of_elements + 1; i++) { + n3b_knot_matrix[i].resize(num_of_elements + 1); + UFBS3b[i].resize(num_of_elements + 1); + for (int j = 1; j < num_of_elements + 1; j++) { + n3b_knot_matrix[i][j].resize(num_of_elements + 1); + UFBS3b[i][j].resize(num_of_elements + 1); + } + } + memory->create(neighshort, maxshort, "pair:neighshort"); + } +} + +void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) +{ + utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {}\n", \ + potf_name, itype, jtype); + + if (!platform::file_is_readable(potf_name)) + error->all(FLERR, "UF3: {} file is not readable", potf_name); + + FILE *fp; + fp = utils::open_potential(potf_name, lmp, nullptr); + + TextFileReader txtfilereader(fp, "UF3:POTFP"); + txtfilereader.ignore_comments = false; + + std::string temp_line = txtfilereader.next_line(1); + Tokenizer file_header(temp_line); + + if (file_header.count() != 2) + error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found \n\ + {} word/s",potf_name,file_header.count()); + + if (file_header.contains("#UF3 POT") == 0) + error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n\ + files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); + + temp_line = txtfilereader.next_line(1); + ValueTokenizer fp2nd_line(temp_line); + + if (fp2nd_line.count() != 4) + error->all(FLERR, "UF3: Expected 4 words on 2nd line =>\n\ + nBody leading_trim trailing_trim type_of_knot_spacing\n\ + Found {}",temp_line); + + std::string nbody_on_file = fp2nd_line.next_string(); + if (utils::strmatch(nbody_on_file,"2B")) + utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n",potf_name); + else + error->all(FLERR, "UF3: Expected a 2B UF3 file but found {}", + nbody_on_file); + + int leading_trim = fp2nd_line.next_int(); + int trailing_trim = fp2nd_line.next_int(); + if (leading_trim != 0) + error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ + leading_trim=0\n"); + if (trailing_trim != 3) + error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ + trailing_trim=3\n"); + + std::string knot_type = fp2nd_line.next_string(); + if (utils::strmatch(knot_type,"uk")){ + utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with uniform\n\ + knot spacing\n",potf_name); + knot_spacing_type_2b[itype][jtype] = 0; + knot_spacing_type_2b[jtype][itype] = 0; + } + else if (utils::strmatch(knot_type,"nk")){ + utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with non-uniform\n\ + knot spacing\n",potf_name); + knot_spacing_type_2b[itype][jtype] = 1; + knot_spacing_type_2b[jtype][itype] = 1; + /*error->all(FLERR, "UF3: Current implementation only works with uniform\n\ + knot spacing");*/ + } + else + error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots)\n\ + Found {} on the 2nd line of {} pot file",knot_type,potf_name); + + temp_line = txtfilereader.next_line(1); + ValueTokenizer fp3rd_line(temp_line); + if (fp3rd_line.count() != 2) + error->all(FLERR, "UF3: Expected only 2 numbers on 3rd line =>\n\ + Rij_CUTOFF NUM_OF_KNOTS\n\ + Found {} number/s",fp3rd_line.count()); + + //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared + cut[itype][jtype] = fp3rd_line.next_double(); + cut[jtype][itype] = cut[itype][jtype]; + + int num_knots_2b = fp3rd_line.next_int(); + + temp_line = txtfilereader.next_line(num_knots_2b); + ValueTokenizer fp4th_line(temp_line); + + if (fp4th_line.count() != num_knots_2b) + error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", + num_knots_2b,fp4th_line.count()); + + n2b_knot[itype][jtype].resize(num_knots_2b); + n2b_knot[jtype][itype].resize(num_knots_2b); + for (int k = 0; k < num_knots_2b; k++) { + n2b_knot[itype][jtype][k] = fp4th_line.next_double(); + n2b_knot[jtype][itype][k] = n2b_knot[itype][jtype][k]; + } + + temp_line = txtfilereader.next_line(1); + ValueTokenizer fp5th_line(temp_line); + int num_of_coeff_2b = fp5th_line.next_int(); + + temp_line = txtfilereader.next_line(num_of_coeff_2b); + ValueTokenizer fp6th_line(temp_line); + + if (fp6th_line.count() != num_of_coeff_2b) + error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", + num_of_coeff_2b, fp6th_line.count()); + + n2b_coeff[itype][jtype].resize(num_of_coeff_2b); + n2b_coeff[jtype][itype].resize(num_of_coeff_2b); + for (int k = 0; k < num_of_coeff_2b; k++) { + n2b_coeff[itype][jtype][k] = fp6th_line.next_double(); + n2b_coeff[jtype][itype][k] = n2b_coeff[itype][jtype][k]; + } + + if (n2b_knot[itype][jtype].size() != n2b_coeff[itype][jtype].size() + 4) { + error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", + potf_name); + } + setflag[itype][jtype] = 1; + setflag[jtype][itype] = 1; +} + + +void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name) +{ + utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {} {}\n", + potf_name, itype, jtype, ktype); + + if (!platform::file_is_readable(potf_name)) + error->all(FLERR, "UF3: {} file is not readable", potf_name); + + FILE *fp; + fp = utils::open_potential(potf_name, lmp, nullptr); + + TextFileReader txtfilereader(fp, "UF3:POTFP"); + txtfilereader.ignore_comments = false; + + std::string temp_line = txtfilereader.next_line(1); + Tokenizer file_header(temp_line); + + if (file_header.count() != 2) + error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found \n\ + {} word/s",potf_name,file_header.count()); + + if (file_header.contains("#UF3 POT") == 0) + error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n\ + files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); + + temp_line = txtfilereader.next_line(1); + ValueTokenizer fp2nd_line(temp_line); + + if (fp2nd_line.count() != 4) + error->all(FLERR, "UF3: Expected 3 words on 2nd line =>\n\ + nBody leading_trim trailing_trim type_of_knot_spacing\n\ + Found {}",temp_line); + + std::string nbody_on_file = fp2nd_line.next_string(); + + if (utils::strmatch(nbody_on_file,"3B")) + utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential\n",potf_name); + else + error->all(FLERR, "UF3: Expected a 3B UF3 file but found {}", + nbody_on_file); + + int leading_trim = fp2nd_line.next_int(); + int trailing_trim = fp2nd_line.next_int(); + if (leading_trim != 0) + error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ + leading_trim=0\n"); + if (trailing_trim != 3) + error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ + trailing_trim=3\n"); + + std::string knot_type = fp2nd_line.next_string(); + if (utils::strmatch(knot_type,"uk")){ + utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with uniform\n\ + knot spacing\n",potf_name); + knot_spacing_type_3b[itype][jtype][ktype] = 0; + knot_spacing_type_3b[itype][ktype][jtype] = 0; + } + else if (utils::strmatch(knot_type,"nk")){ + utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with non-uniform\n\ + knot spacing\n",potf_name); + knot_spacing_type_3b[itype][jtype][ktype] = 1; + knot_spacing_type_3b[itype][ktype][jtype] = 1; + /*error->all(FLERR, "UF3: Current implementation only works with uniform\n\ + knot spacing");*/ + } + else + error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots)\n\ + Found {} on the 2nd line of {} pot file",knot_type,potf_name); + + temp_line = txtfilereader.next_line(6); + ValueTokenizer fp3rd_line(temp_line); + + if (fp3rd_line.count() != 6) + error->all(FLERR, "UF3: Expected only 6 numbers on 3rd line =>\n\ + Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ\n\ + Found {} number/s",fp3rd_line.count()); + + double cut3b_rjk = fp3rd_line.next_double(); + double cut3b_rij = fp3rd_line.next_double(); + double cut3b_rik = fp3rd_line.next_double(); + + if (cut3b_rij != cut3b_rik) { + error->all(FLERR, "UF3: rij!=rik, Current implementation only works for rij=rik"); + } + + if (2 * cut3b_rik != cut3b_rjk) { + error->all(FLERR, "UF3: 2rij=2rik!=rik, Current implementation only works \n\ + for 2rij=2rik!=rik"); + } + + cut_3b_list[itype][jtype] = std::max(cut3b_rij, cut_3b_list[itype][jtype]); + cut_3b_list[itype][ktype] = std::max(cut_3b_list[itype][ktype], cut3b_rik); + + cut_3b[itype][jtype][ktype] = cut3b_rij; + cut_3b[itype][ktype][jtype] = cut3b_rik; + + int num_knots_3b_jk = fp3rd_line.next_int(); + temp_line = txtfilereader.next_line(num_knots_3b_jk); + ValueTokenizer fp4th_line(temp_line); + + if (fp4th_line.count() != num_knots_3b_jk) + error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", + num_knots_3b_jk, fp4th_line.count()); + + + n3b_knot_matrix[itype][jtype][ktype].resize(3); + n3b_knot_matrix[itype][ktype][jtype].resize(3); + + n3b_knot_matrix[itype][jtype][ktype][0].resize(num_knots_3b_jk); + n3b_knot_matrix[itype][ktype][jtype][0].resize(num_knots_3b_jk); + + for (int i = 0; i < num_knots_3b_jk; i++) { + n3b_knot_matrix[itype][jtype][ktype][0][i] = fp4th_line.next_double(); + n3b_knot_matrix[itype][ktype][jtype][0][i] = + n3b_knot_matrix[itype][jtype][ktype][0][i]; + } + + min_cut_3b[itype][jtype][ktype][0] = n3b_knot_matrix[itype][jtype][ktype][0][0]; + //min_cut_3b[itype][jtype][ktype][0] --> cutoff for jk distance + + min_cut_3b[itype][ktype][jtype][0] = n3b_knot_matrix[itype][ktype][jtype][0][0]; + if (comm->me == 0) + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_jk={} {}-{}-{}_jk={}\n", + potf_name,itype,jtype,ktype,min_cut_3b[itype][jtype][ktype][0], + itype,ktype,jtype,min_cut_3b[itype][ktype][jtype][0]); + + int num_knots_3b_ik = fp3rd_line.next_int(); + temp_line = txtfilereader.next_line(num_knots_3b_ik); + ValueTokenizer fp5th_line(temp_line); + + if (fp5th_line.count() != num_knots_3b_ik) + error->all(FLERR, "UF3: Expected {} numbers on 5th line but found {} numbers", + num_knots_3b_ik, fp5th_line.count()); + + n3b_knot_matrix[itype][jtype][ktype][1].resize(num_knots_3b_ik); + n3b_knot_matrix[itype][ktype][jtype][2].resize(num_knots_3b_ik); + for (int i = 0; i < num_knots_3b_ik; i++) { + n3b_knot_matrix[itype][jtype][ktype][1][i] = fp5th_line.next_double(); + n3b_knot_matrix[itype][ktype][jtype][2][i] = + n3b_knot_matrix[itype][jtype][ktype][1][i]; + } + + min_cut_3b[itype][jtype][ktype][1] = n3b_knot_matrix[itype][jtype][ktype][1][0]; + //min_cut_3b[itype][jtype][ktype][1] --> cutoff for ik distance + + min_cut_3b[itype][ktype][jtype][2] = n3b_knot_matrix[itype][ktype][jtype][2][0]; + if (comm->me == 0) + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ik={} {}-{}-{}_ik={}\n", + potf_name,itype,jtype,ktype,min_cut_3b[itype][jtype][ktype][1], + itype,ktype,jtype,min_cut_3b[itype][ktype][jtype][2]); + + int num_knots_3b_ij = fp3rd_line.next_int(); + temp_line = txtfilereader.next_line(num_knots_3b_ij); + ValueTokenizer fp6th_line(temp_line); + + if (fp6th_line.count() != num_knots_3b_ij) + error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", + num_knots_3b_ij, fp5th_line.count()); + + n3b_knot_matrix[itype][jtype][ktype][2].resize(num_knots_3b_ij); + n3b_knot_matrix[itype][ktype][jtype][1].resize(num_knots_3b_ij); + for (int i = 0; i < num_knots_3b_ij; i++) { + n3b_knot_matrix[itype][jtype][ktype][2][i] = fp6th_line.next_double(); + n3b_knot_matrix[itype][ktype][jtype][1][i] = + n3b_knot_matrix[itype][jtype][ktype][2][i]; + } + + min_cut_3b[itype][jtype][ktype][2] = n3b_knot_matrix[itype][jtype][ktype][2][0]; + //min_cut_3b[itype][jtype][ktype][2] --> cutoff for ij distance + min_cut_3b[itype][ktype][jtype][1] = n3b_knot_matrix[itype][ktype][jtype][1][0]; + if (comm->me == 0) + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ij={} {}-{}-{}_ij={}\n", + potf_name,itype,jtype,ktype,min_cut_3b[itype][jtype][ktype][2], + itype,ktype,jtype,min_cut_3b[itype][ktype][jtype][1]); + + temp_line = txtfilereader.next_line(3); + ValueTokenizer fp7th_line(temp_line); + + if (fp7th_line.count() != 3) + error->all(FLERR, "UF3: Expected 3 numbers on 7th line =>\n\ + SHAPE_OF_COEFF_MATRIX[I][J][K] \n\ + found {} numbers", fp7th_line.count()); + + coeff_matrix_dim1 = fp7th_line.next_int(); + coeff_matrix_dim2 = fp7th_line.next_int(); + coeff_matrix_dim3 = fp7th_line.next_int(); + + if (n3b_knot_matrix[itype][jtype][ktype][0].size() != coeff_matrix_dim3 + 3 + 1) + error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and \n\ + coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", potf_name); + + if (n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) + error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and \n\ + coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1",potf_name); + + if (n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) + error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and \n\ + coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1",potf_name); + + coeff_matrix_elements_len = coeff_matrix_dim3; + + std::string key = std::to_string(itype) + std::to_string(jtype) + std::to_string(ktype); + n3b_coeff_matrix[key].resize(coeff_matrix_dim1); + + int line_count = 0; + for (int i = 0; i < coeff_matrix_dim1; i++) { + n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); + for (int j = 0; j < coeff_matrix_dim2; j++) { + temp_line = txtfilereader.next_line(coeff_matrix_elements_len); + ValueTokenizer coeff_line(temp_line); + n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); + + if (coeff_line.count() != coeff_matrix_elements_len) + error->all(FLERR, "UF3: Expected {} numbers on {}th line but found \n\ + {} numbers",coeff_matrix_elements_len, line_count+8, coeff_line.count()); + for (int k = 0; k < coeff_matrix_dim3; k++) { + n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); + } + line_count += 1; + } + } + + std::string key2 = std::to_string(itype) + std::to_string(ktype) + std::to_string(jtype); + n3b_coeff_matrix[key2].resize(coeff_matrix_dim2); + for (int j = 0; j < coeff_matrix_dim2; j++) { + n3b_coeff_matrix[key2][j].resize(coeff_matrix_dim1); + for (int i = 0; i < coeff_matrix_dim1; i++) { + n3b_coeff_matrix[key2][j][i].resize(coeff_matrix_dim3); + } + } + + for (int i = 0; i < coeff_matrix_dim1; i++) { + for (int j = 0; j < coeff_matrix_dim2; j++) { + for (int k = 0; k < coeff_matrix_dim3; k++) { + n3b_coeff_matrix[key2][j][i][k] = n3b_coeff_matrix[key][i][j][k]; + } + } + } + + setflag_3b[itype][jtype][ktype] = 1; + setflag_3b[itype][ktype][jtype] = 1; + +} + +void PairUF3::uf3_read_pot_file(char *potf_name) +{ + if (comm->me == 0) utils::logmesg(lmp, "\nUF3: Opening {} file\n", potf_name); + + FILE *fp; + fp = utils::open_potential(potf_name, lmp, nullptr); + // if (fp) error->all(FLERR,"UF3: {} file not found",potf_name); + + TextFileReader txtfilereader(fp, "UF3:POTFP"); + txtfilereader.ignore_comments = false; + + std::string temp_line = txtfilereader.next_line(2); + Tokenizer fp1st_line(temp_line); + + if (fp1st_line.contains("#UF3 POT") == 0) + error->all(FLERR, "UF3: {} file is not UF3 POT type, found type {} {} on the file", potf_name, + fp1st_line.next(), fp1st_line.next()); + + if (comm->me == 0) + utils::logmesg(lmp, "UF3: {} file is of type {} {}\n", potf_name, fp1st_line.next(), + fp1st_line.next()); + + temp_line = txtfilereader.next_line(1); + Tokenizer fp2nd_line(temp_line); + if (fp2nd_line.contains("2B") == 1) { + temp_line = txtfilereader.next_line(4); + ValueTokenizer fp3rd_line(temp_line); + int temp_type1 = fp3rd_line.next_int(); + int temp_type2 = fp3rd_line.next_int(); + if (comm->me == 0) + utils::logmesg(lmp, "UF3: {} file contains 2-body UF3 potential for {} {}\n", potf_name, + temp_type1, temp_type2); + + //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared + cut[temp_type1][temp_type2] = fp3rd_line.next_double(); + // if(comm->me==0) utils::logmesg(lmp,"UF3: Cutoff {}\n",cutsq[temp_type1][temp_type2]); + cut[temp_type2][temp_type1] = cut[temp_type1][temp_type2]; + + int temp_line_len = fp3rd_line.next_int(); + + temp_line = txtfilereader.next_line(temp_line_len); + ValueTokenizer fp4th_line(temp_line); + + n2b_knot[temp_type1][temp_type2].resize(temp_line_len); + n2b_knot[temp_type2][temp_type1].resize(temp_line_len); + for (int k = 0; k < temp_line_len; k++) { + n2b_knot[temp_type1][temp_type2][k] = fp4th_line.next_double(); + n2b_knot[temp_type2][temp_type1][k] = n2b_knot[temp_type1][temp_type2][k]; + } + + temp_line = txtfilereader.next_line(1); + ValueTokenizer fp5th_line(temp_line); + + temp_line_len = fp5th_line.next_int(); + + temp_line = txtfilereader.next_line(temp_line_len); + // utils::logmesg(lmp,"UF3:11 {}",temp_line); + ValueTokenizer fp6th_line(temp_line); + // if(comm->me==0) utils::logmesg(lmp,"UF3: {}\n",temp_line_len); + n2b_coeff[temp_type1][temp_type2].resize(temp_line_len); + n2b_coeff[temp_type2][temp_type1].resize(temp_line_len); + + for (int k = 0; k < temp_line_len; k++) { + n2b_coeff[temp_type1][temp_type2][k] = fp6th_line.next_double(); + n2b_coeff[temp_type2][temp_type1][k] = n2b_coeff[temp_type1][temp_type2][k]; + // if(comm->me==0) utils::logmesg(lmp,"UF3: {}\n",n2b_coeff[temp_type1][temp_type2][k]); + } + // for(int i=0;ime==0) utils::logmesg(lmp,"UF3: {}\n",n2b_coeff[temp_type1][temp_type2][i]); + if (n2b_knot[temp_type1][temp_type2].size() != n2b_coeff[temp_type1][temp_type2].size() + 4) { + error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", + potf_name); + } + setflag[temp_type1][temp_type2] = 1; + setflag[temp_type2][temp_type1] = 1; + } else if (fp2nd_line.contains("3B") == 1) { + temp_line = txtfilereader.next_line(9); + ValueTokenizer fp3rd_line(temp_line); + int temp_type1 = fp3rd_line.next_int(); + int temp_type2 = fp3rd_line.next_int(); + int temp_type3 = fp3rd_line.next_int(); + if (comm->me == 0) + utils::logmesg(lmp, "UF3: {} file contains 3-body UF3 potential for {} {} {}\n", potf_name, + temp_type1, temp_type2, temp_type3); + + double cut3b_rjk = fp3rd_line.next_double(); + double cut3b_rij = fp3rd_line.next_double(); + // cut_3b[temp_type1][temp_type2] = std::max(cut3b_rij, + // cut_3b[temp_type1][temp_type2]); + cut_3b_list[temp_type1][temp_type2] = std::max(cut3b_rij, cut_3b_list[temp_type1][temp_type2]); + double cut3b_rik = fp3rd_line.next_double(); + if (cut3b_rij != cut3b_rik) { + error->all(FLERR, "UF3: rij!=rik, Current implementation only works for rij=rik"); + } + if (2 * cut3b_rik != cut3b_rjk) { + error->all(FLERR, + "UF3: 2rij=2rik!=rik, Current implementation only works for 2rij=2rik!=rik"); + } + // cut_3b[temp_type1][temp_type3] = std::max(cut_3b[temp_type1][temp_type3],cut3b_rik); + cut_3b_list[temp_type1][temp_type3] = std::max(cut_3b_list[temp_type1][temp_type3], cut3b_rik); + + cut_3b[temp_type1][temp_type2][temp_type3] = cut3b_rij; + cut_3b[temp_type1][temp_type3][temp_type2] = cut3b_rik; + + int temp_line_len = fp3rd_line.next_int(); + temp_line = txtfilereader.next_line(temp_line_len); + ValueTokenizer fp4th_line(temp_line); + + n3b_knot_matrix[temp_type1][temp_type2][temp_type3].resize(3); + n3b_knot_matrix[temp_type1][temp_type3][temp_type2].resize(3); + + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].resize(temp_line_len); + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0].resize(temp_line_len); + for (int i = 0; i < temp_line_len; i++) { + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i] = fp4th_line.next_double(); + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][i] = + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i]; + } + + min_cut_3b[temp_type1][temp_type2][temp_type3][0] = n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][0]; + min_cut_3b[temp_type1][temp_type3][temp_type2][0] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][0]; + if (comm->me == 0) + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_0={} {}-{}-{}_0={}\n", + potf_name,temp_type1,temp_type2,temp_type3,min_cut_3b[temp_type1][temp_type2][temp_type3][0], + temp_type1,temp_type3,temp_type2,min_cut_3b[temp_type1][temp_type3][temp_type2][0]); + + temp_line_len = fp3rd_line.next_int(); + temp_line = txtfilereader.next_line(temp_line_len); + ValueTokenizer fp5th_line(temp_line); + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].resize(temp_line_len); + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2].resize(temp_line_len); + for (int i = 0; i < temp_line_len; i++) { + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i] = fp5th_line.next_double(); + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][i] = + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i]; + } + + min_cut_3b[temp_type1][temp_type2][temp_type3][1] = n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][0]; + min_cut_3b[temp_type1][temp_type3][temp_type2][2] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][0]; + if (comm->me == 0) + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_1={} {}-{}-{}_2={}\n", + potf_name,temp_type1,temp_type2,temp_type3,min_cut_3b[temp_type1][temp_type2][temp_type3][1], + temp_type1,temp_type3,temp_type2,min_cut_3b[temp_type1][temp_type3][temp_type2][2]); + + temp_line_len = fp3rd_line.next_int(); + temp_line = txtfilereader.next_line(temp_line_len); + ValueTokenizer fp6th_line(temp_line); + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].resize(temp_line_len); + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1].resize(temp_line_len); + for (int i = 0; i < temp_line_len; i++) { + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i] = fp6th_line.next_double(); + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][i] = + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i]; + } + + min_cut_3b[temp_type1][temp_type2][temp_type3][2] = n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][0]; + min_cut_3b[temp_type1][temp_type3][temp_type2][1] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][0]; + if (comm->me == 0) + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_2={} {}-{}-{}_1={}\n", + potf_name,temp_type1,temp_type2,temp_type3,min_cut_3b[temp_type1][temp_type2][temp_type3][2], + temp_type1,temp_type3,temp_type2,min_cut_3b[temp_type1][temp_type3][temp_type2][2]); + + temp_line = txtfilereader.next_line(3); + ValueTokenizer fp7th_line(temp_line); + + coeff_matrix_dim1 = fp7th_line.next_int(); + coeff_matrix_dim2 = fp7th_line.next_int(); + coeff_matrix_dim3 = fp7th_line.next_int(); + if (n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].size() != + coeff_matrix_dim3 + 3 + 1) { + error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", + potf_name); + } + if (n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].size() != + coeff_matrix_dim2 + 3 + 1) { + error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", + potf_name); + } + if (n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].size() != + coeff_matrix_dim1 + 3 + 1) { + error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", + potf_name); + } + + coeff_matrix_elements_len = coeff_matrix_dim3; + + std::string key = + std::to_string(temp_type1) + std::to_string(temp_type2) + std::to_string(temp_type3); + n3b_coeff_matrix[key].resize(coeff_matrix_dim1); + for (int i = 0; i < coeff_matrix_dim1; i++) { + n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); + for (int j = 0; j < coeff_matrix_dim2; j++) { + temp_line = txtfilereader.next_line(coeff_matrix_elements_len); + ValueTokenizer coeff_line(temp_line); + n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); + for (int k = 0; k < coeff_matrix_dim3; k++) { + n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); + } + } + } + + key = std::to_string(temp_type1) + std::to_string(temp_type3) + std::to_string(temp_type2); + n3b_coeff_matrix[key] = + n3b_coeff_matrix[std::to_string(temp_type1) + std::to_string(temp_type2) + + std::to_string(temp_type3)]; + setflag_3b[temp_type1][temp_type2][temp_type3] = 1; + setflag_3b[temp_type1][temp_type3][temp_type2] = 1; + } else + error->all( + FLERR, + "UF3: {} file does not contain right words indicating whether it is 2 or 3 body potential", + potf_name); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ +void PairUF3::init_style() +{ + if (force->newton_pair == 0) error->all(FLERR, "UF3: Pair style requires newton pair on"); + // request a default neighbor list + neighbor->add_request(this, NeighConst::REQ_FULL); +} + +/* ---------------------------------------------------------------------- + init list sets the pointer to full neighbour list requested in previous function +------------------------------------------------------------------------- */ + +void PairUF3::init_list(int /*id*/, class NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ +double PairUF3::init_one(int i /*i*/, int /*j*/ j) +{ + + if (!bsplines_created) create_bsplines(); + + //init_one is called by pair.cpp at line 267 where it is squred + //at line 268 + return cut[i][j]; +} + +void PairUF3::create_bsplines() +{ + bsplines_created = 1; + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + if (setflag[i][j] != 1) + error->all(FLERR,"UF3: Not all 2-body UF potentials are set, \n\ + missing potential file for {}-{} interaction",i, j); + } + } + if (pot_3b) { + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = 1; k < num_of_elements + 1; k++) { + if (setflag_3b[i][j][k] != 1) + error->all(FLERR,"UF3: Not all 3-body UF potentials are set, \n\ + missing potential file for {}-{}-{} interaction", i, j, k); + } + } + } + } + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knot[i][j], n2b_coeff[i][j], + knot_spacing_type_2b[i][j]); + UFBS2b[j][i] = UFBS2b[i][j]; + } + if (pot_3b) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = j; k < num_of_elements + 1; k++) { + std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); + UFBS3b[i][j][k] = + uf3_triplet_bspline(lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key], + knot_spacing_type_3b[i][j][k]); + std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); + UFBS3b[i][k][j] = + uf3_triplet_bspline(lmp, n3b_knot_matrix[i][k][j], n3b_coeff_matrix[key2], + knot_spacing_type_3b[i][k][j]); + } + } + } + } +} + +void PairUF3::compute(int eflag, int vflag) +{ + int i, j, k, ii, jj, kk, inum, jnum, itype, jtype, ktype; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair, fx, fy, fz; + double del_rji[3], del_rki[3], del_rkj[3]; + double fij[3], fik[3], fjk[3]; + double fji[3], fki[3], fkj[3]; + double Fi[3], Fj[3], Fk[3]; + double rsq, rij, rik, rjk; + int *ilist, *jlist, *numneigh, **firstneigh; + + ev_init(eflag, vflag); + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + // loop over neighbors of my atoms + for (ii = 0; ii < inum; ii++) { + evdwl = 0; + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + int numshort = 0; + for (jj = 0; jj < jnum; jj++) { + fx = 0; + fy = 0; + fz = 0; + j = jlist[jj]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + + rsq = delx * delx + dely * dely + delz * delz; + jtype = type[j]; + if (rsq < cutsq[itype][jtype]) { + rij = sqrt(rsq); + + if (pot_3b) { + if (rij <= cut_3b_list[itype][jtype]) { + neighshort[numshort] = j; + if (numshort >= maxshort - 1) { + maxshort += maxshort / 2; + memory->grow(neighshort, maxshort, "pair:neighshort"); + } + numshort = numshort + 1; + } + } + + double *pair_eval = UFBS2b[itype][jtype].eval(rij); + + fpair = -1 * pair_eval[1] / rij; + + fx = delx * fpair; + fy = dely * fpair; + fz = delz * fpair; + + f[i][0] += fx; + f[i][1] += fy; + f[i][2] += fz; + f[j][0] -= fx; + f[j][1] -= fy; + f[j][2] -= fz; + + if (eflag) evdwl = pair_eval[0]; + + if (evflag) { + ev_tally_xyz(i, j, nlocal, newton_pair, evdwl, 0.0, fx, fy, fz, delx, dely, delz); + + // Centroid Stress + if (vflag_either && cvflag_atom) { + double v[6]; + + v[0] = delx * fx; + v[1] = dely * fy; + v[2] = delz * fz; + v[3] = delx * fy; + v[4] = delx * fz; + v[5] = dely * fz; + + cvatom[i][0] += 0.5 * v[0]; + cvatom[i][1] += 0.5 * v[1]; + cvatom[i][2] += 0.5 * v[2]; + cvatom[i][3] += 0.5 * v[3]; + cvatom[i][4] += 0.5 * v[4]; + cvatom[i][5] += 0.5 * v[5]; + cvatom[i][6] += 0.5 * v[3]; + cvatom[i][7] += 0.5 * v[4]; + cvatom[i][8] += 0.5 * v[5]; + + cvatom[j][0] += 0.5 * v[0]; + cvatom[j][1] += 0.5 * v[1]; + cvatom[j][2] += 0.5 * v[2]; + cvatom[j][3] += 0.5 * v[3]; + cvatom[j][4] += 0.5 * v[4]; + cvatom[j][5] += 0.5 * v[5]; + cvatom[j][6] += 0.5 * v[3]; + cvatom[j][7] += 0.5 * v[4]; + cvatom[j][8] += 0.5 * v[5]; + } + } + } + } + + // 3-body interaction + // jth atom + jnum = numshort - 1; + for (jj = 0; jj < jnum; jj++) { + fij[0] = fji[0] = 0; + fij[1] = fji[1] = 0; + fij[2] = fji[2] = 0; + j = neighshort[jj]; + jtype = type[j]; + del_rji[0] = x[j][0] - xtmp; + del_rji[1] = x[j][1] - ytmp; + del_rji[2] = x[j][2] - ztmp; + rij = + sqrt(((del_rji[0] * del_rji[0]) + (del_rji[1] * del_rji[1]) + (del_rji[2] * del_rji[2]))); + + // kth atom + for (kk = jj + 1; kk < numshort; kk++) { + + fik[0] = fki[0] = 0; + fik[1] = fki[1] = 0; + fik[2] = fki[2] = 0; + + fjk[0] = fkj[0] = 0; + fjk[1] = fkj[1] = 0; + fjk[2] = fkj[2] = 0; + + k = neighshort[kk]; + ktype = type[k]; + del_rki[0] = x[k][0] - xtmp; + del_rki[1] = x[k][1] - ytmp; + del_rki[2] = x[k][2] - ztmp; + rik = sqrt( + ((del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]))); + + if ((rij <= cut_3b[itype][jtype][ktype]) && (rik <= cut_3b[itype][ktype][jtype]) && + (rij >= min_cut_3b[itype][jtype][ktype][2]) && + (rik >= min_cut_3b[itype][jtype][ktype][1])) { + + del_rkj[0] = x[k][0] - x[j][0]; + del_rkj[1] = x[k][1] - x[j][1]; + del_rkj[2] = x[k][2] - x[j][2]; + rjk = sqrt( + ((del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]))); + + if (rjk >= min_cut_3b[itype][jtype][ktype][0]){ + double *triangle_eval = UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); + + fij[0] = *(triangle_eval + 1) * (del_rji[0] / rij); + fji[0] = -fij[0]; + fik[0] = *(triangle_eval + 2) * (del_rki[0] / rik); + fki[0] = -fik[0]; + fjk[0] = *(triangle_eval + 3) * (del_rkj[0] / rjk); + fkj[0] = -fjk[0]; + + fij[1] = *(triangle_eval + 1) * (del_rji[1] / rij); + fji[1] = -fij[1]; + fik[1] = *(triangle_eval + 2) * (del_rki[1] / rik); + fki[1] = -fik[1]; + fjk[1] = *(triangle_eval + 3) * (del_rkj[1] / rjk); + fkj[1] = -fjk[1]; + + fij[2] = *(triangle_eval + 1) * (del_rji[2] / rij); + fji[2] = -fij[2]; + fik[2] = *(triangle_eval + 2) * (del_rki[2] / rik); + fki[2] = -fik[2]; + fjk[2] = *(triangle_eval + 3) * (del_rkj[2] / rjk); + fkj[2] = -fjk[2]; + + Fi[0] = fij[0] + fik[0]; + Fi[1] = fij[1] + fik[1]; + Fi[2] = fij[2] + fik[2]; + f[i][0] += Fi[0]; + f[i][1] += Fi[1]; + f[i][2] += Fi[2]; + + Fj[0] = fji[0] + fjk[0]; + Fj[1] = fji[1] + fjk[1]; + Fj[2] = fji[2] + fjk[2]; + f[j][0] += Fj[0]; + f[j][1] += Fj[1]; + f[j][2] += Fj[2]; + + Fk[0] = fki[0] + fkj[0]; + Fk[1] = fki[1] + fkj[1]; + Fk[2] = fki[2] + fkj[2]; + f[k][0] += Fk[0]; + f[k][1] += Fk[1]; + f[k][2] += Fk[2]; + + if (eflag) evdwl = *triangle_eval; + + if (evflag) { ev_tally3(i, j, k, evdwl, 0, Fj, Fk, del_rji, del_rki); + // Centroid stress 3-body term + if (vflag_either && cvflag_atom) { + double ric[3]; + ric[0] = THIRD * (-del_rji[0] - del_rki[0]); + ric[1] = THIRD * (-del_rji[1] - del_rki[1]); + ric[2] = THIRD * (-del_rji[2] - del_rki[2]); + + cvatom[i][0] += ric[0] * Fi[0]; + cvatom[i][1] += ric[1] * Fi[1]; + cvatom[i][2] += ric[2] * Fi[2]; + cvatom[i][3] += ric[0] * Fi[1]; + cvatom[i][4] += ric[0] * Fi[2]; + cvatom[i][5] += ric[1] * Fi[2]; + cvatom[i][6] += ric[1] * Fi[0]; + cvatom[i][7] += ric[2] * Fi[0]; + cvatom[i][8] += ric[2] * Fi[1]; + + double rjc[3]; + rjc[0] = THIRD * (del_rji[0] - del_rkj[0]); + rjc[1] = THIRD * (del_rji[1] - del_rkj[1]); + rjc[2] = THIRD * (del_rji[2] - del_rkj[2]); + + cvatom[j][0] += rjc[0] * Fj[0]; + cvatom[j][1] += rjc[1] * Fj[1]; + cvatom[j][2] += rjc[2] * Fj[2]; + cvatom[j][3] += rjc[0] * Fj[1]; + cvatom[j][4] += rjc[0] * Fj[2]; + cvatom[j][5] += rjc[1] * Fj[2]; + cvatom[j][6] += rjc[1] * Fj[0]; + cvatom[j][7] += rjc[2] * Fj[0]; + cvatom[j][8] += rjc[2] * Fj[1]; + + double rkc[3]; + rkc[0] = THIRD * (del_rki[0] + del_rkj[0]); + rkc[1] = THIRD * (del_rki[1] + del_rkj[1]); + rkc[2] = THIRD * (del_rki[2] + del_rkj[2]); + + cvatom[k][0] += rkc[0] * Fk[0]; + cvatom[k][1] += rkc[1] * Fk[1]; + cvatom[k][2] += rkc[2] * Fk[2]; + cvatom[k][3] += rkc[0] * Fk[1]; + cvatom[k][4] += rkc[0] * Fk[2]; + cvatom[k][5] += rkc[1] * Fk[2]; + cvatom[k][6] += rkc[1] * Fk[0]; + cvatom[k][7] += rkc[2] * Fk[0]; + cvatom[k][8] += rkc[2] * Fk[1]; + } + } + } + } + } + } + } + if (vflag_fdotr) virial_fdotr_compute(); +} + +double PairUF3::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, + double /*factor_coul*/, double factor_lj, double &fforce) +{ + double value = 0.0; + double r = sqrt(rsq); + + if (r < cut[itype][jtype]) { + double *pair_eval = UFBS2b[itype][jtype].eval(r); + value = pair_eval[0]; + fforce = factor_lj * pair_eval[1]; + } + + return factor_lj * value; +} + +double PairUF3::memory_usage() +{ + double bytes = Pair::memory_usage(); + + bytes = 0; + + bytes += (double)5*sizeof(double); //num_of_elements, nbody_flag, + //n2body_pot_files, n3body_pot_files, + //tot_pot_files; + + bytes += (double)5*sizeof(double); //bsplines_created, coeff_matrix_dim1, + //coeff_matrix_dim2, coeff_matrix_dim3, + //coeff_matrix_elements_len + bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ + (num_of_elements+1)*sizeof(double); //***setflag_3b + + bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut + + bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ + (num_of_elements+1)*sizeof(double); //***cut_3b + + bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut_3b_list + + bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ + (num_of_elements+1)*3*sizeof(double); //min_cut_3b + + for (int i=1; i < num_of_elements+1; i++){ + for (int j=i; j < num_of_elements+1; j++){ + bytes += (double)2*n2b_knot[i][j].size()*sizeof(double); //n2b_knot + bytes += (double)2*n2b_coeff[i][j].size()*sizeof(double); //n2b_coeff + } + if (pot_3b){ + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = j; k < num_of_elements + 1; k++) { + bytes += (double)2*n3b_knot_matrix[i][j][k][0].size()*sizeof(double); + bytes += (double)2*n3b_knot_matrix[i][j][k][1].size()*sizeof(double); + bytes += (double)2*n3b_knot_matrix[i][j][k][2].size()*sizeof(double); + + std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); + + for (int l=0; l < n3b_coeff_matrix[key].size(); l++){ + for (int m=0; m < n3b_coeff_matrix[key][l].size(); m++){ + bytes += (double)2*n3b_coeff_matrix[key][l][m].size()*sizeof(double); + //key = ijk + //key = ikj + } + } + } + } + } + } + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++){ + bytes += (double)2*UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] + } + if (pot_3b) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = j; k < num_of_elements + 1; k++) { + bytes += (double)2*UFBS3b[i][j][k].memory_usage(); + } + } + } + } + + bytes += (double)(maxshort+1)*sizeof(int); //neighshort, maxshort + + return bytes; +} + diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h new file mode 100644 index 0000000000..54f0e7e2e4 --- /dev/null +++ b/src/ML-UF3/pair_uf3.h @@ -0,0 +1,88 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + * Contributing authors: Ajinkya Hire(U of Florida), + * Hendrik Kraß (U of Constance), + * Richard Hennig (U of Florida) + * ---------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(uf3,PairUF3); +// clang-format on +#else + +#ifndef LMP_PAIR_UF3_H +#define LMP_PAIR_UF3_H + +#include "uf3_pair_bspline.h" +#include "uf3_triplet_bspline.h" + +#include "pair.h" + +#include +namespace LAMMPS_NS { + +class PairUF3 : public Pair { + public: + PairUF3(class LAMMPS *); + ~PairUF3() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void init_style() override; + void init_list(int, class NeighList *) override; // needed for ptr to full neigh list + double init_one(int, int) override; // needed for cutoff radius for neighbour list + double single(int, int, int, int, double, double, double, double &) override; + + double memory_usage() override; + + protected: + void uf3_read_pot_file(char *potf_name); + void uf3_read_pot_file(int i, int j, char *potf_name); + void uf3_read_pot_file(int i, int j, int k, char *potf_name); + int num_of_elements, nbody_flag, n2body_pot_files, n3body_pot_files, tot_pot_files; + int bsplines_created; + int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; + bool pot_3b; + int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; + double **cut, ***cut_3b, **cut_3b_list, ****min_cut_3b; + virtual void allocate(); + void create_bsplines(); + std::vector>> n2b_knot, n2b_coeff; + std::vector>>>> n3b_knot_matrix; + std::unordered_map>>> n3b_coeff_matrix; + std::vector> UFBS2b; + std::vector>> UFBS3b; + int *neighshort, maxshort; // short neighbor list array for 3body interaction +}; + +} // namespace LAMMPS_NS + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +*/ diff --git a/src/ML-UF3/uf3_bspline_basis2.cpp b/src/ML-UF3/uf3_bspline_basis2.cpp new file mode 100644 index 0000000000..8ae1991ce2 --- /dev/null +++ b/src/ML-UF3/uf3_bspline_basis2.cpp @@ -0,0 +1,88 @@ +#include "uf3_bspline_basis2.h" + +#include "utils.h" +#include + +using namespace LAMMPS_NS; + +// Constructor +// Initializes coefficients and knots +// Requires [knots] to have length 4 +uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double coefficient) +{ + lmp = ulmp; + + double c0, c1, c2; + + c0 = coefficient * + (pow(knots[0], 2) / + (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + c1 = coefficient * + (-2 * knots[0] / + (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + c2 = coefficient * + (1 / (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + constants.push_back(c0); + constants.push_back(c1); + constants.push_back(c2); + c0 = coefficient * + (-knots[1] * knots[3] / + (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + knots[0] * knots[2] / + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + c1 = coefficient * + (knots[1] / + (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + knots[3] / + (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + knots[0] / + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2)) + + knots[2] / + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + c2 = coefficient * + (-1 / (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + 1 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + constants.push_back(c0); + constants.push_back(c1); + constants.push_back(c2); + c0 = coefficient * + (pow(knots[3], 2) / + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + c1 = coefficient * + (-2 * knots[3] / + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + c2 = coefficient * + (1 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + constants.push_back(c0); + constants.push_back(c1); + constants.push_back(c2); +} + +uf3_bspline_basis2::~uf3_bspline_basis2() {} + +// Evaluate outer-left part of spline +double uf3_bspline_basis2::eval0(double rsq, double r) +{ + return rsq * constants[2] + r * constants[1] + constants[0]; +} + +// Evaluate center-left part of spline +double uf3_bspline_basis2::eval1(double rsq, double r) +{ + return rsq * constants[5] + r * constants[4] + constants[3]; +} + +// Evaluate center-right part of spline +double uf3_bspline_basis2::eval2(double rsq, double r) +{ + return rsq * constants[8] + r * constants[7] + constants[6]; +} + +double uf3_bspline_basis2::memory_usage() +{ + double bytes = 0; + + bytes += (double)constants.size()*sizeof(double); + + return bytes; +} diff --git a/src/ML-UF3/uf3_bspline_basis2.h b/src/ML-UF3/uf3_bspline_basis2.h new file mode 100644 index 0000000000..8551b097b1 --- /dev/null +++ b/src/ML-UF3/uf3_bspline_basis2.h @@ -0,0 +1,32 @@ +//De Boor's algorithm @ +//https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.html +//For values outside the domain, +//extrapoltaes the left(right) hand side piece of the curve +//Only works for bspline degree upto 3 becuase of definiation of P +// +#include "pointers.h" + +#include + +#ifndef UF3_BSPLINE_BASIS2_H +#define UF3_BSPLINE_BASIS2_H + +namespace LAMMPS_NS { + +class uf3_bspline_basis2 { + private: + LAMMPS *lmp; + std::vector constants; + + public: + uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double coefficient); + ~uf3_bspline_basis2(); + double eval0(double, double); + double eval1(double, double); + double eval2(double, double); + + double memory_usage(); +}; + +} // namespace LAMMPS_NS +#endif diff --git a/src/ML-UF3/uf3_bspline_basis3.cpp b/src/ML-UF3/uf3_bspline_basis3.cpp new file mode 100644 index 0000000000..f66ac0d1dc --- /dev/null +++ b/src/ML-UF3/uf3_bspline_basis3.cpp @@ -0,0 +1,324 @@ +#include "uf3_bspline_basis3.h" + +#include "utils.h" +#include + +using namespace LAMMPS_NS; + +// Constructor +// Initializes coefficients and knots +// [knots] needs to have length 4 +uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double coefficient) +{ + lmp = ulmp; + + double c0, c1, c2, c3; + + c0 = coefficient * + (-pow(knots[0], 3) / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + c1 = coefficient * + (3 * pow(knots[0], 2) / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + c2 = coefficient * + (-3 * knots[0] / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + c3 = coefficient * + (1 / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + constants.push_back(c0); + constants.push_back(c1); + constants.push_back(c2); + constants.push_back(c3); + c0 = coefficient * + (pow(knots[1], 2) * knots[4] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) + + pow(knots[0], 2) * knots[2] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * knots[1] * knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + c1 = coefficient * + (-pow(knots[1], 2) / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) - + 2 * knots[1] * knots[4] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) - + pow(knots[0], 2) / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + 2 * knots[0] * knots[2] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + knots[0] * knots[1] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + knots[0] * knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + knots[1] * knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + c2 = coefficient * + (2 * knots[1] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) + + knots[4] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) + + 2 * knots[0] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[2] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + knots[1] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + c3 = coefficient * + (-1 / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) - + 1 / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + 1 / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + constants.push_back(c0); + constants.push_back(c1); + constants.push_back(c2); + constants.push_back(c3); + c0 = coefficient * + (-knots[0] * pow(knots[3], 2) / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[1] * knots[3] * knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[2] * pow(knots[4], 2) / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + c1 = coefficient * + (2 * knots[0] * knots[3] / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + pow(knots[3], 2) / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + knots[1] * knots[3] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[3] * knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + 2 * knots[2] * knots[4] / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) + + pow(knots[4], 2) / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + c2 = coefficient * + (-knots[0] / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + 2 * knots[3] / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[1] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[3] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[2] / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) - + 2 * knots[4] / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + c3 = coefficient * + (1 / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + 1 / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + 1 / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + constants.push_back(c0); + constants.push_back(c1); + constants.push_back(c2); + constants.push_back(c3); + c0 = coefficient * + (pow(knots[4], 3) / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + c1 = coefficient * + (-3 * pow(knots[4], 2) / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + c2 = coefficient * + (3 * knots[4] / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + c3 = coefficient * + (-1 / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + constants.push_back(c0); + constants.push_back(c1); + constants.push_back(c2); + constants.push_back(c3); +} + +uf3_bspline_basis3::~uf3_bspline_basis3() {} + +// Evaluate outer-left part of spline +double uf3_bspline_basis3::eval0(double rth, double rsq, double r) +{ + return rth * constants[3] + rsq * constants[2] + r * constants[1] + constants[0]; +} + +// Evaluate center-left part of spline +double uf3_bspline_basis3::eval1(double rth, double rsq, double r) +{ + return rth * constants[7] + rsq * constants[6] + r * constants[5] + constants[4]; +} + +// Evaluate center-right part of spline +double uf3_bspline_basis3::eval2(double rth, double rsq, double r) +{ + return rth * constants[11] + rsq * constants[10] + r * constants[9] + constants[8]; +} + +// Evaluate outer-right part of spline +double uf3_bspline_basis3::eval3(double rth, double rsq, double r) +{ + return rth * constants[15] + rsq * constants[14] + r * constants[13] + constants[12]; +} + +double uf3_bspline_basis3::memory_usage() +{ + double bytes = 0; + + bytes += (double)constants.size()*sizeof(double); + + return bytes; +} diff --git a/src/ML-UF3/uf3_bspline_basis3.h b/src/ML-UF3/uf3_bspline_basis3.h new file mode 100644 index 0000000000..d29d9b08f1 --- /dev/null +++ b/src/ML-UF3/uf3_bspline_basis3.h @@ -0,0 +1,33 @@ +//De Boor's algorithm @ +//https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.html +//For values outside the domain, +//extrapoltaes the left(right) hand side piece of the curve +//Only works for bspline degree upto 3 becuase of definiation of P +// +#include "pointers.h" + +#include + +#ifndef UF3_BSPLINE_BASIS3_H +#define UF3_BSPLINE_BASIS3_H + +namespace LAMMPS_NS { + +class uf3_bspline_basis3 { + private: + LAMMPS *lmp; + std::vector constants; + + public: + uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double coefficient); + ~uf3_bspline_basis3(); + double eval0(double, double, double); + double eval1(double, double, double); + double eval2(double, double, double); + double eval3(double, double, double); + + double memory_usage(); +}; + +} // namespace LAMMPS_NS +#endif diff --git a/src/ML-UF3/uf3_pair_bspline.cpp b/src/ML-UF3/uf3_pair_bspline.cpp new file mode 100644 index 0000000000..d4c14284f8 --- /dev/null +++ b/src/ML-UF3/uf3_pair_bspline.cpp @@ -0,0 +1,144 @@ +#include "uf3_pair_bspline.h" + +#include "uf3_bspline_basis2.h" +#include "uf3_bspline_basis3.h" + +#include "utils.h" +#include "error.h" +#include + +using namespace LAMMPS_NS; + +// Dummy constructor +uf3_pair_bspline::uf3_pair_bspline() {} + +// Constructor +// Passing vectors by reference +uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const std::vector &uknot_vect, + const std::vector &ucoeff_vect, + const int &uknot_spacing_type) +{ + lmp = ulmp; + knot_vect = uknot_vect; + coeff_vect = ucoeff_vect; + + knot_spacing_type = uknot_spacing_type; + if (knot_spacing_type==0){ + knot_spacing = knot_vect[4]-knot_vect[3]; + get_starting_index=&uf3_pair_bspline::get_starting_index_uniform; + } + else if (knot_spacing_type==1){ + knot_spacing = 0; + get_starting_index=&uf3_pair_bspline::get_starting_index_nonuniform; + } + + else + lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ + '1'(non-uniform knots)"); + + knot_vect_size = uknot_vect.size(); + coeff_vect_size = ucoeff_vect.size(); + + // Initialize B-Spline Basis Functions + for (int i = 0; i < knot_vect.size() - 4; i++) + bspline_bases.push_back(uf3_bspline_basis3(lmp, &knot_vect[i], coeff_vect[i])); + + // Initialize Coefficients and Knots for Derivatives + // The last coefficient needs to be droped + for (int i = 0; i < coeff_vect_size - 1; i++) { + double dntemp4 = 3 / (knot_vect[i + 4] - knot_vect[i + 1]); + dncoeff_vect.push_back((coeff_vect[i + 1] - coeff_vect[i]) * dntemp4); + } + //What we have is a clamped bspline -->i.e value of the bspline curve at the + //knots with multiplicity equal to the degree of bspline is equal to the coefficient + // + //Therefore for the derivative bspline the very first and last knot needs to be droped + //to change their multiplicity from 4 (necessary condition for clamped cubic bspline) + //to 3 (necessary condition for clamped quadratic bspline) + // + //Also if the coeff vector size of decreases by 1 for the derivative bspline + //knots size needs to go down by 2 as ==> knots = coefficient + degree + 1 + for (int i = 1; i < knot_vect_size - 1; i++) dnknot_vect.push_back(knot_vect[i]); + + // Initialize B-Spline Derivative Basis Functions + for (int i = 0; i < dnknot_vect.size() - 3; i++) + dnbspline_bases.push_back(uf3_bspline_basis2(lmp, &dnknot_vect[i], dncoeff_vect[i])); +} + +uf3_pair_bspline::~uf3_pair_bspline() {} + +int uf3_pair_bspline::get_starting_index_uniform(double r) +{ + return 3+(int)((r-knot_vect[0])/knot_spacing); +} + +int uf3_pair_bspline::get_starting_index_nonuniform(double r) +{ + if (knot_vect.front() <= r && r < knot_vect.back()) { + //Determine the interval for value_rij + for (int i = 3; i < knot_vect_size - 1; ++i) { + if (knot_vect[i] <= r && r < knot_vect[i + 1]) { + return i; + } + } + } +} + +double *uf3_pair_bspline::eval(double r) +{ + + // Find knot starting position + + int start_index=(this->*get_starting_index)(r); + /*if (knot_vect.front() <= r && r < knot_vect.back()) { + //Determine the interval for value_rij + for (int i = 3; i < knot_vect_size - 1; ++i) { + if (knot_vect[i] <= r && r < knot_vect[i + 1]) { + start_index = i; + break; + } + } + }*/ + + int knot_affect_start = start_index - 3; + + double rsq = r * r; + double rth = rsq * r; + + // Calculate energy + + ret_val[0] = bspline_bases[knot_affect_start + 3].eval0(rth, rsq, r); + ret_val[0] += bspline_bases[knot_affect_start + 2].eval1(rth, rsq, r); + ret_val[0] += bspline_bases[knot_affect_start + 1].eval2(rth, rsq, r); + ret_val[0] += bspline_bases[knot_affect_start].eval3(rth, rsq, r); + + // Calculate force + + ret_val[1] = dnbspline_bases[knot_affect_start + 2].eval0(rsq, r); + ret_val[1] += dnbspline_bases[knot_affect_start + 1].eval1(rsq, r); + ret_val[1] += dnbspline_bases[knot_affect_start].eval2(rsq, r); + + return ret_val; +} + +double uf3_pair_bspline::memory_usage() +{ + double bytes = 0; + + bytes += (double)2*sizeof(int); //knot_vect_size, + //coeff_vect_size + bytes += (double)knot_vect.size()*sizeof(double); //knot_vect + bytes += (double)dnknot_vect.size()*sizeof(double); //dnknot_vect + bytes += (double)coeff_vect.size()*sizeof(double); //coeff_vect + bytes += (double)dncoeff_vect.size()*sizeof(double); //dncoeff_vect + + for (int i = 0; i < knot_vect.size() - 4; i++) + bytes += (double)bspline_bases[i].memory_usage(); //bspline_basis3 + + for (int i = 0; i < dnknot_vect.size() - 3; i++) + bytes += (double)dnbspline_bases[i].memory_usage(); //bspline_basis2 + + bytes += (double)2*sizeof(double); //ret_val + + return bytes; +} diff --git a/src/ML-UF3/uf3_pair_bspline.h b/src/ML-UF3/uf3_pair_bspline.h new file mode 100644 index 0000000000..aa3f1e8c40 --- /dev/null +++ b/src/ML-UF3/uf3_pair_bspline.h @@ -0,0 +1,55 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/ Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +// De Boor's algorithm @ +// https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.html +// For values outside the domain, it exhibits undefined behavior. +// Uses fixed B-Spline degree 3. + +#include "pointers.h" + +#include "uf3_bspline_basis2.h" +#include "uf3_bspline_basis3.h" + +#include + +#ifndef UF3_PAIR_BSPLINE_H +#define UF3_PAIR_BSPLINE_H + +namespace LAMMPS_NS { + +class uf3_pair_bspline { + private: + int knot_vect_size, coeff_vect_size; + std::vector knot_vect, dnknot_vect; + std::vector coeff_vect, dncoeff_vect; + std::vector bspline_bases; + std::vector dnbspline_bases; + int get_starting_index_uniform(double), get_starting_index_nonuniform(double); + int (uf3_pair_bspline::*get_starting_index)(double); + //double knot_spacing=0; + LAMMPS *lmp; + + public: + // dummy constructor + uf3_pair_bspline(); + uf3_pair_bspline(LAMMPS *ulmp, const std::vector &uknot_vect, + const std::vector &ucoeff_vect, + const int &uknot_spacing_type); + ~uf3_pair_bspline(); + int knot_spacing_type; + double knot_spacing=0; + double ret_val[2]; + double *eval(double value_rij); + double memory_usage(); +}; +} // namespace LAMMPS_NS +#endif diff --git a/src/ML-UF3/uf3_triplet_bspline.cpp b/src/ML-UF3/uf3_triplet_bspline.cpp new file mode 100644 index 0000000000..6c5a5a19e7 --- /dev/null +++ b/src/ML-UF3/uf3_triplet_bspline.cpp @@ -0,0 +1,347 @@ +#include "uf3_triplet_bspline.h" +#include "error.h" +#include +#include + +using namespace LAMMPS_NS; + +// Dummy constructor +uf3_triplet_bspline::uf3_triplet_bspline(){}; + +// Construct a new 3D B-Spline +uf3_triplet_bspline::uf3_triplet_bspline( + LAMMPS *ulmp, const std::vector> &uknot_matrix, + const std::vector>> &ucoeff_matrix, + const int &uknot_spacing_type) +{ + lmp = ulmp; + knot_matrix = uknot_matrix; + coeff_matrix = ucoeff_matrix; + + knot_spacing_type = uknot_spacing_type; + if (knot_spacing_type==0){ + knot_spacing_ij = knot_matrix[2][4]-knot_matrix[2][3]; + knot_spacing_ik = knot_matrix[1][4]-knot_matrix[1][3]; + knot_spacing_jk = knot_matrix[0][4]-knot_matrix[0][3]; + get_starting_index=&uf3_triplet_bspline::get_starting_index_uniform; + } + else if (knot_spacing_type==1){ + knot_spacing_ij = 0; + knot_spacing_ik = 0; + knot_spacing_jk = 0; + get_starting_index=&uf3_triplet_bspline::get_starting_index_nonuniform; + } + + else + lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ + '1'(non-uniform knots)"); + + knot_vect_size_ij = knot_matrix[2].size(); + knot_vect_size_ik = knot_matrix[1].size(); + knot_vect_size_jk = knot_matrix[0].size(); + + int resolution_ij = knot_vect_size_ij - 4; + int resolution_ik = knot_vect_size_ik - 4; + int resolution_jk = knot_vect_size_jk - 4; + + // Cache Spline Basis Functions + for (int l = 0; l < resolution_ij; l++) { + bsplines_ij.push_back(uf3_bspline_basis3(lmp, &knot_matrix[2][l], 1)); + } + + for (int l = 0; l < resolution_ik; l++) { + // Reuse jk Basis if Knots match + if (knot_matrix[1][l] == knot_matrix[2][l] && knot_matrix[1][l + 1] == knot_matrix[2][l + 1] && + knot_matrix[1][l + 2] == knot_matrix[2][l + 2] && + knot_matrix[1][l + 3] == knot_matrix[2][l + 3]) + bsplines_ik.push_back(bsplines_ij[l]); + else + bsplines_ik.push_back(uf3_bspline_basis3(lmp, &knot_matrix[1][l], 1)); + } + + for (int l = 0; l < resolution_jk; l++) { + bsplines_jk.push_back(uf3_bspline_basis3(lmp, &knot_matrix[0][l], 1)); + } + + // Initialize Coefficients for Derivatives + for (int i = 0; i < coeff_matrix.size(); i++) { + std::vector> dncoeff_vect2; + for (int j = 0; j < coeff_matrix[0].size(); j++) { + std::vector dncoeff_vect; + for (int k = 0; k < coeff_matrix[0][0].size() - 1; k++) { + double dntemp4 = 3 / (knot_matrix[0][k + 4] - knot_matrix[0][k + 1]); + dncoeff_vect.push_back((coeff_matrix[i][j][k + 1] - coeff_matrix[i][j][k]) * dntemp4); + } + dncoeff_vect2.push_back(dncoeff_vect); + } + dncoeff_matrix_jk.push_back(dncoeff_vect2); + } + + for (int i = 0; i < coeff_matrix.size(); i++) { + std::vector> dncoeff_vect2; + for (int j = 0; j < coeff_matrix[0].size() - 1; j++) { + double dntemp4 = 3 / (knot_matrix[1][j + 4] - knot_matrix[1][j + 1]); + std::vector dncoeff_vect; + for (int k = 0; k < coeff_matrix[0][0].size(); k++) { + dncoeff_vect.push_back((coeff_matrix[i][j + 1][k] - coeff_matrix[i][j][k]) * dntemp4); + } + dncoeff_vect2.push_back(dncoeff_vect); + } + dncoeff_matrix_ik.push_back(dncoeff_vect2); + } + + for (int i = 0; i < coeff_matrix.size() - 1; i++) { + std::vector> dncoeff_vect2; + double dntemp4 = 3 / (knot_matrix[2][i + 4] - knot_matrix[2][i + 1]); + for (int j = 0; j < coeff_matrix[0].size(); j++) { + std::vector dncoeff_vect; + for (int k = 0; k < coeff_matrix[0][0].size(); k++) { + dncoeff_vect.push_back((coeff_matrix[i + 1][j][k] - coeff_matrix[i][j][k]) * dntemp4); + } + dncoeff_vect2.push_back(dncoeff_vect); + } + dncoeff_matrix_ij.push_back(dncoeff_vect2); + } + + std::vector> dnknot_matrix; + for (int i = 0; i < knot_matrix.size(); i++) { + std::vector dnknot_vect; + for (int j = 1; j < knot_matrix[0].size() - 1; j++) { + dnknot_vect.push_back(knot_matrix[i][j]); + } + dnknot_matrix.push_back(dnknot_vect); + } + + // Cache Derivative Spline Basis Functions + for (int l = 0; l < resolution_ij - 1; l++) { + dnbsplines_ij.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[2][l], 1)); + } + + for (int l = 0; l < resolution_ik - 1; l++) { + // Reuse jk Basis if Knots match + if (dnknot_matrix[1][l] == dnknot_matrix[2][l] && + dnknot_matrix[1][l + 1] == dnknot_matrix[2][l + 1] && + dnknot_matrix[1][l + 2] == dnknot_matrix[2][l + 2]) + dnbsplines_ik.push_back(dnbsplines_ij[l]); + else + dnbsplines_ik.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[1][l], 1)); + } + + for (int l = 0; l < resolution_jk - 1; l++) { + dnbsplines_jk.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[0][l], 1)); + } +} + +// Destructor +uf3_triplet_bspline::~uf3_triplet_bspline() {} + +// Evaluate 3D B-Spline value +double *uf3_triplet_bspline::eval(double value_rij, double value_rik, double value_rjk) +{ + + // Find starting knots + + //int iknot_ij = starting_knot(knot_matrix[2], knot_vect_size_ij, value_rij) - 3; + //int iknot_ik = starting_knot(knot_matrix[1], knot_vect_size_ik, value_rik) - 3; + //int iknot_jk = starting_knot(knot_matrix[0], knot_vect_size_jk, value_rjk) - 3; + int iknot_ij = (this->*get_starting_index)(knot_matrix[2], knot_vect_size_ij, value_rij,knot_spacing_ij) - 3; + int iknot_ik = (this->*get_starting_index)(knot_matrix[1], knot_vect_size_ik, value_rik,knot_spacing_ik) - 3; + int iknot_jk = (this->*get_starting_index)(knot_matrix[0], knot_vect_size_jk, value_rjk,knot_spacing_jk) - 3; + + double rsq_ij = value_rij * value_rij; + double rsq_ik = value_rik * value_rik; + double rsq_jk = value_rjk * value_rjk; + double rth_ij = rsq_ij * value_rij; + double rth_ik = rsq_ik * value_rik; + double rth_jk = rsq_jk * value_rjk; + + // Calculate energies + + double basis_ij[4]; + basis_ij[0] = bsplines_ij[iknot_ij].eval3(rth_ij, rsq_ij, value_rij); + basis_ij[1] = bsplines_ij[iknot_ij + 1].eval2(rth_ij, rsq_ij, value_rij); + basis_ij[2] = bsplines_ij[iknot_ij + 2].eval1(rth_ij, rsq_ij, value_rij); + basis_ij[3] = bsplines_ij[iknot_ij + 3].eval0(rth_ij, rsq_ij, value_rij); + + double basis_ik[4]; + basis_ik[0] = bsplines_ik[iknot_ik].eval3(rth_ik, rsq_ik, value_rik); + basis_ik[1] = bsplines_ik[iknot_ik + 1].eval2(rth_ik, rsq_ik, value_rik); + basis_ik[2] = bsplines_ik[iknot_ik + 2].eval1(rth_ik, rsq_ik, value_rik); + basis_ik[3] = bsplines_ik[iknot_ik + 3].eval0(rth_ik, rsq_ik, value_rik); + + double basis_jk[4]; + basis_jk[0] = bsplines_jk[iknot_jk].eval3(rth_jk, rsq_jk, value_rjk); + basis_jk[1] = bsplines_jk[iknot_jk + 1].eval2(rth_jk, rsq_jk, value_rjk); + basis_jk[2] = bsplines_jk[iknot_jk + 2].eval1(rth_jk, rsq_jk, value_rjk); + basis_jk[3] = bsplines_jk[iknot_jk + 3].eval0(rth_jk, rsq_jk, value_rjk); + + ret_val[0] = 0; + ret_val[1] = 0; + ret_val[2] = 0; + ret_val[3] = 0; + + for (int i = 0; i < 4; i++) { + const double basis_iji = basis_ij[i]; // prevent repeated access of same memory location + for (int j = 0; j < 4; j++) { + const double factor = basis_iji * basis_ik[j]; // prevent repeated access of same memory location + const double* slice = &coeff_matrix[i + iknot_ij][j + iknot_ik][iknot_jk]; // declare a contigues 1D slice of memory + double tmp[4]; // declare tmp array that holds the 4 tmp values so the can be computed simultaniously in 4 separate registeres. + tmp[0] = slice[0] * basis_jk[0]; + tmp[1] = slice[1] * basis_jk[1]; + tmp[2] = slice[2] * basis_jk[2]; + tmp[3] = slice[3] * basis_jk[3]; + double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; + ret_val[0] += factor * sum; // use 1 fused multiply-add (FMA) + } + } + + // Calculate forces + + double dnbasis_ij[4]; + dnbasis_ij[0] = dnbsplines_ij[iknot_ij].eval2(rsq_ij, value_rij); + dnbasis_ij[1] = dnbsplines_ij[iknot_ij + 1].eval1(rsq_ij, value_rij); + dnbasis_ij[2] = dnbsplines_ij[iknot_ij + 2].eval0(rsq_ij, value_rij); + dnbasis_ij[3] = 0; + + double dnbasis_ik[4]; + dnbasis_ik[0] = dnbsplines_ik[iknot_ik].eval2(rsq_ik, value_rik); + dnbasis_ik[1] = dnbsplines_ik[iknot_ik + 1].eval1(rsq_ik, value_rik); + dnbasis_ik[2] = dnbsplines_ik[iknot_ik + 2].eval0(rsq_ik, value_rik); + dnbasis_ik[3] = 0; + + double dnbasis_jk[4]; + dnbasis_jk[0] = dnbsplines_jk[iknot_jk].eval2(rsq_jk, value_rjk); + dnbasis_jk[1] = dnbsplines_jk[iknot_jk + 1].eval1(rsq_jk, value_rjk); + dnbasis_jk[2] = dnbsplines_jk[iknot_jk + 2].eval0(rsq_jk, value_rjk); + dnbasis_jk[3] = 0; + + for (int i = 0; i < 3; i++) { + const double dnbasis_iji = dnbasis_ij[i]; + for (int j = 0; j < 4; j++) { + const double factor = dnbasis_iji * basis_ik[j]; + const double* slice = &dncoeff_matrix_ij[iknot_ij + i][iknot_ik + j][iknot_jk]; + double tmp[4]; + tmp[0] = slice[0] * basis_jk[0]; + tmp[1] = slice[1] * basis_jk[1]; + tmp[2] = slice[2] * basis_jk[2]; + tmp[3] = slice[3] * basis_jk[3]; + double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; + ret_val[1] += factor * sum; + } + } + + for (int i = 0; i < 4; i++) { + const double basis_iji = basis_ij[i]; + for (int j = 0; j < 3; j++) { + const double factor = basis_iji * dnbasis_ik[j]; + const double* slice = &dncoeff_matrix_ik[iknot_ij + i][iknot_ik + j][iknot_jk]; + double tmp[4]; + tmp[0] = slice[0] * basis_jk[0]; + tmp[1] = slice[1] * basis_jk[1]; + tmp[2] = slice[2] * basis_jk[2]; + tmp[3] = slice[3] * basis_jk[3]; + double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; + ret_val[2] += factor * sum; + } + } + + for (int i = 0; i < 4; i++) { + const double basis_iji = basis_ij[i]; + for (int j = 0; j < 4; j++) { + const double factor = basis_iji * basis_ik[j]; + const double* slice = &dncoeff_matrix_jk[iknot_ij + i][iknot_ik + j][iknot_jk]; + double tmp[3]; + tmp[0] = slice[0] * dnbasis_jk[0]; + tmp[1] = slice[1] * dnbasis_jk[1]; + tmp[2] = slice[2] * dnbasis_jk[2]; + double sum = tmp[0] + tmp[1] + tmp[2]; + ret_val[3] += factor * sum; + } + } + + return ret_val; +} + +// Find starting knot for spline evaluation + +int uf3_triplet_bspline::starting_knot(const std::vector knot_vect, int knot_vect_size, + double r) +{ + if (knot_vect.front() <= r && r < knot_vect.back()) { + for (int i = 3; i < knot_vect_size - 1; i++) { + if (knot_vect[i] <= r && r < knot_vect[i + 1]) return i; + } + } + + return 0; +} + +int uf3_triplet_bspline::get_starting_index_uniform(const std::vector knot_vect, int knot_vect_size, + double r, double knot_spacing) +{ + return 3+(int)((r-knot_vect[0])/knot_spacing); +} + +int uf3_triplet_bspline::get_starting_index_nonuniform(const std::vector knot_vect, int knot_vect_size, + double r, double knot_spacing) +{ + if (knot_vect.front() <= r && r < knot_vect.back()) { + //Determine the interval for value_rij + for (int i = 3; i < knot_vect_size - 1; ++i) { + if (knot_vect[i] <= r && r < knot_vect[i + 1]) { + return i; + } + } + } +} + +double uf3_triplet_bspline::memory_usage() +{ + double bytes = 0; + + bytes += (double) 3*sizeof(int); //knot_vect_size_ij, + //knot_vect_size_ik, + //knot_vect_size_jk; + + for (int i=0; i + +#ifndef UF3_TRIPLET_BSPLINE_H +#define UF3_TRIPLET_BSPLINE_H + +namespace LAMMPS_NS { +class uf3_triplet_bspline { + private: + LAMMPS *lmp; + int knot_vect_size_ij, knot_vect_size_ik, knot_vect_size_jk; + std::vector>> coeff_matrix, dncoeff_matrix_ij, dncoeff_matrix_ik, + dncoeff_matrix_jk; + std::vector> knot_matrix; + std::vector bsplines_ij, bsplines_ik, bsplines_jk; + std::vector dnbsplines_ij, dnbsplines_ik, dnbsplines_jk; + int get_starting_index_uniform(const std::vector, int, double, double); + int get_starting_index_nonuniform(const std::vector, int, double, double); + int (uf3_triplet_bspline::*get_starting_index)(const std::vector, int, double, double); + //double knot_spacing_ij=0,knot_spacing_ik=0,knot_spacing_jk=0; + //double _alignvar(, 8) ret_val[4]; // Force memory alignment on 8 byte boundaries + double ret_val[4]; + + int starting_knot(const std::vector, int, double); + + public: + //Dummy Constructor + uf3_triplet_bspline(); + uf3_triplet_bspline(LAMMPS *ulmp, const std::vector> &uknot_matrix, + const std::vector>> &ucoeff_matrix, + const int &uknot_spacing_type); + ~uf3_triplet_bspline(); + int knot_spacing_type; + double knot_spacing_ij=0,knot_spacing_ik=0,knot_spacing_jk=0; + double *eval(double value_rij, double value_rik, double value_rjk); + + double memory_usage(); +}; +} // namespace LAMMPS_NS +#endif From 53c6959e52a34fb882954ab2d46a384a6f077db3 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 12:08:07 -0400 Subject: [PATCH 02/65] Added src files for uf3/kk --- src/KOKKOS/pair_uf3_kokkos.cpp | 1722 ++++++++++++++++++++++++++++++++ src/KOKKOS/pair_uf3_kokkos.h | 199 ++++ 2 files changed, 1921 insertions(+) create mode 100644 src/KOKKOS/pair_uf3_kokkos.cpp create mode 100644 src/KOKKOS/pair_uf3_kokkos.h diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp new file mode 100644 index 0000000000..dbcdd22e3d --- /dev/null +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -0,0 +1,1722 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + * Contributing authors: Ajinkya Hire (U of Florida), + * Hendrik Kraß (U of Constance), + * Richard Hennig (U of Florida) + * ---------------------------------------------------------------------- */ + +#include "pair_uf3_kokkos.h" + +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "kokkos.h" +#include "kokkos_type.h" +#include "math_const.h" +#include "memory.h" +#include "memory_kokkos.h" +#include "neigh_list_kokkos.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair_kokkos.h" +#include "text_file_reader.h" +#include +#include +#include + +#include + +using namespace LAMMPS_NS; +using namespace MathConst; + +template PairUF3Kokkos::PairUF3Kokkos(LAMMPS *lmp) : PairUF3(lmp) +{ + respa_enable = 0; + + //kokkosable = 1; + atomKK = (AtomKokkos *) atom; + execution_space = ExecutionSpaceFromDevice::space; + datamask_read = X_MASK | F_MASK | TAG_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; + datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; +} + +template PairUF3Kokkos::~PairUF3Kokkos() +{ + if (!copymode) { + memoryKK->destroy_kokkos(k_eatom, eatom); //destory eatom from host, set it to nullptr + //Also set k_eatom to empty View + memoryKK->destroy_kokkos(k_vatom, vatom); + memoryKK->destroy_kokkos(k_cutsq,cutsq); + destroy_3d(k_cut_3b,cut_3b); + destroy_4d(k_min_cut_3b,min_cut_3b); + eatom = NULL; + vatom = NULL; + cvatom = NULL; + } +} + +template +template +void PairUF3Kokkos::destroy_3d(TYPE data, typename TYPE::value_type*** &array) +{ + if (array == nullptr) return; + data = TYPE(); + memory->sfree(array); + array = nullptr; +} + +template +template +void PairUF3Kokkos::destroy_4d(TYPE data, typename TYPE::value_type**** &array) +{ + if (array == nullptr) return; + data = TYPE(); + memory->sfree(array); + array = nullptr; +} + +/* ---------------------------------------------------------------------- + * global settings + * ---------------------------------------------------------------------- */ + +template void PairUF3Kokkos::settings(int narg, char **arg) +{ + PairUF3::settings(narg, arg); + //1. Determines whether the simulation is 2-body or 2 and 3-body + //2. Set nbody_flag, num_of_elements, pot_3b +} + +/* ---------------------------------------------------------------------- + * set coeffs for one or more type pairs + * ---------------------------------------------------------------------- */ +template void PairUF3Kokkos::coeff(int narg, char **arg) +{ + PairUF3::coeff(narg,arg); + //Also calls allocate internally + //Grows arrays to the right dimensions --> setflag, cutsq, cut, knot_spacing_type_2b, + //n2b_knot, n2b_coeff, UFBS2b, n2b_knot[i], n2b_coeff[i], UFBS2b[i], setflag_3b, + //cut_3b, cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, + //UFBS3b, neighshort + // + //Also reads the pot_files_internally + + +/* copy_2d(d_cutsq, cutsq, num_of_elements + 1, num_of_elements + 1); //copy cutsq from + //host to device memory + if (pot_3b) { + copy_3d(d_cut_3b, cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); + copy_2d(d_cut_3b_list, cut_3b_list, num_of_elements + 1, num_of_elements + 1); + } else { + //why are we allocating space to d_cut_3b, d_cut_3b_list if the pot is 2-body only? + Kokkos::realloc(d_cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); + Kokkos::realloc(d_cut_3b_list, num_of_elements + 1, num_of_elements + 1); + } + //No allocation for device equivalent of --> setflag, cut, knot_spacing_type_2b, + //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, + //cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, + //neighshort + + //UFBS2b and UFBS3b are array of objects. Bad idea to use kokkos view(array) + //for it + create_2b_coefficients(); + if (pot_3b) create_3b_coefficients();*/ +} + +template +void PairUF3Kokkos::allocate() +{ + if (!allocated) PairUF3::allocate(); + int n = atom->ntypes; + memory->destroy(cutsq); //Why are we destroying cutsq? cutsq is allocated when + //PairUF3::coeff or PairUF3::allocate is called; in the next step when k_cutsq + //is created cut_3b is set to point to the host array of k_cutsq + //memory->destroy(cut_3b); + + memoryKK->create_kokkos(k_cutsq,cutsq,n+1,n+1,"pair:cutsq"); + d_cutsq = k_cutsq.template view(); //assignment; get the device + //view of k_cutsq and assign it to d_cutsq; in the header file we just + //decleared d_cutsq's type + memoryKK->create_kokkos(k_cut_3b,n+1,n+1,n+1,"threebody:cut"); + memoryKK->create_kokkos(k_min_cut_3b,n+1,n+1,n+1,3,"threebody:cut"); + d_cut_3b = k_cut_3b.template view(); + d_min_cut_3b = k_min_cut_3b.template view(); +} + + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +template void PairUF3Kokkos::init_style() +{ + + PairUF3::init_style(); + + neighflag = lmp->kokkos->neighflag; + + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + + request->enable_full(); + request->enable_ghost(); +} + +/* ---------------------------------------------------------------------- + init list sets the pointer to full neighbour list requested in previous function +------------------------------------------------------------------------- */ + +template +void PairUF3Kokkos::init_list(int /*id*/, class NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ +template double PairUF3Kokkos::init_one(int i, int j) +{ + double cutone = PairUF3::init_one(i, j); + + if (!coefficients_created) create_coefficients(); + + k_cutsq.h_view(i,j) = k_cutsq.h_view(j,i) = cutone*cutone; //Update the k_cutsq's + //host memory + k_cutsq.template modify(); //Record that k_cutsq's host memory has + //been modified + + return cutone; +} + +template void PairUF3Kokkos::create_coefficients() +{ + coefficients_created = 1; + + /*for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + //Check for knot_spacing type + //Currently only uniform is supported + if (UFBS2b[i][j].knot_spacing_type != 0) + error->all(FLERR,"UF3Kokkos: Currently only uniform knot-spacing is suupoted"); + } + }*/ + + if (pot_3b){ + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = 1; k < num_of_elements + 1; k++) { + /*if (UFBS3b[i][j][k].knot_spacing_type != 0) + error->all(FLERR,"UF3Kokkos: Currently only uniform knot-spacing is suupoted");*/ + k_cut_3b.h_view(i,j,k) = cut_3b[i][j][k]; + + // Notice the order of min_cut_3b[i][j][k] + //In min_cut_3b[i][j][k], + //min_cut_3b[i][j][k][0] is the knot_vector along jk, + //min_cut_3b[i][j][k][1] is the knot_vector along ik, + //min_cut_3b[i][j][k][2] is the knot_vector along ij, + //see pair_uf3.cpp for more details + k_min_cut_3b.h_view(i,j,k,0) = min_cut_3b[i][j][k][0]; + k_min_cut_3b.h_view(i,j,k,1) = min_cut_3b[i][j][k][1]; + k_min_cut_3b.h_view(i,j,k,2) = min_cut_3b[i][j][k][2]; + //k_cut_3b.h_view(i,k,j) = cut_3b[i][k][j]; + } + } + } + k_cut_3b.template modify(); + k_min_cut_3b.template modify(); + } + //copy_2d(d_cutsq, cutsq, num_of_elements + 1, num_of_elements + 1); //copy cutsq from + //host to device memory + /*if (pot_3b) { + copy_3d(d_cut_3b, cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); + copy_2d(d_cut_3b_list, cut_3b_list, num_of_elements + 1, num_of_elements + 1); + } else { + //why are we allocating space to d_cut_3b, d_cut_3b_list if the pot is 2-body only? + Kokkos::realloc(d_cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); + Kokkos::realloc(d_cut_3b_list, num_of_elements + 1, num_of_elements + 1); + }*/ + //No allocation for device equivalent of --> setflag, cut, knot_spacing_type_2b, + //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, + //cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, + //neighshort + + //UFBS2b and UFBS3b are array of objects. Bad idea to use kokkos view(array) + //for it + create_2b_coefficients(); + if (pot_3b) create_3b_coefficients(); + +} + +template void PairUF3Kokkos::create_2b_coefficients() +{ + + // Setup interaction pair map + //TODO: Instead of using map2b and map3b use simple indexing + Kokkos::realloc(map2b, num_of_elements + 1, num_of_elements + 1); + auto map2b_view = Kokkos::create_mirror(map2b); + + int interaction_count = 0; + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + map2b_view(i, j) = interaction_count; + map2b_view(j, i) = interaction_count++; + } + } + Kokkos::deep_copy(map2b, map2b_view); + + // Count max knots for array size + + int max_knots = 0; + for (int i = 1; i < n2b_knot.size(); i++) + for (int j = i; j < n2b_knot[i].size(); j++) max_knots = max(max_knots, n2b_knot[i][j].size()); + + // Copy coefficients to view + + Kokkos::realloc(d_coefficients_2b, interaction_count, max_knots - 4); + auto d_coefficients_2b_view = Kokkos::create_mirror(d_coefficients_2b); + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + for (int k = 0; k < n2b_coeff[i][j].size(); k++) { + d_coefficients_2b_view(map2b_view(i, j), k) = n2b_coeff[i][j][k]; + } + } + } + Kokkos::deep_copy(d_coefficients_2b, d_coefficients_2b_view); + + // Copy knots from array to view + + Kokkos::realloc(d_n2b_knot, interaction_count, max_knots); + Kokkos::realloc(d_n2b_knot_spacings, interaction_count); + auto d_n2b_knot_view = Kokkos::create_mirror(d_n2b_knot); + auto d_n2b_knot_spacings_view = Kokkos::create_mirror(d_n2b_knot_spacings); + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + for (int k = 0; k < n2b_knot[i][j].size(); k++) { + d_n2b_knot_view(map2b_view(i, j), k) = n2b_knot[i][j][k]; + } + d_n2b_knot_spacings_view(map2b_view(i, j)) = UFBS2b[i][j].knot_spacing; + } + } + + Kokkos::deep_copy(d_n2b_knot, d_n2b_knot_view); + Kokkos::deep_copy(d_n2b_knot_spacings, d_n2b_knot_spacings_view); + // Set spline constants + + Kokkos::realloc(constants_2b, interaction_count, max_knots - 4); + auto constants_2b_view = Kokkos::create_mirror(constants_2b); + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + for (int l = 0; l < n2b_knot[i][j].size() - 4; l++) { + auto c = get_constants(&n2b_knot[i][j][l], n2b_coeff[i][j][l]); + for (int k = 0; k < 16; k++) + constants_2b_view(map2b_view(i, j), l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 + : c[k]; + } + } + } + Kokkos::deep_copy(constants_2b, constants_2b_view); + + Kokkos::realloc(dnconstants_2b, interaction_count, max_knots - 5); + auto dnconstants_2b_view = Kokkos::create_mirror(dnconstants_2b); + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + for (int l = 0; l < n2b_knot[i][j].size() - 5; l++) { + double dntemp4 = 3 / (n2b_knot[i][j][l + 4] - n2b_knot[i][j][l + 1]); + double coeff = (n2b_coeff[i][j][l + 1] - n2b_coeff[i][j][l]) * dntemp4; + auto c = get_dnconstants(&n2b_knot[i][j][l + 1], coeff); + for (int k = 0; k < 9; k++) + dnconstants_2b_view(map2b_view(i, j), l, k) = + (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; + } + } + } + Kokkos::deep_copy(dnconstants_2b, dnconstants_2b_view); +} + +template void PairUF3Kokkos::create_3b_coefficients() +{ + // Init interaction map for 3B + + Kokkos::realloc(map3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); + auto map3b_view = Kokkos::create_mirror(map3b); + + int interaction_count = 0; + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = 1; k < num_of_elements + 1; k++) { + map3b_view(i, j, k) = interaction_count; + interaction_count++; + // map3b_view(i, k, j) = interaction_count++; + } + } + } + Kokkos::deep_copy(map3b, map3b_view); + + // Count max knots for view + + int max_knots = 0; + //In n3b_knot_matrix[i][j][k], + //n3b_knot_matrix[i][j][k][0] is the knot_vector along jk, + //n3b_knot_matrix[i][j][k][1] is the knot_vector along ik, + //n3b_knot_matrix[i][j][k][2] is the knot_vector along ij, + //see pair_uf3.cpp for more details + + for (int i = 1; i < n3b_knot_matrix.size(); i++) + for (int j = 1; j < n3b_knot_matrix[i].size(); j++) + for (int k = 1; k < n3b_knot_matrix[i][j].size(); k++) + max_knots = + max(max_knots, + max(n3b_knot_matrix[i][j][k][0].size(), + max(n3b_knot_matrix[i][j][k][1].size(), n3b_knot_matrix[i][j][k][2].size()))); + + // Init knot matrix view + + Kokkos::realloc(d_n3b_knot_matrix, interaction_count, 3, max_knots); + Kokkos::realloc(d_n3b_knot_matrix_spacings, interaction_count, 3); + auto d_n3b_knot_matrix_view = Kokkos::create_mirror(d_n3b_knot_matrix); + auto d_n3b_knot_matrix_spacings_view = Kokkos::create_mirror(d_n3b_knot_matrix_spacings); + + for (int i = 1; i < n3b_knot_matrix.size(); i++) + for (int j = 1; j < n3b_knot_matrix[i].size(); j++) + for (int k = 1; k < n3b_knot_matrix[i][j].size(); k++) { + for (int m = 0; m < n3b_knot_matrix[i][j][k][0].size(); m++) + d_n3b_knot_matrix_view(map3b_view(i, j, k), 0, m) = n3b_knot_matrix[i][j][k][0][m]; + for (int m = 0; m < n3b_knot_matrix[i][j][k][1].size(); m++) + d_n3b_knot_matrix_view(map3b_view(i, j, k), 1, m) = n3b_knot_matrix[i][j][k][1][m]; + for (int m = 0; m < n3b_knot_matrix[i][j][k][2].size(); m++) + d_n3b_knot_matrix_view(map3b_view(i, j, k), 2, m) = n3b_knot_matrix[i][j][k][2][m]; + + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = UFBS3b[i][j][k].knot_spacing_ij; + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = UFBS3b[i][j][k].knot_spacing_ik; + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = UFBS3b[i][j][k].knot_spacing_jk; + } + Kokkos::deep_copy(d_n3b_knot_matrix, d_n3b_knot_matrix_view); + Kokkos::deep_copy(d_n3b_knot_matrix_spacings, d_n3b_knot_matrix_spacings_view); + + // Set knots spacings + + Kokkos::realloc(d_n3b_knot_spacings, interaction_count, 3); + auto d_n3b_knot_spacings_view = Kokkos::create_mirror(d_n3b_knot_spacings); + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + for (int k = 1; k < num_of_elements + 1; k++) { + d_n3b_knot_spacings_view(map3b_view(i, j, k), 0) = + 1 / (n3b_knot_matrix[i][j][k][0][5] - n3b_knot_matrix[i][j][k][0][4]); + d_n3b_knot_spacings_view(map3b_view(i, j, k), 1) = + 1 / (n3b_knot_matrix[i][j][k][1][5] - n3b_knot_matrix[i][j][k][1][4]); + d_n3b_knot_spacings_view(map3b_view(i, j, k), 2) = + 1 / (n3b_knot_matrix[i][j][k][2][5] - n3b_knot_matrix[i][j][k][2][4]); + } + } + } + Kokkos::deep_copy(d_n3b_knot_spacings, d_n3b_knot_spacings_view); + + // Copy coefficients + + Kokkos::realloc(d_coefficients_3b, interaction_count, max_knots - 4, max_knots - 4, + max_knots - 4); + auto d_coefficients_3b_view = Kokkos::create_mirror(d_coefficients_3b); + + for (int n = 1; n < num_of_elements + 1; n++) { + for (int m = 1; m < num_of_elements + 1; m++) { + for (int o = 1; o < num_of_elements + 1; o++) { + std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); + for (int i = 0; i < n3b_coeff_matrix[key].size(); i++) { + for (int j = 0; j < n3b_coeff_matrix[key][i].size(); j++) { + for (int k = 0; k < n3b_coeff_matrix[key][i][j].size() - 1; k++) { + d_coefficients_3b_view(map3b_view(n, m, o), i, j, k) = n3b_coeff_matrix[key][i][j][k]; + } + } + } + } + } + } + Kokkos::deep_copy(d_coefficients_3b, d_coefficients_3b_view); + // + // Create derivative coefficients + + // TODO: Shrink size + Kokkos::realloc(d_dncoefficients_3b, interaction_count, 3, max_knots - 4, max_knots - 4, + max_knots - 4); + auto d_dncoefficients_3b_view = Kokkos::create_mirror(d_dncoefficients_3b); + + //Notice the order for d_dncoefficients_3b_view(map3b_view(n, m, o), X, i, j, k) + //d_dncoefficients_3b_view(map3b_view(n, m, o), 2, i, j, k) --> coeff for rjk + //d_dncoefficients_3b_view(map3b_view(n, m, o), 1, i, j, k) --> coeff for rik + //d_dncoefficients_3b_view(map3b_view(n, m, o), 0, i, j, k) --> coeff for rij + // + //This is because- + //In n3b_knot_matrix[i][j][k], + //n3b_knot_matrix[i][j][k][0] is the knot_vector along jk, + //n3b_knot_matrix[i][j][k][1] is the knot_vector along ik, + //n3b_knot_matrix[i][j][k][2] is the knot_vector along ij, + //see pair_uf3.cpp for more details + + for (int n = 1; n < num_of_elements + 1; n++) { + for (int m = 1; m < num_of_elements + 1; m++) { + for (int o = 1; o < num_of_elements + 1; o++) { + std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); + for (int i = 0; i < n3b_coeff_matrix[key].size(); i++) { + for (int j = 0; j < n3b_coeff_matrix[key][i].size(); j++) { + for (int k = 0; k < n3b_coeff_matrix[key][i][j].size() - 1; k++) { + F_FLOAT dntemp4 = + 3 / (n3b_knot_matrix[n][m][o][0][k + 4] - n3b_knot_matrix[n][m][o][0][k + 1]); + d_dncoefficients_3b_view(map3b_view(n, m, o), 2, i, j, k) = + (n3b_coeff_matrix[key][i][j][k + 1] - n3b_coeff_matrix[key][i][j][k]) * dntemp4; + } + } + } + + for (int i = 0; i < n3b_coeff_matrix[key].size(); i++) { + std::vector> dncoeff_vect2; + for (int j = 0; j < n3b_coeff_matrix[key][i].size() - 1; j++) { + F_FLOAT dntemp4 = + 3 / (n3b_knot_matrix[n][m][o][1][j + 4] - n3b_knot_matrix[n][m][o][1][j + 1]); + std::vector dncoeff_vect; + for (int k = 0; k < n3b_coeff_matrix[key][i][j].size(); k++) { + d_dncoefficients_3b_view(map3b_view(n, m, o), 1, i, j, k) = + (n3b_coeff_matrix[key][i][j + 1][k] - n3b_coeff_matrix[key][i][j][k]) * dntemp4; + } + } + } + + for (int i = 0; i < n3b_coeff_matrix[key].size() - 1; i++) { + F_FLOAT dntemp4 = + 3 / (n3b_knot_matrix[n][m][o][2][i + 4] - n3b_knot_matrix[n][m][o][2][i + 1]); + for (int j = 0; j < n3b_coeff_matrix[key][i].size(); j++) { + for (int k = 0; k < n3b_coeff_matrix[key][i][j].size(); k++) { + d_dncoefficients_3b_view(map3b_view(n, m, o), 0, i, j, k) = + (n3b_coeff_matrix[key][i + 1][j][k] - n3b_coeff_matrix[key][i][j][k]) * dntemp4; + } + } + } + } + } + } + Kokkos::deep_copy(d_dncoefficients_3b, d_dncoefficients_3b_view); + + // Set spline constants + + Kokkos::realloc(constants_3b, interaction_count, 3, max_knots - 4); + auto constants_3b_view = Kokkos::create_mirror(constants_3b); + + //In n3b_knot_matrix[i][j][k], + //n3b_knot_matrix[i][j][k][0] is the knot_vector along jk, + //n3b_knot_matrix[i][j][k][1] is the knot_vector along ik, + //n3b_knot_matrix[i][j][k][2] is the knot_vector along ij, + //see pair_uf3.cpp for more details + for (int n = 1; n < num_of_elements + 1; n++) { + for (int m = 1; m < num_of_elements + 1; m++) { + for (int o = 1; o < num_of_elements + 1; o++) { + for (int l = 0; l < n3b_knot_matrix[n][m][o][2].size() - 4; l++) { + auto c = get_constants(&n3b_knot_matrix[n][m][o][2][l], 1); + for (int k = 0; k < 16; k++) + constants_3b_view(map3b_view(n, m, o), 0, l, k) = + (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; + } + for (int l = 0; l < n3b_knot_matrix[n][m][o][1].size() - 4; l++) { + auto c = get_constants(&n3b_knot_matrix[n][m][o][1][l], 1); + for (int k = 0; k < 16; k++) + constants_3b_view(map3b_view(n, m, o), 1, l, k) = + (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; + } + for (int l = 0; l < n3b_knot_matrix[n][m][o][0].size() - 4; l++) { + auto c = get_constants(&n3b_knot_matrix[n][m][o][0][l], 1); + for (int k = 0; k < 16; k++) + constants_3b_view(map3b_view(n, m, o), 2, l, k) = + (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; + } + } + } + } + Kokkos::deep_copy(constants_3b, constants_3b_view); + + Kokkos::realloc(dnconstants_3b, interaction_count, 3, max_knots - 6); + auto dnconstants_3b_view = Kokkos::create_mirror(dnconstants_3b); + + for (int n = 1; n < num_of_elements + 1; n++) { + for (int m = 1; m < num_of_elements + 1; m++) { + for (int o = 1; o < num_of_elements + 1; o++) { + for (int l = 1; l < n3b_knot_matrix[n][m][o][2].size() - 5; l++) { + auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][2][l], 1); + for (int k = 0; k < 9; k++) + dnconstants_3b_view(map3b_view(n, m, o), 0, l - 1, k) = + (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; + } + for (int l = 1; l < n3b_knot_matrix[n][m][o][1].size() - 5; l++) { + auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][1][l], 1); + for (int k = 0; k < 9; k++) + dnconstants_3b_view(map3b_view(n, m, o), 1, l - 1, k) = + (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; + } + for (int l = 1; l < n3b_knot_matrix[n][m][o][0].size() - 5; l++) { + auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][0][l], 1); + for (int k = 0; k < 9; k++) + dnconstants_3b_view(map3b_view(n, m, o), 2, l - 1, k) = + (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; + } + } + } + } + Kokkos::deep_copy(dnconstants_3b, dnconstants_3b_view); +} + +template +template +KOKKOS_INLINE_FUNCTION void PairUF3Kokkos::twobody(const int itype, const int jtype, + const F_FLOAT r, F_FLOAT &evdwl, + F_FLOAT &fpair) const +{ + + // Find knot starting position + int interaction_id = map2b(itype, jtype); + int start_index = 3; + while (r > d_n2b_knot(interaction_id, start_index + 1)) start_index++; + //int start_index = 3+(int)((r-d_n2b_knot(interaction_id,0))/d_n2b_knot_spacings(interaction_id)); + + F_FLOAT r_values[4]; + r_values[0] = 1; + r_values[1] = r; + r_values[2] = r_values[1] * r_values[1]; + + if (EVFLAG) { + r_values[3] = r_values[2] * r_values[1]; + // Calculate energy + evdwl = constants_2b(interaction_id, start_index, 0); + evdwl += r_values[1] * constants_2b(interaction_id, start_index, 1); + evdwl += r_values[2] * constants_2b(interaction_id, start_index, 2); + evdwl += r_values[3] * constants_2b(interaction_id, start_index, 3); + evdwl += constants_2b(interaction_id, start_index - 1, 4); + evdwl += r_values[1] * constants_2b(interaction_id, start_index - 1, 5); + evdwl += r_values[2] * constants_2b(interaction_id, start_index - 1, 6); + evdwl += r_values[3] * constants_2b(interaction_id, start_index - 1, 7); + evdwl += constants_2b(interaction_id, start_index - 2, 8); + evdwl += r_values[1] * constants_2b(interaction_id, start_index - 2, 9); + evdwl += r_values[2] * constants_2b(interaction_id, start_index - 2, 10); + evdwl += r_values[3] * constants_2b(interaction_id, start_index - 2, 11); + evdwl += constants_2b(interaction_id, start_index - 3, 12); + evdwl += r_values[1] * constants_2b(interaction_id, start_index - 3, 13); + evdwl += r_values[2] * constants_2b(interaction_id, start_index - 3, 14); + evdwl += r_values[3] * constants_2b(interaction_id, start_index - 3, 15); + } + + // Calculate force + fpair = dnconstants_2b(interaction_id, start_index - 1, 0); + fpair += r_values[1] * dnconstants_2b(interaction_id, start_index - 1, 1); + fpair += r_values[2] * dnconstants_2b(interaction_id, start_index - 1, 2); + fpair += dnconstants_2b(interaction_id, start_index - 2, 3); + fpair += r_values[1] * dnconstants_2b(interaction_id, start_index - 2, 4); + fpair += r_values[2] * dnconstants_2b(interaction_id, start_index - 2, 5); + fpair += dnconstants_2b(interaction_id, start_index - 3, 6); + fpair += r_values[1] * dnconstants_2b(interaction_id, start_index - 3, 7); + fpair += r_values[2] * dnconstants_2b(interaction_id, start_index - 3, 8); +} + +template +template +KOKKOS_INLINE_FUNCTION void PairUF3Kokkos::threebody( + const int itype, const int jtype, const int ktype, const F_FLOAT value_rij, + const F_FLOAT value_rik, const F_FLOAT value_rjk, F_FLOAT &evdwl, F_FLOAT (&fforce)[3]) const +{ + evdwl = 0; + fforce[0] = 0; + fforce[1] = 0; + fforce[2] = 0; + + F_FLOAT evals[3][4]; + F_FLOAT dnevals[3][4]; + int start_indices[3]; + F_FLOAT r[3] = {value_rij, value_rik, value_rjk}; + int interaction_id = map3b(itype, jtype, ktype); + + auto coefficients = + Kokkos::subview(d_coefficients_3b, interaction_id, Kokkos::ALL, Kokkos::ALL, Kokkos::ALL); + auto dncoefficients = Kokkos::subview(d_dncoefficients_3b, interaction_id, Kokkos::ALL, + Kokkos::ALL, Kokkos::ALL, Kokkos::ALL); + //Notice the 2-d in d_n3b_knot_matrix + // + //In d_n3b_knot_matrix[i][j][k], + //d_n3b_knot_matrix[i][j][k][0] is the knot_vector along jk, + //d_n3b_knot_matrix[i][j][k][1] is the knot_vector along ik, + //d_n3b_knot_matrix[i][j][k][2] is the knot_vector along ij, + // + //and r[0] = rij, r[1] = rik and r[2] = rjk + //see n3b_knot_matrix and pair_uf3.cpp for more details + for (int d = 0; d < 3; d++) { + start_indices[d] = 3; + while (r[d] > d_n3b_knot_matrix(interaction_id, 2-d, start_indices[d] + 1)) start_indices[d]++; + //start_indices[d] = 3+(int)((r[d]-d_n3b_knot_matrix(interaction_id, 2-d, 0))/d_n3b_knot_matrix_spacings(interaction_id, 2-d)); + + F_FLOAT r_values[4]; + r_values[0] = 1; + r_values[1] = r[d]; + r_values[2] = r_values[1] * r_values[1]; + + r_values[3] = r_values[2] * r_values[1]; + + // Calculate energy + evals[d][0] = constants_3b(interaction_id, d, start_indices[d], 0); + evals[d][0] += r_values[1] * constants_3b(interaction_id, d, start_indices[d], 1); + evals[d][0] += r_values[2] * constants_3b(interaction_id, d, start_indices[d], 2); + evals[d][0] += r_values[3] * constants_3b(interaction_id, d, start_indices[d], 3); + evals[d][1] = constants_3b(interaction_id, d, start_indices[d] - 1, 4); + evals[d][1] += r_values[1] * constants_3b(interaction_id, d, start_indices[d] - 1, 5); + evals[d][1] += r_values[2] * constants_3b(interaction_id, d, start_indices[d] - 1, 6); + evals[d][1] += r_values[3] * constants_3b(interaction_id, d, start_indices[d] - 1, 7); + evals[d][2] = constants_3b(interaction_id, d, start_indices[d] - 2, 8); + evals[d][2] += r_values[1] * constants_3b(interaction_id, d, start_indices[d] - 2, 9); + evals[d][2] += r_values[2] * constants_3b(interaction_id, d, start_indices[d] - 2, 10); + evals[d][2] += r_values[3] * constants_3b(interaction_id, d, start_indices[d] - 2, 11); + evals[d][3] = constants_3b(interaction_id, d, start_indices[d] - 3, 12); + evals[d][3] += r_values[1] * constants_3b(interaction_id, d, start_indices[d] - 3, 13); + evals[d][3] += r_values[2] * constants_3b(interaction_id, d, start_indices[d] - 3, 14); + evals[d][3] += r_values[3] * constants_3b(interaction_id, d, start_indices[d] - 3, 15); + + dnevals[d][0] = dnconstants_3b(interaction_id, d, start_indices[d] - 1, 0); + dnevals[d][0] += r_values[1] * dnconstants_3b(interaction_id, d, start_indices[d] - 1, 1); + dnevals[d][0] += r_values[2] * dnconstants_3b(interaction_id, d, start_indices[d] - 1, 2); + dnevals[d][1] = dnconstants_3b(interaction_id, d, start_indices[d] - 2, 3); + dnevals[d][1] += r_values[1] * dnconstants_3b(interaction_id, d, start_indices[d] - 2, 4); + dnevals[d][1] += r_values[2] * dnconstants_3b(interaction_id, d, start_indices[d] - 2, 5); + dnevals[d][2] = dnconstants_3b(interaction_id, d, start_indices[d] - 3, 6); + dnevals[d][2] += r_values[1] * dnconstants_3b(interaction_id, d, start_indices[d] - 3, 7); + dnevals[d][2] += r_values[2] * dnconstants_3b(interaction_id, d, start_indices[d] - 3, 8); + dnevals[d][3] = 0; + } + + if (EVFLAG) { + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + for (int k = 0; k < 4; k++) { + evdwl += coefficients(start_indices[0] - i, start_indices[1] - j, start_indices[2] - k) * + evals[0][i] * evals[1][j] * evals[2][k]; + } + } + } + } + + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 4; j++) { + for (int k = 0; k < 4; k++) { + fforce[0] += dncoefficients(0, start_indices[0] - 3 + i, start_indices[1] - 3 + j, + start_indices[2] - 3 + k) * + dnevals[0][2 - i] * evals[1][3 - j] * evals[2][3 - k]; + } + } + } + + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 3; j++) { + for (int k = 0; k < 4; k++) { + fforce[1] += dncoefficients(1, start_indices[0] - 3 + i, start_indices[1] - 3 + j, + start_indices[2] - 3 + k) * + evals[0][3 - i] * dnevals[1][2 - j] * evals[2][3 - k]; + } + } + } + + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + for (int k = 0; k < 3; k++) { + fforce[2] += dncoefficients(2, start_indices[0] - 3 + i, start_indices[1] - 3 + j, + start_indices[2] - 3 + k) * + evals[0][3 - i] * evals[1][3 - j] * dnevals[2][2 - k]; + } + } + } +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +/*template void PairUF3Kokkos::init_style() +{ + + PairUF3::init_style(); + + neighflag = lmp->kokkos->neighflag; + + auto request = neighbor->find_request(this); + request->set_kokkos_host(std::is_same::value && + !std::is_same::value); + request->set_kokkos_device(std::is_same::value); + + request->enable_full(); + // request->enable_ghost(); +}*/ + +/* ---------------------------------------------------------------------- + init list sets the pointer to full neighbour list requested in previous function +------------------------------------------------------------------------- */ + +//template +//void PairUF3Kokkos::init_list(int /*id*/, class NeighList *ptr) +//{ +// list = ptr; +//} + +template void PairUF3Kokkos::compute(int eflag_in, int vflag_in) +{ + eflag = eflag_in; + vflag = vflag_in; + + if (neighflag == FULL) no_virial_fdotr_compute = 1; + + ev_init(eflag, vflag, 0); + + // reallocate per-atom arrays if necessary + + if (eflag_atom) { + memoryKK->destroy_kokkos(k_eatom, eatom); + memoryKK->create_kokkos(k_eatom, eatom, maxeatom, "pair:eatom"); + d_eatom = k_eatom.view(); + } + if (vflag_atom) { + memoryKK->destroy_kokkos(k_vatom, vatom); + memoryKK->create_kokkos(k_vatom, vatom, maxvatom, "pair:vatom"); + d_vatom = k_vatom.view(); + } + + atomKK->sync(execution_space, datamask_read); + if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); + else atomKK->modified(execution_space,F_MASK); + + x = atomKK->k_x.template view(); + f = atomKK->k_f.template view(); + tag = atomKK->k_tag.template view(); + type = atomKK->k_type.template view(); + nlocal = atom->nlocal; + newton_pair = force->newton_pair; + nall = atom->nlocal + atom->nghost; + k_cutsq.template sync(); //Sync the device memory of k_cutsq with + //the array from the host memory; this updates d_cutsq also + k_cut_3b.template sync(); + k_min_cut_3b.template sync(); + + inum = list->inum; + const int ignum = inum + list->gnum; + NeighListKokkos *k_list = static_cast *>(list); + d_ilist = k_list->d_ilist; + d_numneigh = k_list->d_numneigh; + d_neighbors = k_list->d_neighbors; + + copymode = 1; + + escatter = ScatterEType(d_eatom); + fscatter = ScatterFType(f); + vscatter = ScatterVType(d_vatom); + //cvscatter = ScatterCVType(d_cvatom); + + EV_FLOAT ev; + EV_FLOAT ev_all; + + // build short neighbor list + + int max_neighs = d_neighbors.extent(1); + + if (((int)d_neighbors_short.extent(1) != max_neighs) || + ((int)d_neighbors_short.extent(0) != ignum)) { + d_neighbors_short = Kokkos::View("UF3::neighbors_short", ignum, max_neighs); + } + if (d_numneigh_short.extent(0) != ignum) + d_numneigh_short = Kokkos::View("UF3::numneighs_short", ignum); + Kokkos::parallel_for( + Kokkos::RangePolicy(0, ignum), *this); + + // loop over neighbor list of my atoms + + if (evflag){ + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0, inum), *this, ev); + } + else{ + Kokkos::parallel_for( + Kokkos::RangePolicy>(0, inum), *this); + } + ev_all += ev; + + Kokkos::Experimental::contribute(d_eatom, escatter); + Kokkos::Experimental::contribute(d_vatom, vscatter); + //Kokkos::Experimental::contribute(d_cvatom, cvscatter); + Kokkos::Experimental::contribute(f, fscatter); + + if (eflag_global) eng_vdwl += ev_all.evdwl; + if (vflag_global) { + virial[0] += ev_all.v[0]; + virial[1] += ev_all.v[1]; + virial[2] += ev_all.v[2]; + virial[3] += ev_all.v[3]; + virial[4] += ev_all.v[4]; + virial[5] += ev_all.v[5]; + } + + if (eflag_atom) { + k_eatom.template modify(); + k_eatom.template sync(); + } + + if (vflag_atom) { + k_vatom.template modify(); + k_vatom.template sync(); + } + + if (cvflag_atom) { + //k_cvatom.template modify(); + //k_cvatom.template sync(); + } + + if (vflag_fdotr) pair_virial_fdotr_compute(this); + + copymode = 0; +} + +/* ---------------------------------------------------------------------- */ + +template +KOKKOS_INLINE_FUNCTION void PairUF3Kokkos::operator()(TagPairUF3ComputeShortNeigh, + const int &ii) const +{ + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i, 0); + const X_FLOAT ytmp = x(i, 1); + const X_FLOAT ztmp = x(i, 2); + + const int jnum = d_numneigh[i]; + int inside = 0; + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i, jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j, 0); + const X_FLOAT dely = ytmp - x(j, 1); + const X_FLOAT delz = ztmp - x(j, 2); + const F_FLOAT rsq = delx * delx + dely * dely + delz * delz; + + const int itype = type[i]; + const int jtype = type[j]; + + if (rsq <= d_cutsq(itype, jtype)) { + d_neighbors_short(i, inside) = j; + inside++; + } + } + d_numneigh_short(i) = inside; +} + +/* ---------------------------------------------------------------------- */ + +template +template +KOKKOS_INLINE_FUNCTION void +PairUF3Kokkos::operator()(TagPairUF3ComputeFullA, const int &ii, + EV_FLOAT &ev) const +{ + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = vscatter.access(); + auto a_f = fscatter.access(); + auto a_cvatom = cvscatter.access(); + + F_FLOAT del_rji[3], del_rki[3], del_rkj[3], triangle_eval[3]; + F_FLOAT fij[3], fik[3], fjk[3]; + F_FLOAT fji[3], fki[3], fkj[3]; + F_FLOAT Fj[3], Fk[3]; + F_FLOAT evdwl = 0, evdwl3 = 0; + F_FLOAT fpair = 0; + + const int i = d_ilist[ii]; + + const tagint itag = tag[i]; + const int itype = type[i]; + const X_FLOAT xtmp = x(i, 0); + const X_FLOAT ytmp = x(i, 1); + const X_FLOAT ztmp = x(i, 2); + + // two-body interactions + + const int jnum = d_numneigh_short[i]; + + F_FLOAT fxtmpi = 0.0; + F_FLOAT fytmpi = 0.0; + F_FLOAT fztmpi = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors_short(i, jj); + j &= NEIGHMASK; + const tagint jtag = tag[j]; + + const int jtype = type[j]; + + const X_FLOAT delx = xtmp - x(j, 0); + const X_FLOAT dely = ytmp - x(j, 1); + const X_FLOAT delz = ztmp - x(j, 2); + const F_FLOAT rsq = delx * delx + dely * dely + delz * delz; + + if (rsq >= d_cutsq(itype, jtype)) continue; + + const F_FLOAT rij = sqrt(rsq); + this->template twobody(itype, jtype, rij, evdwl, fpair); + + fpair = -fpair / rij; + + fxtmpi += delx * fpair; + fytmpi += dely * fpair; + fztmpi += delz * fpair; + a_f(j, 0) -= delx * fpair; + a_f(j, 1) -= dely * fpair; + a_f(j, 2) -= delz * fpair; + + if (EVFLAG) { + if (eflag) ev.evdwl += evdwl; + if (vflag_either || eflag_atom) + this->template ev_tally(ev, i, j, evdwl, fpair, delx, dely, delz); + } + } + + // 3-body interaction + // jth atom + const int jnumm1 = jnum - 1; + for (int jj = 0; jj < jnumm1; jj++) { + int j = d_neighbors_short(i, jj); + j &= NEIGHMASK; + const int jtype = type[j]; + del_rji[0] = x(j, 0) - xtmp; + del_rji[1] = x(j, 1) - ytmp; + del_rji[2] = x(j, 2) - ztmp; + F_FLOAT rij = sqrt(del_rji[0] * del_rji[0] + del_rji[1] * del_rji[1] + del_rji[2] * del_rji[2]); + + F_FLOAT fxtmpj = 0.0; + F_FLOAT fytmpj = 0.0; + F_FLOAT fztmpj = 0.0; + + for (int kk = jj + 1; kk < jnum; kk++) { + int k = d_neighbors_short(i, kk); + k &= NEIGHMASK; + const int ktype = type[k]; + + // Notice the order of d_min_cut_3b[i][j][k] + //In d_min_cut_3b[i][j][k], + //d_min_cut_3b[i][j][k][0] is the knot_vector along jk, + //d_min_cut_3b[i][j][k][1] is the knot_vector along ik, + //d_min_cut_3b[i][j][k][2] is the knot_vector along ij, + //see pair_uf3.cpp for more details + if (rij < d_min_cut_3b(itype, jtype, ktype, 2)) continue; + if (rij > d_cut_3b(itype, jtype, ktype)) continue; + + del_rki[0] = x(k, 0) - xtmp; + del_rki[1] = x(k, 1) - ytmp; + del_rki[2] = x(k, 2) - ztmp; + F_FLOAT rik = + sqrt(del_rki[0] * del_rki[0] + del_rki[1] * del_rki[1] + del_rki[2] * del_rki[2]); + + if (rik < d_min_cut_3b(itype, jtype, ktype, 1)) continue; + if (rik > d_cut_3b(itype, ktype, jtype)) continue; + + del_rkj[0] = x(k, 0) - x(j, 0); + del_rkj[1] = x(k, 1) - x(j, 1); + del_rkj[2] = x(k, 2) - x(j, 2); + F_FLOAT rjk = + sqrt(del_rkj[0] * del_rkj[0] + del_rkj[1] * del_rkj[1] + del_rkj[2] * del_rkj[2]); + if (rjk < d_min_cut_3b(itype, jtype, ktype, 0)) continue; + this->template threebody(itype, jtype, ktype, rij, rik, rjk, evdwl3, triangle_eval); + + fij[0] = *(triangle_eval + 0) * (del_rji[0] / rij); + fji[0] = -fij[0]; + fik[0] = *(triangle_eval + 1) * (del_rki[0] / rik); + fki[0] = -fik[0]; + fjk[0] = *(triangle_eval + 2) * (del_rkj[0] / rjk); + fkj[0] = -fjk[0]; + + fij[1] = *(triangle_eval + 0) * (del_rji[1] / rij); + fji[1] = -fij[1]; + fik[1] = *(triangle_eval + 1) * (del_rki[1] / rik); + fki[1] = -fik[1]; + fjk[1] = *(triangle_eval + 2) * (del_rkj[1] / rjk); + fkj[1] = -fjk[1]; + + fij[2] = *(triangle_eval + 0) * (del_rji[2] / rij); + fji[2] = -fij[2]; + fik[2] = *(triangle_eval + 1) * (del_rki[2] / rik); + fki[2] = -fik[2]; + fjk[2] = *(triangle_eval + 2) * (del_rkj[2] / rjk); + fkj[2] = -fjk[2]; + + Fj[0] = fji[0] + fjk[0]; + Fj[1] = fji[1] + fjk[1]; + Fj[2] = fji[2] + fjk[2]; + + Fk[0] = fki[0] + fkj[0]; + Fk[1] = fki[1] + fkj[1]; + Fk[2] = fki[2] + fkj[2]; + + fxtmpi += (fij[0] + fik[0]); + fytmpi += (fij[1] + fik[1]); + fztmpi += (fij[2] + fik[2]); + fxtmpj += Fj[0]; + fytmpj += Fj[1]; + fztmpj += Fj[2]; + a_f(k, 0) += Fk[0]; + a_f(k, 1) += Fk[1]; + a_f(k, 2) += Fk[2]; + + if (EVFLAG) { + if (eflag) { ev.evdwl += evdwl3; } + if (vflag_either || eflag_atom) { + this->template ev_tally3(ev, i, j, k, evdwl3, 0.0, Fj, Fk, del_rji, del_rki); + if (cvflag_atom) { + + F_FLOAT ric[3]; + ric[0] = THIRD * (-del_rji[0] - del_rki[0]); + ric[1] = THIRD * (-del_rji[1] - del_rki[1]); + ric[2] = THIRD * (-del_rji[2] - del_rki[2]); + a_cvatom(i, 0) += ric[0] * (-Fj[0] - Fk[0]); + a_cvatom(i, 1) += ric[1] * (-Fj[1] - Fk[1]); + a_cvatom(i, 2) += ric[2] * (-Fj[2] - Fk[2]); + a_cvatom(i, 3) += ric[0] * (-Fj[1] - Fk[1]); + a_cvatom(i, 4) += ric[0] * (-Fj[2] - Fk[2]); + a_cvatom(i, 5) += ric[1] * (-Fj[2] - Fk[2]); + a_cvatom(i, 6) += ric[1] * (-Fj[0] - Fk[0]); + a_cvatom(i, 7) += ric[2] * (-Fj[0] - Fk[0]); + a_cvatom(i, 8) += ric[2] * (-Fj[1] - Fk[1]); + + double rjc[3]; + rjc[0] = THIRD * (del_rji[0] - del_rkj[0]); + rjc[1] = THIRD * (del_rji[1] - del_rkj[1]); + rjc[2] = THIRD * (del_rji[2] - del_rkj[2]); + + a_cvatom(j, 0) += rjc[0] * Fj[0]; + a_cvatom(j, 1) += rjc[1] * Fj[1]; + a_cvatom(j, 2) += rjc[2] * Fj[2]; + a_cvatom(j, 3) += rjc[0] * Fj[1]; + a_cvatom(j, 4) += rjc[0] * Fj[2]; + a_cvatom(j, 5) += rjc[1] * Fj[2]; + a_cvatom(j, 6) += rjc[1] * Fj[0]; + a_cvatom(j, 7) += rjc[2] * Fj[0]; + a_cvatom(j, 8) += rjc[2] * Fj[1]; + + double rkc[3]; + rkc[0] = THIRD * (del_rki[0] + del_rkj[0]); + rkc[1] = THIRD * (del_rki[1] + del_rkj[1]); + rkc[2] = THIRD * (del_rki[2] + del_rkj[2]); + + a_cvatom(k, 0) += rkc[0] * Fk[0]; + a_cvatom(k, 1) += rkc[1] * Fk[1]; + a_cvatom(k, 2) += rkc[2] * Fk[2]; + a_cvatom(k, 3) += rkc[0] * Fk[1]; + a_cvatom(k, 4) += rkc[0] * Fk[2]; + a_cvatom(k, 5) += rkc[1] * Fk[2]; + a_cvatom(k, 6) += rkc[1] * Fk[0]; + a_cvatom(k, 7) += rkc[2] * Fk[0]; + a_cvatom(k, 8) += rkc[2] * Fk[1]; + } + } + } + } + a_f(j, 0) += fxtmpj; + a_f(j, 1) += fytmpj; + a_f(j, 2) += fztmpj; + } + + a_f(i, 0) += fxtmpi; + a_f(i, 1) += fytmpi; + a_f(i, 2) += fztmpi; +} + +template +template +KOKKOS_INLINE_FUNCTION void +PairUF3Kokkos::operator()(TagPairUF3ComputeFullA, + const int &ii) const +{ + EV_FLOAT ev; + this->template operator()(TagPairUF3ComputeFullA(), ii, ev); +} + +/* ---------------------------------------------------------------------- */ + +template +template +KOKKOS_INLINE_FUNCTION void +PairUF3Kokkos::ev_tally(EV_FLOAT &ev, const int &i, const int &j, const F_FLOAT &epair, + const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, + const F_FLOAT &delz) const +{ + + // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, + // and neither for Serial + + auto a_eatom = escatter.access(); + auto a_vatom = vscatter.access(); + auto a_cvatom = cvscatter.access(); + + if (eflag_atom) { + const E_FLOAT epairhalf = 0.5 * epair; + a_eatom[i] += epairhalf; + a_eatom[j] += epairhalf; + } + + if (vflag_either) { + const E_FLOAT v0 = delx * delx * fpair; + const E_FLOAT v1 = dely * dely * fpair; + const E_FLOAT v2 = delz * delz * fpair; + const E_FLOAT v3 = delx * dely * fpair; + const E_FLOAT v4 = delx * delz * fpair; + const E_FLOAT v5 = dely * delz * fpair; + + if (vflag_global) { + ev.v[0] += v0; + ev.v[1] += v1; + ev.v[2] += v2; + ev.v[3] += v3; + ev.v[4] += v4; + ev.v[5] += v5; + } + + if (vflag_atom) { + a_vatom(i, 0) += 0.5 * v0; + a_vatom(i, 1) += 0.5 * v1; + a_vatom(i, 2) += 0.5 * v2; + a_vatom(i, 3) += 0.5 * v3; + a_vatom(i, 4) += 0.5 * v4; + a_vatom(i, 5) += 0.5 * v5; + + a_vatom(j, 0) += 0.5 * v0; + a_vatom(j, 1) += 0.5 * v1; + a_vatom(j, 2) += 0.5 * v2; + a_vatom(j, 3) += 0.5 * v3; + a_vatom(j, 4) += 0.5 * v4; + a_vatom(j, 5) += 0.5 * v5; + } + + if (cvflag_atom) { + a_cvatom(i, 0) += 0.5 * v0; + a_cvatom(i, 1) += 0.5 * v1; + a_cvatom(i, 2) += 0.5 * v2; + a_cvatom(i, 3) += 0.5 * v3; + a_cvatom(i, 4) += 0.5 * v4; + a_cvatom(i, 5) += 0.5 * v5; + a_cvatom(i, 6) += 0.5 * v3; + a_cvatom(i, 7) += 0.5 * v4; + a_cvatom(i, 8) += 0.5 * v5; + a_cvatom(j, 0) += 0.5 * v0; + a_cvatom(j, 1) += 0.5 * v1; + a_cvatom(j, 2) += 0.5 * v2; + a_cvatom(j, 3) += 0.5 * v3; + a_cvatom(j, 4) += 0.5 * v4; + a_cvatom(j, 5) += 0.5 * v5; + a_cvatom(j, 6) += 0.5 * v3; + a_cvatom(j, 7) += 0.5 * v4; + a_cvatom(j, 8) += 0.5 * v5; + } + } +} + +/* ---------------------------------------------------------------------- + tally eng_vdwl and virial into global and per-atom accumulators + called by SW and hbond potentials, newton_pair is always on + virial = riFi + rjFj + rkFk = (rj-ri) Fj + (rk-ri) Fk = drji*fj + drki*fk + ------------------------------------------------------------------------- */ + +template +template +KOKKOS_INLINE_FUNCTION void +PairUF3Kokkos::ev_tally3(EV_FLOAT &ev, const int &i, const int &j, int &k, + const F_FLOAT &evdwl, const F_FLOAT &ecoul, F_FLOAT *fj, + F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const +{ + F_FLOAT epairthird, v[6]; + + // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, + // and neither for Serial + + auto a_eatom = escatter.access(); + auto a_vatom = vscatter.access(); + + if (eflag_atom) { + epairthird = THIRD * (evdwl + ecoul); + a_eatom[i] += epairthird; + a_eatom[j] += epairthird; + a_eatom[k] += epairthird; + } + + if (vflag_either) { + v[0] = drji[0] * fj[0] + drki[0] * fk[0]; + v[1] = drji[1] * fj[1] + drki[1] * fk[1]; + v[2] = drji[2] * fj[2] + drki[2] * fk[2]; + v[3] = drji[0] * fj[1] + drki[0] * fk[1]; + v[4] = drji[0] * fj[2] + drki[0] * fk[2]; + v[5] = drji[1] * fj[2] + drki[1] * fk[2]; + + if (vflag_global) { + ev.v[0] += v[0]; + ev.v[1] += v[1]; + ev.v[2] += v[2]; + ev.v[3] += v[3]; + ev.v[4] += v[4]; + ev.v[5] += v[5]; + } + + if (vflag_atom) { + a_vatom(i, 0) += THIRD * v[0]; + a_vatom(i, 1) += THIRD * v[1]; + a_vatom(i, 2) += THIRD * v[2]; + a_vatom(i, 3) += THIRD * v[3]; + a_vatom(i, 4) += THIRD * v[4]; + a_vatom(i, 5) += THIRD * v[5]; + + a_vatom(j, 0) += THIRD * v[0]; + a_vatom(j, 1) += THIRD * v[1]; + a_vatom(j, 2) += THIRD * v[2]; + a_vatom(j, 3) += THIRD * v[3]; + a_vatom(j, 4) += THIRD * v[4]; + a_vatom(j, 5) += THIRD * v[5]; + + a_vatom(k, 0) += THIRD * v[0]; + a_vatom(k, 1) += THIRD * v[1]; + a_vatom(k, 2) += THIRD * v[2]; + a_vatom(k, 3) += THIRD * v[3]; + a_vatom(k, 4) += THIRD * v[4]; + a_vatom(k, 5) += THIRD * v[5]; + } + } +} + +/* ---------------------------------------------------------------------- + tally eng_vdwl and virial into global and per-atom accumulators + called by SW and hbond potentials, newton_pair is always on + virial = riFi + rjFj + rkFk = (rj-ri) Fj + (rk-ri) Fk = drji*fj + drki*fk + ------------------------------------------------------------------------- */ + +template +template +void PairUF3Kokkos::copy_2d(V &d, T **h, int m, int n) +{ + Kokkos::View tmp("pair::tmp", m, n); //Create tmp view(array) on + //device memory + + //auto h_view = Kokkos::create_mirror_view(tmp); + auto h_view = Kokkos::create_mirror(tmp); //Create a mirror of the device + //view(array) tmp, as deep_copy is only possible for mirror views + + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + h_view(i, j) = h[i][j]; //fill mirror + } + //views with data from normal array 'h' which always lives on host memory + } + + Kokkos::deep_copy(tmp, h_view); //Deepcopy data from h_view(host) to tmp(device) + + d = tmp; +} + +template +template +void PairUF3Kokkos::copy_3d(V &d, T ***h, int m, int n, int o) +{ + Kokkos::View tmp("pair::tmp", m, n, o); //Create tmp view(array) on + //device memory + + //auto h_view = Kokkos::create_mirror_view(tmp); //create_mirror always copies + //the data. create_mirror_view only copies data if the host cannot access the + //data + auto h_view = Kokkos::create_mirror(tmp); //Create a mirror of the device + //view(array) tmp, as deep_copy is only possible for mirror views + for (int i = 0; i < m; i++) { + for (int j = 0; j < n; j++) { + for (int k = 0; k < o; k++) { h_view(i, j, k) = h[i][j][k]; } //fill mirror + //views with data from normal array 'h' which always lives on host memory + } + } + + Kokkos::deep_copy(tmp, h_view); //Deepcopy data from h_view(host) to tmp(device) + + d = tmp; +} + +template +std::vector PairUF3Kokkos::get_constants(double *knots, double coefficient) +{ + + std::vector constants(16); + + constants[0] = coefficient * + (-pow(knots[0], 3) / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + constants[1] = coefficient * + (3 * pow(knots[0], 2) / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + constants[2] = coefficient * + (-3 * knots[0] / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + constants[3] = coefficient * + (1 / + (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[3])); + constants[4] = coefficient * + (pow(knots[1], 2) * knots[4] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) + + pow(knots[0], 2) * knots[2] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * knots[1] * knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + constants[5] = coefficient * + (-pow(knots[1], 2) / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) - + 2 * knots[1] * knots[4] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) - + pow(knots[0], 2) / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + 2 * knots[0] * knots[2] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + knots[0] * knots[1] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + knots[0] * knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + knots[1] * knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + constants[6] = coefficient * + (2 * knots[1] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) + + knots[4] / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) + + 2 * knots[0] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[2] / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + knots[1] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + knots[3] / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + constants[7] = coefficient * + (-1 / + (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + knots[2] * knots[3] * knots[4]) - + 1 / + (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - + knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + 1 / + (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + + pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + constants[8] = coefficient * + (-knots[0] * pow(knots[3], 2) / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[1] * knots[3] * knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[2] * pow(knots[4], 2) / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + constants[9] = coefficient * + (2 * knots[0] * knots[3] / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + pow(knots[3], 2) / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + knots[1] * knots[3] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[3] * knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + 2 * knots[2] * knots[4] / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) + + pow(knots[4], 2) / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + constants[10] = coefficient * + (-knots[0] / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + 2 * knots[3] / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[1] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[3] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[4] / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[2] / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) - + 2 * knots[4] / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + constants[11] = coefficient * + (1 / + (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + + knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - + knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + 1 / + (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - + knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + 1 / + (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + + pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + constants[12] = coefficient * + (pow(knots[4], 3) / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + constants[13] = coefficient * + (-3 * pow(knots[4], 2) / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + constants[14] = coefficient * + (3 * knots[4] / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + constants[15] = coefficient * + (-1 / + (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + + knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + + knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + + pow(knots[4], 3))); + + return constants; +} + +template +std::vector PairUF3Kokkos::get_dnconstants(double *knots, double coefficient) +{ + std::vector constants(9); + + constants[0] = coefficient * + (pow(knots[0], 2) / + (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + constants[1] = coefficient * + (-2 * knots[0] / + (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + constants[2] = coefficient * + (1 / (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + constants[3] = coefficient * + (-knots[1] * knots[3] / + (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + knots[0] * knots[2] / + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + constants[4] = coefficient * + (knots[1] / + (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + knots[3] / + (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + knots[0] / + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2)) + + knots[2] / + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + constants[5] = coefficient * + (-1 / (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + 1 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + constants[6] = coefficient * + (pow(knots[3], 2) / + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + constants[7] = coefficient * + (-2 * knots[3] / + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + constants[8] = coefficient * + (1 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + + return constants; +} + +template +double PairUF3Kokkos::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, + double /*factor_coul*/, double factor_lj, double &fforce) +{ + double value = 0.0; + double r = sqrt(rsq); + int interaction_id = map2b(itype, jtype); + int start_index = 3; + while (r > d_n2b_knot(interaction_id, start_index + 1)) start_index++; + + if (r < d_cutsq(itype, jtype)) { + F_FLOAT r_values[4]; + r_values[0] = 1; + r_values[1] = r; + r_values[2] = r_values[1] * r_values[1]; + r_values[3] = r_values[2] * r_values[1]; + + // Calculate energy + value = constants_2b(interaction_id, start_index, 0); + value += r_values[1] * constants_2b(interaction_id, start_index, 1); + value += r_values[2] * constants_2b(interaction_id, start_index, 2); + value += r_values[3] * constants_2b(interaction_id, start_index, 3); + value += constants_2b(interaction_id, start_index - 1, 4); + value += r_values[1] * constants_2b(interaction_id, start_index - 1, 5); + value += r_values[2] * constants_2b(interaction_id, start_index - 1, 6); + value += r_values[3] * constants_2b(interaction_id, start_index - 1, 7); + value += constants_2b(interaction_id, start_index - 2, 8); + value += r_values[1] * constants_2b(interaction_id, start_index - 2, 9); + value += r_values[2] * constants_2b(interaction_id, start_index - 2, 10); + value += r_values[3] * constants_2b(interaction_id, start_index - 2, 11); + value += constants_2b(interaction_id, start_index - 3, 12); + value += r_values[1] * constants_2b(interaction_id, start_index - 3, 13); + value += r_values[2] * constants_2b(interaction_id, start_index - 3, 14); + value += r_values[3] * constants_2b(interaction_id, start_index - 3, 15); + + // Calculate force + fforce = dnconstants_2b(interaction_id, start_index - 1, 0); + fforce += r_values[1] * dnconstants_2b(interaction_id, start_index - 1, 1); + fforce += r_values[2] * dnconstants_2b(interaction_id, start_index - 1, 2); + fforce += dnconstants_2b(interaction_id, start_index - 2, 3); + fforce += r_values[1] * dnconstants_2b(interaction_id, start_index - 2, 4); + fforce += r_values[2] * dnconstants_2b(interaction_id, start_index - 2, 5); + fforce += dnconstants_2b(interaction_id, start_index - 3, 6); + fforce += r_values[1] * dnconstants_2b(interaction_id, start_index - 3, 7); + fforce += r_values[2] * dnconstants_2b(interaction_id, start_index - 3, 8); + } + + return factor_lj * value; +} + +namespace LAMMPS_NS { +template class PairUF3Kokkos; +#ifdef KOKKOS_ENABLE_CUDA +template class PairUF3Kokkos; +#endif +} // namespace LAMMPS_NS diff --git a/src/KOKKOS/pair_uf3_kokkos.h b/src/KOKKOS/pair_uf3_kokkos.h new file mode 100644 index 0000000000..193c65d6de --- /dev/null +++ b/src/KOKKOS/pair_uf3_kokkos.h @@ -0,0 +1,199 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + * Contributing authors: Ajinkya Hire (U of Florida), + * Hendrik Kraß (U of Constance), + * Richard Hennig (U of Florida) + * ---------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(uf3/kk,PairUF3Kokkos) +PairStyle(uf3/kk/device,PairUF3Kokkos) +// clang-format on +#else + +#ifndef LMP_PAIR_UF3_KOKKOS_H +#define LMP_PAIR_UF3_KOKKOS_H + +#include "kokkos.h" +#include "pair_kokkos.h" +#include "pair_uf3.h" + +template struct TagPairUF3ComputeFullA {}; +struct TagPairUF3ComputeShortNeigh {}; + +namespace LAMMPS_NS { + +template class PairUF3Kokkos : public PairUF3 { + public: + PairUF3Kokkos(class LAMMPS *); + ~PairUF3Kokkos() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + void allocate(); + void init_style() override; + void init_list(int, class NeighList *) override; // needed for ptr to full neigh list + double init_one(int, int) override; // needed for cutoff radius for neighbour list + double single(int, int, int, int, double, double, double, double &) override; + + template void copy_2d(V &d, T **h, int m, int n); + template void copy_3d(V &d, T ***h, int m, int n, int o); + + template + KOKKOS_INLINE_FUNCTION void operator()(TagPairUF3ComputeFullA, const int &, + EV_FLOAT &) const; + + template + KOKKOS_INLINE_FUNCTION void operator()(TagPairUF3ComputeFullA, + const int &) const; + + KOKKOS_INLINE_FUNCTION + void operator()(TagPairUF3ComputeShortNeigh, const int &) const; + + enum { EnabledNeighFlags = FULL }; + enum { COUL_FLAG = 0 }; + typedef DeviceType device_type; + typedef ArrayTypes AT; + typedef EV_FLOAT value_type; + + protected: + typename AT::tdual_ffloat_2d k_cutsq;//Create a DualView, defination of tdual_ffloat_2d in kokkos_type.h + typename AT::t_ffloat_2d d_cutsq; //t_ffloat_2d = t_dev ==> Creates a new View d_cutsq + //the type of d_cutsq is decided by the Device(not host) type for the DualView k_cutsq + //Meaning the memory location of d_cutsq is the same as the Device(not host) memory location of + //k_cutsq + typedef Kokkos::DualView tdual_ffloat_3d; + typedef Kokkos::DualView tdual_ffloat_4d; + tdual_ffloat_3d k_cut_3b; + tdual_ffloat_4d k_min_cut_3b; + typename tdual_ffloat_3d::t_dev d_cut_3b; + typename tdual_ffloat_4d::t_dev d_min_cut_3b; + template void destroy_3d(TYPE data, typename TYPE::value_type*** &array); + template void destroy_4d(TYPE data, typename TYPE::value_type**** &array); + Kokkos::View /*d_cutsq,*/ d_cut_3b_list; + //Kokkos::View d_cut_3b; + + Kokkos::View d_coefficients_2b; + Kokkos::View d_dncoefficients_2b; + Kokkos::View d_n2b_knot; + Kokkos::View d_n2b_knot_spacings; + Kokkos::View map2b; + Kokkos::View constants; + Kokkos::View dnconstants; + Kokkos::View d_n3b_knot_matrix; + Kokkos::View d_coefficients_3b; + Kokkos::View d_dncoefficients_3b; + Kokkos::View d_n3b_knot_spacings; + Kokkos::View d_n3b_knot_matrix_spacings; + Kokkos::View map3b; + + Kokkos::View constants_2b; + Kokkos::View dnconstants_2b; + Kokkos::View constants_3b; + Kokkos::View dnconstants_3b; + + std::vector get_constants(double *knots, double coefficient); + std::vector get_dnconstants(double *knots, double coefficient); + + int coefficients_created = 0; + void create_coefficients(); + void create_3b_coefficients(); + void create_2b_coefficients(); + std::vector get_coefficients(const double *knots, const double coefficient) const; + std::vector get_dncoefficients(const double *knots, const double coefficient) const; + + template + void twobody(const int itype, const int jtype, const F_FLOAT r, F_FLOAT &evdwl, + F_FLOAT &fpair) const; + template + void threebody(const int itype, const int jtype, const int ktype, const F_FLOAT value_rij, + const F_FLOAT value_rik, const F_FLOAT value_rjk, F_FLOAT &evdwl3, + F_FLOAT (&fforce)[3]) const; + + template + KOKKOS_INLINE_FUNCTION void + ev_tally(EV_FLOAT &ev, const int &i, const int &j, const F_FLOAT &epair, const F_FLOAT &fpair, + const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; + + template + KOKKOS_INLINE_FUNCTION void ev_tally3(EV_FLOAT &ev, const int &i, const int &j, int &k, + const F_FLOAT &evdwl, const F_FLOAT &ecoul, F_FLOAT *fj, + F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const; + + typename AT::t_x_array_randomread x; + typename AT::t_f_array f; + typename AT::t_tagint_1d tag; + typename AT::t_int_1d_randomread type; + + DAT::tdual_efloat_1d k_eatom; + DAT::tdual_virial_array k_vatom; + typename AT::t_efloat_1d d_eatom; + typename AT::t_virial_array d_vatom; + + using ScatterFType = Kokkos::Experimental::ScatterView; + ScatterFType fscatter; + using ScatterVType = Kokkos::Experimental::ScatterView; + ScatterVType vscatter; + using ScatterCVType = Kokkos::Experimental::ScatterView; + ScatterCVType cvscatter; + using ScatterEType = Kokkos::Experimental::ScatterView; + ScatterEType escatter; + + typename AT::t_neighbors_2d d_neighbors; + typename AT::t_int_1d_randomread d_ilist; + typename AT::t_int_1d_randomread d_numneigh; + + int neighflag, newton_pair; + int nlocal, nall, eflag, vflag; + + int inum; + Kokkos::View d_neighbors_short; + Kokkos::View d_numneigh_short; + + friend void pair_virial_fdotr_compute(PairUF3Kokkos *); +}; + +KOKKOS_INLINE_FUNCTION int min(int i, int j) +{ + return i < j ? i : j; +} +KOKKOS_INLINE_FUNCTION int max(int i, int j) +{ + return i > j ? i : j; +} + +} // namespace LAMMPS_NS + +#endif +#endif + + /* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +*/ From 9a23ddf88aae911f03bb061d77fd3f3cd8864350 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 12:08:51 -0400 Subject: [PATCH 03/65] Added ml-uf3 to cmake and make files --- cmake/CMakeLists.txt | 1 + src/Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f87c92396f..def26bdfed 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -285,6 +285,7 @@ set(STANDARD_PACKAGES ML-RANN ML-SNAP ML-POD + ML-UF3 MOFFF MOLECULE MOLFILE diff --git a/src/Makefile b/src/Makefile index b9f1bcbdef..33d7012cae 100644 --- a/src/Makefile +++ b/src/Makefile @@ -104,6 +104,7 @@ PACKAGE = \ ml-quip \ ml-rann \ ml-snap \ + ml-uf3 \ mofff \ molfile \ netcdf \ From 923e251540a795a20e12cd63e6a91dbdc3f24082 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 12:10:01 -0400 Subject: [PATCH 04/65] Added documentation for ml-uf3 --- doc/src/pair_style.rst | 1 + doc/src/pair_uf3.rst | 186 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 doc/src/pair_uf3.rst diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 53bf269e1c..670ba3e6ec 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -381,6 +381,7 @@ accelerated styles exist. * :doc:`tracker ` - monitor information about pairwise interactions * :doc:`tri/lj ` - LJ potential between triangles * :doc:`ufm ` - +* :doc:`uf3 ` - UF3 machine-learning potential * :doc:`vashishta ` - Vashishta 2-body and 3-body potential * :doc:`vashishta/table ` - * :doc:`wf/cut ` - Wang-Frenkel Potential for short-ranged interactions diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst new file mode 100644 index 0000000000..2a6548dee9 --- /dev/null +++ b/doc/src/pair_uf3.rst @@ -0,0 +1,186 @@ +.. index:: pair_style uf3 +.. index:: pair_style uf3/kk + +pair_style uf3 command +====================== + +Accelerator Variants: *uf3/kk* + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style style BodyFlag NumAtomType + +* style = *uf3* or *uf3/kk* + + .. parsed-literal:: + + BodyFlag = Indicates whether to calculate only 2-body or 2 and 3-body interactions. Possible values- 2 or 3 + NumAtomType = Number of atoms types in the simulation + + + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style uf3 3 1 + pair_coeff 1 1 Nb_Nb + pair_coeff 3b 1 1 1 Nb_Nb_Nb + + pair_style uf3 2 2 + pair_coeff 1 1 Nb_Nb + pair_coeff 1 2 Nb_Sn + pair_coeff 2 2 Sn_Sn + + pair_style uf3 3 2 + pair_coeff 1 1 Nb_Nb + pair_coeff 1 2 Nb_Sn + pair_coeff 2 2 Sn_Sn + pair_style 3b 1 1 1 Nb_Nb_Nb + pair_style 3b 1 1 2 Nb_Nb_Sn + pair_style 3b 1 2 2 Nb_Sn_Sn + pair_style 3b 2 1 1 Sn_Nb_Nb + pair_style 3b 2 1 2 Sn_Nb_Sn + pair_style 3b 2 2 2 Sn_Sn_Sn + +Description +""""""""""" + +The *uf3* style computes the :ref:`Ultra-Fast Force Fields (UF3) ` potential, a machine-learning interatomic potential. In UF3, the total energy of the system is defined via two- and three-body interactions: + +.. math:: + + E & = \sum_{i,j} V_2(r_{ij}) + \sum_{i,j,k} V_3 (r_{ij},r_{ik},r_{jk}) + + V_2(r_{ij}) & = \sum_{n=0}^N c_n B_n(r_{ij}) + + V_3 (r_{ij},r_{ik},r_{jk}) & = \sum_{l=0}^N_l \sum_{m=0}^N_m \sum_{n=0}^N_n c_{l,m,n} B_l(r_{ij}) B_m(r_{ik}) B_n(r_{jk}) + +where :math:`V_2(r_{ij})` and :math:`V_3 (r_{ij},r_{ik},r_{jk})` are the two- and three-body interactions, respectively. For the two-body the summation is over all neighbours J and for the three-body the summation is over all neighbors J and K of atom I within a cutoff distance determined from the potential files. :math:`B_n(r_{ij})` are the cubic bspline basis, :math:`c_n` and :math:`c_{l,m,n}` are the machine-learned interaction parameters and :math:`N`, :math:`N_l`, :math:`N_m`, and :math:`N_n` denote the number of basis functions per spline or tensor spline dimension. + +The UF3 LAMMPS potential files are provided using multiple pair_coeff commands. A single UF3 LAMMPS potential file contains information about one particular interaction only. + +.. note:: + + Unlike other MANYBODY and ML potentials in LAMMPS, the atom type for which the specified potential file should be used for is not determined from the potential file, but is rather determined from the user provided atom type numbers after pair_coeff. + +As an example, if a LAMMPS simulation contains 2 atom types (elements 'A' and 'B'), the pair_coeff command will be- + +.. code-block:: LAMMPS + + pair_style uf3 3 2 + pair_coeff 1 1 A_A + pair_coeff 1 2 A_B + pair_coeff 2 2 B_B + pair_coeff 3b 1 1 1 A_A_A + pair_coeff 3b 1 1 2 A_A_B + pair_coeff 3b 1 2 2 A_B_B + pair_coeff 3b 2 1 1 B_A_A + pair_coeff 3b 2 1 2 B_A_B + pair_coeff 3b 2 2 2 B_B_B + +If a value of "2" is specified in the :code:`pair_style uf3` command, only the two-body potential files are needed. For 3-body interaction the first atom type is the central atom. We recommend using the :code:`generate_uf3_lammps_pots.py` script (found `here `_) for generating the UF3 LAMMPS potential files from the UF3 JSON potentials. + +LAMMPS wild-card character "*" can also be used to specify a single UF3 LAMMPS potential file for multiple interaction. For example- + +.. code-block:: LAMMPS + + pair_style uf3 3 2 + pair_coeff * * A_A + pair_coeff 3b 1 * * A_A_A + pair_coeff 3b 2 * * B_B_B + +The file A_A will be used for 2-body interaction between atom types 1-1, 1-2 and 2-2; file A_A_A will be used 3-body interaction for atom types 1-1-1, 1-1-2, 1-2-2; and so on. Note, using a single interaction file for all types of interactions is **not** the recommended way of using :code:`pair_style uf3` and will often lead to **incorrect results**. + + +UF3 LAMMPS potential files in the *potentials* directory of the LAMMPS distribution have a ".uf3" suffix. All UF3 LAMMPS potential files should start with :code:`#UF3 POT` and end with :code:`#` characters. Following shows the format of a generic 2-body UF3 LAMMPS potential file- + +.. code-block:: LAMMPS + + #UF3 POT + 2B LEADING_TRIM TRAILING_TRIM + Rij_CUTOFF NUM_OF_KNOTS + BSPLINE_KNOTS + NUM_OF_COEFF + COEFF + # + +The second line indicates whether the potential file contains data for 2-body (:code:`2B`) or 3-body (:code:`3B`) interaction. This is followed by :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` number on the same line. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS is terminated after issuing an error message. The :code:`Rij_CUTOFF` sets the 2-body cutoff for the interaction described by the potential file. :code:`NUM_OF_KNOTS` is the number of knots (or the length of the knot vector) present on the very next line. The :code:`BSPLINE_KNOTS` line should contain all the knots in ascending order. :code:`NUM_OF_COEFF` is the number of coefficients in the :code:`COEFF` line. All the numbers in the BSPLINE_KNOTS and COEFF line should be space-separated. + +The format of a generic 3-body UF3 LAMMPS potential file is as follow- + +.. code-block:: LAMMPS + + #UF3 POT + 3B LEADING_TRIM TRAILING_TRIM + Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ + BSPLINE_KNOTS_FOR_JK + BSPLINE_KNOTS_FOR_IK + BSPLINE_KNOTS_FOR_IJ + SHAPE_OF_COEFF_MATRIX[I][J][K] + COEFF_MATRIX[0][0][K] + COEFF_MATRIX[0][1][K] + COEFF_MATRIX[0][2][K] + . + . + . + COEFF_MATRIX[1][0][K] + COEFF_MATRIX[1][1][K] + COEFF_MATRIX[1][2][K] + . + . + . + # + +Similar to the 2-body potential file, the third line sets the cutoffs and length of the knots. The cutoff distance between atom-type I and J is :code:`Rij_CUTOFF`, atom-type I and K is :code:`Rik_CUTOFF` and between J and K is :code:`Rjk_CUTOFF`. + +.. note:: + + The current implementation only works for UF3 potentials with cutoff distances for 3-body interactions that follows :code:`2Rij_CUTOFF=2Rik_CUTOFF=Rjk_CUTOFF` relation. + +The :code:`BSPLINE_KNOTS_FOR_JK`, :code:`BSPLINE_KNOTS_FOR_IK`, and :code:`BSPLINE_KNOTS_FOR_IJ` lines (note the order) contain the knots in increasing order for atoms J and K, I and K, and atoms I and J respectively. The number of knots is defined by the :code:`NUM_OF_KNOTS_*` characters in the previous line. +The shape of the coefficient matrix is defined on the :code:`SHAPE_OF_COEFF_MATRIX[I][J][K]` line followed by the columns of the coefficient matrix, one per line, as shown above. For example, if the coefficient matrix has the shape of 8x8x13, then :code:`SHAPE_OF_COEFF_MATRIX[I][J][K]` will be :code:`8 8 13` followed by 64 (8x8) lines each containing 13 coefficients seperated by space. + + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +For atom type pairs I,J and I != J, where types I and J correspond to two different element types, mixing is performed by LAMMPS as described above from values in the potential file. + +This pair style does not support the :doc:`pair_modify ` shift, table, and tail options. + +This pair style does not write its information to :doc:`binary restart files `, since it is stored in potential files. + +This pair style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. + +The single() function of 'uf3' pair style only return the 2-body interaction energy. + +Restrictions +"""""""""""" + +The 'uf3' pair style is part of the ML-UF3 package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. + +This pair style requires the :doc:`newton ` setting to be "on". + +The UF3 LAMMPS potential files provided with LAMMPS (see the potentials directory) are parameterized for metal :doc:`units `. + + +Related commands +"""""""""""""""" + +:doc:`pair_coeff ` + +Default +""""""" + +none + +---------- + +.. _Xie23: + +**(Xie23)** Xie, S.R., Rupp, M. & Hennig, R.G. Ultra-fast interpretable machine-learning potentials. npj Comput Mater 9, 162 (2023). https://doi.org/10.1038/s41524-023-01092-7 From a720d0dc6785cbc02ac466620945ec26d82cbbf0 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 12:10:31 -0400 Subject: [PATCH 05/65] Added ml-uf3 potential files --- potentials/A_A.uf3_pot | 7 +++ potentials/A_A_A.uf3_pot | 129 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 potentials/A_A.uf3_pot create mode 100644 potentials/A_A_A.uf3_pot diff --git a/potentials/A_A.uf3_pot b/potentials/A_A.uf3_pot new file mode 100644 index 0000000000..a50b48bae9 --- /dev/null +++ b/potentials/A_A.uf3_pot @@ -0,0 +1,7 @@ +#UF3 POT +2B 0 3 nk +8.0 31 +0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8 +27 +79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0 +# diff --git a/potentials/A_A_A.uf3_pot b/potentials/A_A_A.uf3_pot new file mode 100644 index 0000000000..18f79c3b8a --- /dev/null +++ b/potentials/A_A_A.uf3_pot @@ -0,0 +1,129 @@ +#UF3 POT +3B 0 3 nk +8.0 4.0 4.0 23 15 15 +0.001 0.001 0.001 0.001 0.50093749999999992 1.000875 1.5008124999999999 2.00075 2.5006874999999997 3.0006249999999999 3.5005624999999996 4.0004999999999997 4.5004375000000003 5.000375 5.5003124999999997 6.0002500000000003 6.5001875 7.0001249999999997 7.5000625000000003 8 8 8 8 +0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 +0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 +11 11 19 +-1.1790416072105636e-06 6.589114265858035e-08 2.1094970065385374e-06 4.7014910818419987e-07 8.288423734406254e-06 0.000186151370764668 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +9.36844864368356e-06 1.9223644807676324e-05 1.9979026246524356e-05 3.627062812549574e-05 9.775578281629195e-06 -5.894357549683858e-06 6.470814473155067e-07 2.31805322174729e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00013804169495254125 0.0012238504051117233 0.01461439973735456 0.010197731078827295 0.009003775355755566 0.030381456320656558 0.024785731678029766 0.004637019267552505 -0.005938106654005813 -0.002605150959220643 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 +-2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 +-7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.003917873880791907 -0.0007874629498581528 -2.4595030318112164e-05 -2.8508297646329816e-06 1.8504666071760445e-07 0.0001190800388356091 0.0035373487148805376 0.00037674157183609377 0.0012087894330956167 0.0009651695201594091 4.769364472898923e-05 0.0004612591073953361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 +5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 +4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 +0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0016181071043329578 0.003179470547568356 0.008661622548635572 0.011071785334468471 0.004294892778359652 0.0017845979744737465 0.0034643761195723064 0.015112039067322293 0.022192108732694595 0.008134230944897397 0.0007595380961610584 1.6727218309602107e-05 0.00012823915020345735 0.0001971442066043176 0.0 0.0 0.0 0.0 0.0 +0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 +0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 +6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 +5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 +0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 +0.00018639122271027446 0.0034767153815636618 0.018231622622978436 0.0042988446466234575 0.05300133577632108 0.7250033316881788 0.4935009383219143 0.42606157195551264 1.5039118559972142 1.2303936880370434 0.22548363428435172 -0.30298333788301807 -0.13073656424500055 -0.010403074319359695 0.005059645288601829 0.0015181780063355998 0.0 0.0 0.0 +0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 +-0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 +-2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 +4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 +0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 +0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 +-0.011510449622067839 -0.0007610595804959427 1.0172131902385016e-05 0.00448473230635448 0.2199020425072735 0.07466247888373397 0.21339517449435372 0.013531084627798973 0.04473458040783101 0.2378714243611067 0.10478901497777 0.37112701147924365 0.27817806337533985 -0.2385293501359752 -0.33578482057600856 -0.004009555340792723 0.0 0.0 0.0 +4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 +-7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 +0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 +6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 +-0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 +4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 +-0.0008465335016788498 -9.208409992139663e-05 -1.1210629044433908e-05 0.004300763141885697 0.1800503541691201 0.016819879476467067 0.060737350690215776 0.042330087306607714 0.0007006095666399378 0.02251352126872946 0.011185142175963118 -0.02716513333374441 0.00952941322650142 0.02210443704516212 0.07011148238258197 0.057840211345517194 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +# From 5c536c82907fa2ad0b58ce7fbd028206e96c5cce Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 12:11:05 -0400 Subject: [PATCH 06/65] Added ml-uf3 unittest --- unittest/force-styles/tests/A_A.uf3_pot | 7 + unittest/force-styles/tests/A_A_A.uf3_pot | 129 ++++++++++++++ .../force-styles/tests/manybody-pair-uf3.yaml | 159 ++++++++++++++++++ 3 files changed, 295 insertions(+) create mode 100644 unittest/force-styles/tests/A_A.uf3_pot create mode 100644 unittest/force-styles/tests/A_A_A.uf3_pot create mode 100644 unittest/force-styles/tests/manybody-pair-uf3.yaml diff --git a/unittest/force-styles/tests/A_A.uf3_pot b/unittest/force-styles/tests/A_A.uf3_pot new file mode 100644 index 0000000000..a50b48bae9 --- /dev/null +++ b/unittest/force-styles/tests/A_A.uf3_pot @@ -0,0 +1,7 @@ +#UF3 POT +2B 0 3 nk +8.0 31 +0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8 +27 +79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0 +# diff --git a/unittest/force-styles/tests/A_A_A.uf3_pot b/unittest/force-styles/tests/A_A_A.uf3_pot new file mode 100644 index 0000000000..18f79c3b8a --- /dev/null +++ b/unittest/force-styles/tests/A_A_A.uf3_pot @@ -0,0 +1,129 @@ +#UF3 POT +3B 0 3 nk +8.0 4.0 4.0 23 15 15 +0.001 0.001 0.001 0.001 0.50093749999999992 1.000875 1.5008124999999999 2.00075 2.5006874999999997 3.0006249999999999 3.5005624999999996 4.0004999999999997 4.5004375000000003 5.000375 5.5003124999999997 6.0002500000000003 6.5001875 7.0001249999999997 7.5000625000000003 8 8 8 8 +0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 +0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 +11 11 19 +-1.1790416072105636e-06 6.589114265858035e-08 2.1094970065385374e-06 4.7014910818419987e-07 8.288423734406254e-06 0.000186151370764668 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +9.36844864368356e-06 1.9223644807676324e-05 1.9979026246524356e-05 3.627062812549574e-05 9.775578281629195e-06 -5.894357549683858e-06 6.470814473155067e-07 2.31805322174729e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00013804169495254125 0.0012238504051117233 0.01461439973735456 0.010197731078827295 0.009003775355755566 0.030381456320656558 0.024785731678029766 0.004637019267552505 -0.005938106654005813 -0.002605150959220643 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 +-2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 +-7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.003917873880791907 -0.0007874629498581528 -2.4595030318112164e-05 -2.8508297646329816e-06 1.8504666071760445e-07 0.0001190800388356091 0.0035373487148805376 0.00037674157183609377 0.0012087894330956167 0.0009651695201594091 4.769364472898923e-05 0.0004612591073953361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 +5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 +4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 +0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0016181071043329578 0.003179470547568356 0.008661622548635572 0.011071785334468471 0.004294892778359652 0.0017845979744737465 0.0034643761195723064 0.015112039067322293 0.022192108732694595 0.008134230944897397 0.0007595380961610584 1.6727218309602107e-05 0.00012823915020345735 0.0001971442066043176 0.0 0.0 0.0 0.0 0.0 +0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 +0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 +6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 +5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 +0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 +0.00018639122271027446 0.0034767153815636618 0.018231622622978436 0.0042988446466234575 0.05300133577632108 0.7250033316881788 0.4935009383219143 0.42606157195551264 1.5039118559972142 1.2303936880370434 0.22548363428435172 -0.30298333788301807 -0.13073656424500055 -0.010403074319359695 0.005059645288601829 0.0015181780063355998 0.0 0.0 0.0 +0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 +-0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 +-2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 +4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 +0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 +0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 +-0.011510449622067839 -0.0007610595804959427 1.0172131902385016e-05 0.00448473230635448 0.2199020425072735 0.07466247888373397 0.21339517449435372 0.013531084627798973 0.04473458040783101 0.2378714243611067 0.10478901497777 0.37112701147924365 0.27817806337533985 -0.2385293501359752 -0.33578482057600856 -0.004009555340792723 0.0 0.0 0.0 +4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 +-7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 +0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 +6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 +-0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 +4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 +-0.0008465335016788498 -9.208409992139663e-05 -1.1210629044433908e-05 0.004300763141885697 0.1800503541691201 0.016819879476467067 0.060737350690215776 0.042330087306607714 0.0007006095666399378 0.02251352126872946 0.011185142175963118 -0.02716513333374441 0.00952941322650142 0.02210443704516212 0.07011148238258197 0.057840211345517194 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +# diff --git a/unittest/force-styles/tests/manybody-pair-uf3.yaml b/unittest/force-styles/tests/manybody-pair-uf3.yaml new file mode 100644 index 0000000000..8ba4a24e44 --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-uf3.yaml @@ -0,0 +1,159 @@ +--- +lammps_version: 24 Mar 2022 +tags: generated +date_generated: Tue Nov 28 14:51:03 2023 +epsilon: 1e-09 +skip_tests: +prerequisites: ! | + pair uf3 +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on + variable newton_bond delete +post_commands: ! "" +input_file: in.manybody +pair_style: uf3 3 8 +pair_coeff: ! | + * * A_A.uf3_pot + 3b * * * A_A_A.uf3_pot +extract: ! "" +natoms: 64 +init_vdwl: -76.14388662099438 +init_coul: 0 +init_stress: ! |2- + 3.1223073343802071e+02 3.1503555484293474e+02 3.2087032195384182e+02 -5.2677023646012433e+00 4.1046361968856566e+01 -2.2705704820012654e-01 +init_forces: ! |2 + 1 -1.0963106297354930e+00 1.9921565797217811e+00 2.0176595423650685e+00 + 2 -2.5744974244934786e+00 8.6065313692841872e-01 -1.3343920771683084e+00 + 3 -7.5762202587571881e-01 -5.1086473746213934e-01 1.7774798100697495e+00 + 4 -1.2651178900120015e+00 2.5481168050091734e+00 1.0332353551246649e+00 + 5 -3.3301075059618213e-02 -8.6936885426915711e-01 -8.0361144939346540e-01 + 6 5.9576544655966956e-02 -5.7569733665007693e-02 -2.5260577270195245e-01 + 7 -7.8223973805485159e-01 -1.5872724248886485e+00 -4.0690678808175756e-01 + 8 1.2837377243355602e-01 6.8616887866365453e-02 3.9279992110159728e-02 + 9 1.3013607224018784e+00 -2.2234802020121042e-01 -2.5820065882172409e+00 + 10 -3.5389541898719123e-01 1.0418734269769769e+00 -6.7534263859128518e-01 + 11 1.5048713773196754e+00 -1.1607474819622305e+00 -4.1343086960946002e-01 + 12 -3.8382036374205457e+00 -1.8953194768009614e+00 -1.5975045274049304e+00 + 13 -5.1243974635480005e-01 2.8005048190722506e+00 -8.5188627697957486e-01 + 14 -4.3260615266171099e-01 1.7104546503175775e+00 4.8896255947620082e-01 + 15 -2.1729171109783061e+00 1.9610148525080886e+00 -1.7550881080125238e+00 + 16 1.3063694982664014e+00 4.0801741093678640e-01 3.3816303090167859e+00 + 17 1.0103076935514768e+00 1.3062727533124225e+00 -3.0591856171743643e+00 + 18 6.6364797168941592e-01 1.3269858177825717e+00 1.0859880651465830e+00 + 19 -4.3237772669504843e-01 1.5179601478654310e+00 -8.9399081937433889e-01 + 20 -4.1109776137187977e+00 4.8942123015814726e-01 3.0324705210921541e-02 + 21 1.0443613152888414e+00 -2.7611218991110009e-01 -3.2334333893456133e+00 + 22 -3.8840635954358733e+00 1.8543888965122868e+00 -2.7044170995178298e+00 + 23 6.4824470795616951e-01 1.1930964693491897e+00 2.3472683895454201e+00 + 24 5.6518885203578750e-01 8.9024666222906623e-01 9.9558410495963645e-01 + 25 -2.3884920507811258e-01 -1.2236748552119361e-01 9.6166740424011798e-04 + 26 -9.4060753459907698e-01 -2.9688412181022056e-01 6.7007032584453752e-01 + 27 5.0390685311588923e-01 -5.8477364114704944e-01 1.6320689076693460e+00 + 28 -8.1564347181637331e-01 1.9951358496458818e-01 3.2879220126777038e+00 + 29 -1.6141037582891811e+00 3.7621933923780954e-01 5.6865013193370151e-01 + 30 -1.2051389982059610e+00 6.5471000907223187e-02 4.6548238063076404e-02 + 31 -8.3799333021355227e-01 -4.3387478264068147e-01 -3.4488785440063413e-01 + 32 -1.8712481645378094e+00 3.1431436055998407e-02 1.1920833582466677e+00 + 33 2.1132311819974756e+00 -7.8762333052322075e-01 2.9319369786200289e+00 + 34 -7.4212669325944880e-01 1.5089695276247311e-01 6.4837671979385259e-01 + 35 4.7876606586762549e-01 -5.2894027298845681e-01 6.5312176822087242e-01 + 36 9.4335406181387005e-01 -7.7270400013223828e-01 4.8506498341757304e-01 + 37 -6.9776523536821422e-01 1.5814045923629079e+00 -1.7145687025150753e+00 + 38 8.3390581678419395e-01 -2.3460369438656256e-01 -8.1845978792256724e-01 + 39 7.9082785819764490e-01 -1.4014821253885934e+00 -3.6171284136791626e+00 + 40 1.5528260681499937e+00 -1.9423308463414859e+00 2.7454733155675826e-01 + 41 1.6230449781222470e-01 4.0254440068393893e-01 -1.0728426614941826e+00 + 42 -2.5760797297848943e+00 -2.3727612877133377e+00 -7.3694736943877159e-01 + 43 -1.4658113294445060e-01 -3.7059450064886161e+00 -2.2611910919567893e-01 + 44 2.6125365540590240e+00 -2.0393457867642488e+00 -1.7353429519549574e-01 + 45 9.1508218547652620e-01 3.2090468646350390e-01 -1.3730810235354041e+00 + 46 -1.2861926535120600e+00 -1.8325412123528377e+00 2.7409156132103112e+00 + 47 5.2214882788544981e-01 9.0702150750152088e-02 1.3758849361839385e+00 + 48 8.7060691872545093e-01 1.0333012026994193e+00 -8.8450736609033931e-01 + 49 1.6921455867723978e-01 -3.2865843167979367e+00 -2.3941507623279072e+00 + 50 1.3029435213640246e+00 1.1566980491369294e+00 -7.8373321422495534e-02 + 51 1.7782167191801962e-01 3.5869618077998595e+00 2.1417753790319543e+00 + 52 3.4939214706481048e+00 -2.4127970289820255e+00 4.1443505260596725e+00 + 53 4.5955988135622799e-01 1.4913218496577223e+00 1.3076728090591363e+00 + 54 7.0400726037068106e-01 -9.4898269328552198e-01 -7.0340401843204670e-01 + 55 1.1319661424097816e+00 -2.3442414589969114e+00 -7.7166661047173946e-01 + 56 7.7292681497946214e-01 5.4202239892193216e-01 -1.0429033367200278e+00 + 57 1.1664627895682855e+00 1.9743121270468009e-01 -3.8302192241786348e-01 + 58 1.3342985230821185e+00 -2.6808564460978351e-01 -9.3875599645237040e-01 + 59 2.1547446695381884e+00 2.5922697594917221e-01 5.5883175680123842e-01 + 60 -1.1202730918333845e+00 -4.0836109063032069e+00 -3.1463158656990915e+00 + 61 7.5258775499505959e-01 1.4742795022217277e+00 -2.2056849646259416e-01 + 62 -2.1194607090574338e+00 9.6304617778841872e-01 -5.8648933450219842e-01 + 63 2.2116847362243819e+00 -6.9485816680348522e-01 -1.2888780585377166e+00 + 64 2.0946943533672595e+00 1.7817828615230797e+00 5.2222100516662051e+00 +run_vdwl: -76.1335425447406 +run_coul: 0 +run_stress: ! |2- + 3.1227357278065733e+02 3.1510436259931976e+02 3.2097655273455166e+02 -5.2932374901106582e+00 4.0956468170617640e+01 1.5018802669860862e-01 +run_forces: ! |2 + 1 -1.1136068191144672e+00 1.9868928531451695e+00 2.0284715885889444e+00 + 2 -2.5718148688418596e+00 8.3532761170683545e-01 -1.3404690568364115e+00 + 3 -7.6676194475345183e-01 -5.0716795928532021e-01 1.7997537336742999e+00 + 4 -1.2720923579033645e+00 2.5419855255447907e+00 1.0258862987566395e+00 + 5 -4.3524258688024453e-02 -8.8004954612209696e-01 -7.9382095260610019e-01 + 6 8.9678254474529928e-02 -5.0742940694548030e-02 -2.4348008365156723e-01 + 7 -7.7364435925734953e-01 -1.5558296160053275e+00 -4.2051790182009818e-01 + 8 1.1143851887986839e-01 7.2497057799814191e-02 3.6624183488660304e-02 + 9 1.2839141188983776e+00 -2.4381166390795905e-01 -2.5926851536420066e+00 + 10 -3.6606370803571597e-01 1.0472513106007628e+00 -6.5579353351390024e-01 + 11 1.4796344435746969e+00 -1.1469564140842350e+00 -4.2766370678100751e-01 + 12 -3.8341194520315707e+00 -1.8877013457658414e+00 -1.5901839974079914e+00 + 13 -4.6650968579193675e-01 2.7962961910932282e+00 -8.2237329615475063e-01 + 14 -4.5362402854231521e-01 1.7048830533652388e+00 4.9165017205992945e-01 + 15 -2.1790730324228798e+00 1.9552241266001966e+00 -1.7453842965710837e+00 + 16 1.3028733875052598e+00 4.1039519382071737e-01 3.3783851223727419e+00 + 17 1.0049330607671125e+00 1.3021263787131616e+00 -3.0544446010601831e+00 + 18 6.3052176771903379e-01 1.3324251901771336e+00 1.0977786571785106e+00 + 19 -4.5964705284123741e-01 1.4850585747490403e+00 -8.9955925151919691e-01 + 20 -4.0843338981113764e+00 4.6843741575982639e-01 4.6947857407657889e-03 + 21 1.0581909871649149e+00 -2.9084634536392007e-01 -3.2540160500533157e+00 + 22 -3.8927799316015426e+00 1.8587085622785937e+00 -2.7125312751977178e+00 + 23 6.6350903350923252e-01 1.1973095378961089e+00 2.3524290511459478e+00 + 24 5.7143336751982488e-01 8.7715571174154605e-01 9.9432218349388102e-01 + 25 -2.4703347062300032e-01 -1.2710986429222224e-01 -1.5749033311971992e-02 + 26 -9.3451713960198701e-01 -2.7778133649821901e-01 6.6713867661147919e-01 + 27 4.9808843860149610e-01 -5.8536464204160887e-01 1.6301914265685915e+00 + 28 -8.2771277475903027e-01 2.1570720428840873e-01 3.2880151472957344e+00 + 29 -1.6048620343875755e+00 3.8486480806372897e-01 5.6967398899129529e-01 + 30 -1.1973961350199096e+00 5.1593120685595580e-02 4.1293831832017062e-02 + 31 -8.4115448475027121e-01 -4.4444260925279200e-01 -3.3858426829044269e-01 + 32 -1.8597577591090164e+00 1.2810085646854485e-02 1.1797889462030640e+00 + 33 2.1159519472471811e+00 -7.8729199670032701e-01 2.9290939088097181e+00 + 34 -7.4188497270023746e-01 1.5645497560825464e-01 6.6033973957472436e-01 + 35 4.8203360935099837e-01 -5.2533146218590032e-01 6.5589135580856639e-01 + 36 9.4037223416537397e-01 -7.6094150822319195e-01 4.5734538655438040e-01 + 37 -6.9906373360474205e-01 1.5746536313295925e+00 -1.7263112595330459e+00 + 38 8.5615988284237132e-01 -2.2431722964535125e-01 -8.0332888328255958e-01 + 39 7.8065137836247200e-01 -1.3983715176027893e+00 -3.6344006191116991e+00 + 40 1.5756754145077525e+00 -1.9548680562354619e+00 2.4171639489710248e-01 + 41 1.7946227297557377e-01 4.1626928569421628e-01 -1.0542445180049111e+00 + 42 -2.5855819286639807e+00 -2.3809591696792194e+00 -7.5444018878363772e-01 + 43 -1.5651979567151933e-01 -3.7133196766462597e+00 -2.3417783002479109e-01 + 44 2.6088788324017109e+00 -2.0370826629544276e+00 -1.7748087222007777e-01 + 45 9.0750981150111454e-01 3.1320571808181447e-01 -1.3570279945304848e+00 + 46 -1.2844641842483453e+00 -1.8271514736854049e+00 2.7652384797305016e+00 + 47 5.2355177969578193e-01 9.5756521123463834e-02 1.3725765177085687e+00 + 48 8.7731662768264451e-01 1.0414860079651591e+00 -9.0032888888892382e-01 + 49 1.4644557239036082e-01 -3.3233388609839873e+00 -2.4250592659007468e+00 + 50 1.3159886335597091e+00 1.1534831728413786e+00 -7.9023436269654135e-02 + 51 1.5810961991408728e-01 3.6227053406802825e+00 2.1622129324293375e+00 + 52 3.5238822669377128e+00 -2.4112486219526210e+00 4.1691651240037055e+00 + 53 4.6279178075715538e-01 1.5349821135997805e+00 1.3624008261786760e+00 + 54 7.0473247201702627e-01 -9.3593778743269240e-01 -7.0089892988315006e-01 + 55 1.1161312397801737e+00 -2.3385526086116117e+00 -7.5151515336312336e-01 + 56 7.6996392118239054e-01 5.3225925152027631e-01 -1.0367667800909899e+00 + 57 1.1705705890031866e+00 1.9234764366836088e-01 -3.8394944778612211e-01 + 58 1.3292217712869172e+00 -2.6420177775466325e-01 -9.5699172084102668e-01 + 59 2.1842122534627268e+00 2.6220494593377625e-01 5.4393643560229021e-01 + 60 -1.1457317620961742e+00 -4.1194027577964150e+00 -3.1920012226137322e+00 + 61 7.5501968427331045e-01 1.4824037577796831e+00 -2.0845605296052469e-01 + 62 -2.1181153169676303e+00 9.6226604332888710e-01 -5.7042120154066434e-01 + 63 2.2161829432347631e+00 -7.0548049758710407e-01 -1.3062673143062038e+00 + 64 2.1263589729936818e+00 1.8281740261598369e+00 5.2543331430537403e+00 +... From d55f750dc650e869c0cde744abffb07beec92406 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire <48733363+monk-04@users.noreply.github.com> Date: Mon, 25 Mar 2024 15:17:43 -0400 Subject: [PATCH 07/65] Fixed typos in the UF3 equation --- doc/src/pair_uf3.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index 2a6548dee9..c6fea0136c 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -54,11 +54,9 @@ The *uf3* style computes the :ref:`Ultra-Fast Force Fields (UF3) ` potent .. math:: - E & = \sum_{i,j} V_2(r_{ij}) + \sum_{i,j,k} V_3 (r_{ij},r_{ik},r_{jk}) - - V_2(r_{ij}) & = \sum_{n=0}^N c_n B_n(r_{ij}) - - V_3 (r_{ij},r_{ik},r_{jk}) & = \sum_{l=0}^N_l \sum_{m=0}^N_m \sum_{n=0}^N_n c_{l,m,n} B_l(r_{ij}) B_m(r_{ik}) B_n(r_{jk}) + E & = \sum_{i,j} V_2(r_{ij}) + \sum_{i,j,k} V_3 (r_{ij},r_{ik},r_{jk}) \\ + V_2(r_{ij}) & = \sum_{n=0}^N c_n B_n(r_{ij}) \\ + V_3 (r_{ij},r_{ik},r_{jk}) & = \sum_{l=0}^{N_l} \sum_{m=0}^{N_m} \sum_{n=0}^{N_n} c_{l,m,n} B_l(r_{ij}) B_m(r_{ik}) B_n(r_{jk}) where :math:`V_2(r_{ij})` and :math:`V_3 (r_{ij},r_{ik},r_{jk})` are the two- and three-body interactions, respectively. For the two-body the summation is over all neighbours J and for the three-body the summation is over all neighbors J and K of atom I within a cutoff distance determined from the potential files. :math:`B_n(r_{ij})` are the cubic bspline basis, :math:`c_n` and :math:`c_{l,m,n}` are the machine-learned interaction parameters and :math:`N`, :math:`N_l`, :math:`N_m`, and :math:`N_n` denote the number of basis functions per spline or tensor spline dimension. From de43263e2872e5e1d663ae41703b0a3a6cd6cf96 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 17:18:11 -0400 Subject: [PATCH 08/65] Fixed lammps developer email-id and contributing authors section. Removed some old comments --- src/KOKKOS/pair_uf3_kokkos.cpp | 11 ++++++----- src/KOKKOS/pair_uf3_kokkos.h | 11 ++++++----- src/ML-UF3/pair_uf3.cpp | 11 ++++++----- src/ML-UF3/pair_uf3.h | 11 ++++++----- src/ML-UF3/uf3_bspline_basis2.cpp | 14 ++++++++++++++ src/ML-UF3/uf3_bspline_basis2.h | 19 +++++++++++++------ src/ML-UF3/uf3_bspline_basis3.cpp | 14 ++++++++++++++ src/ML-UF3/uf3_bspline_basis3.h | 20 ++++++++++++++------ src/ML-UF3/uf3_pair_bspline.cpp | 13 +++++++++++++ src/ML-UF3/uf3_pair_bspline.h | 11 ++++------- src/ML-UF3/uf3_triplet_bspline.cpp | 13 +++++++++++++ src/ML-UF3/uf3_triplet_bspline.h | 6 ++++-- 12 files changed, 113 insertions(+), 41 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index dbcdd22e3d..aeab64a536 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - * Contributing authors: Ajinkya Hire (U of Florida), - * Hendrik Kraß (U of Constance), - * Richard Hennig (U of Florida) - * ---------------------------------------------------------------------- */ + Contributing author: Ajinkya Hire (Univ. of Florida), + Hendrik Kraß (Univ. of Constance), + Matthias Rupp (Luxembourg Institute of Science and Technology), + Richard Hennig (Univ of Florida) +---------------------------------------------------------------------- */ #include "pair_uf3_kokkos.h" diff --git a/src/KOKKOS/pair_uf3_kokkos.h b/src/KOKKOS/pair_uf3_kokkos.h index 193c65d6de..aacd074e54 100644 --- a/src/KOKKOS/pair_uf3_kokkos.h +++ b/src/KOKKOS/pair_uf3_kokkos.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - * Contributing authors: Ajinkya Hire (U of Florida), - * Hendrik Kraß (U of Constance), - * Richard Hennig (U of Florida) - * ---------------------------------------------------------------------- */ + Contributing author: Ajinkya Hire (Univ. of Florida), + Hendrik Kraß (Univ. of Constance), + Matthias Rupp (Luxembourg Institute of Science and Technology), + Richard Hennig (Univ of Florida) +---------------------------------------------------------------------- */ #ifdef PAIR_CLASS // clang-format off diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 4188c51ac0..946c7bbc4a 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -1,7 +1,7 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - * Contributing authors: Ajinkya Hire (U of Florida), - * Hendrik Kraß (U of Constance), - * Richard Hennig (U of Florida) - * ---------------------------------------------------------------------- */ + Contributing author: Ajinkya Hire (Univ. of Florida), + Hendrik Kraß (Univ. of Constance), + Matthias Rupp (Luxembourg Institute of Science and Technology), + Richard Hennig (Univ of Florida) +---------------------------------------------------------------------- */ #include "pair_uf3.h" #include "uf3_pair_bspline.h" diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 54f0e7e2e4..eaa16c745c 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -1,7 +1,7 @@ /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - * Contributing authors: Ajinkya Hire(U of Florida), - * Hendrik Kraß (U of Constance), - * Richard Hennig (U of Florida) - * ---------------------------------------------------------------------- */ + Contributing author: Ajinkya Hire (Univ. of Florida), + Hendrik Kraß (Univ. of Constance), + Matthias Rupp (Luxembourg Institute of Science and Technology), + Richard Hennig (Univ of Florida) +---------------------------------------------------------------------- */ #ifdef PAIR_CLASS // clang-format off diff --git a/src/ML-UF3/uf3_bspline_basis2.cpp b/src/ML-UF3/uf3_bspline_basis2.cpp index 8ae1991ce2..fb345cc10b 100644 --- a/src/ML-UF3/uf3_bspline_basis2.cpp +++ b/src/ML-UF3/uf3_bspline_basis2.cpp @@ -1,3 +1,17 @@ +// clang-format off +/* ---------------------------------------------------------------------- + lammps - large-scale atomic/molecular massively parallel simulator + https://www.lammps.org/, sandia national laboratories + lammps development team: developers@lammps.org + + copyright (2003) sandia corporation. under the terms of contract + de-ac04-94al85000 with sandia corporation, the u.s. government retains + certain rights in this software. this software is distributed under + the gnu general public license. + + see the readme file in the top-level lammps directory. +------------------------------------------------------------------------- */ + #include "uf3_bspline_basis2.h" #include "utils.h" diff --git a/src/ML-UF3/uf3_bspline_basis2.h b/src/ML-UF3/uf3_bspline_basis2.h index 8551b097b1..423a366fe0 100644 --- a/src/ML-UF3/uf3_bspline_basis2.h +++ b/src/ML-UF3/uf3_bspline_basis2.h @@ -1,9 +1,16 @@ -//De Boor's algorithm @ -//https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.html -//For values outside the domain, -//extrapoltaes the left(right) hand side piece of the curve -//Only works for bspline degree upto 3 becuase of definiation of P -// +// clang-format off +/* ---------------------------------------------------------------------- + lammps - large-scale atomic/molecular massively parallel simulator + https://www.lammps.org/, sandia national laboratories + lammps development team: developers@lammps.org + + copyright (2003) sandia corporation. under the terms of contract + de-ac04-94al85000 with sandia corporation, the u.s. government retains + certain rights in this software. this software is distributed under + the gnu general public license. + + see the readme file in the top-level lammps directory. +------------------------------------------------------------------------- */ #include "pointers.h" #include diff --git a/src/ML-UF3/uf3_bspline_basis3.cpp b/src/ML-UF3/uf3_bspline_basis3.cpp index f66ac0d1dc..0778ae82a3 100644 --- a/src/ML-UF3/uf3_bspline_basis3.cpp +++ b/src/ML-UF3/uf3_bspline_basis3.cpp @@ -1,3 +1,17 @@ +// clang-format off +/* ---------------------------------------------------------------------- + lammps - large-scale atomic/molecular massively parallel simulator + https://www.lammps.org/, sandia national laboratories + lammps development team: developers@lammps.org + + copyright (2003) sandia corporation. under the terms of contract + de-ac04-94al85000 with sandia corporation, the u.s. government retains + certain rights in this software. this software is distributed under + the gnu general public license. + + see the readme file in the top-level lammps directory. +------------------------------------------------------------------------- */ + #include "uf3_bspline_basis3.h" #include "utils.h" diff --git a/src/ML-UF3/uf3_bspline_basis3.h b/src/ML-UF3/uf3_bspline_basis3.h index d29d9b08f1..676c8da453 100644 --- a/src/ML-UF3/uf3_bspline_basis3.h +++ b/src/ML-UF3/uf3_bspline_basis3.h @@ -1,9 +1,17 @@ -//De Boor's algorithm @ -//https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.html -//For values outside the domain, -//extrapoltaes the left(right) hand side piece of the curve -//Only works for bspline degree upto 3 becuase of definiation of P -// +// clang-format off +/* ---------------------------------------------------------------------- + lammps - large-scale atomic/molecular massively parallel simulator + https://www.lammps.org/, sandia national laboratories + lammps development team: developers@lammps.org + + copyright (2003) sandia corporation. under the terms of contract + de-ac04-94al85000 with sandia corporation, the u.s. government retains + certain rights in this software. this software is distributed under + the gnu general public license. + + see the readme file in the top-level lammps directory. +------------------------------------------------------------------------- */ + #include "pointers.h" #include diff --git a/src/ML-UF3/uf3_pair_bspline.cpp b/src/ML-UF3/uf3_pair_bspline.cpp index d4c14284f8..b2fab151b1 100644 --- a/src/ML-UF3/uf3_pair_bspline.cpp +++ b/src/ML-UF3/uf3_pair_bspline.cpp @@ -1,3 +1,16 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + #include "uf3_pair_bspline.h" #include "uf3_bspline_basis2.h" diff --git a/src/ML-UF3/uf3_pair_bspline.h b/src/ML-UF3/uf3_pair_bspline.h index aa3f1e8c40..4bd4a618b9 100644 --- a/src/ML-UF3/uf3_pair_bspline.h +++ b/src/ML-UF3/uf3_pair_bspline.h @@ -1,19 +1,16 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/ Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -// De Boor's algorithm @ -// https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.html -// For values outside the domain, it exhibits undefined behavior. -// Uses fixed B-Spline degree 3. - #include "pointers.h" #include "uf3_bspline_basis2.h" diff --git a/src/ML-UF3/uf3_triplet_bspline.cpp b/src/ML-UF3/uf3_triplet_bspline.cpp index 6c5a5a19e7..d9199d301c 100644 --- a/src/ML-UF3/uf3_triplet_bspline.cpp +++ b/src/ML-UF3/uf3_triplet_bspline.cpp @@ -1,3 +1,16 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + #include "uf3_triplet_bspline.h" #include "error.h" #include diff --git a/src/ML-UF3/uf3_triplet_bspline.h b/src/ML-UF3/uf3_triplet_bspline.h index f5cf6a1b92..6c560d8d7e 100644 --- a/src/ML-UF3/uf3_triplet_bspline.h +++ b/src/ML-UF3/uf3_triplet_bspline.h @@ -1,11 +1,13 @@ /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/ Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ From 06c4fc6590592bedbf73f068c34db56e6084f2ee Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 17:23:47 -0400 Subject: [PATCH 09/65] Removed LAMMPS errordocs --- src/KOKKOS/pair_uf3_kokkos.h | 13 ------------- src/ML-UF3/pair_uf3.h | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.h b/src/KOKKOS/pair_uf3_kokkos.h index aacd074e54..15c2832da1 100644 --- a/src/KOKKOS/pair_uf3_kokkos.h +++ b/src/KOKKOS/pair_uf3_kokkos.h @@ -185,16 +185,3 @@ KOKKOS_INLINE_FUNCTION int max(int i, int j) #endif #endif - /* ERROR/WARNING messages: - -E: Illegal ... command - -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index eaa16c745c..79627e0def 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -74,16 +74,3 @@ class PairUF3 : public Pair { #endif #endif -/* ERROR/WARNING messages: - -E: Illegal ... command - -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ From b2809996b8ab04754bc2d146d709809009a653ff Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 25 Mar 2024 17:45:06 -0400 Subject: [PATCH 10/65] fixed trailing whitespaces --- doc/src/pair_uf3.rst | 2 +- src/KOKKOS/pair_uf3_kokkos.cpp | 26 +++++++------- src/ML-UF3/pair_uf3.cpp | 62 ++++++++++++++++---------------- src/ML-UF3/uf3_pair_bspline.cpp | 10 +++--- src/ML-UF3/uf3_pair_bspline.h | 2 +- src/ML-UF3/uf3_triplet_bspline.h | 2 +- 6 files changed, 52 insertions(+), 52 deletions(-) diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index c6fea0136c..c4c9a5b31f 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -83,7 +83,7 @@ As an example, if a LAMMPS simulation contains 2 atom types (elements 'A' and 'B If a value of "2" is specified in the :code:`pair_style uf3` command, only the two-body potential files are needed. For 3-body interaction the first atom type is the central atom. We recommend using the :code:`generate_uf3_lammps_pots.py` script (found `here `_) for generating the UF3 LAMMPS potential files from the UF3 JSON potentials. -LAMMPS wild-card character "*" can also be used to specify a single UF3 LAMMPS potential file for multiple interaction. For example- +LAMMPS wild-card character "*" can also be used to specify a single UF3 LAMMPS potential file for multiple interaction. For example- .. code-block:: LAMMPS diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index aeab64a536..38a820a08f 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -71,7 +71,7 @@ template PairUF3Kokkos::~PairUF3Kokkos() } template -template +template void PairUF3Kokkos::destroy_3d(TYPE data, typename TYPE::value_type*** &array) { if (array == nullptr) return; @@ -81,7 +81,7 @@ void PairUF3Kokkos::destroy_3d(TYPE data, typename TYPE::value_type* } template -template +template void PairUF3Kokkos::destroy_4d(TYPE data, typename TYPE::value_type**** &array) { if (array == nullptr) return; @@ -127,10 +127,10 @@ template void PairUF3Kokkos::coeff(int narg, char Kokkos::realloc(d_cut_3b_list, num_of_elements + 1, num_of_elements + 1); } //No allocation for device equivalent of --> setflag, cut, knot_spacing_type_2b, - //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, + //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, //cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, //neighshort - + //UFBS2b and UFBS3b are array of objects. Bad idea to use kokkos view(array) //for it create_2b_coefficients(); @@ -147,7 +147,7 @@ void PairUF3Kokkos::allocate() //is created cut_3b is set to point to the host array of k_cutsq //memory->destroy(cut_3b); - memoryKK->create_kokkos(k_cutsq,cutsq,n+1,n+1,"pair:cutsq"); + memoryKK->create_kokkos(k_cutsq,cutsq,n+1,n+1,"pair:cutsq"); d_cutsq = k_cutsq.template view(); //assignment; get the device //view of k_cutsq and assign it to d_cutsq; in the header file we just //decleared d_cutsq's type @@ -208,7 +208,7 @@ template double PairUF3Kokkos::init_one(int i, in template void PairUF3Kokkos::create_coefficients() { coefficients_created = 1; - + /*for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { //Check for knot_spacing type @@ -253,10 +253,10 @@ template void PairUF3Kokkos::create_coefficients( Kokkos::realloc(d_cut_3b_list, num_of_elements + 1, num_of_elements + 1); }*/ //No allocation for device equivalent of --> setflag, cut, knot_spacing_type_2b, - //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, + //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, //cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, //neighshort - + //UFBS2b and UFBS3b are array of objects. Bad idea to use kokkos view(array) //for it create_2b_coefficients(); @@ -815,7 +815,7 @@ template void PairUF3Kokkos::compute(int eflag_in //the array from the host memory; this updates d_cutsq also k_cut_3b.template sync(); k_min_cut_3b.template sync(); - + inum = list->inum; const int ignum = inum + list->gnum; NeighListKokkos *k_list = static_cast *>(list); @@ -837,7 +837,7 @@ template void PairUF3Kokkos::compute(int eflag_in int max_neighs = d_neighbors.extent(1); - if (((int)d_neighbors_short.extent(1) != max_neighs) || + if (((int)d_neighbors_short.extent(1) != max_neighs) || ((int)d_neighbors_short.extent(0) != ignum)) { d_neighbors_short = Kokkos::View("UF3::neighbors_short", ignum, max_neighs); } @@ -969,7 +969,7 @@ PairUF3Kokkos::operator()(TagPairUF3ComputeFullA, const tagint jtag = tag[j]; const int jtype = type[j]; - + const X_FLOAT delx = xtmp - x(j, 0); const X_FLOAT dely = ytmp - x(j, 1); const X_FLOAT delz = ztmp - x(j, 2); @@ -979,7 +979,7 @@ PairUF3Kokkos::operator()(TagPairUF3ComputeFullA, const F_FLOAT rij = sqrt(rsq); this->template twobody(itype, jtype, rij, evdwl, fpair); - + fpair = -fpair / rij; fxtmpi += delx * fpair; @@ -1341,7 +1341,7 @@ void PairUF3Kokkos::copy_3d(V &d, T ***h, int m, int n, int o) //device memory //auto h_view = Kokkos::create_mirror_view(tmp); //create_mirror always copies - //the data. create_mirror_view only copies data if the host cannot access the + //the data. create_mirror_view only copies data if the host cannot access the //data auto h_view = Kokkos::create_mirror(tmp); //Create a mirror of the device //view(array) tmp, as deep_copy is only possible for mirror views diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 946c7bbc4a..6b518c7ef1 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -106,7 +106,7 @@ number of elements detected by lammps in the structure are not same\n\ void PairUF3::coeff(int narg, char **arg) { if (!allocated) allocate(); - + if (narg != 3 && narg != 5){ /*error->warning(FLERR, "\nUF3: WARNING!! It seems that you are using the \n\ older style of specifying UF3 POT files. This style of listing \n\ @@ -194,7 +194,7 @@ void PairUF3::coeff(int narg, char **arg) // open UF3 potential file on all proc for (int i = 2; i < narg; i++) { uf3_read_pot_file(arg[i]); } if (!bsplines_created) create_bsplines(); - + // setflag check needed here for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { @@ -224,7 +224,7 @@ void PairUF3::coeff(int narg, char **arg) for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - UFBS3b[i][j][k] = + UFBS3b[i][j][k] = uf3_triplet_bspline(lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key]); UFBS3b[i][k][j] = UFBS3b[i][j][k]; } @@ -322,7 +322,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) std::string temp_line = txtfilereader.next_line(1); Tokenizer file_header(temp_line); - + if (file_header.count() != 2) error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found \n\ {} word/s",potf_name,file_header.count()); @@ -338,7 +338,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) error->all(FLERR, "UF3: Expected 4 words on 2nd line =>\n\ nBody leading_trim trailing_trim type_of_knot_spacing\n\ Found {}",temp_line); - + std::string nbody_on_file = fp2nd_line.next_string(); if (utils::strmatch(nbody_on_file,"2B")) utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n",potf_name); @@ -354,14 +354,14 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) if (trailing_trim != 3) error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ trailing_trim=3\n"); - + std::string knot_type = fp2nd_line.next_string(); if (utils::strmatch(knot_type,"uk")){ utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with uniform\n\ knot spacing\n",potf_name); knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; - } + } else if (utils::strmatch(knot_type,"nk")){ utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with non-uniform\n\ knot spacing\n",potf_name); @@ -380,7 +380,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) error->all(FLERR, "UF3: Expected only 2 numbers on 3rd line =>\n\ Rij_CUTOFF NUM_OF_KNOTS\n\ Found {} number/s",fp3rd_line.count()); - + //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared cut[itype][jtype] = fp3rd_line.next_double(); cut[jtype][itype] = cut[itype][jtype]; @@ -389,7 +389,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) temp_line = txtfilereader.next_line(num_knots_2b); ValueTokenizer fp4th_line(temp_line); - + if (fp4th_line.count() != num_knots_2b) error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_2b,fp4th_line.count()); @@ -418,7 +418,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) n2b_coeff[itype][jtype][k] = fp6th_line.next_double(); n2b_coeff[jtype][itype][k] = n2b_coeff[itype][jtype][k]; } - + if (n2b_knot[itype][jtype].size() != n2b_coeff[itype][jtype].size() + 4) { error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", potf_name); @@ -444,7 +444,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name std::string temp_line = txtfilereader.next_line(1); Tokenizer file_header(temp_line); - + if (file_header.count() != 2) error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found \n\ {} word/s",potf_name,file_header.count()); @@ -477,7 +477,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name if (trailing_trim != 3) error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ trailing_trim=3\n"); - + std::string knot_type = fp2nd_line.next_string(); if (utils::strmatch(knot_type,"uk")){ utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with uniform\n\ @@ -496,7 +496,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name else error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots)\n\ Found {} on the 2nd line of {} pot file",knot_type,potf_name); - + temp_line = txtfilereader.next_line(6); ValueTokenizer fp3rd_line(temp_line); @@ -504,7 +504,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name error->all(FLERR, "UF3: Expected only 6 numbers on 3rd line =>\n\ Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ\n\ Found {} number/s",fp3rd_line.count()); - + double cut3b_rjk = fp3rd_line.next_double(); double cut3b_rij = fp3rd_line.next_double(); double cut3b_rik = fp3rd_line.next_double(); @@ -517,10 +517,10 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name error->all(FLERR, "UF3: 2rij=2rik!=rik, Current implementation only works \n\ for 2rij=2rik!=rik"); } - + cut_3b_list[itype][jtype] = std::max(cut3b_rij, cut_3b_list[itype][jtype]); cut_3b_list[itype][ktype] = std::max(cut_3b_list[itype][ktype], cut3b_rik); - + cut_3b[itype][jtype][ktype] = cut3b_rij; cut_3b[itype][ktype][jtype] = cut3b_rik; @@ -531,7 +531,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name if (fp4th_line.count() != num_knots_3b_jk) error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_3b_jk, fp4th_line.count()); - + n3b_knot_matrix[itype][jtype][ktype].resize(3); n3b_knot_matrix[itype][ktype][jtype].resize(3); @@ -545,9 +545,9 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name n3b_knot_matrix[itype][jtype][ktype][0][i]; } - min_cut_3b[itype][jtype][ktype][0] = n3b_knot_matrix[itype][jtype][ktype][0][0]; + min_cut_3b[itype][jtype][ktype][0] = n3b_knot_matrix[itype][jtype][ktype][0][0]; //min_cut_3b[itype][jtype][ktype][0] --> cutoff for jk distance - + min_cut_3b[itype][ktype][jtype][0] = n3b_knot_matrix[itype][ktype][jtype][0][0]; if (comm->me == 0) utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_jk={} {}-{}-{}_jk={}\n", @@ -591,12 +591,12 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name n3b_knot_matrix[itype][ktype][jtype][1].resize(num_knots_3b_ij); for (int i = 0; i < num_knots_3b_ij; i++) { n3b_knot_matrix[itype][jtype][ktype][2][i] = fp6th_line.next_double(); - n3b_knot_matrix[itype][ktype][jtype][1][i] = + n3b_knot_matrix[itype][ktype][jtype][1][i] = n3b_knot_matrix[itype][jtype][ktype][2][i]; } min_cut_3b[itype][jtype][ktype][2] = n3b_knot_matrix[itype][jtype][ktype][2][0]; - //min_cut_3b[itype][jtype][ktype][2] --> cutoff for ij distance + //min_cut_3b[itype][jtype][ktype][2] --> cutoff for ij distance min_cut_3b[itype][ktype][jtype][1] = n3b_knot_matrix[itype][ktype][jtype][1][0]; if (comm->me == 0) utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ij={} {}-{}-{}_ij={}\n", @@ -619,16 +619,16 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and \n\ coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", potf_name); - if (n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) + if (n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and \n\ coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1",potf_name); - if (n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) + if (n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and \n\ coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1",potf_name); coeff_matrix_elements_len = coeff_matrix_dim3; - + std::string key = std::to_string(itype) + std::to_string(jtype) + std::to_string(ktype); n3b_coeff_matrix[key].resize(coeff_matrix_dim1); @@ -949,7 +949,7 @@ void PairUF3::create_bsplines() for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - UFBS3b[i][j][k] = + UFBS3b[i][j][k] = uf3_triplet_bspline(lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); @@ -1113,7 +1113,7 @@ void PairUF3::compute(int eflag, int vflag) ((del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]))); if ((rij <= cut_3b[itype][jtype][ktype]) && (rik <= cut_3b[itype][ktype][jtype]) && - (rij >= min_cut_3b[itype][jtype][ktype][2]) && + (rij >= min_cut_3b[itype][jtype][ktype][2]) && (rik >= min_cut_3b[itype][jtype][ktype][1])) { del_rkj[0] = x[k][0] - x[j][0]; @@ -1247,17 +1247,17 @@ double PairUF3::memory_usage() bytes = 0; - bytes += (double)5*sizeof(double); //num_of_elements, nbody_flag, - //n2body_pot_files, n3body_pot_files, + bytes += (double)5*sizeof(double); //num_of_elements, nbody_flag, + //n2body_pot_files, n3body_pot_files, //tot_pot_files; bytes += (double)5*sizeof(double); //bsplines_created, coeff_matrix_dim1, - //coeff_matrix_dim2, coeff_matrix_dim3, + //coeff_matrix_dim2, coeff_matrix_dim3, //coeff_matrix_elements_len bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ (num_of_elements+1)*sizeof(double); //***setflag_3b - bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut + bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ (num_of_elements+1)*sizeof(double); //***cut_3b @@ -1305,7 +1305,7 @@ double PairUF3::memory_usage() } } } - + bytes += (double)(maxshort+1)*sizeof(int); //neighshort, maxshort return bytes; diff --git a/src/ML-UF3/uf3_pair_bspline.cpp b/src/ML-UF3/uf3_pair_bspline.cpp index b2fab151b1..3ecdb2f626 100644 --- a/src/ML-UF3/uf3_pair_bspline.cpp +++ b/src/ML-UF3/uf3_pair_bspline.cpp @@ -28,13 +28,13 @@ uf3_pair_bspline::uf3_pair_bspline() {} // Constructor // Passing vectors by reference uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const std::vector &uknot_vect, - const std::vector &ucoeff_vect, + const std::vector &ucoeff_vect, const int &uknot_spacing_type) { lmp = ulmp; knot_vect = uknot_vect; coeff_vect = ucoeff_vect; - + knot_spacing_type = uknot_spacing_type; if (knot_spacing_type==0){ knot_spacing = knot_vect[4]-knot_vect[3]; @@ -48,10 +48,10 @@ uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const std::vector &ukno else lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ '1'(non-uniform knots)"); - + knot_vect_size = uknot_vect.size(); coeff_vect_size = ucoeff_vect.size(); - + // Initialize B-Spline Basis Functions for (int i = 0; i < knot_vect.size() - 4; i++) bspline_bases.push_back(uf3_bspline_basis3(lmp, &knot_vect[i], coeff_vect[i])); @@ -62,7 +62,7 @@ uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const std::vector &ukno double dntemp4 = 3 / (knot_vect[i + 4] - knot_vect[i + 1]); dncoeff_vect.push_back((coeff_vect[i + 1] - coeff_vect[i]) * dntemp4); } - //What we have is a clamped bspline -->i.e value of the bspline curve at the + //What we have is a clamped bspline -->i.e value of the bspline curve at the //knots with multiplicity equal to the degree of bspline is equal to the coefficient // //Therefore for the derivative bspline the very first and last knot needs to be droped diff --git a/src/ML-UF3/uf3_pair_bspline.h b/src/ML-UF3/uf3_pair_bspline.h index 4bd4a618b9..d10bfb430e 100644 --- a/src/ML-UF3/uf3_pair_bspline.h +++ b/src/ML-UF3/uf3_pair_bspline.h @@ -32,7 +32,7 @@ class uf3_pair_bspline { std::vector dnbspline_bases; int get_starting_index_uniform(double), get_starting_index_nonuniform(double); int (uf3_pair_bspline::*get_starting_index)(double); - //double knot_spacing=0; + //double knot_spacing=0; LAMMPS *lmp; public: diff --git a/src/ML-UF3/uf3_triplet_bspline.h b/src/ML-UF3/uf3_triplet_bspline.h index 6c560d8d7e..642201d879 100644 --- a/src/ML-UF3/uf3_triplet_bspline.h +++ b/src/ML-UF3/uf3_triplet_bspline.h @@ -35,7 +35,7 @@ class uf3_triplet_bspline { int get_starting_index_uniform(const std::vector, int, double, double); int get_starting_index_nonuniform(const std::vector, int, double, double); int (uf3_triplet_bspline::*get_starting_index)(const std::vector, int, double, double); - //double knot_spacing_ij=0,knot_spacing_ik=0,knot_spacing_jk=0; + //double knot_spacing_ij=0,knot_spacing_ik=0,knot_spacing_jk=0; //double _alignvar(, 8) ret_val[4]; // Force memory alignment on 8 byte boundaries double ret_val[4]; From 4e95db1bb791b69817fd7f83cc77d28d6be3333d Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 26 Mar 2024 12:34:29 -0400 Subject: [PATCH 11/65] Added uf3 details to Commands_pair, Packages_details and Packages_list --- doc/src/Commands_pair.rst | 1 + doc/src/Packages_details.rst | 26 ++++++++++++++++++++++++++ doc/src/Packages_list.rst | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 9bbe216dec..b804afdfc0 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -302,6 +302,7 @@ OPT. * :doc:`tip4p/long/soft (o) ` * :doc:`tri/lj ` * :doc:`ufm (got) ` + * :doc:`uf3 (k) ` * :doc:`vashishta (gko) ` * :doc:`vashishta/table (o) ` * :doc:`wf/cut ` diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index a3d65d9d65..edac1ee3f3 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -84,6 +84,7 @@ page gives those details. * :ref:`ML-QUIP ` * :ref:`ML-RANN ` * :ref:`ML-SNAP ` + * :ref:`ML-UF3 ` * :ref:`MOFFF ` * :ref:`MOLECULE ` * :ref:`MOLFILE ` @@ -1925,6 +1926,31 @@ computes which analyze attributes of the potential. ---------- +.. _PKG-ML-UF3: + +ML-UF3 package +-------------- + +**Contents:** + +A pair style for the Ultra-Fast Forcefield potentials (UF3). UF3 is a +methodology for deriving a highly accurate classical potential which is fast to +evaluate and is fitted to a large archives of quantum mechanical (DFT) data. +The use of bspline basis set in UF3 enables the rapid evaluation of 2-body and +3-body interactions. + +**Authors:** Ajinkya C Hire (University of Florida), +Hendrik Krass (University of Constance), +Matthias Rupp (Luxembourg Institute of Science and Technology), +Richard Hennig (University of Florida) + +**Supporting info:** + +* src/ML-UF3: filenames -> commands +* :doc:`pair_style uf3 ` +* examples/uf3 +* https://github.com/uf3/uf3 + .. _PKG-MOFFF: MOFFF package diff --git a/doc/src/Packages_list.rst b/doc/src/Packages_list.rst index c0a1164513..e86e43e9ce 100644 --- a/doc/src/Packages_list.rst +++ b/doc/src/Packages_list.rst @@ -318,6 +318,11 @@ whether an extra library is needed to build and use the package: - :doc:`pair_style snap ` - snap - no + * - :ref:`ML-UF3 ` + - quantum-fitted ultra fast potentials + - :doc:`pair_style uf3 ` + - uf3 + - no * - :ref:`MOFFF ` - styles for `MOF-FF `_ force field - :doc:`pair_style buck6d/coul/gauss ` From 3a34b3eeafa63d6f9bc721c7dace2c30f489cbc3 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 26 Mar 2024 12:35:30 -0400 Subject: [PATCH 12/65] Added uf3 examples to the examples directory --- examples/README | 1 + examples/uf3/README.md | 4 ++++ examples/uf3/in.uf3.2b.W | 46 +++++++++++++++++++++++++++++++++++++++ examples/uf3/in.uf3.3b.W | 47 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 examples/uf3/README.md create mode 100644 examples/uf3/in.uf3.2b.W create mode 100644 examples/uf3/in.uf3.3b.W diff --git a/examples/README b/examples/README index 62a09f654d..a68ab9fe66 100644 --- a/examples/README +++ b/examples/README @@ -116,6 +116,7 @@ template: examples for using atom_style template and comparing to atom style mol tersoff: regression test input for Tersoff variants threebody: regression test input for a variety of threebody potentials ttm: two-temeperature model examples +uf3: examples for using uf3 potentials vashishta: models using the Vashishta potential voronoi: Voronoi tesselation via compute voronoi/atom command wall: use of reflective walls with different stochastic models diff --git a/examples/uf3/README.md b/examples/uf3/README.md new file mode 100644 index 0000000000..cfbe0b6cc2 --- /dev/null +++ b/examples/uf3/README.md @@ -0,0 +1,4 @@ +This directory contains a variety of tests for the ML-UF3 package. These include: + +in.uf3.3b.W # UF3 2-body and 3-body potential +in.uf3.2b.W # UF3 2-body potential diff --git a/examples/uf3/in.uf3.2b.W b/examples/uf3/in.uf3.2b.W new file mode 100644 index 0000000000..038189f0c7 --- /dev/null +++ b/examples/uf3/in.uf3.2b.W @@ -0,0 +1,46 @@ +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.187 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box + +mass 1 183.84 + +# # ============= set pair style + +pair_style uf3 2 1 +pair_coeff 1 1 W_W + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} diff --git a/examples/uf3/in.uf3.3b.W b/examples/uf3/in.uf3.3b.W new file mode 100644 index 0000000000..fa14b1347c --- /dev/null +++ b/examples/uf3/in.uf3.3b.W @@ -0,0 +1,47 @@ +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.187 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box + +mass 1 183.84 + +# # ============= set pair style + +pair_style uf3 3 1 +pair_coeff 1 1 W_W +pair_coeff 3b 1 1 1 W_W_W + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} From ff39a03e838018611bb423e3e3681efd35daf016 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 26 Mar 2024 13:14:32 -0400 Subject: [PATCH 13/65] Removed trailing whitespaces --- doc/src/Packages_details.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index edac1ee3f3..fa1ddf0a39 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -1933,15 +1933,15 @@ ML-UF3 package **Contents:** -A pair style for the Ultra-Fast Forcefield potentials (UF3). UF3 is a +A pair style for the Ultra-Fast Forcefield potentials (UF3). UF3 is a methodology for deriving a highly accurate classical potential which is fast to evaluate and is fitted to a large archives of quantum mechanical (DFT) data. -The use of bspline basis set in UF3 enables the rapid evaluation of 2-body and +The use of bspline basis set in UF3 enables the rapid evaluation of 2-body and 3-body interactions. **Authors:** Ajinkya C Hire (University of Florida), -Hendrik Krass (University of Constance), -Matthias Rupp (Luxembourg Institute of Science and Technology), +Hendrik Krass (University of Constance), +Matthias Rupp (Luxembourg Institute of Science and Technology), Richard Hennig (University of Florida) **Supporting info:** @@ -1949,7 +1949,7 @@ Richard Hennig (University of Florida) * src/ML-UF3: filenames -> commands * :doc:`pair_style uf3 ` * examples/uf3 -* https://github.com/uf3/uf3 +* https://github.com/uf3/uf3 .. _PKG-MOFFF: From dc0b0d8be82c70131ba12e90c35bea12e422b520 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 26 Mar 2024 13:18:26 -0400 Subject: [PATCH 14/65] Added example potential files for W --- examples/uf3/W_W | 7 ++++ examples/uf3/W_W_W | 89 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 examples/uf3/W_W create mode 100644 examples/uf3/W_W_W diff --git a/examples/uf3/W_W b/examples/uf3/W_W new file mode 100644 index 0000000000..4197457323 --- /dev/null +++ b/examples/uf3/W_W @@ -0,0 +1,7 @@ +#UF3 POT +2B 0 3 uk +5.5 22 +0.001 0.001 0.001 0.001 0.36759999999999998 0.73419999999999996 1.1007999999999998 1.4673999999999998 1.8339999999999999 2.2005999999999997 2.5671999999999997 2.9337999999999997 3.3003999999999998 3.6669999999999998 4.0335999999999999 4.4001999999999999 4.7667999999999999 5.1334 5.5 5.5 5.5 5.5 +18 +85.256465889606673 85.256465889606673 60.118514370108457 39.372994322346095 23.019905746319598 11.095292589050336 2.5770289203919474 -0.21591409154943711 -0.41582603147952274 -0.29361205978352245 -0.23467230507950282 -0.13083777191249607 -0.031024404500506326 -0.059144784016542738 -0.037145211195670137 0 0 0 +# diff --git a/examples/uf3/W_W_W b/examples/uf3/W_W_W new file mode 100644 index 0000000000..b0b9fd5542 --- /dev/null +++ b/examples/uf3/W_W_W @@ -0,0 +1,89 @@ +#UF3 POT +3B 0 3 uk +7.0 3.5 3.5 19 13 13 +1.5 1.5 1.5 1.5 1.9583333333333333 2.4166666666666665 2.875 3.333333333333333 3.7916666666666665 4.25 4.708333333333333 5.1666666666666661 5.625 6.083333333333333 6.5416666666666661 7 7 7 7 +1.5 1.5 1.5 1.5 1.8333333333333333 2.1666666666666665 2.5 2.833333333333333 3.1666666666666665 3.5 3.5 3.5 3.5 +1.5 1.5 1.5 1.5 1.8333333333333333 2.1666666666666665 2.5 2.833333333333333 3.1666666666666665 3.5 3.5 3.5 3.5 +9 9 15 +-1.0025267383014886e-06 1.627666892216261e-10 8.48457178601592e-09 1.0410120456668556e-08 1.1330088302187643e-06 1.4224457260740182e-05 3.749471162873949e-05 3.695233634472074e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.922778833696604e-05 -1.0222423928319826e-06 -4.8075020979943344e-05 -3.8518708184701e-05 -9.794643241404816e-06 -5.109554485113297e-07 -4.104591531909916e-10 5.419385825688335e-09 2.3261619203718816e-06 0.0 0.0 0.0 0.0 0.0 0.0 +2.829068261701631e-05 3.3565662462635585e-05 -4.4282774329572976e-05 5.3019338472701156e-05 1.656981200092865e-05 5.764723793849365e-06 8.90212763080714e-06 -1.266718085517006e-06 2.431925564724538e-06 -3.3416793274446366e-07 0.0 0.0 0.0 0.0 0.0 +9.661425891180097e-09 1.1180525909838732e-07 7.372128540386131e-06 9.39083445715028e-06 1.0838653682096786e-05 9.806075321172179e-05 7.23071321840456e-05 0.00011393368280907902 7.532201192649856e-05 1.4915718900782886e-05 0.0 0.0 0.0 0.0 0.0 +4.674109331563019e-07 -5.406616138544008e-09 2.0217516565542138e-08 5.815480232140697e-06 2.377543599749233e-05 4.214830983861595e-05 -7.397778428926203e-05 7.061700585974997e-05 3.398811616466058e-05 3.0440209444922143e-05 0.00013514584901612643 0.0 0.0 0.0 0.0 +-2.18344999249825e-05 -0.00011697904895508256 -5.553581955175406e-06 2.658838454117769e-08 1.2146153008512734e-05 1.918298817375017e-05 5.40154814815751e-05 1.2944187401636162e-05 3.710536690671586e-05 1.6795050072301748e-05 -7.229556489685409e-06 8.543467581763247e-06 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.922778833696604e-05 -1.0222423928319826e-06 -4.8075020979943344e-05 -3.8518708184701e-05 -9.794643241404816e-06 -5.109554485113297e-07 -4.104591531909916e-10 5.419385825688335e-09 2.3261619203718816e-06 0.0 0.0 0.0 0.0 0.0 0.0 +4.7777593982974866e-05 2.1830415880551608e-05 -8.74161436707018e-06 7.718518436280754e-09 3.872620009304499e-06 2.2808275890118977e-05 4.9693195966817054e-05 -5.792733170014431e-06 4.574471594251372e-05 -2.840624725005251e-05 0.0 0.0 0.0 0.0 0.0 +-2.983543176137801e-05 4.9033674735689904e-05 4.195810226183578e-05 0.00010403045298571696 0.0003809288520722337 3.373314734861335e-05 1.0875278462846613e-05 2.680082116524925e-05 2.6236988936225364e-05 3.6338704048890435e-06 0.0 0.0 0.0 0.0 0.0 +2.1399512390776296e-05 2.7931318963336216e-05 1.601611374550643e-05 0.0011462578563508437 0.0020096052304490785 0.0010339536769749804 0.001014125101157229 0.00021102390605096824 -9.581571365103867e-06 -2.280019726143644e-05 3.57351467975471e-07 0.0 0.0 0.0 0.0 +6.2467013661098965e-06 2.658299496065299e-05 0.0007087760404542255 -0.002278488280232273 -0.007044271575650293 0.0038614975616579586 0.009260853457130498 -0.0010473278276317726 -8.516349321648054e-05 0.00020262630262751473 1.3414729868362445e-06 7.953262907187799e-08 0.0 0.0 0.0 +2.3603382351924323e-06 7.146280072503116e-05 0.0012361202483760594 -0.005734465078354871 -0.017135562936976125 -0.0016664758722632735 0.010195949308015286 -0.005412690557758046 -0.0029107216230642853 -0.0007612908343076258 -0.00013449226099999524 2.1468761472671134e-05 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +2.829068261701631e-05 3.3565662462635585e-05 -4.4282774329572976e-05 5.3019338472701156e-05 1.656981200092865e-05 5.764723793849365e-06 8.90212763080714e-06 -1.266718085517006e-06 2.431925564724538e-06 -3.3416793274446366e-07 0.0 0.0 0.0 0.0 0.0 +-2.983543176137801e-05 4.9033674735689904e-05 4.195810226183578e-05 0.00010403045298571696 0.0003809288520722337 3.373314734861335e-05 1.0875278462846613e-05 2.680082116524925e-05 2.6236988936225364e-05 3.6338704048890435e-06 0.0 0.0 0.0 0.0 0.0 +4.805582975622838e-05 3.5904852202535306e-05 0.0001861581391418004 0.011742061168666256 0.024776619721352023 0.009905830782079064 0.001165275555230131 0.0004071734306161239 0.00037033988296356686 4.258576293935207e-05 -1.0503156955159468e-06 0.0 0.0 0.0 0.0 +-5.680777858210279e-07 7.084011901144194e-05 0.0050124193537796876 0.1029510036679177 0.24007141064120838 0.17886074568759117 0.03778564255583381 -0.01538608134214139 -0.01488601265585909 -0.005013137591006775 1.477967512985198e-07 2.827576677896298e-05 0.0 0.0 0.0 +3.4701391129480595e-05 0.005680635772167662 0.07108357438929552 0.18745843365735923 0.18473391598372302 0.2461411417071668 -0.005111666129467331 -0.24038059036230178 -0.19258370027930355 -0.048958604017684836 -0.0025501911244683846 -4.982008439539256e-06 0.0 0.0 0.0 +1.8054960278101902e-05 0.011611823828717463 0.14139350699353365 0.1678085431015684 -0.22152577092526715 0.26507903411379746 0.08279760718466518 0.02879361559120084 0.04448600527937973 -0.006339073225905362 0.012182164968354765 -0.0016647733469859114 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +9.661425891180097e-09 1.1180525909838732e-07 7.372128540386131e-06 9.39083445715028e-06 1.0838653682096786e-05 9.806075321172179e-05 7.23071321840456e-05 0.00011393368280907902 7.532201192649856e-05 1.4915718900782886e-05 0.0 0.0 0.0 0.0 0.0 +2.1399512390776296e-05 2.7931318963336216e-05 1.601611374550643e-05 0.0011462578563508437 0.0020096052304490785 0.0010339536769749804 0.001014125101157229 0.00021102390605096824 -9.581571365103867e-06 -2.280019726143644e-05 3.57351467975471e-07 0.0 0.0 0.0 0.0 +-5.680777858210279e-07 7.084011901144194e-05 0.0050124193537796876 0.1029510036679177 0.24007141064120838 0.17886074568759117 0.03778564255583381 -0.01538608134214139 -0.01488601265585909 -0.005013137591006775 1.477967512985198e-07 2.827576677896298e-05 0.0 0.0 0.0 +3.224364873093737e-05 0.0005926077146340155 0.03682711928362166 0.046898795979650645 0.054125869772576704 0.49020499621758107 0.3614418794239106 0.569703720925391 0.37654073726442117 0.07453613145477757 0.002320760953344357 -4.1320810202123745e-05 0.0 0.0 0.0 +7.181321030642065e-05 0.029059269505937943 0.11884075783303522 0.21076878762972284 -0.36996025259611676 0.35312700844142586 0.16990097184555128 0.15210775765373416 0.6757140775652752 -0.10922320044264704 -0.5849697059462919 -0.027759887396949002 0.0 0.0 0.0 +9.734779590447442e-05 0.06072685888500135 0.09586373042400446 0.2700889438647233 0.06469057221256519 0.1854847883254132 0.08392153868089386 -0.03626027544891736 0.04232832520121794 0.23849583983886427 0.10911730115168922 -0.04380214407208333 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.674109331563019e-07 -5.406616138544008e-09 2.0217516565542138e-08 5.815480232140697e-06 2.377543599749233e-05 4.214830983861595e-05 -7.397778428926203e-05 7.061700585974997e-05 3.398811616466058e-05 3.0440209444922143e-05 0.00013514584901612643 0.0 0.0 0.0 0.0 +6.2467013661098965e-06 2.658299496065299e-05 0.0007087760404542255 -0.002278488280232273 -0.007044271575650293 0.0038614975616579586 0.009260853457130498 -0.0010473278276317726 -8.516349321648054e-05 0.00020262630262751473 1.3414729868362445e-06 7.953262907187799e-08 0.0 0.0 0.0 +3.4701391129480595e-05 0.005680635772167662 0.07108357438929552 0.18745843365735923 0.18473391598372302 0.2461411417071668 -0.005111666129467331 -0.24038059036230178 -0.19258370027930355 -0.048958604017684836 -0.0025501911244683846 -4.982008439539256e-06 0.0 0.0 0.0 +7.181321030642065e-05 0.029059269505937943 0.11884075783303522 0.21076878762972284 -0.36996025259611676 0.35312700844142586 0.16990097184555128 0.15210775765373416 0.6757140775652752 -0.10922320044264704 -0.5849697059462919 -0.027759887396949002 0.0 0.0 0.0 +3.8792902483003914e-05 0.01940944659869733 0.11401272918676479 0.24845559032094336 -0.029040137137018487 0.22760022061135138 -0.14408030764137164 -0.1502303415258775 0.24414290246285578 0.20048840049956973 -0.3098919852331769 0.38455675655513366 0.0 0.0 0.0 +0.0001449154156948679 0.05388868537335966 0.1340445791122114 0.1304729995514306 0.02041924003827766 0.11401975265164792 0.13440972558465583 -0.056806908474571434 0.03945347719095876 0.02504259931146615 0.04957547514580214 0.01854515348232565 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-2.18344999249825e-05 -0.00011697904895508256 -5.553581955175406e-06 2.658838454117769e-08 1.2146153008512734e-05 1.918298817375017e-05 5.40154814815751e-05 1.2944187401636162e-05 3.710536690671586e-05 1.6795050072301748e-05 -7.229556489685409e-06 8.543467581763247e-06 0.0 0.0 0.0 +2.3603382351924323e-06 7.146280072503116e-05 0.0012361202483760594 -0.005734465078354871 -0.017135562936976125 -0.0016664758722632735 0.010195949308015286 -0.005412690557758046 -0.0029107216230642853 -0.0007612908343076258 -0.00013449226099999524 2.1468761472671134e-05 0.0 0.0 0.0 +1.8054960278101902e-05 0.011611823828717463 0.14139350699353365 0.1678085431015684 -0.22152577092526715 0.26507903411379746 0.08279760718466518 0.02879361559120084 0.04448600527937973 -0.006339073225905362 0.012182164968354765 -0.0016647733469859114 0.0 0.0 0.0 +9.734779590447442e-05 0.06072685888500135 0.09586373042400446 0.2700889438647233 0.06469057221256519 0.1854847883254132 0.08392153868089386 -0.03626027544891736 0.04232832520121794 0.23849583983886427 0.10911730115168922 -0.04380214407208333 0.0 0.0 0.0 +0.0001449154156948679 0.05388868537335966 0.1340445791122114 0.1304729995514306 0.02041924003827766 0.11401975265164792 0.13440972558465583 -0.056806908474571434 0.03945347719095876 0.02504259931146615 0.04957547514580214 0.01854515348232565 0.0 0.0 0.0 +5.588250079169304e-05 -0.012017079745903034 -0.0008295411205340048 0.00043274236043781584 0.036933605134660964 -0.017759680455812197 0.15248826375477179 -0.022974467887332546 0.005116007779072725 -0.01249692329646853 -0.12288470938617652 0.022731129576009593 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +# From 7e09353e7ce46e538d85fbc09176216bc62eea7a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Mar 2024 06:28:23 -0400 Subject: [PATCH 15/65] add ML-UF3 to compatible CMake preset files --- cmake/presets/all_off.cmake | 1 + cmake/presets/all_on.cmake | 1 + cmake/presets/mingw-cross.cmake | 1 + cmake/presets/most.cmake | 1 + cmake/presets/windows.cmake | 1 + 5 files changed, 5 insertions(+) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index e078879f70..c82eb568bf 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -60,6 +60,7 @@ set(ALL_PACKAGES ML-QUIP ML-RANN ML-SNAP + ML-UF3 MOFFF MOLECULE MOLFILE diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 3f44a863f7..d909b6aca7 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -62,6 +62,7 @@ set(ALL_PACKAGES ML-QUIP ML-RANN ML-SNAP + ML-UF3 MOFFF MOLECULE MOLFILE diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index f3565668b2..8fdce0512f 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -50,6 +50,7 @@ set(WIN_PACKAGES ML-POD ML-RANN ML-SNAP + ML-UF3 MOFFF MOLECULE MOLFILE diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index 2356e24764..2ed7cbcaac 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -45,6 +45,7 @@ set(ALL_PACKAGES ML-IAP ML-POD ML-SNAP + ML-UF3 MOFFF MOLECULE OPENMP diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index 9655134e7f..d47e1077e8 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -42,6 +42,7 @@ set(WIN_PACKAGES ML-IAP ML-POD ML-SNAP + ML-UF3 MOFFF MOLECULE MOLFILE From f9a0ec83b4ac1244192daf3efad8ae50d34db3d8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Mar 2024 06:28:35 -0400 Subject: [PATCH 16/65] update .gitignore --- src/.gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/.gitignore b/src/.gitignore index 88bb80fdc5..b0d5339054 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -169,6 +169,17 @@ /rann_*.cpp /rann_*.h +/pair_uf3.cpp +/pair_uf3.h +/uf3_bspline_basis2.cpp +/uf3_bspline_basis2.h +/uf3_bspline_basis3.cpp +/uf3_bspline_basis3.h +/uf3_pair_bspline.cpp +/uf3_pair_bspline.h +/uf3_triplet_bspline.cpp +/uf3_triplet_bspline.h + /compute_test_nbl.cpp /compute_test_nbl.h /pair_multi_lucy.cpp From 0d7c41b1c347934bcd9f334cab46fa004e83b34f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Mar 2024 06:30:20 -0400 Subject: [PATCH 17/65] update code owners list --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ed37fa80b9..e1d22a1732 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -38,6 +38,7 @@ src/ML-HDNNP/* @singraber src/ML-IAP/* @athomps src/ML-PACE/* @yury-lysogorskiy src/ML-POD/* @exapde +src/ML-UF3/* @monk-04 src/MOFFF/* @hheenen src/MOLFILE/* @akohlmey src/NETCDF/* @pastewka From 7323364d1dbb751e76f976b3ad2e35b4a0d2b94d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Mar 2024 06:35:19 -0400 Subject: [PATCH 18/65] move examples --- examples/{ => PACKAGES}/uf3/README.md | 0 examples/{ => PACKAGES}/uf3/W_W | 0 examples/{ => PACKAGES}/uf3/W_W_W | 0 examples/{ => PACKAGES}/uf3/in.uf3.2b.W | 0 examples/{ => PACKAGES}/uf3/in.uf3.3b.W | 0 examples/README | 1 - 6 files changed, 1 deletion(-) rename examples/{ => PACKAGES}/uf3/README.md (100%) rename examples/{ => PACKAGES}/uf3/W_W (100%) rename examples/{ => PACKAGES}/uf3/W_W_W (100%) rename examples/{ => PACKAGES}/uf3/in.uf3.2b.W (100%) rename examples/{ => PACKAGES}/uf3/in.uf3.3b.W (100%) diff --git a/examples/uf3/README.md b/examples/PACKAGES/uf3/README.md similarity index 100% rename from examples/uf3/README.md rename to examples/PACKAGES/uf3/README.md diff --git a/examples/uf3/W_W b/examples/PACKAGES/uf3/W_W similarity index 100% rename from examples/uf3/W_W rename to examples/PACKAGES/uf3/W_W diff --git a/examples/uf3/W_W_W b/examples/PACKAGES/uf3/W_W_W similarity index 100% rename from examples/uf3/W_W_W rename to examples/PACKAGES/uf3/W_W_W diff --git a/examples/uf3/in.uf3.2b.W b/examples/PACKAGES/uf3/in.uf3.2b.W similarity index 100% rename from examples/uf3/in.uf3.2b.W rename to examples/PACKAGES/uf3/in.uf3.2b.W diff --git a/examples/uf3/in.uf3.3b.W b/examples/PACKAGES/uf3/in.uf3.3b.W similarity index 100% rename from examples/uf3/in.uf3.3b.W rename to examples/PACKAGES/uf3/in.uf3.3b.W diff --git a/examples/README b/examples/README index a68ab9fe66..62a09f654d 100644 --- a/examples/README +++ b/examples/README @@ -116,7 +116,6 @@ template: examples for using atom_style template and comparing to atom style mol tersoff: regression test input for Tersoff variants threebody: regression test input for a variety of threebody potentials ttm: two-temeperature model examples -uf3: examples for using uf3 potentials vashishta: models using the Vashishta potential voronoi: Voronoi tesselation via compute voronoi/atom command wall: use of reflective walls with different stochastic models From fda433a7ee02928e5dc7a756cdec27764fac075f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Mar 2024 06:53:03 -0400 Subject: [PATCH 19/65] reformat and fix spelling and related issues --- doc/src/Packages_details.rst | 10 +- doc/src/pair_uf3.rst | 107 +++++++++++++++----- doc/utils/sphinx-config/false_positives.txt | 6 ++ 3 files changed, 94 insertions(+), 29 deletions(-) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index fa1ddf0a39..1ac8818c42 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -1933,11 +1933,11 @@ ML-UF3 package **Contents:** -A pair style for the Ultra-Fast Forcefield potentials (UF3). UF3 is a -methodology for deriving a highly accurate classical potential which is fast to -evaluate and is fitted to a large archives of quantum mechanical (DFT) data. -The use of bspline basis set in UF3 enables the rapid evaluation of 2-body and -3-body interactions. +A pair style for the ultra-fast force field potentials (UF3). UF3 is a +methodology for deriving a highly accurate classical potential which is +fast to evaluate and is fitted to a large archives of quantum mechanical +(DFT) data. The use of b-spline basis set in UF3 enables the rapid +evaluation of 2-body and 3-body interactions. **Authors:** Ajinkya C Hire (University of Florida), Hendrik Krass (University of Constance), diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index c4c9a5b31f..38122bc982 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -17,11 +17,9 @@ Syntax .. parsed-literal:: - BodyFlag = Indicates whether to calculate only 2-body or 2 and 3-body interactions. Possible values- 2 or 3 + BodyFlag = Indicates whether to calculate only 2-body or 2 and 3-body interactions. Possible values: 2 or 3 NumAtomType = Number of atoms types in the simulation - - Examples """""""" @@ -50,7 +48,12 @@ Examples Description """"""""""" -The *uf3* style computes the :ref:`Ultra-Fast Force Fields (UF3) ` potential, a machine-learning interatomic potential. In UF3, the total energy of the system is defined via two- and three-body interactions: +.. versionadded:: TBD + +The *uf3* style computes the :ref:`Ultra-Fast Force Fields (UF3) +` potential, a machine-learning interatomic potential. In UF3, +the total energy of the system is defined via two- and three-body +interactions: .. math:: @@ -58,15 +61,29 @@ The *uf3* style computes the :ref:`Ultra-Fast Force Fields (UF3) ` potent V_2(r_{ij}) & = \sum_{n=0}^N c_n B_n(r_{ij}) \\ V_3 (r_{ij},r_{ik},r_{jk}) & = \sum_{l=0}^{N_l} \sum_{m=0}^{N_m} \sum_{n=0}^{N_n} c_{l,m,n} B_l(r_{ij}) B_m(r_{ik}) B_n(r_{jk}) -where :math:`V_2(r_{ij})` and :math:`V_3 (r_{ij},r_{ik},r_{jk})` are the two- and three-body interactions, respectively. For the two-body the summation is over all neighbours J and for the three-body the summation is over all neighbors J and K of atom I within a cutoff distance determined from the potential files. :math:`B_n(r_{ij})` are the cubic bspline basis, :math:`c_n` and :math:`c_{l,m,n}` are the machine-learned interaction parameters and :math:`N`, :math:`N_l`, :math:`N_m`, and :math:`N_n` denote the number of basis functions per spline or tensor spline dimension. +where :math:`V_2(r_{ij})` and :math:`V_3 (r_{ij},r_{ik},r_{jk})` are the +two- and three-body interactions, respectively. For the two-body the +summation is over all neighbors J and for the three-body the summation +is over all neighbors J and K of atom I within a cutoff distance +determined from the potential files. :math:`B_n(r_{ij})` are the cubic +b-spline basis, :math:`c_n` and :math:`c_{l,m,n}` are the machine-learned +interaction parameters and :math:`N`, :math:`N_l`, :math:`N_m`, and +:math:`N_n` denote the number of basis functions per spline or tensor +spline dimension. -The UF3 LAMMPS potential files are provided using multiple pair_coeff commands. A single UF3 LAMMPS potential file contains information about one particular interaction only. +The UF3 LAMMPS potential files are provided using multiple pair_coeff +commands. A single UF3 LAMMPS potential file contains information about +one particular interaction only. .. note:: - Unlike other MANYBODY and ML potentials in LAMMPS, the atom type for which the specified potential file should be used for is not determined from the potential file, but is rather determined from the user provided atom type numbers after pair_coeff. + Unlike other MANYBODY and ML potentials in LAMMPS, the atom type for + which the specified potential file should be used for is not + determined from the potential file, but is rather determined from the + user provided atom type numbers after pair_coeff. -As an example, if a LAMMPS simulation contains 2 atom types (elements 'A' and 'B'), the pair_coeff command will be- +As an example, if a LAMMPS simulation contains 2 atom types (elements +'A' and 'B'), the pair_coeff command will be: .. code-block:: LAMMPS @@ -81,9 +98,15 @@ As an example, if a LAMMPS simulation contains 2 atom types (elements 'A' and 'B pair_coeff 3b 2 1 2 B_A_B pair_coeff 3b 2 2 2 B_B_B -If a value of "2" is specified in the :code:`pair_style uf3` command, only the two-body potential files are needed. For 3-body interaction the first atom type is the central atom. We recommend using the :code:`generate_uf3_lammps_pots.py` script (found `here `_) for generating the UF3 LAMMPS potential files from the UF3 JSON potentials. +If a value of "2" is specified in the :code:`pair_style uf3` command, +only the two-body potential files are needed. For 3-body interaction the +first atom type is the central atom. We recommend using the +:code:`generate_uf3_lammps_pots.py` script (found `here +`_) for +generating the UF3 LAMMPS potential files from the UF3 JSON potentials. -LAMMPS wild-card character "*" can also be used to specify a single UF3 LAMMPS potential file for multiple interaction. For example- +LAMMPS wild-card character "*" can also be used to specify a single UF3 +LAMMPS potential file for multiple interaction. For example- .. code-block:: LAMMPS @@ -92,10 +115,18 @@ LAMMPS wild-card character "*" can also be used to specify a single UF3 LAMMPS p pair_coeff 3b 1 * * A_A_A pair_coeff 3b 2 * * B_B_B -The file A_A will be used for 2-body interaction between atom types 1-1, 1-2 and 2-2; file A_A_A will be used 3-body interaction for atom types 1-1-1, 1-1-2, 1-2-2; and so on. Note, using a single interaction file for all types of interactions is **not** the recommended way of using :code:`pair_style uf3` and will often lead to **incorrect results**. +The file A_A will be used for 2-body interaction between atom types 1-1, +1-2 and 2-2; file A_A_A will be used 3-body interaction for atom types +1-1-1, 1-1-2, 1-2-2; and so on. Note, using a single interaction file +for all types of interactions is **not** the recommended way of using +:code:`pair_style uf3` and will often lead to **incorrect results**. +---------- -UF3 LAMMPS potential files in the *potentials* directory of the LAMMPS distribution have a ".uf3" suffix. All UF3 LAMMPS potential files should start with :code:`#UF3 POT` and end with :code:`#` characters. Following shows the format of a generic 2-body UF3 LAMMPS potential file- +UF3 LAMMPS potential files in the *potentials* directory of the LAMMPS +distribution have a ".uf3" suffix. All UF3 LAMMPS potential files should +start with :code:`#UF3 POT` and end with :code:`#` characters. Following +shows the format of a generic 2-body UF3 LAMMPS potential file- .. code-block:: LAMMPS @@ -134,38 +165,66 @@ The format of a generic 3-body UF3 LAMMPS potential file is as follow- . # -Similar to the 2-body potential file, the third line sets the cutoffs and length of the knots. The cutoff distance between atom-type I and J is :code:`Rij_CUTOFF`, atom-type I and K is :code:`Rik_CUTOFF` and between J and K is :code:`Rjk_CUTOFF`. +Similar to the 2-body potential file, the third line sets the cutoffs +and length of the knots. The cutoff distance between atom-type I and J +is :code:`Rij_CUTOFF`, atom-type I and K is :code:`Rik_CUTOFF` and +between J and K is :code:`Rjk_CUTOFF`. .. note:: - The current implementation only works for UF3 potentials with cutoff distances for 3-body interactions that follows :code:`2Rij_CUTOFF=2Rik_CUTOFF=Rjk_CUTOFF` relation. + The current implementation only works for UF3 potentials with cutoff + distances for 3-body interactions that follows + :code:`2Rij_CUTOFF=2Rik_CUTOFF=Rjk_CUTOFF` relation. -The :code:`BSPLINE_KNOTS_FOR_JK`, :code:`BSPLINE_KNOTS_FOR_IK`, and :code:`BSPLINE_KNOTS_FOR_IJ` lines (note the order) contain the knots in increasing order for atoms J and K, I and K, and atoms I and J respectively. The number of knots is defined by the :code:`NUM_OF_KNOTS_*` characters in the previous line. -The shape of the coefficient matrix is defined on the :code:`SHAPE_OF_COEFF_MATRIX[I][J][K]` line followed by the columns of the coefficient matrix, one per line, as shown above. For example, if the coefficient matrix has the shape of 8x8x13, then :code:`SHAPE_OF_COEFF_MATRIX[I][J][K]` will be :code:`8 8 13` followed by 64 (8x8) lines each containing 13 coefficients seperated by space. +The :code:`BSPLINE_KNOTS_FOR_JK`, :code:`BSPLINE_KNOTS_FOR_IK`, and +:code:`BSPLINE_KNOTS_FOR_IJ` lines (note the order) contain the knots in +increasing order for atoms J and K, I and K, and atoms I and J +respectively. The number of knots is defined by the +:code:`NUM_OF_KNOTS_*` characters in the previous line. The shape of +the coefficient matrix is defined on the +:code:`SHAPE_OF_COEFF_MATRIX[I][J][K]` line followed by the columns of +the coefficient matrix, one per line, as shown above. For example, if +the coefficient matrix has the shape of 8x8x13, then +:code:`SHAPE_OF_COEFF_MATRIX[I][J][K]` will be :code:`8 8 13` followed +by 64 (8x8) lines each containing 13 coefficients separated by space. +---------- + +.. include:: accel_styles.rst + +---------- Mixing, shift, table, tail correction, restart, rRESPA info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -For atom type pairs I,J and I != J, where types I and J correspond to two different element types, mixing is performed by LAMMPS as described above from values in the potential file. +For atom type pairs I,J and I != J, where types I and J correspond to +two different element types, mixing is performed by LAMMPS as described +above from values in the potential file. -This pair style does not support the :doc:`pair_modify ` shift, table, and tail options. +This pair style does not support the :doc:`pair_modify ` +shift, table, and tail options. -This pair style does not write its information to :doc:`binary restart files `, since it is stored in potential files. +This pair style does not write its information to :doc:`binary restart +files `, since it is stored in potential files. -This pair style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. - -The single() function of 'uf3' pair style only return the 2-body interaction energy. +This pair style can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. It does not support the +*inner*, *middle*, *outer* keywords. Restrictions """""""""""" -The 'uf3' pair style is part of the ML-UF3 package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +The 'uf3' pair style is part of the ML-UF3 package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` page for more info. This pair style requires the :doc:`newton ` setting to be "on". -The UF3 LAMMPS potential files provided with LAMMPS (see the potentials directory) are parameterized for metal :doc:`units `. +The UF3 LAMMPS potential files provided with LAMMPS (see the potentials +directory) are parameterized for metal :doc:`units `. +The single() function of 'uf3' pair style only return the 2-body +interaction energy. Related commands """""""""""""""" diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 04ea69575a..3e548f3aa8 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1407,6 +1407,7 @@ Hendrik Henin Henkelman Henkes +Hennig henrich Henrich Hermitian @@ -1567,6 +1568,7 @@ interlayer intermolecular interoperable Interparticle +interpretable interstitials intertube Intr @@ -1786,6 +1788,7 @@ Koziol Kp kradius Kraker +Krass Kraus Kremer Kress @@ -3226,6 +3229,7 @@ Rudranarayan Rudzinski Runge runtime +Rupp Rutuparna rx rxd @@ -3771,6 +3775,8 @@ uChem uCond uef UEF +uf +uf3 ufm Uhlenbeck Ui From 713b308a996c9d2c2c99e6787054621cc159bc7c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Mar 2024 07:25:36 -0400 Subject: [PATCH 20/65] update ML-UF3 examples --- examples/PACKAGES/uf3/{W_W => W_W.uf3} | 0 examples/PACKAGES/uf3/{W_W_W => W_W_W.uf3} | 0 examples/PACKAGES/uf3/in.uf3.2b.W | 2 +- examples/PACKAGES/uf3/in.uf3.3b.W | 4 +- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 | 122 ++++++++++++++++ .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 | 122 ++++++++++++++++ .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 | 132 ++++++++++++++++++ .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 | 132 ++++++++++++++++++ 8 files changed, 511 insertions(+), 3 deletions(-) rename examples/PACKAGES/uf3/{W_W => W_W.uf3} (100%) rename examples/PACKAGES/uf3/{W_W_W => W_W_W.uf3} (100%) create mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 create mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 create mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 create mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 diff --git a/examples/PACKAGES/uf3/W_W b/examples/PACKAGES/uf3/W_W.uf3 similarity index 100% rename from examples/PACKAGES/uf3/W_W rename to examples/PACKAGES/uf3/W_W.uf3 diff --git a/examples/PACKAGES/uf3/W_W_W b/examples/PACKAGES/uf3/W_W_W.uf3 similarity index 100% rename from examples/PACKAGES/uf3/W_W_W rename to examples/PACKAGES/uf3/W_W_W.uf3 diff --git a/examples/PACKAGES/uf3/in.uf3.2b.W b/examples/PACKAGES/uf3/in.uf3.2b.W index 038189f0c7..29510ea5b1 100644 --- a/examples/PACKAGES/uf3/in.uf3.2b.W +++ b/examples/PACKAGES/uf3/in.uf3.2b.W @@ -25,7 +25,7 @@ mass 1 183.84 # # ============= set pair style pair_style uf3 2 1 -pair_coeff 1 1 W_W +pair_coeff 1 1 W_W.uf3 # # ============= Setup output diff --git a/examples/PACKAGES/uf3/in.uf3.3b.W b/examples/PACKAGES/uf3/in.uf3.3b.W index fa14b1347c..e66b38aa83 100644 --- a/examples/PACKAGES/uf3/in.uf3.3b.W +++ b/examples/PACKAGES/uf3/in.uf3.3b.W @@ -25,8 +25,8 @@ mass 1 183.84 # # ============= set pair style pair_style uf3 3 1 -pair_coeff 1 1 W_W -pair_coeff 3b 1 1 1 W_W_W +pair_coeff 1 1 W_W.uf3 +pair_coeff 3b 1 1 1 W_W_W.uf3 # # ============= Setup output diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 new file mode 100644 index 0000000000..bd4eb61bcd --- /dev/null +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 @@ -0,0 +1,122 @@ +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) + using 1 OpenMP thread(s) per MPI task +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.187 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.187 +Lattice spacing in x,y,z = 3.187 3.187 3.187 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 128 atoms + using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) + create_atoms CPU = 0.000 seconds + +mass 1 183.84 + +# # ============= set pair style + +pair_style uf3 2 1 +pair_coeff 1 1 W_W.uf3 + +UF3: Opening W_W.uf3 file +UF3: W_W.uf3 file should contain UF3 potential for 1 1 +UF3: File W_W.uf3 contains 2-body UF3 potential +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform + knot spacing + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.5 + ghost atom cutoff = 6.5 + binsize = 3.25, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair uf3, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.113 | 3.113 | 3.113 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 300 -4.9097145 0 -4.8712394 -398022.13 + 10 297.43433 -4.9093854 0 -4.8712394 -397994.78 + 20 289.88359 -4.908417 0 -4.8712393 -397922.72 + 30 277.73497 -4.9068589 0 -4.8712393 -397829.84 + 40 261.57286 -4.904786 0 -4.8712392 -397731.28 + 50 242.14207 -4.902294 0 -4.8712392 -397640.01 + 60 220.31079 -4.899494 0 -4.8712391 -397572.33 + 70 197.03391 -4.8965087 0 -4.871239 -397551.93 + 80 173.31044 -4.893466 0 -4.8712389 -397601.62 + 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 + 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 +Loop time of 0.0344773 on 1 procs for 100 steps with 128 atoms + +Performance: 125.300 ns/day, 0.192 hours/ns, 2900.463 timesteps/s, 371.259 katom-step/s +98.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.033145 | 0.033145 | 0.033145 | 0.0 | 96.14 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.00071163 | 0.00071163 | 0.00071163 | 0.0 | 2.06 +Output | 0.0002018 | 0.0002018 | 0.0002018 | 0.0 | 0.59 +Modify | 0.00017741 | 0.00017741 | 0.00017741 | 0.0 | 0.51 +Other | | 0.0002413 | | | 0.70 + +Nlocal: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1113 ave 1113 max 1113 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 8192 ave 8192 max 8192 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 8192 +Ave neighs/atom = 64 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 new file mode 100644 index 0000000000..4d42ef0016 --- /dev/null +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 @@ -0,0 +1,122 @@ +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) + using 1 OpenMP thread(s) per MPI task +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.187 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.187 +Lattice spacing in x,y,z = 3.187 3.187 3.187 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 128 atoms + using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) + create_atoms CPU = 0.000 seconds + +mass 1 183.84 + +# # ============= set pair style + +pair_style uf3 2 1 +pair_coeff 1 1 W_W.uf3 + +UF3: Opening W_W.uf3 file +UF3: W_W.uf3 file should contain UF3 potential for 1 1 +UF3: File W_W.uf3 contains 2-body UF3 potential +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform + knot spacing + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.5 + ghost atom cutoff = 6.5 + binsize = 3.25, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair uf3, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.104 | 3.104 | 3.104 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 300 -4.9097145 0 -4.8712394 -398022.13 + 10 297.43433 -4.9093854 0 -4.8712394 -397994.78 + 20 289.88359 -4.908417 0 -4.8712393 -397922.72 + 30 277.73497 -4.9068589 0 -4.8712393 -397829.84 + 40 261.57286 -4.904786 0 -4.8712392 -397731.28 + 50 242.14207 -4.902294 0 -4.8712392 -397640.01 + 60 220.31079 -4.899494 0 -4.8712391 -397572.33 + 70 197.03391 -4.8965087 0 -4.871239 -397551.93 + 80 173.31044 -4.893466 0 -4.8712389 -397601.62 + 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 + 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 +Loop time of 0.0111207 on 4 procs for 100 steps with 128 atoms + +Performance: 388.463 ns/day, 0.062 hours/ns, 8992.202 timesteps/s, 1.151 Matom-step/s +98.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.0087312 | 0.008777 | 0.0088396 | 0.0 | 78.92 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.0019835 | 0.0020323 | 0.0020742 | 0.1 | 18.27 +Output | 7.6664e-05 | 8.1924e-05 | 9.4556e-05 | 0.0 | 0.74 +Modify | 5.4618e-05 | 5.8768e-05 | 6.2489e-05 | 0.0 | 0.53 +Other | | 0.0001708 | | | 1.54 + +Nlocal: 32 ave 32 max 32 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 697 ave 697 max 697 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 2048 ave 2048 max 2048 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 8192 +Ave neighs/atom = 64 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 new file mode 100644 index 0000000000..ad6c138b96 --- /dev/null +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 @@ -0,0 +1,132 @@ +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) + using 1 OpenMP thread(s) per MPI task +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.187 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.187 +Lattice spacing in x,y,z = 3.187 3.187 3.187 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 128 atoms + using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) + create_atoms CPU = 0.000 seconds + +mass 1 183.84 + +# # ============= set pair style + +pair_style uf3 3 1 +pair_coeff 1 1 W_W.uf3 + +UF3: Opening W_W.uf3 file +UF3: W_W.uf3 file should contain UF3 potential for 1 1 +UF3: File W_W.uf3 contains 2-body UF3 potential +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform + knot spacing +pair_coeff 3b 1 1 1 W_W_W.uf3 + +UF3: Opening W_W_W.uf3 file +UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 +UF3: File W_W_W.uf3 contains 3-body UF3 potential +UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform + knot spacing +UF3: 3b min cutoff W_W_W.uf3 1-1-1_jk=1.5 1-1-1_jk=1.5 +UF3: 3b min cutoff W_W_W.uf3 1-1-1_ik=1.5 1-1-1_ik=1.5 +UF3: 3b min cutoff W_W_W.uf3 1-1-1_ij=1.5 1-1-1_ij=1.5 + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.5 + ghost atom cutoff = 6.5 + binsize = 3.25, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair uf3, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.214 | 3.214 | 3.214 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 300 -4.3916353 0 -4.3531602 -21224 + 10 292.96093 -4.3907325 0 -4.3531602 -21177.095 + 20 272.60651 -4.3881219 0 -4.35316 -21038.525 + 30 241.12074 -4.3840835 0 -4.3531597 -20793.964 + 40 201.8718 -4.3790495 0 -4.3531594 -20444.219 + 50 159.06853 -4.3735596 0 -4.353159 -19996.634 + 60 117.24817 -4.3681958 0 -4.3531587 -19470.011 + 70 80.716097 -4.3635102 0 -4.3531584 -18905.505 + 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 + 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 + 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 +Loop time of 0.486699 on 1 procs for 100 steps with 128 atoms + +Performance: 8.876 ns/day, 2.704 hours/ns, 205.466 timesteps/s, 26.300 katom-step/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.48518 | 0.48518 | 0.48518 | 0.0 | 99.69 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.00082659 | 0.00082659 | 0.00082659 | 0.0 | 0.17 +Output | 0.00014676 | 0.00014676 | 0.00014676 | 0.0 | 0.03 +Modify | 0.00025566 | 0.00025566 | 0.00025566 | 0.0 | 0.05 +Other | | 0.0002862 | | | 0.06 + +Nlocal: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1113 ave 1113 max 1113 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 8192 ave 8192 max 8192 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 8192 +Ave neighs/atom = 64 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 new file mode 100644 index 0000000000..56ab30c270 --- /dev/null +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 @@ -0,0 +1,132 @@ +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) + using 1 OpenMP thread(s) per MPI task +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.187 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.187 +Lattice spacing in x,y,z = 3.187 3.187 3.187 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 128 atoms + using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) + create_atoms CPU = 0.000 seconds + +mass 1 183.84 + +# # ============= set pair style + +pair_style uf3 3 1 +pair_coeff 1 1 W_W.uf3 + +UF3: Opening W_W.uf3 file +UF3: W_W.uf3 file should contain UF3 potential for 1 1 +UF3: File W_W.uf3 contains 2-body UF3 potential +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform + knot spacing +pair_coeff 3b 1 1 1 W_W_W.uf3 + +UF3: Opening W_W_W.uf3 file +UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 +UF3: File W_W_W.uf3 contains 3-body UF3 potential +UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform + knot spacing +UF3: 3b min cutoff W_W_W.uf3 1-1-1_jk=1.5 1-1-1_jk=1.5 +UF3: 3b min cutoff W_W_W.uf3 1-1-1_ik=1.5 1-1-1_ik=1.5 +UF3: 3b min cutoff W_W_W.uf3 1-1-1_ij=1.5 1-1-1_ij=1.5 + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.5 + ghost atom cutoff = 6.5 + binsize = 3.25, bins = 4 4 4 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair uf3, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.205 | 3.205 | 3.205 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 300 -4.3916353 0 -4.3531602 -21224 + 10 292.96093 -4.3907325 0 -4.3531602 -21177.095 + 20 272.60651 -4.3881219 0 -4.35316 -21038.525 + 30 241.12074 -4.3840835 0 -4.3531597 -20793.964 + 40 201.8718 -4.3790495 0 -4.3531594 -20444.219 + 50 159.06853 -4.3735596 0 -4.353159 -19996.634 + 60 117.24817 -4.3681958 0 -4.3531587 -19470.011 + 70 80.716097 -4.3635102 0 -4.3531584 -18905.505 + 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 + 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 + 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 +Loop time of 0.133856 on 4 procs for 100 steps with 128 atoms + +Performance: 32.273 ns/day, 0.744 hours/ns, 747.069 timesteps/s, 95.625 katom-step/s +98.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.1196 | 0.1221 | 0.12575 | 0.7 | 91.22 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.0074076 | 0.011068 | 0.01359 | 2.4 | 8.27 +Output | 0.00013888 | 0.00015365 | 0.00018854 | 0.0 | 0.11 +Modify | 0.00010546 | 0.00011783 | 0.00013025 | 0.0 | 0.09 +Other | | 0.0004172 | | | 0.31 + +Nlocal: 32 ave 32 max 32 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 697 ave 697 max 697 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 2048 ave 2048 max 2048 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 8192 +Ave neighs/atom = 64 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:00 From fca23dac72bddfcb34d3cbfc91b9a0deac2db1f2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 27 Mar 2024 07:26:43 -0400 Subject: [PATCH 21/65] some style cleanup and simplified pair_style and pair_coeff input --- examples/PACKAGES/uf3/in.uf3.2b.W | 2 +- examples/PACKAGES/uf3/in.uf3.3b.W | 2 +- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 | 22 +-- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 | 22 +-- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 | 24 +-- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 | 24 +-- src/ML-UF3/pair_uf3.cpp | 185 ++++-------------- 7 files changed, 84 insertions(+), 197 deletions(-) diff --git a/examples/PACKAGES/uf3/in.uf3.2b.W b/examples/PACKAGES/uf3/in.uf3.2b.W index 29510ea5b1..bff3529e9c 100644 --- a/examples/PACKAGES/uf3/in.uf3.2b.W +++ b/examples/PACKAGES/uf3/in.uf3.2b.W @@ -24,7 +24,7 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 2 1 +pair_style uf3 2 pair_coeff 1 1 W_W.uf3 diff --git a/examples/PACKAGES/uf3/in.uf3.3b.W b/examples/PACKAGES/uf3/in.uf3.3b.W index e66b38aa83..9ca29293b5 100644 --- a/examples/PACKAGES/uf3/in.uf3.3b.W +++ b/examples/PACKAGES/uf3/in.uf3.3b.W @@ -24,7 +24,7 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 3 1 +pair_style uf3 3 pair_coeff 1 1 W_W.uf3 pair_coeff 3b 1 1 1 W_W_W.uf3 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 index bd4eb61bcd..4dee5c5942 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,10 +39,8 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 2 1 +pair_style uf3 2 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform @@ -91,20 +89,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.113 | 3.113 | 3.113 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0344773 on 1 procs for 100 steps with 128 atoms +Loop time of 0.0345905 on 1 procs for 100 steps with 128 atoms -Performance: 125.300 ns/day, 0.192 hours/ns, 2900.463 timesteps/s, 371.259 katom-step/s -98.6% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 124.890 ns/day, 0.192 hours/ns, 2890.965 timesteps/s, 370.044 katom-step/s +99.2% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.033145 | 0.033145 | 0.033145 | 0.0 | 96.14 +Pair | 0.03333 | 0.03333 | 0.03333 | 0.0 | 96.36 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00071163 | 0.00071163 | 0.00071163 | 0.0 | 2.06 -Output | 0.0002018 | 0.0002018 | 0.0002018 | 0.0 | 0.59 -Modify | 0.00017741 | 0.00017741 | 0.00017741 | 0.0 | 0.51 -Other | | 0.0002413 | | | 0.70 +Comm | 0.00068797 | 0.00068797 | 0.00068797 | 0.0 | 1.99 +Output | 0.00015217 | 0.00015217 | 0.00015217 | 0.0 | 0.44 +Modify | 0.00019786 | 0.00019786 | 0.00019786 | 0.0 | 0.57 +Other | | 0.0002224 | | | 0.64 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 index 4d42ef0016..10936a977c 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,10 +39,8 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 2 1 +pair_style uf3 2 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform @@ -91,20 +89,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.104 | 3.104 | 3.104 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0111207 on 4 procs for 100 steps with 128 atoms +Loop time of 0.0104225 on 4 procs for 100 steps with 128 atoms -Performance: 388.463 ns/day, 0.062 hours/ns, 8992.202 timesteps/s, 1.151 Matom-step/s -98.9% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 414.488 ns/day, 0.058 hours/ns, 9594.626 timesteps/s, 1.228 Matom-step/s +99.4% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.0087312 | 0.008777 | 0.0088396 | 0.0 | 78.92 +Pair | 0.0076422 | 0.0077975 | 0.0081692 | 0.2 | 74.81 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0019835 | 0.0020323 | 0.0020742 | 0.1 | 18.27 -Output | 7.6664e-05 | 8.1924e-05 | 9.4556e-05 | 0.0 | 0.74 -Modify | 5.4618e-05 | 5.8768e-05 | 6.2489e-05 | 0.0 | 0.53 -Other | | 0.0001708 | | | 1.54 +Comm | 0.001954 | 0.0022765 | 0.0024447 | 0.4 | 21.84 +Output | 7.7086e-05 | 8.2565e-05 | 9.3188e-05 | 0.0 | 0.79 +Modify | 4.8524e-05 | 5.011e-05 | 5.1759e-05 | 0.0 | 0.48 +Other | | 0.0002159 | | | 2.07 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 index ad6c138b96..3e95eb6055 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,17 +39,13 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 3 1 +pair_style uf3 3 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing pair_coeff 3b 1 1 1 W_W_W.uf3 - -UF3: Opening W_W_W.uf3 file UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 UF3: File W_W_W.uf3 contains 3-body UF3 potential UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform @@ -101,20 +97,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.214 | 3.214 | 3.214 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.486699 on 1 procs for 100 steps with 128 atoms +Loop time of 0.478107 on 1 procs for 100 steps with 128 atoms -Performance: 8.876 ns/day, 2.704 hours/ns, 205.466 timesteps/s, 26.300 katom-step/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 9.036 ns/day, 2.656 hours/ns, 209.158 timesteps/s, 26.772 katom-step/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.48518 | 0.48518 | 0.48518 | 0.0 | 99.69 +Pair | 0.47649 | 0.47649 | 0.47649 | 0.0 | 99.66 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00082659 | 0.00082659 | 0.00082659 | 0.0 | 0.17 -Output | 0.00014676 | 0.00014676 | 0.00014676 | 0.0 | 0.03 -Modify | 0.00025566 | 0.00025566 | 0.00025566 | 0.0 | 0.05 -Other | | 0.0002862 | | | 0.06 +Comm | 0.00082433 | 0.00082433 | 0.00082433 | 0.0 | 0.17 +Output | 0.00020504 | 0.00020504 | 0.00020504 | 0.0 | 0.04 +Modify | 0.00022769 | 0.00022769 | 0.00022769 | 0.0 | 0.05 +Other | | 0.0003635 | | | 0.08 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 index 56ab30c270..330a69ea40 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-324-gfda433a7ee-modified) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -39,17 +39,13 @@ mass 1 183.84 # # ============= set pair style -pair_style uf3 3 1 +pair_style uf3 3 pair_coeff 1 1 W_W.uf3 - -UF3: Opening W_W.uf3 file UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing pair_coeff 3b 1 1 1 W_W_W.uf3 - -UF3: Opening W_W_W.uf3 file UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 UF3: File W_W_W.uf3 contains 3-body UF3 potential UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform @@ -101,20 +97,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.205 | 3.205 | 3.205 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.133856 on 4 procs for 100 steps with 128 atoms +Loop time of 0.135192 on 4 procs for 100 steps with 128 atoms -Performance: 32.273 ns/day, 0.744 hours/ns, 747.069 timesteps/s, 95.625 katom-step/s -98.9% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 31.955 ns/day, 0.751 hours/ns, 739.688 timesteps/s, 94.680 katom-step/s +99.5% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.1196 | 0.1221 | 0.12575 | 0.7 | 91.22 +Pair | 0.11876 | 0.12259 | 0.13092 | 1.4 | 90.68 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0074076 | 0.011068 | 0.01359 | 2.4 | 8.27 -Output | 0.00013888 | 0.00015365 | 0.00018854 | 0.0 | 0.11 -Modify | 0.00010546 | 0.00011783 | 0.00013025 | 0.0 | 0.09 -Other | | 0.0004172 | | | 0.31 +Comm | 0.0035898 | 0.011903 | 0.015736 | 4.5 | 8.80 +Output | 0.00016067 | 0.00018114 | 0.00023041 | 0.0 | 0.13 +Modify | 9.9574e-05 | 0.00011041 | 0.00012152 | 0.0 | 0.08 +Other | | 0.0004092 | | | 0.30 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 6b518c7ef1..4fa87ba335 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -19,6 +19,7 @@ ---------------------------------------------------------------------- */ #include "pair_uf3.h" + #include "uf3_pair_bspline.h" #include "uf3_triplet_bspline.h" @@ -35,7 +36,9 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::THIRD; + +/* ---------------------------------------------------------------------- */ PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp) { @@ -45,11 +48,11 @@ PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp) neighshort = nullptr; centroidstressflag = CENTROID_AVAIL; manybody_flag = 1; - one_coeff = 0; //if 1 then allow only one coeff call of form 'pair_coeff * *' - //by setting it to 0 we will allow multiple 'pair_coeff' calls bsplines_created = 0; } +/* ---------------------------------------------------------------------- */ + PairUF3::~PairUF3() { if (copymode) return; @@ -75,18 +78,11 @@ PairUF3::~PairUF3() void PairUF3::settings(int narg, char **arg) { - if (narg != 2) - error->all(FLERR, "UF3: Invalid number of argument in pair settings\n\ - Are you running 2-body or 2 & 3-body UF potential\n\ - Also how many elements?"); + if (narg != 1) + error->all(FLERR, "Invalid number of arguments for pair_style uf3" + " Are you using a 2-body or 2 & 3-body UF potential?"); nbody_flag = utils::numeric(FLERR, arg[0], true, lmp); - num_of_elements = utils::numeric(FLERR, arg[1], true, lmp); // atom->ntypes; - if (num_of_elements != atom->ntypes) { - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Number of elements provided in the input file and \ -number of elements detected by lammps in the structure are not same\n\ - proceed with caution\n"); - } + num_of_elements = atom->ntypes; if (nbody_flag == 2) { pot_3b = false; n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; @@ -97,7 +93,7 @@ number of elements detected by lammps in the structure are not same\n\ n3body_pot_files = num_of_elements * (num_of_elements * (num_of_elements + 1) / 2); tot_pot_files = n2body_pot_files + n3body_pot_files; } else - error->all(FLERR, "UF3: UF3 not yet implemented for {}-body", nbody_flag); + error->all(FLERR, "Pair style uf3 not (yet) implemented for {}-body terms", nbody_flag); } /* ---------------------------------------------------------------------- @@ -107,131 +103,33 @@ void PairUF3::coeff(int narg, char **arg) { if (!allocated) allocate(); - if (narg != 3 && narg != 5){ - /*error->warning(FLERR, "\nUF3: WARNING!! It seems that you are using the \n\ - older style of specifying UF3 POT files. This style of listing \n\ - all the potential files on a single line will be depcrecated in \n\ - the next version of ML-UF3");*/ - if (narg == tot_pot_files + 2) - error->all(FLERR, "UF3 The old style of listing all the potential files\n\ - on a single line is depcrecated"); - else - error->all(FLERR, "UF3: Invalid number of argument in pair coeff;\n\ - Provide the species number followed by the LAMMPS POT file\n\ - Eg. 'pair_coeff 1 1 POT_FILE' for 2-body and \n\ - 'pair_coeff 3b 1 2 2 POT_FILE' for 3-body."); - } - if (narg == 3 || narg == 5){ - int ilo, ihi, jlo, jhi, klo, khi; - if (narg == 3){ - utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); - utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); - } + if (narg != 3 && narg != 5) + error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); - if (narg == 5){ - utils::bounds(FLERR, arg[1], 1, atom->ntypes, ilo, ihi, error); - utils::bounds(FLERR, arg[2], 1, atom->ntypes, jlo, jhi, error); - utils::bounds(FLERR, arg[3], 1, atom->ntypes, klo, khi, error); - } - - if (narg == 3){ - if (utils::strmatch(arg[0],".*\\*.*") || utils::strmatch(arg[1],".*\\*.*")){ - for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo, i); j <= jhi; j++) { - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[2]); - uf3_read_pot_file(i,j,arg[2]); - } - } - } - - else{ - int i = utils::inumeric(FLERR, arg[0], true, lmp); - int j = utils::inumeric(FLERR, arg[1], true, lmp); - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[2]); + int ilo, ihi, jlo, jhi, klo, khi; + if (narg == 3) { + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { uf3_read_pot_file(i,j,arg[2]); } } + } else if (narg == 5) { + utils::bounds(FLERR, arg[1], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[2], 1, atom->ntypes, jlo, jhi, error); + utils::bounds(FLERR, arg[3], 1, atom->ntypes, klo, khi, error); + if (!utils::strmatch(arg[0],"^3b$")) + error->all(FLERR, "Pair style uf3 3-body terms require the first argument to be 3b"); - if (narg == 5){ - if (!utils::strmatch(arg[0],"3b")) - error->all(FLERR, "UF3: Invalid argument. For 3-body the first argument\n\ - argument to pair_coeff needs to be 3b.\n\ - Example pair_coeff 3b 1 2 2 A_B_B."); - if (utils::strmatch(arg[1],".*\\*.*") || utils::strmatch(arg[2],".*\\*.*") || utils::strmatch(arg[3],".*\\*.*")){ - for (int i = ilo; i <= ihi; i++) { - for (int j = jlo; j <= jhi; j++) { - for (int k = MAX(klo, jlo); k <= khi; k++) { - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[4]); - uf3_read_pot_file(i,j,k,arg[4]); - } - } - } - } - else{ - if (comm->me == 0) - utils::logmesg(lmp, "\nUF3: Opening {} file\n", arg[4]); - int i = utils::inumeric(FLERR, arg[1], true, lmp); - int j = utils::inumeric(FLERR, arg[2], true, lmp); - int k = utils::inumeric(FLERR, arg[3], true, lmp); - uf3_read_pot_file(i,j,k,arg[4]); - } - } - } - - /*else{ - if (narg != tot_pot_files + 2) - error->all(FLERR,"UF3: Invalid number of argument in pair coeff; \n\ - Number of potential files provided is not correct"); - - error->warning(FLERR, "\nUF3: WARNING!! It seems that you are using the \n\ - older style of specifying UF3 POT files. This style of listing \n\ - all the potential files on a single line will be depcrecated in \n\ - the next version of ML-UF3"); - - // open UF3 potential file on all proc - for (int i = 2; i < narg; i++) { uf3_read_pot_file(arg[i]); } - if (!bsplines_created) create_bsplines(); - - // setflag check needed here - for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = 1; j < num_of_elements + 1; j++) { - if (setflag[i][j] != 1) - error->all(FLERR,"UF3: Not all 2-body UF potentials are set, \n\ - missing potential file for {}-{} interaction",i, j); - } - } - - if (pot_3b) { - for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = 1; j < num_of_elements + 1; j++) { - for (int k = 1; k < num_of_elements + 1; k++) { - if (setflag_3b[i][j][k] != 1) - error->all(FLERR,"UF3: Not all 3-body UF potentials are set, \n\ - missing potential file for {}-{}-{} interaction", i, j, k); - } - } - } - } - for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = i; j < num_of_elements + 1; j++) { - UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knot[i][j], n2b_coeff[i][j]); - UFBS2b[j][i] = UFBS2b[i][j]; - } - if (pot_3b) { - for (int j = 1; j < num_of_elements + 1; j++) { - for (int k = j; k < num_of_elements + 1; k++) { - std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - UFBS3b[i][j][k] = - uf3_triplet_bspline(lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key]); - UFBS3b[i][k][j] = UFBS3b[i][j][k]; + for (int i = ilo; i <= ihi; i++) { + for (int j = jlo; j <= jhi; j++) { + for (int k = MAX(klo, jlo); k <= khi; k++) { + uf3_read_pot_file(i,j,k,arg[4]); } } } } - }*/ } void PairUF3::allocate() @@ -356,13 +254,13 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) trailing_trim=3\n"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type,"uk")){ + if (utils::strmatch(knot_type,"uk")) { utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with uniform\n\ knot spacing\n",potf_name); knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; } - else if (utils::strmatch(knot_type,"nk")){ + else if (utils::strmatch(knot_type,"nk")) { utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with non-uniform\n\ knot spacing\n",potf_name); knot_spacing_type_2b[itype][jtype] = 1; @@ -479,13 +377,13 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name trailing_trim=3\n"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type,"uk")){ + if (utils::strmatch(knot_type,"uk")) { utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with uniform\n\ knot spacing\n",potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 0; knot_spacing_type_3b[itype][ktype][jtype] = 0; } - else if (utils::strmatch(knot_type,"nk")){ + else if (utils::strmatch(knot_type,"nk")) { utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with non-uniform\n\ knot spacing\n",potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 1; @@ -1122,7 +1020,7 @@ void PairUF3::compute(int eflag, int vflag) rjk = sqrt( ((del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]))); - if (rjk >= min_cut_3b[itype][jtype][ktype][0]){ + if (rjk >= min_cut_3b[itype][jtype][ktype][0]) { double *triangle_eval = UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); fij[0] = *(triangle_eval + 1) * (del_rji[0] / rij); @@ -1169,7 +1067,8 @@ void PairUF3::compute(int eflag, int vflag) if (eflag) evdwl = *triangle_eval; - if (evflag) { ev_tally3(i, j, k, evdwl, 0, Fj, Fk, del_rji, del_rki); + if (evflag) { + ev_tally3(i, j, k, evdwl, 0, Fj, Fk, del_rji, del_rki); // Centroid stress 3-body term if (vflag_either && cvflag_atom) { double ric[3]; @@ -1267,12 +1166,12 @@ double PairUF3::memory_usage() bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ (num_of_elements+1)*3*sizeof(double); //min_cut_3b - for (int i=1; i < num_of_elements+1; i++){ - for (int j=i; j < num_of_elements+1; j++){ + for (int i=1; i < num_of_elements+1; i++) { + for (int j=i; j < num_of_elements+1; j++) { bytes += (double)2*n2b_knot[i][j].size()*sizeof(double); //n2b_knot bytes += (double)2*n2b_coeff[i][j].size()*sizeof(double); //n2b_coeff } - if (pot_3b){ + if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { bytes += (double)2*n3b_knot_matrix[i][j][k][0].size()*sizeof(double); @@ -1281,8 +1180,8 @@ double PairUF3::memory_usage() std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - for (int l=0; l < n3b_coeff_matrix[key].size(); l++){ - for (int m=0; m < n3b_coeff_matrix[key][l].size(); m++){ + for (int l=0; l < n3b_coeff_matrix[key].size(); l++) { + for (int m=0; m < n3b_coeff_matrix[key][l].size(); m++) { bytes += (double)2*n3b_coeff_matrix[key][l][m].size()*sizeof(double); //key = ijk //key = ikj @@ -1294,7 +1193,7 @@ double PairUF3::memory_usage() } for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = i; j < num_of_elements + 1; j++){ + for (int j = i; j < num_of_elements + 1; j++) { bytes += (double)2*UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] } if (pot_3b) { From eb89c7a39254cc17b6e55c5e0001d4e79f9c60c9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 17:01:37 -0400 Subject: [PATCH 22/65] examples folder was moved --- doc/src/Packages_list.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Packages_list.rst b/doc/src/Packages_list.rst index e86e43e9ce..2fd4086452 100644 --- a/doc/src/Packages_list.rst +++ b/doc/src/Packages_list.rst @@ -321,7 +321,7 @@ whether an extra library is needed to build and use the package: * - :ref:`ML-UF3 ` - quantum-fitted ultra fast potentials - :doc:`pair_style uf3 ` - - uf3 + - PACKAGES/uf3 - no * - :ref:`MOFFF ` - styles for `MOF-FF `_ force field From 392c3b6d65ba0ae97f9e5787bdbff282098bd164 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 17:02:07 -0400 Subject: [PATCH 23/65] manybody and single flag need to be changed from the default when 2-body/3-body is selected --- src/ML-UF3/pair_uf3.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 4fa87ba335..9403bc3648 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -85,10 +85,12 @@ void PairUF3::settings(int narg, char **arg) num_of_elements = atom->ntypes; if (nbody_flag == 2) { pot_3b = false; + manybody_flag = 0; n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; tot_pot_files = n2body_pot_files; } else if (nbody_flag == 3) { pot_3b = true; + single_enable = 0; n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; n3body_pot_files = num_of_elements * (num_of_elements * (num_of_elements + 1) / 2); tot_pot_files = n2body_pot_files + n3body_pot_files; From a6e5c8b981236b933b2717d9447d41e32d2f2696 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 17:31:34 -0400 Subject: [PATCH 24/65] update more files and docs for .uf3 potential file extension also remove redundant files --- doc/src/pair_uf3.rst | 54 ++++---- potentials/{A_A.uf3_pot => A_A.uf3} | 0 potentials/{A_A_A.uf3_pot => A_A_A.uf3} | 0 potentials/README | 1 + unittest/force-styles/tests/A_A.uf3_pot | 7 - unittest/force-styles/tests/A_A_A.uf3_pot | 129 ------------------ .../force-styles/tests/manybody-pair-uf3.yaml | 8 +- 7 files changed, 32 insertions(+), 167 deletions(-) rename potentials/{A_A.uf3_pot => A_A.uf3} (100%) rename potentials/{A_A_A.uf3_pot => A_A_A.uf3} (100%) delete mode 100644 unittest/force-styles/tests/A_A.uf3_pot delete mode 100644 unittest/force-styles/tests/A_A_A.uf3_pot diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index 38122bc982..49ca018b85 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -25,25 +25,25 @@ Examples .. code-block:: LAMMPS - pair_style uf3 3 1 - pair_coeff 1 1 Nb_Nb - pair_coeff 3b 1 1 1 Nb_Nb_Nb + pair_style uf3 3 + pair_coeff 1 1 Nb_Nb.uf3 + pair_coeff 3b 1 1 1 Nb_Nb_Nb.uf3 - pair_style uf3 2 2 - pair_coeff 1 1 Nb_Nb - pair_coeff 1 2 Nb_Sn - pair_coeff 2 2 Sn_Sn + pair_style uf3 2 + pair_coeff 1 1 Nb_Nb.uf3 + pair_coeff 1 2 Nb_Sn.uf3 + pair_coeff 2 2 Sn_Sn.uf3 - pair_style uf3 3 2 - pair_coeff 1 1 Nb_Nb - pair_coeff 1 2 Nb_Sn - pair_coeff 2 2 Sn_Sn - pair_style 3b 1 1 1 Nb_Nb_Nb - pair_style 3b 1 1 2 Nb_Nb_Sn - pair_style 3b 1 2 2 Nb_Sn_Sn - pair_style 3b 2 1 1 Sn_Nb_Nb - pair_style 3b 2 1 2 Sn_Nb_Sn - pair_style 3b 2 2 2 Sn_Sn_Sn + pair_style uf3 3 + pair_coeff 1 1 Nb_Nb.uf3 + pair_coeff 1 2 Nb_Sn.uf3 + pair_coeff 2 2 Sn_Sn.uf3 + pair_style 3b 1 1 1 Nb_Nb_Nb.uf3 + pair_style 3b 1 1 2 Nb_Nb_Sn.uf3 + pair_style 3b 1 2 2 Nb_Sn_Sn.uf3 + pair_style 3b 2 1 1 Sn_Nb_Nb.uf3 + pair_style 3b 2 1 2 Sn_Nb_Sn.uf3 + pair_style 3b 2 2 2 Sn_Sn_Sn.uf3 Description """"""""""" @@ -87,16 +87,16 @@ As an example, if a LAMMPS simulation contains 2 atom types (elements .. code-block:: LAMMPS - pair_style uf3 3 2 - pair_coeff 1 1 A_A - pair_coeff 1 2 A_B - pair_coeff 2 2 B_B - pair_coeff 3b 1 1 1 A_A_A - pair_coeff 3b 1 1 2 A_A_B - pair_coeff 3b 1 2 2 A_B_B - pair_coeff 3b 2 1 1 B_A_A - pair_coeff 3b 2 1 2 B_A_B - pair_coeff 3b 2 2 2 B_B_B + pair_style uf3 3 + pair_coeff 1 1 A_A.uf3 + pair_coeff 1 2 A_B.uf3 + pair_coeff 2 2 B_B.uf3 + pair_coeff 3b 1 1 1 A_A_A.uf3 + pair_coeff 3b 1 1 2 A_A_B.uf3 + pair_coeff 3b 1 2 2 A_B_B.uf3 + pair_coeff 3b 2 1 1 B_A_A.uf3 + pair_coeff 3b 2 1 2 B_A_B.uf3 + pair_coeff 3b 2 2 2 B_B_B.uf3 If a value of "2" is specified in the :code:`pair_style uf3` command, only the two-body potential files are needed. For 3-body interaction the diff --git a/potentials/A_A.uf3_pot b/potentials/A_A.uf3 similarity index 100% rename from potentials/A_A.uf3_pot rename to potentials/A_A.uf3 diff --git a/potentials/A_A_A.uf3_pot b/potentials/A_A_A.uf3 similarity index 100% rename from potentials/A_A_A.uf3_pot rename to potentials/A_A_A.uf3 diff --git a/potentials/README b/potentials/README index 2cb4a383c5..2d6d4c172a 100644 --- a/potentials/README +++ b/potentials/README @@ -118,4 +118,5 @@ sw Stillinger-Weber potential tersoff Tersoff potential tersoff.mod modified Tersoff potential tersoff.zbl Tersoff with ZBL core +uf3 UF3 potential vashishta Vashishta 2-body and 3-body potential diff --git a/unittest/force-styles/tests/A_A.uf3_pot b/unittest/force-styles/tests/A_A.uf3_pot deleted file mode 100644 index a50b48bae9..0000000000 --- a/unittest/force-styles/tests/A_A.uf3_pot +++ /dev/null @@ -1,7 +0,0 @@ -#UF3 POT -2B 0 3 nk -8.0 31 -0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8 -27 -79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0 -# diff --git a/unittest/force-styles/tests/A_A_A.uf3_pot b/unittest/force-styles/tests/A_A_A.uf3_pot deleted file mode 100644 index 18f79c3b8a..0000000000 --- a/unittest/force-styles/tests/A_A_A.uf3_pot +++ /dev/null @@ -1,129 +0,0 @@ -#UF3 POT -3B 0 3 nk -8.0 4.0 4.0 23 15 15 -0.001 0.001 0.001 0.001 0.50093749999999992 1.000875 1.5008124999999999 2.00075 2.5006874999999997 3.0006249999999999 3.5005624999999996 4.0004999999999997 4.5004375000000003 5.000375 5.5003124999999997 6.0002500000000003 6.5001875 7.0001249999999997 7.5000625000000003 8 8 8 8 -0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 -0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 -11 11 19 --1.1790416072105636e-06 6.589114265858035e-08 2.1094970065385374e-06 4.7014910818419987e-07 8.288423734406254e-06 0.000186151370764668 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -9.36844864368356e-06 1.9223644807676324e-05 1.9979026246524356e-05 3.627062812549574e-05 9.775578281629195e-06 -5.894357549683858e-06 6.470814473155067e-07 2.31805322174729e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.00013804169495254125 0.0012238504051117233 0.01461439973735456 0.010197731078827295 0.009003775355755566 0.030381456320656558 0.024785731678029766 0.004637019267552505 -0.005938106654005813 -0.002605150959220643 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 --2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 --7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.003917873880791907 -0.0007874629498581528 -2.4595030318112164e-05 -2.8508297646329816e-06 1.8504666071760445e-07 0.0001190800388356091 0.0035373487148805376 0.00037674157183609377 0.0012087894330956167 0.0009651695201594091 4.769364472898923e-05 0.0004612591073953361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 -5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 -4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 -0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 -0.0016181071043329578 0.003179470547568356 0.008661622548635572 0.011071785334468471 0.004294892778359652 0.0017845979744737465 0.0034643761195723064 0.015112039067322293 0.022192108732694595 0.008134230944897397 0.0007595380961610584 1.6727218309602107e-05 0.00012823915020345735 0.0001971442066043176 0.0 0.0 0.0 0.0 0.0 -0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 -0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 -6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 -5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 -0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 -0.00018639122271027446 0.0034767153815636618 0.018231622622978436 0.0042988446466234575 0.05300133577632108 0.7250033316881788 0.4935009383219143 0.42606157195551264 1.5039118559972142 1.2303936880370434 0.22548363428435172 -0.30298333788301807 -0.13073656424500055 -0.010403074319359695 0.005059645288601829 0.0015181780063355998 0.0 0.0 0.0 -0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 --0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 --2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 -4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 -0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 -0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 --0.011510449622067839 -0.0007610595804959427 1.0172131902385016e-05 0.00448473230635448 0.2199020425072735 0.07466247888373397 0.21339517449435372 0.013531084627798973 0.04473458040783101 0.2378714243611067 0.10478901497777 0.37112701147924365 0.27817806337533985 -0.2385293501359752 -0.33578482057600856 -0.004009555340792723 0.0 0.0 0.0 -4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 --7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 -0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 -6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 --0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 -4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 --0.0008465335016788498 -9.208409992139663e-05 -1.1210629044433908e-05 0.004300763141885697 0.1800503541691201 0.016819879476467067 0.060737350690215776 0.042330087306607714 0.0007006095666399378 0.02251352126872946 0.011185142175963118 -0.02716513333374441 0.00952941322650142 0.02210443704516212 0.07011148238258197 0.057840211345517194 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -# diff --git a/unittest/force-styles/tests/manybody-pair-uf3.yaml b/unittest/force-styles/tests/manybody-pair-uf3.yaml index 8ba4a24e44..cd7fbb9196 100644 --- a/unittest/force-styles/tests/manybody-pair-uf3.yaml +++ b/unittest/force-styles/tests/manybody-pair-uf3.yaml @@ -1,6 +1,6 @@ --- lammps_version: 24 Mar 2022 -tags: generated +tags: date_generated: Tue Nov 28 14:51:03 2023 epsilon: 1e-09 skip_tests: @@ -12,10 +12,10 @@ pre_commands: ! | variable newton_bond delete post_commands: ! "" input_file: in.manybody -pair_style: uf3 3 8 +pair_style: uf3 3 pair_coeff: ! | - * * A_A.uf3_pot - 3b * * * A_A_A.uf3_pot + * * A_A.uf3 + 3b * * * A_A_A.uf3 extract: ! "" natoms: 64 init_vdwl: -76.14388662099438 From ecb5704f250f6b19779f8f28398701ef68c7fa51 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 17:32:26 -0400 Subject: [PATCH 25/65] some formatting and logic cleanup. --- src/ML-UF3/pair_uf3.cpp | 153 +++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 82 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 9403bc3648..240174e2c4 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -208,14 +208,11 @@ void PairUF3::allocate() void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) { - utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {}\n", \ - potf_name, itype, jtype); + if (comm->me == 0) + utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {}\n", potf_name, itype, jtype); - if (!platform::file_is_readable(potf_name)) - error->all(FLERR, "UF3: {} file is not readable", potf_name); - - FILE *fp; - fp = utils::open_potential(potf_name, lmp, nullptr); + FILE *fp = utils::open_potential(potf_name, lmp, nullptr); + if (!fp) error->one(FLERR,"Cannot open UF3 potential file {}", potf_name); TextFileReader txtfilereader(fp, "UF3:POTFP"); txtfilereader.ignore_comments = false; @@ -224,62 +221,60 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) Tokenizer file_header(temp_line); if (file_header.count() != 2) - error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found \n\ - {} word/s",potf_name,file_header.count()); + error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found " + "{} word/s",potf_name,file_header.count()); if (file_header.contains("#UF3 POT") == 0) - error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n\ - files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); + error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" + "files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); temp_line = txtfilereader.next_line(1); ValueTokenizer fp2nd_line(temp_line); if (fp2nd_line.count() != 4) - error->all(FLERR, "UF3: Expected 4 words on 2nd line =>\n\ - nBody leading_trim trailing_trim type_of_knot_spacing\n\ - Found {}",temp_line); + error->all(FLERR, "UF3: Expected 4 words on 2nd line =>\n" + " nBody leading_trim trailing_trim type_of_knot_spacing\n" + " Found {}",temp_line); std::string nbody_on_file = fp2nd_line.next_string(); if (utils::strmatch(nbody_on_file,"2B")) utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n",potf_name); else - error->all(FLERR, "UF3: Expected a 2B UF3 file but found {}", - nbody_on_file); + error->all(FLERR, "UF3: Expected a 2B UF3 file but found {}", nbody_on_file); int leading_trim = fp2nd_line.next_int(); int trailing_trim = fp2nd_line.next_int(); if (leading_trim != 0) - error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ - leading_trim=0\n"); + error->all(FLERR, "UF3: Current implementation is throughly tested only for " + "leading_trim=0"); if (trailing_trim != 3) - error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ - trailing_trim=3\n"); + error->all(FLERR, "UF3: Current implementation is throughly tested only for " + "trailing_trim=3"); std::string knot_type = fp2nd_line.next_string(); if (utils::strmatch(knot_type,"uk")) { - utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with uniform\n\ - knot spacing\n",potf_name); + utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with uniform " + "knot spacing",potf_name); knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; } else if (utils::strmatch(knot_type,"nk")) { - utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with non-uniform\n\ - knot spacing\n",potf_name); + utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with non-uniform " + "knot spacing",potf_name); knot_spacing_type_2b[itype][jtype] = 1; knot_spacing_type_2b[jtype][itype] = 1; - /*error->all(FLERR, "UF3: Current implementation only works with uniform\n\ - knot spacing");*/ + /*error->all(FLERR, "UF3: Current implementation only works with uniform " + " knot spacing");*/ } else - error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots)\n\ - Found {} on the 2nd line of {} pot file",knot_type,potf_name); + error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " + "Found {} on the 2nd line of {} pot file",knot_type,potf_name); temp_line = txtfilereader.next_line(1); ValueTokenizer fp3rd_line(temp_line); if (fp3rd_line.count() != 2) - error->all(FLERR, "UF3: Expected only 2 numbers on 3rd line =>\n\ - Rij_CUTOFF NUM_OF_KNOTS\n\ - Found {} number/s",fp3rd_line.count()); + error->all(FLERR, "UF3: Expected only 2 numbers on 3rd line => " + "Rij_CUTOFF NUM_OF_KNOTS. Found {} number/s",fp3rd_line.count()); //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared cut[itype][jtype] = fp3rd_line.next_double(); @@ -291,7 +286,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) ValueTokenizer fp4th_line(temp_line); if (fp4th_line.count() != num_knots_2b) - error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", + error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_2b,fp4th_line.count()); n2b_knot[itype][jtype].resize(num_knots_2b); @@ -333,11 +328,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {} {}\n", potf_name, itype, jtype, ktype); - if (!platform::file_is_readable(potf_name)) - error->all(FLERR, "UF3: {} file is not readable", potf_name); - - FILE *fp; - fp = utils::open_potential(potf_name, lmp, nullptr); + FILE *fp = utils::open_potential(potf_name, lmp, nullptr); + if (!fp) error->one(FLERR,"Cannot open UF3 potential file {}", potf_name); TextFileReader txtfilereader(fp, "UF3:POTFP"); txtfilereader.ignore_comments = false; @@ -346,20 +338,20 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name Tokenizer file_header(temp_line); if (file_header.count() != 2) - error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found \n\ - {} word/s",potf_name,file_header.count()); + error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found " + "{} word/s",potf_name,file_header.count()); if (file_header.contains("#UF3 POT") == 0) - error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n\ - files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); + error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT " + "files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); temp_line = txtfilereader.next_line(1); ValueTokenizer fp2nd_line(temp_line); if (fp2nd_line.count() != 4) - error->all(FLERR, "UF3: Expected 3 words on 2nd line =>\n\ - nBody leading_trim trailing_trim type_of_knot_spacing\n\ - Found {}",temp_line); + error->all(FLERR, "UF3: Expected 3 words on 2nd line => " + "nBody leading_trim trailing_trim type_of_knot_spacing " + "Found {}",temp_line); std::string nbody_on_file = fp2nd_line.next_string(); @@ -372,38 +364,36 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name int leading_trim = fp2nd_line.next_int(); int trailing_trim = fp2nd_line.next_int(); if (leading_trim != 0) - error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ - leading_trim=0\n"); + error->all(FLERR, "UF3: Current implementation is throughly tested only for " + "leading_trim=0\n"); if (trailing_trim != 3) - error->all(FLERR, "UF3: Current implementation is throughly tested only for\n\ - trailing_trim=3\n"); + error->all(FLERR, "UF3: Current implementation is throughly tested only for " + "trailing_trim=3\n"); std::string knot_type = fp2nd_line.next_string(); if (utils::strmatch(knot_type,"uk")) { - utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with uniform\n\ - knot spacing\n",potf_name); + utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with uniform " + "knot spacing\n",potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 0; knot_spacing_type_3b[itype][ktype][jtype] = 0; } else if (utils::strmatch(knot_type,"nk")) { - utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with non-uniform\n\ - knot spacing\n",potf_name); + utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with non-uniform " + "knot spacing\n",potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 1; knot_spacing_type_3b[itype][ktype][jtype] = 1; - /*error->all(FLERR, "UF3: Current implementation only works with uniform\n\ - knot spacing");*/ } else - error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots)\n\ - Found {} on the 2nd line of {} pot file",knot_type,potf_name); + error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " + "Found {} on the 2nd line of {} pot file",knot_type,potf_name); temp_line = txtfilereader.next_line(6); ValueTokenizer fp3rd_line(temp_line); if (fp3rd_line.count() != 6) - error->all(FLERR, "UF3: Expected only 6 numbers on 3rd line =>\n\ - Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ\n\ - Found {} number/s",fp3rd_line.count()); + error->all(FLERR, "UF3: Expected only 6 numbers on 3rd line => " + "Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ " + "Found {} number/s",fp3rd_line.count()); double cut3b_rjk = fp3rd_line.next_double(); double cut3b_rij = fp3rd_line.next_double(); @@ -414,8 +404,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name } if (2 * cut3b_rik != cut3b_rjk) { - error->all(FLERR, "UF3: 2rij=2rik!=rik, Current implementation only works \n\ - for 2rij=2rik!=rik"); + error->all(FLERR, "UF3: 2rij=2rik!=rik, Current implementation only works " + "for 2rij=2rik!=rik"); } cut_3b_list[itype][jtype] = std::max(cut3b_rij, cut_3b_list[itype][jtype]); @@ -507,25 +497,25 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name ValueTokenizer fp7th_line(temp_line); if (fp7th_line.count() != 3) - error->all(FLERR, "UF3: Expected 3 numbers on 7th line =>\n\ - SHAPE_OF_COEFF_MATRIX[I][J][K] \n\ - found {} numbers", fp7th_line.count()); + error->all(FLERR, "UF3: Expected 3 numbers on 7th line => " + "SHAPE_OF_COEFF_MATRIX[I][J][K] " + "found {} numbers", fp7th_line.count()); coeff_matrix_dim1 = fp7th_line.next_int(); coeff_matrix_dim2 = fp7th_line.next_int(); coeff_matrix_dim3 = fp7th_line.next_int(); if (n3b_knot_matrix[itype][jtype][ktype][0].size() != coeff_matrix_dim3 + 3 + 1) - error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and \n\ - coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", potf_name); + error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and " + "coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", potf_name); if (n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) - error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and \n\ - coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1",potf_name); + error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and " + "coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1",potf_name); if (n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) - error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and \n\ - coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1",potf_name); + error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and " + "coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1",potf_name); coeff_matrix_elements_len = coeff_matrix_dim3; @@ -541,8 +531,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); if (coeff_line.count() != coeff_matrix_elements_len) - error->all(FLERR, "UF3: Expected {} numbers on {}th line but found \n\ - {} numbers",coeff_matrix_elements_len, line_count+8, coeff_line.count()); + error->all(FLERR, "UF3: Expected {} numbers on {}th line but found " + "{} numbers",coeff_matrix_elements_len, line_count+8, coeff_line.count()); for (int k = 0; k < coeff_matrix_dim3; k++) { n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); } @@ -576,9 +566,8 @@ void PairUF3::uf3_read_pot_file(char *potf_name) { if (comm->me == 0) utils::logmesg(lmp, "\nUF3: Opening {} file\n", potf_name); - FILE *fp; - fp = utils::open_potential(potf_name, lmp, nullptr); - // if (fp) error->all(FLERR,"UF3: {} file not found",potf_name); + FILE *fp = utils::open_potential(potf_name, lmp, nullptr); + if (!fp) error->all(FLERR,"Cannot open UF3 potential file {}",potf_name); TextFileReader txtfilereader(fp, "UF3:POTFP"); txtfilereader.ignore_comments = false; @@ -823,8 +812,8 @@ void PairUF3::create_bsplines() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { if (setflag[i][j] != 1) - error->all(FLERR,"UF3: Not all 2-body UF potentials are set, \n\ - missing potential file for {}-{} interaction",i, j); + error->all(FLERR,"UF3: Not all 2-body UF potentials are set, " + "missing potential file for {}-{} interaction",i, j); } } if (pot_3b) { @@ -832,8 +821,8 @@ void PairUF3::create_bsplines() for (int j = 1; j < num_of_elements + 1; j++) { for (int k = 1; k < num_of_elements + 1; k++) { if (setflag_3b[i][j][k] != 1) - error->all(FLERR,"UF3: Not all 3-body UF potentials are set, \n\ - missing potential file for {}-{}-{} interaction", i, j, k); + error->all(FLERR,"UF3: Not all 3-body UF potentials are set, " + "missing potential file for {}-{}-{} interaction", i, j, k); } } } @@ -1155,17 +1144,17 @@ double PairUF3::memory_usage() bytes += (double)5*sizeof(double); //bsplines_created, coeff_matrix_dim1, //coeff_matrix_dim2, coeff_matrix_dim3, //coeff_matrix_elements_len - bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ + bytes += (double)(num_of_elements+1)*(num_of_elements+1)* (num_of_elements+1)*sizeof(double); //***setflag_3b bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut - bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ + bytes += (double)(num_of_elements+1)*(num_of_elements+1)* (num_of_elements+1)*sizeof(double); //***cut_3b bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut_3b_list - bytes += (double)(num_of_elements+1)*(num_of_elements+1)*\ + bytes += (double)(num_of_elements+1)*(num_of_elements+1)* (num_of_elements+1)*3*sizeof(double); //min_cut_3b for (int i=1; i < num_of_elements+1; i++) { From 34f88843fa34040ca01243befeec251434fa6076 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 21:50:30 -0400 Subject: [PATCH 26/65] update example logs --- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 | 23 ++++++++--------- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 | 23 ++++++++--------- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 | 25 ++++++++----------- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 | 25 ++++++++----------- 4 files changed, 44 insertions(+), 52 deletions(-) diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 index 4dee5c5942..b1d413be3e 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -43,9 +43,7 @@ pair_style uf3 2 pair_coeff 1 1 W_W.uf3 UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform - knot spacing - +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing # # ============= Setup output @@ -64,6 +62,7 @@ velocity all create 300.0 2367804 loop geom fix 1 all nve run ${nsteps} run 100 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 @@ -89,20 +88,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.113 | 3.113 | 3.113 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0345905 on 1 procs for 100 steps with 128 atoms +Loop time of 0.0344829 on 1 procs for 100 steps with 128 atoms -Performance: 124.890 ns/day, 0.192 hours/ns, 2890.965 timesteps/s, 370.044 katom-step/s -99.2% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 125.280 ns/day, 0.192 hours/ns, 2899.990 timesteps/s, 371.199 katom-step/s +99.3% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.03333 | 0.03333 | 0.03333 | 0.0 | 96.36 +Pair | 0.033254 | 0.033254 | 0.033254 | 0.0 | 96.44 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00068797 | 0.00068797 | 0.00068797 | 0.0 | 1.99 -Output | 0.00015217 | 0.00015217 | 0.00015217 | 0.0 | 0.44 -Modify | 0.00019786 | 0.00019786 | 0.00019786 | 0.0 | 0.57 -Other | | 0.0002224 | | | 0.64 +Comm | 0.00069442 | 0.00069442 | 0.00069442 | 0.0 | 2.01 +Output | 0.0001137 | 0.0001137 | 0.0001137 | 0.0 | 0.33 +Modify | 0.0002176 | 0.0002176 | 0.0002176 | 0.0 | 0.63 +Other | | 0.0002033 | | | 0.59 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 index 10936a977c..fa1455369b 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -43,9 +43,7 @@ pair_style uf3 2 pair_coeff 1 1 W_W.uf3 UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform - knot spacing - +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing # # ============= Setup output @@ -64,6 +62,7 @@ velocity all create 300.0 2367804 loop geom fix 1 all nve run ${nsteps} run 100 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 @@ -89,20 +88,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.104 | 3.104 | 3.104 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0104225 on 4 procs for 100 steps with 128 atoms +Loop time of 0.00969615 on 4 procs for 100 steps with 128 atoms -Performance: 414.488 ns/day, 0.058 hours/ns, 9594.626 timesteps/s, 1.228 Matom-step/s -99.4% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 445.538 ns/day, 0.054 hours/ns, 10313.372 timesteps/s, 1.320 Matom-step/s +99.7% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.0076422 | 0.0077975 | 0.0081692 | 0.2 | 74.81 +Pair | 0.0075573 | 0.0076696 | 0.007725 | 0.1 | 79.10 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.001954 | 0.0022765 | 0.0024447 | 0.4 | 21.84 -Output | 7.7086e-05 | 8.2565e-05 | 9.3188e-05 | 0.0 | 0.79 -Modify | 4.8524e-05 | 5.011e-05 | 5.1759e-05 | 0.0 | 0.48 -Other | | 0.0002159 | | | 2.07 +Comm | 0.0017105 | 0.0017634 | 0.0018792 | 0.2 | 18.19 +Output | 6.7305e-05 | 7.2505e-05 | 8.2576e-05 | 0.0 | 0.75 +Modify | 4.551e-05 | 4.8142e-05 | 5.4109e-05 | 0.0 | 0.50 +Other | | 0.0001425 | | | 1.47 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 index 3e95eb6055..f8c3dd8af6 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -43,13 +43,10 @@ pair_style uf3 3 pair_coeff 1 1 W_W.uf3 UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform - knot spacing -pair_coeff 3b 1 1 1 W_W_W.uf3 +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacingpair_coeff 3b 1 1 1 W_W_W.uf3 UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 UF3: File W_W_W.uf3 contains 3-body UF3 potential -UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform - knot spacing +UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform knot spacing UF3: 3b min cutoff W_W_W.uf3 1-1-1_jk=1.5 1-1-1_jk=1.5 UF3: 3b min cutoff W_W_W.uf3 1-1-1_ik=1.5 1-1-1_ik=1.5 UF3: 3b min cutoff W_W_W.uf3 1-1-1_ij=1.5 1-1-1_ij=1.5 @@ -97,20 +94,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.214 | 3.214 | 3.214 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.478107 on 1 procs for 100 steps with 128 atoms +Loop time of 0.477708 on 1 procs for 100 steps with 128 atoms -Performance: 9.036 ns/day, 2.656 hours/ns, 209.158 timesteps/s, 26.772 katom-step/s -99.6% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 9.043 ns/day, 2.654 hours/ns, 209.333 timesteps/s, 26.795 katom-step/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.47649 | 0.47649 | 0.47649 | 0.0 | 99.66 +Pair | 0.47636 | 0.47636 | 0.47636 | 0.0 | 99.72 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00082433 | 0.00082433 | 0.00082433 | 0.0 | 0.17 -Output | 0.00020504 | 0.00020504 | 0.00020504 | 0.0 | 0.04 -Modify | 0.00022769 | 0.00022769 | 0.00022769 | 0.0 | 0.05 -Other | | 0.0003635 | | | 0.08 +Comm | 0.0007585 | 0.0007585 | 0.0007585 | 0.0 | 0.16 +Output | 0.00016112 | 0.00016112 | 0.00016112 | 0.0 | 0.03 +Modify | 0.00019415 | 0.00019415 | 0.00019415 | 0.0 | 0.04 +Other | | 0.0002393 | | | 0.05 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 index 330a69ea40..6dc5283901 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-326-g338b9b5d61) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -43,13 +43,10 @@ pair_style uf3 3 pair_coeff 1 1 W_W.uf3 UF3: W_W.uf3 file should contain UF3 potential for 1 1 UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform - knot spacing -pair_coeff 3b 1 1 1 W_W_W.uf3 +UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacingpair_coeff 3b 1 1 1 W_W_W.uf3 UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 UF3: File W_W_W.uf3 contains 3-body UF3 potential -UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform - knot spacing +UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform knot spacing UF3: 3b min cutoff W_W_W.uf3 1-1-1_jk=1.5 1-1-1_jk=1.5 UF3: 3b min cutoff W_W_W.uf3 1-1-1_ik=1.5 1-1-1_ik=1.5 UF3: 3b min cutoff W_W_W.uf3 1-1-1_ij=1.5 1-1-1_ij=1.5 @@ -97,20 +94,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.205 | 3.205 | 3.205 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.135192 on 4 procs for 100 steps with 128 atoms +Loop time of 0.130504 on 4 procs for 100 steps with 128 atoms -Performance: 31.955 ns/day, 0.751 hours/ns, 739.688 timesteps/s, 94.680 katom-step/s -99.5% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 33.102 ns/day, 0.725 hours/ns, 766.258 timesteps/s, 98.081 katom-step/s +99.1% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.11876 | 0.12259 | 0.13092 | 1.4 | 90.68 +Pair | 0.1177 | 0.12008 | 0.12246 | 0.7 | 92.01 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0035898 | 0.011903 | 0.015736 | 4.5 | 8.80 -Output | 0.00016067 | 0.00018114 | 0.00023041 | 0.0 | 0.13 -Modify | 9.9574e-05 | 0.00011041 | 0.00012152 | 0.0 | 0.08 -Other | | 0.0004092 | | | 0.30 +Comm | 0.0074641 | 0.0098397 | 0.012226 | 2.4 | 7.54 +Output | 0.00012713 | 0.00013807 | 0.0001675 | 0.0 | 0.11 +Modify | 8.7486e-05 | 9.3752e-05 | 0.00010061 | 0.0 | 0.07 +Other | | 0.0003502 | | | 0.27 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 From 7c3ac315077f6bc6ae2733dc5893ab388e28f3ac Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 21:50:40 -0400 Subject: [PATCH 27/65] remove dead code --- src/KOKKOS/pair_uf3_kokkos.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 38a820a08f..7c524b8d61 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -948,8 +948,6 @@ PairUF3Kokkos::operator()(TagPairUF3ComputeFullA, F_FLOAT fpair = 0; const int i = d_ilist[ii]; - - const tagint itag = tag[i]; const int itype = type[i]; const X_FLOAT xtmp = x(i, 0); const X_FLOAT ytmp = x(i, 1); @@ -966,8 +964,6 @@ PairUF3Kokkos::operator()(TagPairUF3ComputeFullA, for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors_short(i, jj); j &= NEIGHMASK; - const tagint jtag = tag[j]; - const int jtype = type[j]; const X_FLOAT delx = xtmp - x(j, 0); From 379e212135c04e17ebb8a754cf2cbf4b59797c02 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 22:05:27 -0400 Subject: [PATCH 28/65] add system error message with failure to open potential --- src/ML-UF3/pair_uf3.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 240174e2c4..6bf2452d26 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -212,7 +212,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {}\n", potf_name, itype, jtype); FILE *fp = utils::open_potential(potf_name, lmp, nullptr); - if (!fp) error->one(FLERR,"Cannot open UF3 potential file {}", potf_name); + if (!fp) + error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); TextFileReader txtfilereader(fp, "UF3:POTFP"); txtfilereader.ignore_comments = false; @@ -329,7 +330,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name potf_name, itype, jtype, ktype); FILE *fp = utils::open_potential(potf_name, lmp, nullptr); - if (!fp) error->one(FLERR,"Cannot open UF3 potential file {}", potf_name); + if (!fp) + error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); TextFileReader txtfilereader(fp, "UF3:POTFP"); txtfilereader.ignore_comments = false; @@ -559,7 +561,6 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name setflag_3b[itype][jtype][ktype] = 1; setflag_3b[itype][ktype][jtype] = 1; - } void PairUF3::uf3_read_pot_file(char *potf_name) @@ -567,7 +568,8 @@ void PairUF3::uf3_read_pot_file(char *potf_name) if (comm->me == 0) utils::logmesg(lmp, "\nUF3: Opening {} file\n", potf_name); FILE *fp = utils::open_potential(potf_name, lmp, nullptr); - if (!fp) error->all(FLERR,"Cannot open UF3 potential file {}",potf_name); + if (!fp) + error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); TextFileReader txtfilereader(fp, "UF3:POTFP"); txtfilereader.ignore_comments = false; From 3aae2d0c4b8597d024f83718b114014efa31438b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 22:08:36 -0400 Subject: [PATCH 29/65] apply clang-format --- src/ML-UF3/pair_uf3.cpp | 399 ++++++++++++++++++++++------------------ 1 file changed, 220 insertions(+), 179 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 6bf2452d26..cbde78a43f 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -79,7 +79,8 @@ void PairUF3::settings(int narg, char **arg) { if (narg != 1) - error->all(FLERR, "Invalid number of arguments for pair_style uf3" + error->all(FLERR, + "Invalid number of arguments for pair_style uf3" " Are you using a 2-body or 2 & 3-body UF potential?"); nbody_flag = utils::numeric(FLERR, arg[0], true, lmp); num_of_elements = atom->ntypes; @@ -105,30 +106,25 @@ void PairUF3::coeff(int narg, char **arg) { if (!allocated) allocate(); - if (narg != 3 && narg != 5) - error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); + if (narg != 3 && narg != 5) error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); int ilo, ihi, jlo, jhi, klo, khi; if (narg == 3) { utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo, i); j <= jhi; j++) { - uf3_read_pot_file(i,j,arg[2]); - } + for (int j = MAX(jlo, i); j <= jhi; j++) uf3_read_pot_file(i, j, arg[2]); } } else if (narg == 5) { utils::bounds(FLERR, arg[1], 1, atom->ntypes, ilo, ihi, error); utils::bounds(FLERR, arg[2], 1, atom->ntypes, jlo, jhi, error); utils::bounds(FLERR, arg[3], 1, atom->ntypes, klo, khi, error); - if (!utils::strmatch(arg[0],"^3b$")) + if (!utils::strmatch(arg[0], "^3b$")) error->all(FLERR, "Pair style uf3 3-body terms require the first argument to be 3b"); for (int i = ilo; i <= ihi; i++) { for (int j = jlo; j <= jhi; j++) { - for (int k = MAX(klo, jlo); k <= khi; k++) { - uf3_read_pot_file(i,j,k,arg[4]); - } + for (int k = MAX(klo, jlo); k <= khi; k++) uf3_read_pot_file(i, j, k, arg[4]); } } } @@ -150,7 +146,8 @@ void PairUF3::allocate() memory->create(cut, num_of_elements + 1, num_of_elements + 1, "pair:cut"); //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) //1 = non-uniform knot spacing - memory->create(knot_spacing_type_2b, num_of_elements + 1, num_of_elements + 1, "pair:knot_spacing_2b"); + memory->create(knot_spacing_type_2b, num_of_elements + 1, num_of_elements + 1, + "pair:knot_spacing_2b"); // Contains knot_vect of 2-body potential for type i and j n2b_knot.resize(num_of_elements + 1); @@ -173,12 +170,11 @@ void PairUF3::allocate() memory->create(cut_3b_list, num_of_elements + 1, num_of_elements + 1, "pair:cut_3b_list"); // Contains info about minimum 3-body cutoff distance for type i, j and k memory->create(min_cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, 3, - "pair:min_cut_3b"); - //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) - //1 = non-uniform knot spacing - memory->create(knot_spacing_type_3b, num_of_elements + 1, num_of_elements + 1, - num_of_elements + 1, "pair:knot_spacing_3b"); - + "pair:min_cut_3b"); + //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) + //1 = non-uniform knot spacing + memory->create(knot_spacing_type_3b, num_of_elements + 1, num_of_elements + 1, + num_of_elements + 1, "pair:knot_spacing_3b"); // setting cut_3b and setflag = 0 for (int i = 1; i < num_of_elements + 1; i++) { @@ -209,7 +205,8 @@ void PairUF3::allocate() void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) { if (comm->me == 0) - utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {}\n", potf_name, itype, jtype); + utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {}\n", potf_name, itype, + jtype); FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) @@ -222,60 +219,74 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) Tokenizer file_header(temp_line); if (file_header.count() != 2) - error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found " - "{} word/s",potf_name,file_header.count()); + error->all(FLERR, + "UF3: Expected only two words on 1st line of {} but found " + "{} word/s", + potf_name, file_header.count()); if (file_header.contains("#UF3 POT") == 0) - error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" - "files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); + error->all(FLERR, + "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" + "files contain '#UF3 POT'. Found {} in the header", + potf_name, temp_line); temp_line = txtfilereader.next_line(1); ValueTokenizer fp2nd_line(temp_line); if (fp2nd_line.count() != 4) - error->all(FLERR, "UF3: Expected 4 words on 2nd line =>\n" - " nBody leading_trim trailing_trim type_of_knot_spacing\n" - " Found {}",temp_line); + error->all(FLERR, + "UF3: Expected 4 words on 2nd line =>\n" + " nBody leading_trim trailing_trim type_of_knot_spacing\n" + " Found {}", + temp_line); std::string nbody_on_file = fp2nd_line.next_string(); - if (utils::strmatch(nbody_on_file,"2B")) - utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n",potf_name); + if (utils::strmatch(nbody_on_file, "2B")) + utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n", potf_name); else error->all(FLERR, "UF3: Expected a 2B UF3 file but found {}", nbody_on_file); int leading_trim = fp2nd_line.next_int(); int trailing_trim = fp2nd_line.next_int(); if (leading_trim != 0) - error->all(FLERR, "UF3: Current implementation is throughly tested only for " - "leading_trim=0"); + error->all(FLERR, + "UF3: Current implementation is throughly tested only for " + "leading_trim=0"); if (trailing_trim != 3) - error->all(FLERR, "UF3: Current implementation is throughly tested only for " - "trailing_trim=3"); + error->all(FLERR, + "UF3: Current implementation is throughly tested only for " + "trailing_trim=3"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type,"uk")) { - utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with uniform " - "knot spacing",potf_name); + if (utils::strmatch(knot_type, "uk")) { + utils::logmesg(lmp, + "UF3: File {} contains 2-body UF3 potential with uniform " + "knot spacing", + potf_name); knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; - } - else if (utils::strmatch(knot_type,"nk")) { - utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential with non-uniform " - "knot spacing",potf_name); + } else if (utils::strmatch(knot_type, "nk")) { + utils::logmesg(lmp, + "UF3: File {} contains 2-body UF3 potential with non-uniform " + "knot spacing", + potf_name); knot_spacing_type_2b[itype][jtype] = 1; knot_spacing_type_2b[jtype][itype] = 1; /*error->all(FLERR, "UF3: Current implementation only works with uniform " " knot spacing");*/ - } - else - error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " - "Found {} on the 2nd line of {} pot file",knot_type,potf_name); + } else + error->all(FLERR, + "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " + "Found {} on the 2nd line of {} pot file", + knot_type, potf_name); temp_line = txtfilereader.next_line(1); ValueTokenizer fp3rd_line(temp_line); if (fp3rd_line.count() != 2) - error->all(FLERR, "UF3: Expected only 2 numbers on 3rd line => " - "Rij_CUTOFF NUM_OF_KNOTS. Found {} number/s",fp3rd_line.count()); + error->all(FLERR, + "UF3: Expected only 2 numbers on 3rd line => " + "Rij_CUTOFF NUM_OF_KNOTS. Found {} number/s", + fp3rd_line.count()); //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared cut[itype][jtype] = fp3rd_line.next_double(); @@ -287,8 +298,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) ValueTokenizer fp4th_line(temp_line); if (fp4th_line.count() != num_knots_2b) - error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", - num_knots_2b,fp4th_line.count()); + error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_2b, + fp4th_line.count()); n2b_knot[itype][jtype].resize(num_knots_2b); n2b_knot[jtype][itype].resize(num_knots_2b); @@ -305,8 +316,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) ValueTokenizer fp6th_line(temp_line); if (fp6th_line.count() != num_of_coeff_2b) - error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", - num_of_coeff_2b, fp6th_line.count()); + error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", num_of_coeff_2b, + fp6th_line.count()); n2b_coeff[itype][jtype].resize(num_of_coeff_2b); n2b_coeff[jtype][itype].resize(num_of_coeff_2b); @@ -321,13 +332,13 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) } setflag[itype][jtype] = 1; setflag[jtype][itype] = 1; + fclose(fp); } - void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name) { - utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {} {}\n", - potf_name, itype, jtype, ktype); + utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {} {}\n", potf_name, itype, + jtype, ktype); FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) @@ -340,74 +351,88 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name Tokenizer file_header(temp_line); if (file_header.count() != 2) - error->all(FLERR, "UF3: Expected only two words on 1st line of {} but found " - "{} word/s",potf_name,file_header.count()); + error->all(FLERR, + "UF3: Expected only two words on 1st line of {} but found " + "{} word/s", + potf_name, file_header.count()); if (file_header.contains("#UF3 POT") == 0) - error->all(FLERR, "UF3: {} file is not UF3 POT type, 1st line of UF3 POT " - "files contain '#UF3 POT'. Found {} in the header",potf_name,temp_line); + error->all(FLERR, + "UF3: {} file is not UF3 POT type, 1st line of UF3 POT " + "files contain '#UF3 POT'. Found {} in the header", + potf_name, temp_line); temp_line = txtfilereader.next_line(1); ValueTokenizer fp2nd_line(temp_line); if (fp2nd_line.count() != 4) - error->all(FLERR, "UF3: Expected 3 words on 2nd line => " - "nBody leading_trim trailing_trim type_of_knot_spacing " - "Found {}",temp_line); + error->all(FLERR, + "UF3: Expected 3 words on 2nd line => " + "nBody leading_trim trailing_trim type_of_knot_spacing " + "Found {}", + temp_line); std::string nbody_on_file = fp2nd_line.next_string(); - if (utils::strmatch(nbody_on_file,"3B")) - utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential\n",potf_name); + if (utils::strmatch(nbody_on_file, "3B")) + utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential\n", potf_name); else - error->all(FLERR, "UF3: Expected a 3B UF3 file but found {}", - nbody_on_file); + error->all(FLERR, "UF3: Expected a 3B UF3 file but found {}", nbody_on_file); int leading_trim = fp2nd_line.next_int(); int trailing_trim = fp2nd_line.next_int(); if (leading_trim != 0) - error->all(FLERR, "UF3: Current implementation is throughly tested only for " - "leading_trim=0\n"); + error->all(FLERR, + "UF3: Current implementation is throughly tested only for " + "leading_trim=0\n"); if (trailing_trim != 3) - error->all(FLERR, "UF3: Current implementation is throughly tested only for " - "trailing_trim=3\n"); + error->all(FLERR, + "UF3: Current implementation is throughly tested only for " + "trailing_trim=3\n"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type,"uk")) { - utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with uniform " - "knot spacing\n",potf_name); + if (utils::strmatch(knot_type, "uk")) { + utils::logmesg(lmp, + "UF3: File {} contains 3-body UF3 potential with uniform " + "knot spacing\n", + potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 0; knot_spacing_type_3b[itype][ktype][jtype] = 0; - } - else if (utils::strmatch(knot_type,"nk")) { - utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential with non-uniform " - "knot spacing\n",potf_name); + } else if (utils::strmatch(knot_type, "nk")) { + utils::logmesg(lmp, + "UF3: File {} contains 3-body UF3 potential with non-uniform " + "knot spacing\n", + potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 1; knot_spacing_type_3b[itype][ktype][jtype] = 1; - } - else - error->all(FLERR, "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " - "Found {} on the 2nd line of {} pot file",knot_type,potf_name); + } else + error->all(FLERR, + "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " + "Found {} on the 2nd line of {} pot file", + knot_type, potf_name); temp_line = txtfilereader.next_line(6); ValueTokenizer fp3rd_line(temp_line); if (fp3rd_line.count() != 6) - error->all(FLERR, "UF3: Expected only 6 numbers on 3rd line => " - "Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ " - "Found {} number/s",fp3rd_line.count()); + error->all(FLERR, + "UF3: Expected only 6 numbers on 3rd line => " + "Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ " + "Found {} number/s", + fp3rd_line.count()); double cut3b_rjk = fp3rd_line.next_double(); double cut3b_rij = fp3rd_line.next_double(); double cut3b_rik = fp3rd_line.next_double(); if (cut3b_rij != cut3b_rik) { - error->all(FLERR, "UF3: rij!=rik, Current implementation only works for rij=rik"); + error->all(FLERR, "UF3: rij!=rik, Current implementation only works for rij=rik"); } if (2 * cut3b_rik != cut3b_rjk) { - error->all(FLERR, "UF3: 2rij=2rik!=rik, Current implementation only works " - "for 2rij=2rik!=rik"); + error->all(FLERR, + "UF3: 2rij=2rik!=rik, Current implementation only works " + "for 2rij=2rik!=rik"); } cut_3b_list[itype][jtype] = std::max(cut3b_rij, cut_3b_list[itype][jtype]); @@ -421,9 +446,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name ValueTokenizer fp4th_line(temp_line); if (fp4th_line.count() != num_knots_3b_jk) - error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", - num_knots_3b_jk, fp4th_line.count()); - + error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_3b_jk, + fp4th_line.count()); n3b_knot_matrix[itype][jtype][ktype].resize(3); n3b_knot_matrix[itype][ktype][jtype].resize(3); @@ -433,91 +457,96 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name for (int i = 0; i < num_knots_3b_jk; i++) { n3b_knot_matrix[itype][jtype][ktype][0][i] = fp4th_line.next_double(); - n3b_knot_matrix[itype][ktype][jtype][0][i] = - n3b_knot_matrix[itype][jtype][ktype][0][i]; + n3b_knot_matrix[itype][ktype][jtype][0][i] = n3b_knot_matrix[itype][jtype][ktype][0][i]; } min_cut_3b[itype][jtype][ktype][0] = n3b_knot_matrix[itype][jtype][ktype][0][0]; - //min_cut_3b[itype][jtype][ktype][0] --> cutoff for jk distance + //min_cut_3b[itype][jtype][ktype][0] --> cutoff for jk distance min_cut_3b[itype][ktype][jtype][0] = n3b_knot_matrix[itype][ktype][jtype][0][0]; if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_jk={} {}-{}-{}_jk={}\n", - potf_name,itype,jtype,ktype,min_cut_3b[itype][jtype][ktype][0], - itype,ktype,jtype,min_cut_3b[itype][ktype][jtype][0]); + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_jk={} {}-{}-{}_jk={}\n", potf_name, itype, + jtype, ktype, min_cut_3b[itype][jtype][ktype][0], itype, ktype, jtype, + min_cut_3b[itype][ktype][jtype][0]); int num_knots_3b_ik = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(num_knots_3b_ik); ValueTokenizer fp5th_line(temp_line); if (fp5th_line.count() != num_knots_3b_ik) - error->all(FLERR, "UF3: Expected {} numbers on 5th line but found {} numbers", - num_knots_3b_ik, fp5th_line.count()); + error->all(FLERR, "UF3: Expected {} numbers on 5th line but found {} numbers", num_knots_3b_ik, + fp5th_line.count()); n3b_knot_matrix[itype][jtype][ktype][1].resize(num_knots_3b_ik); n3b_knot_matrix[itype][ktype][jtype][2].resize(num_knots_3b_ik); for (int i = 0; i < num_knots_3b_ik; i++) { - n3b_knot_matrix[itype][jtype][ktype][1][i] = fp5th_line.next_double(); - n3b_knot_matrix[itype][ktype][jtype][2][i] = - n3b_knot_matrix[itype][jtype][ktype][1][i]; - } + n3b_knot_matrix[itype][jtype][ktype][1][i] = fp5th_line.next_double(); + n3b_knot_matrix[itype][ktype][jtype][2][i] = n3b_knot_matrix[itype][jtype][ktype][1][i]; + } min_cut_3b[itype][jtype][ktype][1] = n3b_knot_matrix[itype][jtype][ktype][1][0]; - //min_cut_3b[itype][jtype][ktype][1] --> cutoff for ik distance + //min_cut_3b[itype][jtype][ktype][1] --> cutoff for ik distance min_cut_3b[itype][ktype][jtype][2] = n3b_knot_matrix[itype][ktype][jtype][2][0]; if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ik={} {}-{}-{}_ik={}\n", - potf_name,itype,jtype,ktype,min_cut_3b[itype][jtype][ktype][1], - itype,ktype,jtype,min_cut_3b[itype][ktype][jtype][2]); + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ik={} {}-{}-{}_ik={}\n", potf_name, itype, + jtype, ktype, min_cut_3b[itype][jtype][ktype][1], itype, ktype, jtype, + min_cut_3b[itype][ktype][jtype][2]); int num_knots_3b_ij = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(num_knots_3b_ij); ValueTokenizer fp6th_line(temp_line); if (fp6th_line.count() != num_knots_3b_ij) - error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", - num_knots_3b_ij, fp5th_line.count()); + error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", num_knots_3b_ij, + fp5th_line.count()); n3b_knot_matrix[itype][jtype][ktype][2].resize(num_knots_3b_ij); n3b_knot_matrix[itype][ktype][jtype][1].resize(num_knots_3b_ij); for (int i = 0; i < num_knots_3b_ij; i++) { n3b_knot_matrix[itype][jtype][ktype][2][i] = fp6th_line.next_double(); - n3b_knot_matrix[itype][ktype][jtype][1][i] = - n3b_knot_matrix[itype][jtype][ktype][2][i]; - } + n3b_knot_matrix[itype][ktype][jtype][1][i] = n3b_knot_matrix[itype][jtype][ktype][2][i]; + } min_cut_3b[itype][jtype][ktype][2] = n3b_knot_matrix[itype][jtype][ktype][2][0]; - //min_cut_3b[itype][jtype][ktype][2] --> cutoff for ij distance + //min_cut_3b[itype][jtype][ktype][2] --> cutoff for ij distance min_cut_3b[itype][ktype][jtype][1] = n3b_knot_matrix[itype][ktype][jtype][1][0]; if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ij={} {}-{}-{}_ij={}\n", - potf_name,itype,jtype,ktype,min_cut_3b[itype][jtype][ktype][2], - itype,ktype,jtype,min_cut_3b[itype][ktype][jtype][1]); + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ij={} {}-{}-{}_ij={}\n", potf_name, itype, + jtype, ktype, min_cut_3b[itype][jtype][ktype][2], itype, ktype, jtype, + min_cut_3b[itype][ktype][jtype][1]); temp_line = txtfilereader.next_line(3); ValueTokenizer fp7th_line(temp_line); if (fp7th_line.count() != 3) - error->all(FLERR, "UF3: Expected 3 numbers on 7th line => " - "SHAPE_OF_COEFF_MATRIX[I][J][K] " - "found {} numbers", fp7th_line.count()); + error->all(FLERR, + "UF3: Expected 3 numbers on 7th line => " + "SHAPE_OF_COEFF_MATRIX[I][J][K] " + "found {} numbers", + fp7th_line.count()); coeff_matrix_dim1 = fp7th_line.next_int(); coeff_matrix_dim2 = fp7th_line.next_int(); coeff_matrix_dim3 = fp7th_line.next_int(); if (n3b_knot_matrix[itype][jtype][ktype][0].size() != coeff_matrix_dim3 + 3 + 1) - error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and " - "coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", potf_name); + error->all(FLERR, + "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and " + "coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", + potf_name); if (n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) - error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and " - "coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1",potf_name); + error->all(FLERR, + "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and " + "coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1", + potf_name); if (n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) - error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and " - "coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1",potf_name); + error->all(FLERR, + "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and " + "coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1", + potf_name); coeff_matrix_elements_len = coeff_matrix_dim3; @@ -533,8 +562,8 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); if (coeff_line.count() != coeff_matrix_elements_len) - error->all(FLERR, "UF3: Expected {} numbers on {}th line but found " - "{} numbers",coeff_matrix_elements_len, line_count+8, coeff_line.count()); + error->all(FLERR, "UF3: Expected {} numbers on {}th line but found {} numbers", + coeff_matrix_elements_len, line_count + 8, coeff_line.count()); for (int k = 0; k < coeff_matrix_dim3; k++) { n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); } @@ -561,6 +590,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name setflag_3b[itype][jtype][ktype] = 1; setflag_3b[itype][ktype][jtype] = 1; + fclose(fp); } void PairUF3::uf3_read_pot_file(char *potf_name) @@ -681,12 +711,15 @@ void PairUF3::uf3_read_pot_file(char *potf_name) n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i]; } - min_cut_3b[temp_type1][temp_type2][temp_type3][0] = n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][0]; - min_cut_3b[temp_type1][temp_type3][temp_type2][0] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][0]; + min_cut_3b[temp_type1][temp_type2][temp_type3][0] = + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][0]; + min_cut_3b[temp_type1][temp_type3][temp_type2][0] = + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][0]; if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_0={} {}-{}-{}_0={}\n", - potf_name,temp_type1,temp_type2,temp_type3,min_cut_3b[temp_type1][temp_type2][temp_type3][0], - temp_type1,temp_type3,temp_type2,min_cut_3b[temp_type1][temp_type3][temp_type2][0]); + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_0={} {}-{}-{}_0={}\n", potf_name, + temp_type1, temp_type2, temp_type3, + min_cut_3b[temp_type1][temp_type2][temp_type3][0], temp_type1, temp_type3, + temp_type2, min_cut_3b[temp_type1][temp_type3][temp_type2][0]); temp_line_len = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(temp_line_len); @@ -699,12 +732,15 @@ void PairUF3::uf3_read_pot_file(char *potf_name) n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i]; } - min_cut_3b[temp_type1][temp_type2][temp_type3][1] = n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][0]; - min_cut_3b[temp_type1][temp_type3][temp_type2][2] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][0]; + min_cut_3b[temp_type1][temp_type2][temp_type3][1] = + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][0]; + min_cut_3b[temp_type1][temp_type3][temp_type2][2] = + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][0]; if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_1={} {}-{}-{}_2={}\n", - potf_name,temp_type1,temp_type2,temp_type3,min_cut_3b[temp_type1][temp_type2][temp_type3][1], - temp_type1,temp_type3,temp_type2,min_cut_3b[temp_type1][temp_type3][temp_type2][2]); + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_1={} {}-{}-{}_2={}\n", potf_name, + temp_type1, temp_type2, temp_type3, + min_cut_3b[temp_type1][temp_type2][temp_type3][1], temp_type1, temp_type3, + temp_type2, min_cut_3b[temp_type1][temp_type3][temp_type2][2]); temp_line_len = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(temp_line_len); @@ -717,12 +753,15 @@ void PairUF3::uf3_read_pot_file(char *potf_name) n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i]; } - min_cut_3b[temp_type1][temp_type2][temp_type3][2] = n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][0]; - min_cut_3b[temp_type1][temp_type3][temp_type2][1] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][0]; + min_cut_3b[temp_type1][temp_type2][temp_type3][2] = + n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][0]; + min_cut_3b[temp_type1][temp_type3][temp_type2][1] = + n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][0]; if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_2={} {}-{}-{}_1={}\n", - potf_name,temp_type1,temp_type2,temp_type3,min_cut_3b[temp_type1][temp_type2][temp_type3][2], - temp_type1,temp_type3,temp_type2,min_cut_3b[temp_type1][temp_type3][temp_type2][2]); + utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_2={} {}-{}-{}_1={}\n", potf_name, + temp_type1, temp_type2, temp_type3, + min_cut_3b[temp_type1][temp_type2][temp_type3][2], temp_type1, temp_type3, + temp_type2, min_cut_3b[temp_type1][temp_type3][temp_type2][2]); temp_line = txtfilereader.next_line(3); ValueTokenizer fp7th_line(temp_line); @@ -774,6 +813,7 @@ void PairUF3::uf3_read_pot_file(char *potf_name) FLERR, "UF3: {} file does not contain right words indicating whether it is 2 or 3 body potential", potf_name); + fclose(fp); } /* ---------------------------------------------------------------------- @@ -814,8 +854,10 @@ void PairUF3::create_bsplines() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { if (setflag[i][j] != 1) - error->all(FLERR,"UF3: Not all 2-body UF potentials are set, " - "missing potential file for {}-{} interaction",i, j); + error->all(FLERR, + "UF3: Not all 2-body UF potentials are set, " + "missing potential file for {}-{} interaction", + i, j); } } if (pot_3b) { @@ -823,8 +865,10 @@ void PairUF3::create_bsplines() for (int j = 1; j < num_of_elements + 1; j++) { for (int k = 1; k < num_of_elements + 1; k++) { if (setflag_3b[i][j][k] != 1) - error->all(FLERR,"UF3: Not all 3-body UF potentials are set, " - "missing potential file for {}-{}-{} interaction", i, j, k); + error->all(FLERR, + "UF3: Not all 3-body UF potentials are set, " + "missing potential file for {}-{}-{} interaction", + i, j, k); } } } @@ -832,21 +876,19 @@ void PairUF3::create_bsplines() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knot[i][j], n2b_coeff[i][j], - knot_spacing_type_2b[i][j]); + UFBS2b[i][j] = + uf3_pair_bspline(lmp, n2b_knot[i][j], n2b_coeff[i][j], knot_spacing_type_2b[i][j]); UFBS2b[j][i] = UFBS2b[i][j]; } if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - UFBS3b[i][j][k] = - uf3_triplet_bspline(lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key], - knot_spacing_type_3b[i][j][k]); + UFBS3b[i][j][k] = uf3_triplet_bspline( + lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); - UFBS3b[i][k][j] = - uf3_triplet_bspline(lmp, n3b_knot_matrix[i][k][j], n3b_coeff_matrix[key2], - knot_spacing_type_3b[i][k][j]); + UFBS3b[i][k][j] = uf3_triplet_bspline( + lmp, n3b_knot_matrix[i][k][j], n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]); } } } @@ -1004,8 +1046,8 @@ void PairUF3::compute(int eflag, int vflag) ((del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]))); if ((rij <= cut_3b[itype][jtype][ktype]) && (rik <= cut_3b[itype][ktype][jtype]) && - (rij >= min_cut_3b[itype][jtype][ktype][2]) && - (rik >= min_cut_3b[itype][jtype][ktype][1])) { + (rij >= min_cut_3b[itype][jtype][ktype][2]) && + (rik >= min_cut_3b[itype][jtype][ktype][1])) { del_rkj[0] = x[k][0] - x[j][0]; del_rkj[1] = x[k][1] - x[j][1]; @@ -1139,43 +1181,43 @@ double PairUF3::memory_usage() bytes = 0; - bytes += (double)5*sizeof(double); //num_of_elements, nbody_flag, - //n2body_pot_files, n3body_pot_files, - //tot_pot_files; + bytes += (double) 5 * sizeof(double); //num_of_elements, nbody_flag, + //n2body_pot_files, n3body_pot_files, + //tot_pot_files; - bytes += (double)5*sizeof(double); //bsplines_created, coeff_matrix_dim1, - //coeff_matrix_dim2, coeff_matrix_dim3, - //coeff_matrix_elements_len - bytes += (double)(num_of_elements+1)*(num_of_elements+1)* - (num_of_elements+1)*sizeof(double); //***setflag_3b + bytes += (double) 5 * sizeof(double); //bsplines_created, coeff_matrix_dim1, + //coeff_matrix_dim2, coeff_matrix_dim3, + //coeff_matrix_elements_len + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * + sizeof(double); //***setflag_3b - bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //cut - bytes += (double)(num_of_elements+1)*(num_of_elements+1)* - (num_of_elements+1)*sizeof(double); //***cut_3b + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * + sizeof(double); //***cut_3b - bytes += (double)(num_of_elements+1)*(num_of_elements+1)*sizeof(double); //cut_3b_list + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //cut_3b_list - bytes += (double)(num_of_elements+1)*(num_of_elements+1)* - (num_of_elements+1)*3*sizeof(double); //min_cut_3b + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * 3 * + sizeof(double); //min_cut_3b - for (int i=1; i < num_of_elements+1; i++) { - for (int j=i; j < num_of_elements+1; j++) { - bytes += (double)2*n2b_knot[i][j].size()*sizeof(double); //n2b_knot - bytes += (double)2*n2b_coeff[i][j].size()*sizeof(double); //n2b_coeff + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = i; j < num_of_elements + 1; j++) { + bytes += (double) 2 * n2b_knot[i][j].size() * sizeof(double); //n2b_knot + bytes += (double) 2 * n2b_coeff[i][j].size() * sizeof(double); //n2b_coeff } if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { - bytes += (double)2*n3b_knot_matrix[i][j][k][0].size()*sizeof(double); - bytes += (double)2*n3b_knot_matrix[i][j][k][1].size()*sizeof(double); - bytes += (double)2*n3b_knot_matrix[i][j][k][2].size()*sizeof(double); + bytes += (double) 2 * n3b_knot_matrix[i][j][k][0].size() * sizeof(double); + bytes += (double) 2 * n3b_knot_matrix[i][j][k][1].size() * sizeof(double); + bytes += (double) 2 * n3b_knot_matrix[i][j][k][2].size() * sizeof(double); std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - for (int l=0; l < n3b_coeff_matrix[key].size(); l++) { - for (int m=0; m < n3b_coeff_matrix[key][l].size(); m++) { - bytes += (double)2*n3b_coeff_matrix[key][l][m].size()*sizeof(double); + for (int l = 0; l < n3b_coeff_matrix[key].size(); l++) { + for (int m = 0; m < n3b_coeff_matrix[key][l].size(); m++) { + bytes += (double) 2 * n3b_coeff_matrix[key][l][m].size() * sizeof(double); //key = ijk //key = ikj } @@ -1187,19 +1229,18 @@ double PairUF3::memory_usage() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - bytes += (double)2*UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] + bytes += (double) 2 * UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] } if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { - bytes += (double)2*UFBS3b[i][j][k].memory_usage(); + bytes += (double) 2 * UFBS3b[i][j][k].memory_usage(); } } } } - bytes += (double)(maxshort+1)*sizeof(int); //neighshort, maxshort + bytes += (double) (maxshort + 1) * sizeof(int); //neighshort, maxshort return bytes; } - From 2219e764cec7ab8113771b15f1ce641329f3f31e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 22:26:50 -0400 Subject: [PATCH 30/65] call utils::logmesg() only on rank 0, use c++ string comparisons, remove debug comments --- src/ML-UF3/pair_uf3.cpp | 76 ++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index cbde78a43f..a46268092c 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -241,9 +241,10 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) temp_line); std::string nbody_on_file = fp2nd_line.next_string(); - if (utils::strmatch(nbody_on_file, "2B")) - utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n", potf_name); - else + if (nbody_on_file == "2B") { + if (comm->me == 0) + utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n", potf_name); + } else error->all(FLERR, "UF3: Expected a 2B UF3 file but found {}", nbody_on_file); int leading_trim = fp2nd_line.next_int(); @@ -258,25 +259,23 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) "trailing_trim=3"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type, "uk")) { - utils::logmesg(lmp, - "UF3: File {} contains 2-body UF3 potential with uniform " - "knot spacing", - potf_name); + if (knot_type == "uk") { + if (comm->me == 0) + utils::logmesg(lmp, + "UF3: File {} contains 2-body UF3 potential with uniform knot spacing", + potf_name); knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; - } else if (utils::strmatch(knot_type, "nk")) { - utils::logmesg(lmp, - "UF3: File {} contains 2-body UF3 potential with non-uniform " - "knot spacing", - potf_name); + } else if (knot_type == "nk") { + if (comm->me == 0) + utils::logmesg(lmp, + "UF3: File {} contains 2-body UF3 potential with non-uniform knot spacing", + potf_name); knot_spacing_type_2b[itype][jtype] = 1; knot_spacing_type_2b[jtype][itype] = 1; - /*error->all(FLERR, "UF3: Current implementation only works with uniform " - " knot spacing");*/ } else error->all(FLERR, - "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " + "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots). " "Found {} on the 2nd line of {} pot file", knot_type, potf_name); @@ -337,8 +336,9 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name) { - utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {} {}\n", potf_name, itype, - jtype, ktype); + if (comm->me == 0) + utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {} {}\n", + potf_name, itype, jtype, ktype); FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) @@ -374,35 +374,32 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name std::string nbody_on_file = fp2nd_line.next_string(); - if (utils::strmatch(nbody_on_file, "3B")) - utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential\n", potf_name); - else + if (nbody_on_file == "3B") { + if (comm->me == 0) + utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential\n", potf_name); + } else error->all(FLERR, "UF3: Expected a 3B UF3 file but found {}", nbody_on_file); int leading_trim = fp2nd_line.next_int(); int trailing_trim = fp2nd_line.next_int(); if (leading_trim != 0) - error->all(FLERR, - "UF3: Current implementation is throughly tested only for " - "leading_trim=0\n"); + error->all(FLERR, "UF3: Current implementation is throughly tested only for leading_trim=0"); if (trailing_trim != 3) - error->all(FLERR, - "UF3: Current implementation is throughly tested only for " - "trailing_trim=3\n"); + error->all(FLERR, "UF3: Current implementation is throughly tested only for trailing_trim=3"); std::string knot_type = fp2nd_line.next_string(); - if (utils::strmatch(knot_type, "uk")) { - utils::logmesg(lmp, - "UF3: File {} contains 3-body UF3 potential with uniform " - "knot spacing\n", - potf_name); + if (knot_type == "uk") { + if (comm->me == 0) + utils::logmesg(lmp, + "UF3: File {} contains 3-body UF3 potential with uniform knot spacing\n", + potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 0; knot_spacing_type_3b[itype][ktype][jtype] = 0; - } else if (utils::strmatch(knot_type, "nk")) { - utils::logmesg(lmp, - "UF3: File {} contains 3-body UF3 potential with non-uniform " - "knot spacing\n", - potf_name); + } else if (knot_type == "nk") { + if (comm->me == 0) + utils::logmesg(lmp, + "UF3: File {} contains 3-body UF3 potential with non-uniform knot spacing\n", + potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 1; knot_spacing_type_3b[itype][ktype][jtype] = 1; } else @@ -628,7 +625,6 @@ void PairUF3::uf3_read_pot_file(char *potf_name) //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared cut[temp_type1][temp_type2] = fp3rd_line.next_double(); - // if(comm->me==0) utils::logmesg(lmp,"UF3: Cutoff {}\n",cutsq[temp_type1][temp_type2]); cut[temp_type2][temp_type1] = cut[temp_type1][temp_type2]; int temp_line_len = fp3rd_line.next_int(); @@ -649,18 +645,14 @@ void PairUF3::uf3_read_pot_file(char *potf_name) temp_line_len = fp5th_line.next_int(); temp_line = txtfilereader.next_line(temp_line_len); - // utils::logmesg(lmp,"UF3:11 {}",temp_line); ValueTokenizer fp6th_line(temp_line); - // if(comm->me==0) utils::logmesg(lmp,"UF3: {}\n",temp_line_len); n2b_coeff[temp_type1][temp_type2].resize(temp_line_len); n2b_coeff[temp_type2][temp_type1].resize(temp_line_len); for (int k = 0; k < temp_line_len; k++) { n2b_coeff[temp_type1][temp_type2][k] = fp6th_line.next_double(); n2b_coeff[temp_type2][temp_type1][k] = n2b_coeff[temp_type1][temp_type2][k]; - // if(comm->me==0) utils::logmesg(lmp,"UF3: {}\n",n2b_coeff[temp_type1][temp_type2][k]); } - // for(int i=0;ime==0) utils::logmesg(lmp,"UF3: {}\n",n2b_coeff[temp_type1][temp_type2][i]); if (n2b_knot[temp_type1][temp_type2].size() != n2b_coeff[temp_type1][temp_type2].size() + 4) { error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", potf_name); From 6bdf9819427fc43b780b1b1f43d556d2b7d79ecf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 23:08:51 -0400 Subject: [PATCH 31/65] don't use pow() function for simple square --- src/ML-UF3/uf3_bspline_basis2.cpp | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/ML-UF3/uf3_bspline_basis2.cpp b/src/ML-UF3/uf3_bspline_basis2.cpp index fb345cc10b..7c16ab79d0 100644 --- a/src/ML-UF3/uf3_bspline_basis2.cpp +++ b/src/ML-UF3/uf3_bspline_basis2.cpp @@ -14,10 +14,10 @@ #include "uf3_bspline_basis2.h" -#include "utils.h" -#include +#include "math_special.h" using namespace LAMMPS_NS; +using MathSpecial::square; // Constructor // Initializes coefficients and knots @@ -28,45 +28,45 @@ uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double double c0, c1, c2; - c0 = coefficient * - (pow(knots[0], 2) / - (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + c0 = coefficient + * (square(knots[0]) + / (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); c1 = coefficient * - (-2 * knots[0] / - (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + (-2.0 * knots[0] / + (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); c2 = coefficient * - (1 / (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + (1.0 / (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); constants.push_back(c0); constants.push_back(c1); constants.push_back(c2); c0 = coefficient * (-knots[1] * knots[3] / - (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - knots[0] * knots[2] / - (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2]))); c1 = coefficient * (knots[1] / - (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + knots[3] / - (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + knots[0] / - (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2)) + + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2])) + knots[2] / - (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2]))); c2 = coefficient * - (-1 / (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - - 1 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + (-1.0 / (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + 1.0 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2]))); constants.push_back(c0); constants.push_back(c1); constants.push_back(c2); c0 = coefficient * - (pow(knots[3], 2) / - (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + (square(knots[3]) / + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); c1 = coefficient * - (-2 * knots[3] / - (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + (-2.0 * knots[3] / + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); c2 = coefficient * - (1 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + (1.0 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); constants.push_back(c0); constants.push_back(c1); constants.push_back(c2); From 584137f104f8dda43d24a6b1b3c875674e43f3f0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 23:36:13 -0400 Subject: [PATCH 32/65] remove num_of_elements class variable, just use local copy of atom->ntypes --- src/KOKKOS/pair_uf3_kokkos.cpp | 3 +++ src/ML-UF3/pair_uf3.cpp | 7 ++++--- src/ML-UF3/pair_uf3.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 7c524b8d61..067f3200a0 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -207,6 +207,7 @@ template double PairUF3Kokkos::init_one(int i, in template void PairUF3Kokkos::create_coefficients() { + const int num_of_elements = atom->ntypes; coefficients_created = 1; /*for (int i = 1; i < num_of_elements + 1; i++) { @@ -266,6 +267,7 @@ template void PairUF3Kokkos::create_coefficients( template void PairUF3Kokkos::create_2b_coefficients() { + const int num_of_elements = atom->ntypes; // Setup interaction pair map //TODO: Instead of using map2b and map3b use simple indexing @@ -356,6 +358,7 @@ template void PairUF3Kokkos::create_2b_coefficien template void PairUF3Kokkos::create_3b_coefficients() { + const int num_of_elements = atom->ntypes; // Init interaction map for 3B Kokkos::realloc(map3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index a46268092c..a286a01b7d 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -83,7 +83,7 @@ void PairUF3::settings(int narg, char **arg) "Invalid number of arguments for pair_style uf3" " Are you using a 2-body or 2 & 3-body UF potential?"); nbody_flag = utils::numeric(FLERR, arg[0], true, lmp); - num_of_elements = atom->ntypes; + const int num_of_elements = atom->ntypes; if (nbody_flag == 2) { pot_3b = false; manybody_flag = 0; @@ -133,6 +133,7 @@ void PairUF3::coeff(int narg, char **arg) void PairUF3::allocate() { allocated = 1; + const int num_of_elements = atom->ntypes; // Contains info about wether UF potential were found for type i and j memory->create(setflag, num_of_elements + 1, num_of_elements + 1, "pair:setflag"); @@ -842,6 +843,7 @@ double PairUF3::init_one(int i /*i*/, int /*j*/ j) void PairUF3::create_bsplines() { + const int num_of_elements = atom->ntypes; bsplines_created = 1; for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { @@ -1169,10 +1171,9 @@ double PairUF3::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, double PairUF3::memory_usage() { + const int num_of_elements = atom->ntypes; double bytes = Pair::memory_usage(); - bytes = 0; - bytes += (double) 5 * sizeof(double); //num_of_elements, nbody_flag, //n2body_pot_files, n3body_pot_files, //tot_pot_files; diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 79627e0def..d3e988cc1e 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -53,7 +53,7 @@ class PairUF3 : public Pair { void uf3_read_pot_file(char *potf_name); void uf3_read_pot_file(int i, int j, char *potf_name); void uf3_read_pot_file(int i, int j, int k, char *potf_name); - int num_of_elements, nbody_flag, n2body_pot_files, n3body_pot_files, tot_pot_files; + int nbody_flag, n2body_pot_files, n3body_pot_files, tot_pot_files; int bsplines_created; int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; bool pot_3b; From c5262873b0e491b6c132005628290495f060028a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 23:36:57 -0400 Subject: [PATCH 33/65] initialize all class pointers to null, delete all allocated storage --- src/ML-UF3/pair_uf3.cpp | 6 +++++- src/ML-UF3/uf3_triplet_bspline.cpp | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index a286a01b7d..f9bf8fdbf7 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -40,7 +40,9 @@ using MathConst::THIRD; /* ---------------------------------------------------------------------- */ -PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp) +PairUF3::PairUF3(LAMMPS *lmp) : + Pair(lmp), setflag_3b(nullptr), knot_spacing_type_2b(nullptr), knot_spacing_type_3b(nullptr), + cut(nullptr), cut_3b(nullptr), cut_3b_list(nullptr), min_cut_3b(nullptr) { single_enable = 1; // 1 if single() routine exists restartinfo = 0; // 1 if pair style writes restart info @@ -60,6 +62,7 @@ PairUF3::~PairUF3() memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(cut); + memory->destroy(knot_spacing_type_2b); if (pot_3b) { memory->destroy(setflag_3b); @@ -67,6 +70,7 @@ PairUF3::~PairUF3() memory->destroy(cut_3b_list); memory->destroy(min_cut_3b); memory->destroy(neighshort); + memory->destroy(knot_spacing_type_3b); } } } diff --git a/src/ML-UF3/uf3_triplet_bspline.cpp b/src/ML-UF3/uf3_triplet_bspline.cpp index d9199d301c..a2087bd3a1 100644 --- a/src/ML-UF3/uf3_triplet_bspline.cpp +++ b/src/ML-UF3/uf3_triplet_bspline.cpp @@ -13,7 +13,7 @@ #include "uf3_triplet_bspline.h" #include "error.h" -#include + #include using namespace LAMMPS_NS; @@ -306,6 +306,7 @@ int uf3_triplet_bspline::get_starting_index_nonuniform(const std::vector } } } + return -1; } double uf3_triplet_bspline::memory_usage() From 1fff0a33fce72c1f0451e3a01f732ff9fbdd4f39 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 23:37:22 -0400 Subject: [PATCH 34/65] drop log messages --- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 | 22 +++--- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 | 22 +++--- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 | 26 +++--- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 | 28 +++---- src/KOKKOS/pair_uf3_kokkos.cpp | 4 +- src/ML-UF3/pair_uf3.cpp | 79 +------------------ 6 files changed, 43 insertions(+), 138 deletions(-) diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 index b1d413be3e..743e1a1e97 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -41,9 +41,7 @@ mass 1 183.84 pair_style uf3 2 pair_coeff 1 1 W_W.uf3 -UF3: W_W.uf3 file should contain UF3 potential for 1 1 -UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing + # # ============= Setup output @@ -88,20 +86,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.113 | 3.113 | 3.113 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0344829 on 1 procs for 100 steps with 128 atoms +Loop time of 0.0333361 on 1 procs for 100 steps with 128 atoms -Performance: 125.280 ns/day, 0.192 hours/ns, 2899.990 timesteps/s, 371.199 katom-step/s -99.3% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 129.589 ns/day, 0.185 hours/ns, 2999.749 timesteps/s, 383.968 katom-step/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.033254 | 0.033254 | 0.033254 | 0.0 | 96.44 +Pair | 0.032205 | 0.032205 | 0.032205 | 0.0 | 96.61 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00069442 | 0.00069442 | 0.00069442 | 0.0 | 2.01 -Output | 0.0001137 | 0.0001137 | 0.0001137 | 0.0 | 0.33 -Modify | 0.0002176 | 0.0002176 | 0.0002176 | 0.0 | 0.63 -Other | | 0.0002033 | | | 0.59 +Comm | 0.00067389 | 0.00067389 | 0.00067389 | 0.0 | 2.02 +Output | 9.6021e-05 | 9.6021e-05 | 9.6021e-05 | 0.0 | 0.29 +Modify | 0.00019596 | 0.00019596 | 0.00019596 | 0.0 | 0.59 +Other | | 0.0001652 | | | 0.50 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 index fa1455369b..3814e71f4e 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -41,9 +41,7 @@ mass 1 183.84 pair_style uf3 2 pair_coeff 1 1 W_W.uf3 -UF3: W_W.uf3 file should contain UF3 potential for 1 1 -UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacing + # # ============= Setup output @@ -88,20 +86,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.104 | 3.104 | 3.104 Mbytes 80 173.31044 -4.893466 0 -4.8712389 -397601.62 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.00969615 on 4 procs for 100 steps with 128 atoms +Loop time of 0.0147453 on 4 procs for 100 steps with 128 atoms -Performance: 445.538 ns/day, 0.054 hours/ns, 10313.372 timesteps/s, 1.320 Matom-step/s -99.7% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 292.975 ns/day, 0.082 hours/ns, 6781.825 timesteps/s, 868.074 katom-step/s +96.0% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.0075573 | 0.0076696 | 0.007725 | 0.1 | 79.10 +Pair | 0.0086489 | 0.010103 | 0.0115 | 1.4 | 68.52 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0017105 | 0.0017634 | 0.0018792 | 0.2 | 18.19 -Output | 6.7305e-05 | 7.2505e-05 | 8.2576e-05 | 0.0 | 0.75 -Modify | 4.551e-05 | 4.8142e-05 | 5.4109e-05 | 0.0 | 0.50 -Other | | 0.0001425 | | | 1.47 +Comm | 0.0027662 | 0.0041052 | 0.0055079 | 2.1 | 27.84 +Output | 0.00012555 | 0.0001367 | 0.00015958 | 0.0 | 0.93 +Modify | 6.4367e-05 | 7.9187e-05 | 9.3374e-05 | 0.0 | 0.54 +Other | | 0.000321 | | | 2.18 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 index f8c3dd8af6..014ef3df49 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -41,15 +41,7 @@ mass 1 183.84 pair_style uf3 3 pair_coeff 1 1 W_W.uf3 -UF3: W_W.uf3 file should contain UF3 potential for 1 1 -UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacingpair_coeff 3b 1 1 1 W_W_W.uf3 -UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 -UF3: File W_W_W.uf3 contains 3-body UF3 potential -UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform knot spacing -UF3: 3b min cutoff W_W_W.uf3 1-1-1_jk=1.5 1-1-1_jk=1.5 -UF3: 3b min cutoff W_W_W.uf3 1-1-1_ik=1.5 1-1-1_ik=1.5 -UF3: 3b min cutoff W_W_W.uf3 1-1-1_ij=1.5 1-1-1_ij=1.5 +pair_coeff 3b 1 1 1 W_W_W.uf3 # # ============= Setup output @@ -94,20 +86,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.214 | 3.214 | 3.214 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.477708 on 1 procs for 100 steps with 128 atoms +Loop time of 0.48771 on 1 procs for 100 steps with 128 atoms -Performance: 9.043 ns/day, 2.654 hours/ns, 209.333 timesteps/s, 26.795 katom-step/s +Performance: 8.858 ns/day, 2.709 hours/ns, 205.040 timesteps/s, 26.245 katom-step/s 99.7% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.47636 | 0.47636 | 0.47636 | 0.0 | 99.72 +Pair | 0.48625 | 0.48625 | 0.48625 | 0.0 | 99.70 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0007585 | 0.0007585 | 0.0007585 | 0.0 | 0.16 -Output | 0.00016112 | 0.00016112 | 0.00016112 | 0.0 | 0.03 -Modify | 0.00019415 | 0.00019415 | 0.00019415 | 0.0 | 0.04 -Other | | 0.0002393 | | | 0.05 +Comm | 0.00078 | 0.00078 | 0.00078 | 0.0 | 0.16 +Output | 0.0001819 | 0.0001819 | 0.0001819 | 0.0 | 0.04 +Modify | 0.00020794 | 0.00020794 | 0.00020794 | 0.0 | 0.04 +Other | | 0.0002902 | | | 0.06 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 index 6dc5283901..3dfbf8e5d7 100644 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 +++ b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-331-ga26c281a63) +LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) using 1 OpenMP thread(s) per MPI task # Demonstrate UF3 W potential @@ -41,15 +41,7 @@ mass 1 183.84 pair_style uf3 3 pair_coeff 1 1 W_W.uf3 -UF3: W_W.uf3 file should contain UF3 potential for 1 1 -UF3: File W_W.uf3 contains 2-body UF3 potential -UF3: File W_W.uf3 contains 2-body UF3 potential with uniform knot spacingpair_coeff 3b 1 1 1 W_W_W.uf3 -UF3: W_W_W.uf3 file should contain UF3 potential for 1 1 1 -UF3: File W_W_W.uf3 contains 3-body UF3 potential -UF3: File W_W_W.uf3 contains 3-body UF3 potential with uniform knot spacing -UF3: 3b min cutoff W_W_W.uf3 1-1-1_jk=1.5 1-1-1_jk=1.5 -UF3: 3b min cutoff W_W_W.uf3 1-1-1_ik=1.5 1-1-1_ik=1.5 -UF3: 3b min cutoff W_W_W.uf3 1-1-1_ij=1.5 1-1-1_ij=1.5 +pair_coeff 3b 1 1 1 W_W_W.uf3 # # ============= Setup output @@ -94,20 +86,20 @@ Per MPI rank memory allocation (min/avg/max) = 3.205 | 3.205 | 3.205 Mbytes 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.130504 on 4 procs for 100 steps with 128 atoms +Loop time of 0.2463 on 4 procs for 100 steps with 128 atoms -Performance: 33.102 ns/day, 0.725 hours/ns, 766.258 timesteps/s, 98.081 katom-step/s -99.1% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 17.540 ns/day, 1.368 hours/ns, 406.010 timesteps/s, 51.969 katom-step/s +98.6% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.1177 | 0.12008 | 0.12246 | 0.7 | 92.01 +Pair | 0.12087 | 0.18077 | 0.24119 | 13.8 | 73.39 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0074641 | 0.0098397 | 0.012226 | 2.4 | 7.54 -Output | 0.00012713 | 0.00013807 | 0.0001675 | 0.0 | 0.11 -Modify | 8.7486e-05 | 9.3752e-05 | 0.00010061 | 0.0 | 0.07 -Other | | 0.0003502 | | | 0.27 +Comm | 0.0041617 | 0.064599 | 0.12453 | 23.1 | 26.23 +Output | 0.00029596 | 0.00031702 | 0.00036352 | 0.0 | 0.13 +Modify | 0.00012969 | 0.00013491 | 0.00014544 | 0.0 | 0.05 +Other | | 0.00048 | | | 0.19 Nlocal: 32 ave 32 max 32 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 067f3200a0..5f2039fe39 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -219,7 +219,7 @@ template void PairUF3Kokkos::create_coefficients( } }*/ - if (pot_3b){ + if (pot_3b) { for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = 1; k < num_of_elements + 1; k++) { @@ -851,7 +851,7 @@ template void PairUF3Kokkos::compute(int eflag_in // loop over neighbor list of my atoms - if (evflag){ + if (evflag) { Kokkos::parallel_reduce( Kokkos::RangePolicy>(0, inum), *this, ev); } diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index f9bf8fdbf7..858f25cb8d 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -209,10 +209,6 @@ void PairUF3::allocate() void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) { - if (comm->me == 0) - utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {}\n", potf_name, itype, - jtype); - FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); @@ -246,10 +242,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) temp_line); std::string nbody_on_file = fp2nd_line.next_string(); - if (nbody_on_file == "2B") { - if (comm->me == 0) - utils::logmesg(lmp, "UF3: File {} contains 2-body UF3 potential\n", potf_name); - } else + if (nbody_on_file != "2B") error->all(FLERR, "UF3: Expected a 2B UF3 file but found {}", nbody_on_file); int leading_trim = fp2nd_line.next_int(); @@ -265,17 +258,9 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) std::string knot_type = fp2nd_line.next_string(); if (knot_type == "uk") { - if (comm->me == 0) - utils::logmesg(lmp, - "UF3: File {} contains 2-body UF3 potential with uniform knot spacing", - potf_name); knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; } else if (knot_type == "nk") { - if (comm->me == 0) - utils::logmesg(lmp, - "UF3: File {} contains 2-body UF3 potential with non-uniform knot spacing", - potf_name); knot_spacing_type_2b[itype][jtype] = 1; knot_spacing_type_2b[jtype][itype] = 1; } else @@ -341,10 +326,6 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name) { - if (comm->me == 0) - utils::logmesg(lmp, "UF3: {} file should contain UF3 potential for {} {} {}\n", - potf_name, itype, jtype, ktype); - FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); @@ -378,11 +359,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name temp_line); std::string nbody_on_file = fp2nd_line.next_string(); - - if (nbody_on_file == "3B") { - if (comm->me == 0) - utils::logmesg(lmp, "UF3: File {} contains 3-body UF3 potential\n", potf_name); - } else + if (nbody_on_file != "3B") error->all(FLERR, "UF3: Expected a 3B UF3 file but found {}", nbody_on_file); int leading_trim = fp2nd_line.next_int(); @@ -394,17 +371,9 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name std::string knot_type = fp2nd_line.next_string(); if (knot_type == "uk") { - if (comm->me == 0) - utils::logmesg(lmp, - "UF3: File {} contains 3-body UF3 potential with uniform knot spacing\n", - potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 0; knot_spacing_type_3b[itype][ktype][jtype] = 0; } else if (knot_type == "nk") { - if (comm->me == 0) - utils::logmesg(lmp, - "UF3: File {} contains 3-body UF3 potential with non-uniform knot spacing\n", - potf_name); knot_spacing_type_3b[itype][jtype][ktype] = 1; knot_spacing_type_3b[itype][ktype][jtype] = 1; } else @@ -463,13 +432,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name } min_cut_3b[itype][jtype][ktype][0] = n3b_knot_matrix[itype][jtype][ktype][0][0]; - //min_cut_3b[itype][jtype][ktype][0] --> cutoff for jk distance - min_cut_3b[itype][ktype][jtype][0] = n3b_knot_matrix[itype][ktype][jtype][0][0]; - if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_jk={} {}-{}-{}_jk={}\n", potf_name, itype, - jtype, ktype, min_cut_3b[itype][jtype][ktype][0], itype, ktype, jtype, - min_cut_3b[itype][ktype][jtype][0]); int num_knots_3b_ik = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(num_knots_3b_ik); @@ -487,13 +450,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name } min_cut_3b[itype][jtype][ktype][1] = n3b_knot_matrix[itype][jtype][ktype][1][0]; - //min_cut_3b[itype][jtype][ktype][1] --> cutoff for ik distance - min_cut_3b[itype][ktype][jtype][2] = n3b_knot_matrix[itype][ktype][jtype][2][0]; - if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ik={} {}-{}-{}_ik={}\n", potf_name, itype, - jtype, ktype, min_cut_3b[itype][jtype][ktype][1], itype, ktype, jtype, - min_cut_3b[itype][ktype][jtype][2]); int num_knots_3b_ij = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(num_knots_3b_ij); @@ -511,12 +468,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name } min_cut_3b[itype][jtype][ktype][2] = n3b_knot_matrix[itype][jtype][ktype][2][0]; - //min_cut_3b[itype][jtype][ktype][2] --> cutoff for ij distance min_cut_3b[itype][ktype][jtype][1] = n3b_knot_matrix[itype][ktype][jtype][1][0]; - if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_ij={} {}-{}-{}_ij={}\n", potf_name, itype, - jtype, ktype, min_cut_3b[itype][jtype][ktype][2], itype, ktype, jtype, - min_cut_3b[itype][ktype][jtype][1]); temp_line = txtfilereader.next_line(3); ValueTokenizer fp7th_line(temp_line); @@ -597,8 +549,6 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name void PairUF3::uf3_read_pot_file(char *potf_name) { - if (comm->me == 0) utils::logmesg(lmp, "\nUF3: Opening {} file\n", potf_name); - FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); @@ -613,10 +563,6 @@ void PairUF3::uf3_read_pot_file(char *potf_name) error->all(FLERR, "UF3: {} file is not UF3 POT type, found type {} {} on the file", potf_name, fp1st_line.next(), fp1st_line.next()); - if (comm->me == 0) - utils::logmesg(lmp, "UF3: {} file is of type {} {}\n", potf_name, fp1st_line.next(), - fp1st_line.next()); - temp_line = txtfilereader.next_line(1); Tokenizer fp2nd_line(temp_line); if (fp2nd_line.contains("2B") == 1) { @@ -624,9 +570,6 @@ void PairUF3::uf3_read_pot_file(char *potf_name) ValueTokenizer fp3rd_line(temp_line); int temp_type1 = fp3rd_line.next_int(); int temp_type2 = fp3rd_line.next_int(); - if (comm->me == 0) - utils::logmesg(lmp, "UF3: {} file contains 2-body UF3 potential for {} {}\n", potf_name, - temp_type1, temp_type2); //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared cut[temp_type1][temp_type2] = fp3rd_line.next_double(); @@ -670,9 +613,6 @@ void PairUF3::uf3_read_pot_file(char *potf_name) int temp_type1 = fp3rd_line.next_int(); int temp_type2 = fp3rd_line.next_int(); int temp_type3 = fp3rd_line.next_int(); - if (comm->me == 0) - utils::logmesg(lmp, "UF3: {} file contains 3-body UF3 potential for {} {} {}\n", potf_name, - temp_type1, temp_type2, temp_type3); double cut3b_rjk = fp3rd_line.next_double(); double cut3b_rij = fp3rd_line.next_double(); @@ -712,11 +652,6 @@ void PairUF3::uf3_read_pot_file(char *potf_name) n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][0]; min_cut_3b[temp_type1][temp_type3][temp_type2][0] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][0]; - if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_0={} {}-{}-{}_0={}\n", potf_name, - temp_type1, temp_type2, temp_type3, - min_cut_3b[temp_type1][temp_type2][temp_type3][0], temp_type1, temp_type3, - temp_type2, min_cut_3b[temp_type1][temp_type3][temp_type2][0]); temp_line_len = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(temp_line_len); @@ -733,11 +668,6 @@ void PairUF3::uf3_read_pot_file(char *potf_name) n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][0]; min_cut_3b[temp_type1][temp_type3][temp_type2][2] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][0]; - if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_1={} {}-{}-{}_2={}\n", potf_name, - temp_type1, temp_type2, temp_type3, - min_cut_3b[temp_type1][temp_type2][temp_type3][1], temp_type1, temp_type3, - temp_type2, min_cut_3b[temp_type1][temp_type3][temp_type2][2]); temp_line_len = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(temp_line_len); @@ -754,11 +684,6 @@ void PairUF3::uf3_read_pot_file(char *potf_name) n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][0]; min_cut_3b[temp_type1][temp_type3][temp_type2][1] = n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][0]; - if (comm->me == 0) - utils::logmesg(lmp, "UF3: 3b min cutoff {} {}-{}-{}_2={} {}-{}-{}_1={}\n", potf_name, - temp_type1, temp_type2, temp_type3, - min_cut_3b[temp_type1][temp_type2][temp_type3][2], temp_type1, temp_type3, - temp_type2, min_cut_3b[temp_type1][temp_type3][temp_type2][2]); temp_line = txtfilereader.next_line(3); ValueTokenizer fp7th_line(temp_line); From a6230ba147c4e317faf72d7af5fc5740de3dc03d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 28 Mar 2024 23:49:09 -0400 Subject: [PATCH 35/65] replace pow(x,2) and pow(x,3) with square() and cube() --- src/KOKKOS/pair_uf3_kokkos.cpp | 330 ++++++++++++++--------------- src/ML-UF3/uf3_bspline_basis3.cpp | 333 +++++++++++++++--------------- 2 files changed, 333 insertions(+), 330 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 5f2039fe39..176fc9fe05 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -28,6 +28,7 @@ #include "kokkos.h" #include "kokkos_type.h" #include "math_const.h" +#include "math_special_kokkos.h" #include "memory.h" #include "memory_kokkos.h" #include "neigh_list_kokkos.h" @@ -35,14 +36,15 @@ #include "neighbor.h" #include "pair_kokkos.h" #include "text_file_reader.h" + #include #include #include -#include - using namespace LAMMPS_NS; using namespace MathConst; +using MathSpecialKokkos::cube; +using MathSpecialKokkos::square; template PairUF3Kokkos::PairUF3Kokkos(LAMMPS *lmp) : PairUF3(lmp) { @@ -1363,261 +1365,261 @@ std::vector PairUF3Kokkos::get_constants(double *knots, dou std::vector constants(16); constants[0] = coefficient * - (-pow(knots[0], 3) / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (-cube(knots[0]) / + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); constants[1] = coefficient * - (3 * pow(knots[0], 2) / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (3 * square(knots[0]) / + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); constants[2] = coefficient * (-3 * knots[0] / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); constants[3] = coefficient * (1 / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); constants[4] = coefficient * - (pow(knots[1], 2) * knots[4] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (square(knots[1]) * knots[4] / + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) + - pow(knots[0], 2) * knots[2] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + square(knots[0]) * knots[2] / + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) + knots[0] * knots[1] * knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); constants[5] = coefficient * - (-pow(knots[1], 2) / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-square(knots[1]) / + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) - 2 * knots[1] * knots[4] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) - - pow(knots[0], 2) / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + square(knots[0]) / + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) - 2 * knots[0] * knots[2] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) - knots[0] * knots[1] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) - knots[0] * knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) - knots[1] * knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); constants[6] = coefficient * (2 * knots[1] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) + knots[4] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) + 2 * knots[0] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) + knots[2] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) + knots[0] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) + knots[1] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) + knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); constants[7] = coefficient * (-1 / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) - 1 / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) - 1 / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); constants[8] = coefficient * - (-knots[0] * pow(knots[3], 2) / + (-knots[0] * square(knots[3]) / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) - knots[1] * knots[3] * knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - - knots[2] * pow(knots[4], 2) / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - + knots[2] * square(knots[4]) / + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); constants[9] = coefficient * (2 * knots[0] * knots[3] / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + - pow(knots[3], 2) / + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) + + square(knots[3]) / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) + knots[1] * knots[3] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + knots[1] * knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + knots[3] * knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + 2 * knots[2] * knots[4] / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) + - pow(knots[4], 2) / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4])) + + square(knots[4]) / + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); constants[10] = coefficient * (-knots[0] / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) - 2 * knots[3] / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) - knots[1] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - knots[3] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - knots[2] / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) - + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4])) - 2 * knots[4] / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); constants[11] = coefficient * (1 / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) + 1 / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + 1 / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); constants[12] = coefficient * - (pow(knots[4], 3) / + (cube(knots[4]) / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); constants[13] = coefficient * - (-3 * pow(knots[4], 2) / + (-3 * square(knots[4]) / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); constants[14] = coefficient * (3 * knots[4] / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); constants[15] = coefficient * (-1 / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); return constants; } @@ -1628,38 +1630,38 @@ std::vector PairUF3Kokkos::get_dnconstants(double *knots, d std::vector constants(9); constants[0] = coefficient * - (pow(knots[0], 2) / - (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + (square(knots[0]) / + (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); constants[1] = coefficient * (-2 * knots[0] / - (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); constants[2] = coefficient * - (1 / (pow(knots[0], 2) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); + (1 / (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); constants[3] = coefficient * (-knots[1] * knots[3] / - (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - knots[0] * knots[2] / - (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2]))); constants[4] = coefficient * (knots[1] / - (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + knots[3] / - (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + + (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) + knots[0] / - (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2)) + + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2])) + knots[2] / - (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2]))); constants[5] = coefficient * - (-1 / (pow(knots[1], 2) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - - 1 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + pow(knots[2], 2))); + (-1 / (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - + 1 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2]))); constants[6] = coefficient * - (pow(knots[3], 2) / - (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + (square(knots[3]) / + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); constants[7] = coefficient * (-2 * knots[3] / - (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); constants[8] = coefficient * - (1 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + pow(knots[3], 2))); + (1 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); return constants; } diff --git a/src/ML-UF3/uf3_bspline_basis3.cpp b/src/ML-UF3/uf3_bspline_basis3.cpp index 0778ae82a3..3ed256777b 100644 --- a/src/ML-UF3/uf3_bspline_basis3.cpp +++ b/src/ML-UF3/uf3_bspline_basis3.cpp @@ -14,10 +14,11 @@ #include "uf3_bspline_basis3.h" -#include "utils.h" -#include +#include "math_special.h" using namespace LAMMPS_NS; +using MathSpecial::cube; +using MathSpecial::square; // Constructor // Initializes coefficients and knots @@ -29,27 +30,27 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double double c0, c1, c2, c3; c0 = coefficient * - (-pow(knots[0], 3) / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (-cube(knots[0]) / + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); c1 = coefficient * - (3 * pow(knots[0], 2) / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (3.0 * square(knots[0]) / + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); c2 = coefficient * - (-3 * knots[0] / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (-3.0 * knots[0] / + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); c3 = coefficient * - (1 / - (-pow(knots[0], 3) + pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + - pow(knots[0], 2) * knots[3] - knots[0] * knots[1] * knots[2] - + (1.0 / + (-cube(knots[0]) + square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + + square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); constants.push_back(c0); @@ -57,245 +58,245 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double constants.push_back(c2); constants.push_back(c3); c0 = coefficient * - (pow(knots[1], 2) * knots[4] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (square(knots[1]) * knots[4] / + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) + - pow(knots[0], 2) * knots[2] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + square(knots[0]) * knots[2] / + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) + knots[0] * knots[1] * knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); c1 = coefficient * - (-pow(knots[1], 2) / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-square(knots[1]) / + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) - - 2 * knots[1] * knots[4] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + 2.0 * knots[1] * knots[4] / + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) - - pow(knots[0], 2) / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + square(knots[0]) / + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - - 2 * knots[0] * knots[2] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) - + 2.0 * knots[0] * knots[2] / + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) - knots[0] * knots[1] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) - knots[0] * knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) - + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) - knots[1] * knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); c2 = coefficient * - (2 * knots[1] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (2.0 * knots[1] / + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) + knots[4] / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) + - 2 * knots[0] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + 2.0 * knots[0] / + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) + knots[2] / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) + knots[0] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) + knots[1] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2)) + + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3])) + knots[3] / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); c3 = coefficient * - (-1 / - (-pow(knots[1], 3) + pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + - pow(knots[1], 2) * knots[4] - knots[1] * knots[2] * knots[3] - + (-1.0 / + (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + + square(knots[1]) * knots[4] - knots[1] * knots[2] * knots[3] - knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + knots[2] * knots[3] * knots[4]) - - 1 / - (-pow(knots[0], 2) * knots[1] + pow(knots[0], 2) * knots[2] + + 1.0 / + (-square(knots[0]) * knots[1] + square(knots[0]) * knots[2] + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - - knots[0] * pow(knots[2], 2) - knots[0] * knots[2] * knots[3] - - knots[1] * knots[2] * knots[3] + pow(knots[2], 2) * knots[3]) - - 1 / - (-knots[0] * pow(knots[1], 2) + knots[0] * knots[1] * knots[2] + + knots[0] * square(knots[2]) - knots[0] * knots[2] * knots[3] - + knots[1] * knots[2] * knots[3] + square(knots[2]) * knots[3]) - + 1.0 / + (-knots[0] * square(knots[1]) + knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + - pow(knots[1], 2) * knots[3] - knots[1] * knots[2] * knots[3] - - knots[1] * pow(knots[3], 2) + knots[2] * pow(knots[3], 2))); + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - + knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); constants.push_back(c0); constants.push_back(c1); constants.push_back(c2); constants.push_back(c3); c0 = coefficient * - (-knots[0] * pow(knots[3], 2) / + (-knots[0] * square(knots[3]) / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) - knots[1] * knots[3] * knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - - knots[2] * pow(knots[4], 2) / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - + knots[2] * square(knots[4]) / + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); c1 = coefficient * - (2 * knots[0] * knots[3] / + (2.0 * knots[0] * knots[3] / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + - pow(knots[3], 2) / + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) + + square(knots[3]) / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) + knots[1] * knots[3] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + knots[1] * knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + knots[3] * knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + - 2 * knots[2] * knots[4] / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + + 2.0 * knots[2] * knots[4] / + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) + - pow(knots[4], 2) / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4])) + + square(knots[4]) / + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); c2 = coefficient * (-knots[0] / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - - 2 * knots[3] / + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) - + 2.0 * knots[3] / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) - + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) - knots[1] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - knots[3] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - knots[4] / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) - + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) - knots[2] / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2)) - - 2 * knots[4] / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4])) - + 2.0 * knots[4] / + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); c3 = coefficient * - (1 / + (1.0 / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + - knots[0] * knots[2] * knots[3] - knots[0] * pow(knots[3], 2) + - knots[1] * knots[2] * knots[3] - knots[1] * pow(knots[3], 2) - - knots[2] * pow(knots[3], 2) + pow(knots[3], 3)) + - 1 / - (-pow(knots[1], 2) * knots[2] + pow(knots[1], 2) * knots[3] + + knots[0] * knots[2] * knots[3] - knots[0] * square(knots[3]) + + knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) - + knots[2] * square(knots[3]) + cube(knots[3])) + + 1.0 / + (-square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - - knots[1] * pow(knots[3], 2) - knots[1] * knots[3] * knots[4] - - knots[2] * knots[3] * knots[4] + pow(knots[3], 2) * knots[4]) + - 1 / - (-knots[1] * pow(knots[2], 2) + knots[1] * knots[2] * knots[3] + + knots[1] * square(knots[3]) - knots[1] * knots[3] * knots[4] - + knots[2] * knots[3] * knots[4] + square(knots[3]) * knots[4]) + + 1.0 / + (-knots[1] * square(knots[2]) + knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + - pow(knots[2], 2) * knots[4] - knots[2] * knots[3] * knots[4] - - knots[2] * pow(knots[4], 2) + knots[3] * pow(knots[4], 2))); + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - + knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); constants.push_back(c0); constants.push_back(c1); constants.push_back(c2); constants.push_back(c3); c0 = coefficient * - (pow(knots[4], 3) / + (cube(knots[4]) / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); c1 = coefficient * - (-3 * pow(knots[4], 2) / + (-3.0 * square(knots[4]) / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); c2 = coefficient * - (3 * knots[4] / + (3.0 * knots[4] / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); c3 = coefficient * - (-1 / + (-1.0 / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + - knots[1] * knots[3] * knots[4] - knots[1] * pow(knots[4], 2) + - knots[2] * knots[3] * knots[4] - knots[2] * pow(knots[4], 2) - knots[3] * pow(knots[4], 2) + - pow(knots[4], 3))); + knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + + cube(knots[4]))); constants.push_back(c0); constants.push_back(c1); constants.push_back(c2); From 801ceea90abda4715d03900aa95833f322443eb4 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 1 Apr 2024 18:33:02 -0400 Subject: [PATCH 36/65] Pimplifying the code Attempt-1 --- src/KOKKOS/pair_uf3_kokkos.cpp | 59 +++--- src/ML-UF3/pair_uf3.cpp | 331 ++++++++++++++++++++------------- src/ML-UF3/pair_uf3.h | 28 ++- 3 files changed, 262 insertions(+), 156 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 176fc9fe05..3be2eae34d 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -18,6 +18,7 @@ Richard Hennig (Univ of Florida) ---------------------------------------------------------------------- */ +#include "pair_uf3.h" #include "pair_uf3_kokkos.h" #include "atom_kokkos.h" @@ -55,6 +56,7 @@ template PairUF3Kokkos::PairUF3Kokkos(LAMMPS *lmp execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TAG_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; + } template PairUF3Kokkos::~PairUF3Kokkos() @@ -270,6 +272,8 @@ template void PairUF3Kokkos::create_coefficients( template void PairUF3Kokkos::create_2b_coefficients() { const int num_of_elements = atom->ntypes; + std::vector>>& n2b_knot = get_n2b_knot(); + std::vector>>& n2b_coeff = get_n2b_coeff(); // Setup interaction pair map //TODO: Instead of using map2b and map3b use simple indexing @@ -317,7 +321,7 @@ template void PairUF3Kokkos::create_2b_coefficien for (int k = 0; k < n2b_knot[i][j].size(); k++) { d_n2b_knot_view(map2b_view(i, j), k) = n2b_knot[i][j][k]; } - d_n2b_knot_spacings_view(map2b_view(i, j)) = UFBS2b[i][j].knot_spacing; + d_n2b_knot_spacings_view(map2b_view(i, j)) = get_knot_spacing_2b(i,j); } } @@ -361,6 +365,10 @@ template void PairUF3Kokkos::create_2b_coefficien template void PairUF3Kokkos::create_3b_coefficients() { const int num_of_elements = atom->ntypes; + std::vector>>>>& n3b_knot_matrix = + get_n3b_knot_matrix(); + //std::unordered_map>>>& + // n3b_coeff_matrix = get_n3b_coeff_matrix(); // Init interaction map for 3B Kokkos::realloc(map3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); @@ -393,7 +401,8 @@ template void PairUF3Kokkos::create_3b_coefficien max_knots = max(max_knots, max(n3b_knot_matrix[i][j][k][0].size(), - max(n3b_knot_matrix[i][j][k][1].size(), n3b_knot_matrix[i][j][k][2].size()))); + max(n3b_knot_matrix[i][j][k][1].size(), + n3b_knot_matrix[i][j][k][2].size()))); // Init knot matrix view @@ -412,9 +421,12 @@ template void PairUF3Kokkos::create_3b_coefficien for (int m = 0; m < n3b_knot_matrix[i][j][k][2].size(); m++) d_n3b_knot_matrix_view(map3b_view(i, j, k), 2, m) = n3b_knot_matrix[i][j][k][2][m]; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = UFBS3b[i][j][k].knot_spacing_ij; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = UFBS3b[i][j][k].knot_spacing_ik; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = UFBS3b[i][j][k].knot_spacing_jk; + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = get_knot_spacing_3b_ij(i,j,k); + //uf3_impl->UFBS3b[i][j][k].knot_spacing_ij; + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = get_knot_spacing_3b_ik(i,j,k); + //uf3_impl->UFBS3b[i][j][k].knot_spacing_ik; + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = get_knot_spacing_3b_jk(i,j,k); + //uf3_impl->UFBS3b[i][j][k].knot_spacing_jk; } Kokkos::deep_copy(d_n3b_knot_matrix, d_n3b_knot_matrix_view); Kokkos::deep_copy(d_n3b_knot_matrix_spacings, d_n3b_knot_matrix_spacings_view); @@ -448,10 +460,13 @@ template void PairUF3Kokkos::create_3b_coefficien for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); - for (int i = 0; i < n3b_coeff_matrix[key].size(); i++) { - for (int j = 0; j < n3b_coeff_matrix[key][i].size(); j++) { - for (int k = 0; k < n3b_coeff_matrix[key][i][j].size() - 1; k++) { - d_coefficients_3b_view(map3b_view(n, m, o), i, j, k) = n3b_coeff_matrix[key][i][j][k]; + std::vector>> n3b_coeff_matrix_key = + get_n3b_coeff_matrix_key(key); + for (int i = 0; i < n3b_coeff_matrix_key.size(); i++) { + for (int j = 0; j < n3b_coeff_matrix_key[i].size(); j++) { + for (int k = 0; k < n3b_coeff_matrix_key[i][j].size() - 1; k++) { + d_coefficients_3b_view(map3b_view(n, m, o), i, j, k) = + n3b_coeff_matrix_key[i][j][k]; } } } @@ -483,37 +498,39 @@ template void PairUF3Kokkos::create_3b_coefficien for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); - for (int i = 0; i < n3b_coeff_matrix[key].size(); i++) { - for (int j = 0; j < n3b_coeff_matrix[key][i].size(); j++) { - for (int k = 0; k < n3b_coeff_matrix[key][i][j].size() - 1; k++) { + std::vector>> n3b_coeff_matrix_key = + get_n3b_coeff_matrix_key(key); + for (int i = 0; i < n3b_coeff_matrix_key.size(); i++) { + for (int j = 0; j < n3b_coeff_matrix_key[i].size(); j++) { + for (int k = 0; k < n3b_coeff_matrix_key[i][j].size() - 1; k++) { F_FLOAT dntemp4 = 3 / (n3b_knot_matrix[n][m][o][0][k + 4] - n3b_knot_matrix[n][m][o][0][k + 1]); d_dncoefficients_3b_view(map3b_view(n, m, o), 2, i, j, k) = - (n3b_coeff_matrix[key][i][j][k + 1] - n3b_coeff_matrix[key][i][j][k]) * dntemp4; + (n3b_coeff_matrix_key[i][j][k + 1] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } - for (int i = 0; i < n3b_coeff_matrix[key].size(); i++) { + for (int i = 0; i < n3b_coeff_matrix_key.size(); i++) { std::vector> dncoeff_vect2; - for (int j = 0; j < n3b_coeff_matrix[key][i].size() - 1; j++) { + for (int j = 0; j < n3b_coeff_matrix_key[i].size() - 1; j++) { F_FLOAT dntemp4 = 3 / (n3b_knot_matrix[n][m][o][1][j + 4] - n3b_knot_matrix[n][m][o][1][j + 1]); std::vector dncoeff_vect; - for (int k = 0; k < n3b_coeff_matrix[key][i][j].size(); k++) { + for (int k = 0; k < n3b_coeff_matrix_key[i][j].size(); k++) { d_dncoefficients_3b_view(map3b_view(n, m, o), 1, i, j, k) = - (n3b_coeff_matrix[key][i][j + 1][k] - n3b_coeff_matrix[key][i][j][k]) * dntemp4; + (n3b_coeff_matrix_key[i][j + 1][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } - for (int i = 0; i < n3b_coeff_matrix[key].size() - 1; i++) { + for (int i = 0; i < n3b_coeff_matrix_key.size() - 1; i++) { F_FLOAT dntemp4 = 3 / (n3b_knot_matrix[n][m][o][2][i + 4] - n3b_knot_matrix[n][m][o][2][i + 1]); - for (int j = 0; j < n3b_coeff_matrix[key][i].size(); j++) { - for (int k = 0; k < n3b_coeff_matrix[key][i][j].size(); k++) { + for (int j = 0; j < n3b_coeff_matrix_key[i].size(); j++) { + for (int k = 0; k < n3b_coeff_matrix_key[i][j].size(); k++) { d_dncoefficients_3b_view(map3b_view(n, m, o), 0, i, j, k) = - (n3b_coeff_matrix[key][i + 1][j][k] - n3b_coeff_matrix[key][i][j][k]) * dntemp4; + (n3b_coeff_matrix_key[i + 1][j][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 858f25cb8d..4bd4e64980 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -34,6 +34,20 @@ #include "text_file_reader.h" #include +#include + +namespace LAMMPS_NS{ + struct UF3Impl { + //int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; + //double ***cut_3b, **cut_3b_list, ****min_cut_3b; + + std::vector>> n2b_knot, n2b_coeff; + std::vector>>>> n3b_knot_matrix; + std::unordered_map>>> n3b_coeff_matrix; + std::vector> UFBS2b; + std::vector>> UFBS3b; + }; +} using namespace LAMMPS_NS; using MathConst::THIRD; @@ -41,9 +55,18 @@ using MathConst::THIRD; /* ---------------------------------------------------------------------- */ PairUF3::PairUF3(LAMMPS *lmp) : + //Pair(lmp), cut(nullptr) Pair(lmp), setflag_3b(nullptr), knot_spacing_type_2b(nullptr), knot_spacing_type_3b(nullptr), cut(nullptr), cut_3b(nullptr), cut_3b_list(nullptr), min_cut_3b(nullptr) { + uf3_impl = new UF3Impl; + //uf3_impl->setflag_3b = nullptr; + //uf3_impl->knot_spacing_type_2b = nullptr; + //uf3_impl->knot_spacing_type_3b = nullptr; + //uf3_impl->cut_3b = nullptr; + //uf3_impl->cut_3b_list = nullptr; + //uf3_impl->min_cut_3b = nullptr; + single_enable = 1; // 1 if single() routine exists restartinfo = 0; // 1 if pair style writes restart info maxshort = 10; @@ -73,6 +96,7 @@ PairUF3::~PairUF3() memory->destroy(knot_spacing_type_3b); } } + delete uf3_impl; } /* ---------------------------------------------------------------------- @@ -155,27 +179,28 @@ void PairUF3::allocate() "pair:knot_spacing_2b"); // Contains knot_vect of 2-body potential for type i and j - n2b_knot.resize(num_of_elements + 1); - n2b_coeff.resize(num_of_elements + 1); - UFBS2b.resize(num_of_elements + 1); + uf3_impl->n2b_knot.resize(num_of_elements + 1); + uf3_impl->n2b_coeff.resize(num_of_elements + 1); + uf3_impl->UFBS2b.resize(num_of_elements + 1); for (int i = 1; i < num_of_elements + 1; i++) { - n2b_knot[i].resize(num_of_elements + 1); - n2b_coeff[i].resize(num_of_elements + 1); - UFBS2b[i].resize(num_of_elements + 1); + uf3_impl->n2b_knot[i].resize(num_of_elements + 1); + uf3_impl->n2b_coeff[i].resize(num_of_elements + 1); + uf3_impl->UFBS2b[i].resize(num_of_elements + 1); } if (pot_3b) { // Contains info about wether UF potential were found for type i, j and k - memory->create(setflag_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, - "pair:setflag_3b"); + memory->create(setflag_3b, num_of_elements + 1, num_of_elements + 1, + num_of_elements + 1, "pair:setflag_3b"); // Contains info about 3-body cutoff distance for type i, j and k - memory->create(cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, - "pair:cut_3b"); + memory->create(cut_3b, num_of_elements + 1, num_of_elements + 1, + num_of_elements + 1, "pair:cut_3b"); // Contains info about 3-body cutoff distance for type i, j and k // for constructing 3-body list - memory->create(cut_3b_list, num_of_elements + 1, num_of_elements + 1, "pair:cut_3b_list"); + memory->create(cut_3b_list, num_of_elements + 1, num_of_elements + 1, + "pair:cut_3b_list"); // Contains info about minimum 3-body cutoff distance for type i, j and k - memory->create(min_cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, 3, - "pair:min_cut_3b"); + memory->create(min_cut_3b, num_of_elements + 1, num_of_elements + 1, + num_of_elements + 1, 3, "pair:min_cut_3b"); //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) //1 = non-uniform knot spacing memory->create(knot_spacing_type_3b, num_of_elements + 1, num_of_elements + 1, @@ -193,14 +218,14 @@ void PairUF3::allocate() } } } - n3b_knot_matrix.resize(num_of_elements + 1); - UFBS3b.resize(num_of_elements + 1); + uf3_impl->n3b_knot_matrix.resize(num_of_elements + 1); + uf3_impl->UFBS3b.resize(num_of_elements + 1); for (int i = 1; i < num_of_elements + 1; i++) { - n3b_knot_matrix[i].resize(num_of_elements + 1); - UFBS3b[i].resize(num_of_elements + 1); + uf3_impl->n3b_knot_matrix[i].resize(num_of_elements + 1); + uf3_impl->UFBS3b[i].resize(num_of_elements + 1); for (int j = 1; j < num_of_elements + 1; j++) { - n3b_knot_matrix[i][j].resize(num_of_elements + 1); - UFBS3b[i][j].resize(num_of_elements + 1); + uf3_impl->n3b_knot_matrix[i][j].resize(num_of_elements + 1); + uf3_impl->UFBS3b[i][j].resize(num_of_elements + 1); } } memory->create(neighshort, maxshort, "pair:neighshort"); @@ -290,11 +315,11 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_2b, fp4th_line.count()); - n2b_knot[itype][jtype].resize(num_knots_2b); - n2b_knot[jtype][itype].resize(num_knots_2b); + uf3_impl->n2b_knot[itype][jtype].resize(num_knots_2b); + uf3_impl->n2b_knot[jtype][itype].resize(num_knots_2b); for (int k = 0; k < num_knots_2b; k++) { - n2b_knot[itype][jtype][k] = fp4th_line.next_double(); - n2b_knot[jtype][itype][k] = n2b_knot[itype][jtype][k]; + uf3_impl->n2b_knot[itype][jtype][k] = fp4th_line.next_double(); + uf3_impl->n2b_knot[jtype][itype][k] = uf3_impl->n2b_knot[itype][jtype][k]; } temp_line = txtfilereader.next_line(1); @@ -308,14 +333,14 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", num_of_coeff_2b, fp6th_line.count()); - n2b_coeff[itype][jtype].resize(num_of_coeff_2b); - n2b_coeff[jtype][itype].resize(num_of_coeff_2b); + uf3_impl->n2b_coeff[itype][jtype].resize(num_of_coeff_2b); + uf3_impl->n2b_coeff[jtype][itype].resize(num_of_coeff_2b); for (int k = 0; k < num_of_coeff_2b; k++) { - n2b_coeff[itype][jtype][k] = fp6th_line.next_double(); - n2b_coeff[jtype][itype][k] = n2b_coeff[itype][jtype][k]; + uf3_impl->n2b_coeff[itype][jtype][k] = fp6th_line.next_double(); + uf3_impl->n2b_coeff[jtype][itype][k] = uf3_impl->n2b_coeff[itype][jtype][k]; } - if (n2b_knot[itype][jtype].size() != n2b_coeff[itype][jtype].size() + 4) { + if (uf3_impl->n2b_knot[itype][jtype].size() != uf3_impl->n2b_coeff[itype][jtype].size() + 4) { error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", potf_name); } @@ -326,6 +351,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name) { + int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); @@ -420,19 +446,19 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_3b_jk, fp4th_line.count()); - n3b_knot_matrix[itype][jtype][ktype].resize(3); - n3b_knot_matrix[itype][ktype][jtype].resize(3); + uf3_impl->n3b_knot_matrix[itype][jtype][ktype].resize(3); + uf3_impl->n3b_knot_matrix[itype][ktype][jtype].resize(3); - n3b_knot_matrix[itype][jtype][ktype][0].resize(num_knots_3b_jk); - n3b_knot_matrix[itype][ktype][jtype][0].resize(num_knots_3b_jk); + uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0].resize(num_knots_3b_jk); + uf3_impl->n3b_knot_matrix[itype][ktype][jtype][0].resize(num_knots_3b_jk); for (int i = 0; i < num_knots_3b_jk; i++) { - n3b_knot_matrix[itype][jtype][ktype][0][i] = fp4th_line.next_double(); - n3b_knot_matrix[itype][ktype][jtype][0][i] = n3b_knot_matrix[itype][jtype][ktype][0][i]; + uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0][i] = fp4th_line.next_double(); + uf3_impl->n3b_knot_matrix[itype][ktype][jtype][0][i] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0][i]; } - min_cut_3b[itype][jtype][ktype][0] = n3b_knot_matrix[itype][jtype][ktype][0][0]; - min_cut_3b[itype][ktype][jtype][0] = n3b_knot_matrix[itype][ktype][jtype][0][0]; + min_cut_3b[itype][jtype][ktype][0] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0][0]; + min_cut_3b[itype][ktype][jtype][0] = uf3_impl->n3b_knot_matrix[itype][ktype][jtype][0][0]; int num_knots_3b_ik = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(num_knots_3b_ik); @@ -442,15 +468,15 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name error->all(FLERR, "UF3: Expected {} numbers on 5th line but found {} numbers", num_knots_3b_ik, fp5th_line.count()); - n3b_knot_matrix[itype][jtype][ktype][1].resize(num_knots_3b_ik); - n3b_knot_matrix[itype][ktype][jtype][2].resize(num_knots_3b_ik); + uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1].resize(num_knots_3b_ik); + uf3_impl->n3b_knot_matrix[itype][ktype][jtype][2].resize(num_knots_3b_ik); for (int i = 0; i < num_knots_3b_ik; i++) { - n3b_knot_matrix[itype][jtype][ktype][1][i] = fp5th_line.next_double(); - n3b_knot_matrix[itype][ktype][jtype][2][i] = n3b_knot_matrix[itype][jtype][ktype][1][i]; + uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1][i] = fp5th_line.next_double(); + uf3_impl->n3b_knot_matrix[itype][ktype][jtype][2][i] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1][i]; } - min_cut_3b[itype][jtype][ktype][1] = n3b_knot_matrix[itype][jtype][ktype][1][0]; - min_cut_3b[itype][ktype][jtype][2] = n3b_knot_matrix[itype][ktype][jtype][2][0]; + min_cut_3b[itype][jtype][ktype][1] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1][0]; + min_cut_3b[itype][ktype][jtype][2] = uf3_impl->n3b_knot_matrix[itype][ktype][jtype][2][0]; int num_knots_3b_ij = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(num_knots_3b_ij); @@ -460,15 +486,15 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", num_knots_3b_ij, fp5th_line.count()); - n3b_knot_matrix[itype][jtype][ktype][2].resize(num_knots_3b_ij); - n3b_knot_matrix[itype][ktype][jtype][1].resize(num_knots_3b_ij); + uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2].resize(num_knots_3b_ij); + uf3_impl->n3b_knot_matrix[itype][ktype][jtype][1].resize(num_knots_3b_ij); for (int i = 0; i < num_knots_3b_ij; i++) { - n3b_knot_matrix[itype][jtype][ktype][2][i] = fp6th_line.next_double(); - n3b_knot_matrix[itype][ktype][jtype][1][i] = n3b_knot_matrix[itype][jtype][ktype][2][i]; + uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2][i] = fp6th_line.next_double(); + uf3_impl->n3b_knot_matrix[itype][ktype][jtype][1][i] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2][i]; } - min_cut_3b[itype][jtype][ktype][2] = n3b_knot_matrix[itype][jtype][ktype][2][0]; - min_cut_3b[itype][ktype][jtype][1] = n3b_knot_matrix[itype][ktype][jtype][1][0]; + min_cut_3b[itype][jtype][ktype][2] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2][0]; + min_cut_3b[itype][ktype][jtype][1] = uf3_impl->n3b_knot_matrix[itype][ktype][jtype][1][0]; temp_line = txtfilereader.next_line(3); ValueTokenizer fp7th_line(temp_line); @@ -484,19 +510,19 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name coeff_matrix_dim2 = fp7th_line.next_int(); coeff_matrix_dim3 = fp7th_line.next_int(); - if (n3b_knot_matrix[itype][jtype][ktype][0].size() != coeff_matrix_dim3 + 3 + 1) + if (uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0].size() != coeff_matrix_dim3 + 3 + 1) error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and " "coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", potf_name); - if (n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) + if (uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and " "coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1", potf_name); - if (n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) + if (uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) error->all(FLERR, "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and " "coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1", @@ -505,39 +531,39 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name coeff_matrix_elements_len = coeff_matrix_dim3; std::string key = std::to_string(itype) + std::to_string(jtype) + std::to_string(ktype); - n3b_coeff_matrix[key].resize(coeff_matrix_dim1); + uf3_impl->n3b_coeff_matrix[key].resize(coeff_matrix_dim1); int line_count = 0; for (int i = 0; i < coeff_matrix_dim1; i++) { - n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); + uf3_impl->n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); for (int j = 0; j < coeff_matrix_dim2; j++) { temp_line = txtfilereader.next_line(coeff_matrix_elements_len); ValueTokenizer coeff_line(temp_line); - n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); + uf3_impl->n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); if (coeff_line.count() != coeff_matrix_elements_len) error->all(FLERR, "UF3: Expected {} numbers on {}th line but found {} numbers", coeff_matrix_elements_len, line_count + 8, coeff_line.count()); for (int k = 0; k < coeff_matrix_dim3; k++) { - n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); + uf3_impl->n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); } line_count += 1; } } std::string key2 = std::to_string(itype) + std::to_string(ktype) + std::to_string(jtype); - n3b_coeff_matrix[key2].resize(coeff_matrix_dim2); + uf3_impl->n3b_coeff_matrix[key2].resize(coeff_matrix_dim2); for (int j = 0; j < coeff_matrix_dim2; j++) { - n3b_coeff_matrix[key2][j].resize(coeff_matrix_dim1); + uf3_impl->n3b_coeff_matrix[key2][j].resize(coeff_matrix_dim1); for (int i = 0; i < coeff_matrix_dim1; i++) { - n3b_coeff_matrix[key2][j][i].resize(coeff_matrix_dim3); + uf3_impl->n3b_coeff_matrix[key2][j][i].resize(coeff_matrix_dim3); } } for (int i = 0; i < coeff_matrix_dim1; i++) { for (int j = 0; j < coeff_matrix_dim2; j++) { for (int k = 0; k < coeff_matrix_dim3; k++) { - n3b_coeff_matrix[key2][j][i][k] = n3b_coeff_matrix[key][i][j][k]; + uf3_impl->n3b_coeff_matrix[key2][j][i][k] = uf3_impl->n3b_coeff_matrix[key][i][j][k]; } } } @@ -580,11 +606,11 @@ void PairUF3::uf3_read_pot_file(char *potf_name) temp_line = txtfilereader.next_line(temp_line_len); ValueTokenizer fp4th_line(temp_line); - n2b_knot[temp_type1][temp_type2].resize(temp_line_len); - n2b_knot[temp_type2][temp_type1].resize(temp_line_len); + uf3_impl->n2b_knot[temp_type1][temp_type2].resize(temp_line_len); + uf3_impl->n2b_knot[temp_type2][temp_type1].resize(temp_line_len); for (int k = 0; k < temp_line_len; k++) { - n2b_knot[temp_type1][temp_type2][k] = fp4th_line.next_double(); - n2b_knot[temp_type2][temp_type1][k] = n2b_knot[temp_type1][temp_type2][k]; + uf3_impl->n2b_knot[temp_type1][temp_type2][k] = fp4th_line.next_double(); + uf3_impl->n2b_knot[temp_type2][temp_type1][k] = uf3_impl->n2b_knot[temp_type1][temp_type2][k]; } temp_line = txtfilereader.next_line(1); @@ -594,20 +620,21 @@ void PairUF3::uf3_read_pot_file(char *potf_name) temp_line = txtfilereader.next_line(temp_line_len); ValueTokenizer fp6th_line(temp_line); - n2b_coeff[temp_type1][temp_type2].resize(temp_line_len); - n2b_coeff[temp_type2][temp_type1].resize(temp_line_len); + uf3_impl->n2b_coeff[temp_type1][temp_type2].resize(temp_line_len); + uf3_impl->n2b_coeff[temp_type2][temp_type1].resize(temp_line_len); for (int k = 0; k < temp_line_len; k++) { - n2b_coeff[temp_type1][temp_type2][k] = fp6th_line.next_double(); - n2b_coeff[temp_type2][temp_type1][k] = n2b_coeff[temp_type1][temp_type2][k]; + uf3_impl->n2b_coeff[temp_type1][temp_type2][k] = fp6th_line.next_double(); + uf3_impl->n2b_coeff[temp_type2][temp_type1][k] = uf3_impl->n2b_coeff[temp_type1][temp_type2][k]; } - if (n2b_knot[temp_type1][temp_type2].size() != n2b_coeff[temp_type1][temp_type2].size() + 4) { + if (uf3_impl->n2b_knot[temp_type1][temp_type2].size() != uf3_impl->n2b_coeff[temp_type1][temp_type2].size() + 4) { error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", potf_name); } setflag[temp_type1][temp_type2] = 1; setflag[temp_type2][temp_type1] = 1; } else if (fp2nd_line.contains("3B") == 1) { + int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; temp_line = txtfilereader.next_line(9); ValueTokenizer fp3rd_line(temp_line); int temp_type1 = fp3rd_line.next_int(); @@ -618,7 +645,9 @@ void PairUF3::uf3_read_pot_file(char *potf_name) double cut3b_rij = fp3rd_line.next_double(); // cut_3b[temp_type1][temp_type2] = std::max(cut3b_rij, // cut_3b[temp_type1][temp_type2]); - cut_3b_list[temp_type1][temp_type2] = std::max(cut3b_rij, cut_3b_list[temp_type1][temp_type2]); + cut_3b_list[temp_type1][temp_type2] = + std::max(cut3b_rij, cut_3b_list[temp_type1][temp_type2]); + double cut3b_rik = fp3rd_line.next_double(); if (cut3b_rij != cut3b_rik) { error->all(FLERR, "UF3: rij!=rik, Current implementation only works for rij=rik"); @@ -628,7 +657,8 @@ void PairUF3::uf3_read_pot_file(char *potf_name) "UF3: 2rij=2rik!=rik, Current implementation only works for 2rij=2rik!=rik"); } // cut_3b[temp_type1][temp_type3] = std::max(cut_3b[temp_type1][temp_type3],cut3b_rik); - cut_3b_list[temp_type1][temp_type3] = std::max(cut_3b_list[temp_type1][temp_type3], cut3b_rik); + cut_3b_list[temp_type1][temp_type3] = + std::max(cut_3b_list[temp_type1][temp_type3], cut3b_rik); cut_3b[temp_type1][temp_type2][temp_type3] = cut3b_rij; cut_3b[temp_type1][temp_type3][temp_type2] = cut3b_rik; @@ -637,53 +667,53 @@ void PairUF3::uf3_read_pot_file(char *potf_name) temp_line = txtfilereader.next_line(temp_line_len); ValueTokenizer fp4th_line(temp_line); - n3b_knot_matrix[temp_type1][temp_type2][temp_type3].resize(3); - n3b_knot_matrix[temp_type1][temp_type3][temp_type2].resize(3); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3].resize(3); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2].resize(3); - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].resize(temp_line_len); - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0].resize(temp_line_len); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].resize(temp_line_len); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0].resize(temp_line_len); for (int i = 0; i < temp_line_len; i++) { - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i] = fp4th_line.next_double(); - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][i] = - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i] = fp4th_line.next_double(); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][i] = + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i]; } min_cut_3b[temp_type1][temp_type2][temp_type3][0] = - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][0]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][0]; min_cut_3b[temp_type1][temp_type3][temp_type2][0] = - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][0]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][0]; temp_line_len = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(temp_line_len); ValueTokenizer fp5th_line(temp_line); - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].resize(temp_line_len); - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2].resize(temp_line_len); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].resize(temp_line_len); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2].resize(temp_line_len); for (int i = 0; i < temp_line_len; i++) { - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i] = fp5th_line.next_double(); - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][i] = - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i] = fp5th_line.next_double(); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][i] = + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i]; } min_cut_3b[temp_type1][temp_type2][temp_type3][1] = - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][0]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][0]; min_cut_3b[temp_type1][temp_type3][temp_type2][2] = - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][0]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][0]; temp_line_len = fp3rd_line.next_int(); temp_line = txtfilereader.next_line(temp_line_len); ValueTokenizer fp6th_line(temp_line); - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].resize(temp_line_len); - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1].resize(temp_line_len); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].resize(temp_line_len); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1].resize(temp_line_len); for (int i = 0; i < temp_line_len; i++) { - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i] = fp6th_line.next_double(); - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][i] = - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i] = fp6th_line.next_double(); + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][i] = + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i]; } min_cut_3b[temp_type1][temp_type2][temp_type3][2] = - n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][0]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][0]; min_cut_3b[temp_type1][temp_type3][temp_type2][1] = - n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][0]; + uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][0]; temp_line = txtfilereader.next_line(3); ValueTokenizer fp7th_line(temp_line); @@ -691,17 +721,17 @@ void PairUF3::uf3_read_pot_file(char *potf_name) coeff_matrix_dim1 = fp7th_line.next_int(); coeff_matrix_dim2 = fp7th_line.next_int(); coeff_matrix_dim3 = fp7th_line.next_int(); - if (n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].size() != + if (uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].size() != coeff_matrix_dim3 + 3 + 1) { error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", potf_name); } - if (n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].size() != + if (uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].size() != coeff_matrix_dim2 + 3 + 1) { error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", potf_name); } - if (n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].size() != + if (uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].size() != coeff_matrix_dim1 + 3 + 1) { error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", potf_name); @@ -711,23 +741,24 @@ void PairUF3::uf3_read_pot_file(char *potf_name) std::string key = std::to_string(temp_type1) + std::to_string(temp_type2) + std::to_string(temp_type3); - n3b_coeff_matrix[key].resize(coeff_matrix_dim1); + uf3_impl->n3b_coeff_matrix[key].resize(coeff_matrix_dim1); for (int i = 0; i < coeff_matrix_dim1; i++) { - n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); + uf3_impl->n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); for (int j = 0; j < coeff_matrix_dim2; j++) { temp_line = txtfilereader.next_line(coeff_matrix_elements_len); ValueTokenizer coeff_line(temp_line); - n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); + uf3_impl->n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); for (int k = 0; k < coeff_matrix_dim3; k++) { - n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); + uf3_impl->n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); } } } key = std::to_string(temp_type1) + std::to_string(temp_type3) + std::to_string(temp_type2); - n3b_coeff_matrix[key] = - n3b_coeff_matrix[std::to_string(temp_type1) + std::to_string(temp_type2) + - std::to_string(temp_type3)]; + uf3_impl->n3b_coeff_matrix[key] = + uf3_impl->n3b_coeff_matrix[std::to_string(temp_type1) + + std::to_string(temp_type2) + + std::to_string(temp_type3)]; setflag_3b[temp_type1][temp_type2][temp_type3] = 1; setflag_3b[temp_type1][temp_type3][temp_type2] = 1; } else @@ -799,19 +830,20 @@ void PairUF3::create_bsplines() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - UFBS2b[i][j] = - uf3_pair_bspline(lmp, n2b_knot[i][j], n2b_coeff[i][j], knot_spacing_type_2b[i][j]); - UFBS2b[j][i] = UFBS2b[i][j]; + uf3_impl->UFBS2b[i][j] = + uf3_pair_bspline(lmp, uf3_impl->n2b_knot[i][j], uf3_impl->n2b_coeff[i][j], + knot_spacing_type_2b[i][j]); + uf3_impl->UFBS2b[j][i] = uf3_impl->UFBS2b[i][j]; } if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - UFBS3b[i][j][k] = uf3_triplet_bspline( - lmp, n3b_knot_matrix[i][j][k], n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); + uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( + lmp, uf3_impl->n3b_knot_matrix[i][j][k], uf3_impl->n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); - UFBS3b[i][k][j] = uf3_triplet_bspline( - lmp, n3b_knot_matrix[i][k][j], n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]); + uf3_impl->UFBS3b[i][k][j] = uf3_triplet_bspline( + lmp, uf3_impl->n3b_knot_matrix[i][k][j], uf3_impl->n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]); } } } @@ -879,7 +911,7 @@ void PairUF3::compute(int eflag, int vflag) } } - double *pair_eval = UFBS2b[itype][jtype].eval(rij); + double *pair_eval = uf3_impl->UFBS2b[itype][jtype].eval(rij); fpair = -1 * pair_eval[1] / rij; @@ -968,9 +1000,10 @@ void PairUF3::compute(int eflag, int vflag) rik = sqrt( ((del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]))); - if ((rij <= cut_3b[itype][jtype][ktype]) && (rik <= cut_3b[itype][ktype][jtype]) && - (rij >= min_cut_3b[itype][jtype][ktype][2]) && - (rik >= min_cut_3b[itype][jtype][ktype][1])) { + if ((rij <= cut_3b[itype][jtype][ktype]) && + (rik <= cut_3b[itype][ktype][jtype]) && + (rij >= min_cut_3b[itype][jtype][ktype][2]) && + (rik >= min_cut_3b[itype][jtype][ktype][1])) { del_rkj[0] = x[k][0] - x[j][0]; del_rkj[1] = x[k][1] - x[j][1]; @@ -979,7 +1012,7 @@ void PairUF3::compute(int eflag, int vflag) ((del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]))); if (rjk >= min_cut_3b[itype][jtype][ktype][0]) { - double *triangle_eval = UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); + double *triangle_eval = uf3_impl->UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); fij[0] = *(triangle_eval + 1) * (del_rji[0] / rij); fji[0] = -fij[0]; @@ -1090,7 +1123,7 @@ double PairUF3::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, double r = sqrt(rsq); if (r < cut[itype][jtype]) { - double *pair_eval = UFBS2b[itype][jtype].eval(r); + double *pair_eval = uf3_impl->UFBS2b[itype][jtype].eval(r); value = pair_eval[0]; fforce = factor_lj * pair_eval[1]; } @@ -1125,21 +1158,21 @@ double PairUF3::memory_usage() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - bytes += (double) 2 * n2b_knot[i][j].size() * sizeof(double); //n2b_knot - bytes += (double) 2 * n2b_coeff[i][j].size() * sizeof(double); //n2b_coeff + bytes += (double) 2 * uf3_impl->n2b_knot[i][j].size() * sizeof(double); //n2b_knot + bytes += (double) 2 * uf3_impl->n2b_coeff[i][j].size() * sizeof(double); //n2b_coeff } if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { - bytes += (double) 2 * n3b_knot_matrix[i][j][k][0].size() * sizeof(double); - bytes += (double) 2 * n3b_knot_matrix[i][j][k][1].size() * sizeof(double); - bytes += (double) 2 * n3b_knot_matrix[i][j][k][2].size() * sizeof(double); + bytes += (double) 2 * uf3_impl->n3b_knot_matrix[i][j][k][0].size() * sizeof(double); + bytes += (double) 2 * uf3_impl->n3b_knot_matrix[i][j][k][1].size() * sizeof(double); + bytes += (double) 2 * uf3_impl->n3b_knot_matrix[i][j][k][2].size() * sizeof(double); std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - for (int l = 0; l < n3b_coeff_matrix[key].size(); l++) { - for (int m = 0; m < n3b_coeff_matrix[key][l].size(); m++) { - bytes += (double) 2 * n3b_coeff_matrix[key][l][m].size() * sizeof(double); + for (int l = 0; l < uf3_impl->n3b_coeff_matrix[key].size(); l++) { + for (int m = 0; m < uf3_impl->n3b_coeff_matrix[key][l].size(); m++) { + bytes += (double) 2 * uf3_impl->n3b_coeff_matrix[key][l][m].size() * sizeof(double); //key = ijk //key = ikj } @@ -1151,12 +1184,12 @@ double PairUF3::memory_usage() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - bytes += (double) 2 * UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] + bytes += (double) 2 * uf3_impl->UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] } if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { - bytes += (double) 2 * UFBS3b[i][j][k].memory_usage(); + bytes += (double) 2 * uf3_impl->UFBS3b[i][j][k].memory_usage(); } } } @@ -1166,3 +1199,49 @@ double PairUF3::memory_usage() return bytes; } + +//Accessor function called by pair_uf3_kokkos.cpp +//Will probably be removed once std::vector are converted to arrays +std::vector>>& PairUF3::get_n2b_knot() +{ + return uf3_impl->n2b_knot; +} + +std::vector>>& PairUF3::get_n2b_coeff() +{ + return uf3_impl->n2b_coeff; +} +//Accessor function called by pair_uf3_kokkos.cpp +//Will probably be removed once std::vector are converted to arrays +std::vector>>>>& + PairUF3::get_n3b_knot_matrix() +{ + return uf3_impl->n3b_knot_matrix; +} + +//Accessor function called by pair_uf3_kokkos.cpp +//Will probably be removed once std::vector are converted to arrays +std::vector>>& + PairUF3::get_n3b_coeff_matrix_key(std::string key) +{ + return uf3_impl->n3b_coeff_matrix[key]; +} + +double PairUF3::get_knot_spacing_2b(int i, int j) +{ + return uf3_impl->UFBS2b[i][j].knot_spacing; +} + +double PairUF3::get_knot_spacing_3b_ij(int i, int j, int k) +{ + return uf3_impl->UFBS3b[i][j][k].knot_spacing_ij; +} +double PairUF3::get_knot_spacing_3b_ik(int i, int j, int k) +{ + return uf3_impl->UFBS3b[i][j][k].knot_spacing_ik; +} +double PairUF3::get_knot_spacing_3b_jk(int i, int j, int k) +{ + return uf3_impl->UFBS3b[i][j][k].knot_spacing_jk; +} + diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index d3e988cc1e..62d35d8954 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -27,12 +27,12 @@ PairStyle(uf3,PairUF3); #ifndef LMP_PAIR_UF3_H #define LMP_PAIR_UF3_H -#include "uf3_pair_bspline.h" -#include "uf3_triplet_bspline.h" +//#include "uf3_pair_bspline.h" +//#include "uf3_triplet_bspline.h" #include "pair.h" -#include +//#include namespace LAMMPS_NS { class PairUF3 : public Pair { @@ -55,17 +55,27 @@ class PairUF3 : public Pair { void uf3_read_pot_file(int i, int j, int k, char *potf_name); int nbody_flag, n2body_pot_files, n3body_pot_files, tot_pot_files; int bsplines_created; - int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; + //int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; bool pot_3b; int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; double **cut, ***cut_3b, **cut_3b_list, ****min_cut_3b; virtual void allocate(); void create_bsplines(); - std::vector>> n2b_knot, n2b_coeff; - std::vector>>>> n3b_knot_matrix; - std::unordered_map>>> n3b_coeff_matrix; - std::vector> UFBS2b; - std::vector>> UFBS3b; + struct UF3Impl *uf3_impl; //PIMPLE (pointer-to-implementation) + UF3Impl *get_UF3Impl(); + + //Accessor function called by pair_uf3_kokkos.cpp + //Will probably be removed once std::vector are converted to arrays + std::vector>>& get_n2b_knot(); + std::vector>>& get_n2b_coeff(); + std::vector>>>>& get_n3b_knot_matrix(); + std::vector>>& get_n3b_coeff_matrix_key(std::string key); + double get_knot_spacing_2b(int i, int j); + double get_knot_spacing_3b_ij(int i, int j, int k); + double get_knot_spacing_3b_ik(int i, int j, int k); + double get_knot_spacing_3b_jk(int i, int j, int k); + //std::vector> UFBS2b; + //std::vector>> UFBS3b; int *neighshort, maxshort; // short neighbor list array for 3body interaction }; From d3bc4c7eb83e8d6aa82747cf4d026462e5cc4ea8 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 2 Apr 2024 11:18:01 -0400 Subject: [PATCH 37/65] Removed commented out code --- src/KOKKOS/pair_uf3_kokkos.cpp | 2 +- src/ML-UF3/pair_uf3.cpp | 10 ---------- src/ML-UF3/pair_uf3.h | 7 ------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 3be2eae34d..7bc6ef22d5 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -148,7 +148,7 @@ void PairUF3Kokkos::allocate() int n = atom->ntypes; memory->destroy(cutsq); //Why are we destroying cutsq? cutsq is allocated when //PairUF3::coeff or PairUF3::allocate is called; in the next step when k_cutsq - //is created cut_3b is set to point to the host array of k_cutsq + //is created cutsq is set to point to the host array of k_cutsq //memory->destroy(cut_3b); memoryKK->create_kokkos(k_cutsq,cutsq,n+1,n+1,"pair:cutsq"); diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 4bd4e64980..a9a1d11acb 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -38,8 +38,6 @@ namespace LAMMPS_NS{ struct UF3Impl { - //int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; - //double ***cut_3b, **cut_3b_list, ****min_cut_3b; std::vector>> n2b_knot, n2b_coeff; std::vector>>>> n3b_knot_matrix; @@ -55,18 +53,10 @@ using MathConst::THIRD; /* ---------------------------------------------------------------------- */ PairUF3::PairUF3(LAMMPS *lmp) : - //Pair(lmp), cut(nullptr) Pair(lmp), setflag_3b(nullptr), knot_spacing_type_2b(nullptr), knot_spacing_type_3b(nullptr), cut(nullptr), cut_3b(nullptr), cut_3b_list(nullptr), min_cut_3b(nullptr) { uf3_impl = new UF3Impl; - //uf3_impl->setflag_3b = nullptr; - //uf3_impl->knot_spacing_type_2b = nullptr; - //uf3_impl->knot_spacing_type_3b = nullptr; - //uf3_impl->cut_3b = nullptr; - //uf3_impl->cut_3b_list = nullptr; - //uf3_impl->min_cut_3b = nullptr; - single_enable = 1; // 1 if single() routine exists restartinfo = 0; // 1 if pair style writes restart info maxshort = 10; diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 62d35d8954..293d359c3f 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -27,12 +27,8 @@ PairStyle(uf3,PairUF3); #ifndef LMP_PAIR_UF3_H #define LMP_PAIR_UF3_H -//#include "uf3_pair_bspline.h" -//#include "uf3_triplet_bspline.h" - #include "pair.h" -//#include namespace LAMMPS_NS { class PairUF3 : public Pair { @@ -55,7 +51,6 @@ class PairUF3 : public Pair { void uf3_read_pot_file(int i, int j, int k, char *potf_name); int nbody_flag, n2body_pot_files, n3body_pot_files, tot_pot_files; int bsplines_created; - //int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; bool pot_3b; int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; double **cut, ***cut_3b, **cut_3b_list, ****min_cut_3b; @@ -74,8 +69,6 @@ class PairUF3 : public Pair { double get_knot_spacing_3b_ij(int i, int j, int k); double get_knot_spacing_3b_ik(int i, int j, int k); double get_knot_spacing_3b_jk(int i, int j, int k); - //std::vector> UFBS2b; - //std::vector>> UFBS3b; int *neighshort, maxshort; // short neighbor list array for 3body interaction }; From 7281f9327b0fd245c0659b0c09fb93b36bfe239a Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 2 Apr 2024 13:14:28 -0400 Subject: [PATCH 38/65] Added code to check if 'UNITS:' metadata is present in the pot file or not --- src/ML-UF3/pair_uf3.cpp | 44 ++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index a9a1d11acb..f4c77e7b4c 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -234,10 +234,10 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) std::string temp_line = txtfilereader.next_line(1); Tokenizer file_header(temp_line); - if (file_header.count() != 2) + if (file_header.count() <= 2) error->all(FLERR, - "UF3: Expected only two words on 1st line of {} but found " - "{} word/s", + "UF3: Expected more than two words on 1st line of {} \n" + "but found {} word/s", potf_name, file_header.count()); if (file_header.contains("#UF3 POT") == 0) @@ -245,6 +245,12 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" "files contain '#UF3 POT'. Found {} in the header", potf_name, temp_line); + + if (file_header.contains("UNITS:") == 0) + error->all(FLERR, + "UF3: {} file does not contain the 'UNITS:' metadata in \n" + "the header", + potf_name); temp_line = txtfilereader.next_line(1); ValueTokenizer fp2nd_line(temp_line); @@ -352,18 +358,24 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name std::string temp_line = txtfilereader.next_line(1); Tokenizer file_header(temp_line); - if (file_header.count() != 2) + if (file_header.count() <= 2) error->all(FLERR, - "UF3: Expected only two words on 1st line of {} but found " - "{} word/s", + "UF3: Expected more than two words on 1st line of {} \n" + "but found {} word/s", potf_name, file_header.count()); if (file_header.contains("#UF3 POT") == 0) error->all(FLERR, - "UF3: {} file is not UF3 POT type, 1st line of UF3 POT " + "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" "files contain '#UF3 POT'. Found {} in the header", potf_name, temp_line); + if (file_header.contains("UNITS:") == 0) + error->all(FLERR, + "UF3: {} file does not contain the 'UNITS:' metadata in \n" + "the header", + potf_name); + temp_line = txtfilereader.next_line(1); ValueTokenizer fp2nd_line(temp_line); @@ -575,9 +587,23 @@ void PairUF3::uf3_read_pot_file(char *potf_name) std::string temp_line = txtfilereader.next_line(2); Tokenizer fp1st_line(temp_line); + if (fp1st_line.count() <= 2) + error->all(FLERR, + "UF3: Expected more than two words on 1st line of {} \n" + "but found {} word/s", + potf_name, fp1st_line.count()); + if (fp1st_line.contains("#UF3 POT") == 0) - error->all(FLERR, "UF3: {} file is not UF3 POT type, found type {} {} on the file", potf_name, - fp1st_line.next(), fp1st_line.next()); + error->all(FLERR, + "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" + "files contain '#UF3 POT'. Found {} in the header", + potf_name, temp_line); + + if (fp1st_line.contains("UNITS:") == 0) + error->all(FLERR, + "UF3: {} file does not contain the 'UNITS:' metadata in \n" + "the header", + potf_name); temp_line = txtfilereader.next_line(1); Tokenizer fp2nd_line(temp_line); From 3734252ed865d369c6747afe40adca39d47cf889 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 2 Apr 2024 13:15:05 -0400 Subject: [PATCH 39/65] Replaced the A_A.uf3 and A_A_A.uf3 with uf3 lammps pot files for Nb --- potentials/Nb_Nb.uf3 | 7 +++ potentials/Nb_Nb_Nb.uf3 | 129 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 potentials/Nb_Nb.uf3 create mode 100644 potentials/Nb_Nb_Nb.uf3 diff --git a/potentials/Nb_Nb.uf3 b/potentials/Nb_Nb.uf3 new file mode 100644 index 0000000000..a8583b105d --- /dev/null +++ b/potentials/Nb_Nb.uf3 @@ -0,0 +1,7 @@ +#UF3 POT UNITS: metal DATE: 2024-04-02 12:18:15.359106 AUTHOR: Ajinkya_Hire CITATION: +2B 0 3 nk +8.0 31 +0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8 +27 +79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0 +# diff --git a/potentials/Nb_Nb_Nb.uf3 b/potentials/Nb_Nb_Nb.uf3 new file mode 100644 index 0000000000..ac3748b33c --- /dev/null +++ b/potentials/Nb_Nb_Nb.uf3 @@ -0,0 +1,129 @@ +#UF3 POT UNITS: metal DATE: 2024-04-02 12:18:15.359106 AUTHOR: Ajinkya_Hire CITATION: +3B 0 3 nk +8.0 4.0 4.0 23 15 15 +0.001 0.001 0.001 0.001 0.50093749999999992 1.000875 1.5008124999999999 2.00075 2.5006874999999997 3.0006249999999999 3.5005624999999996 4.0004999999999997 4.5004375000000003 5.000375 5.5003124999999997 6.0002500000000003 6.5001875 7.0001249999999997 7.5000625000000003 8 8 8 8 +0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 +0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 +11 11 19 +-1.1790416072105636e-06 6.589114265858035e-08 2.1094970065385374e-06 4.7014910818419987e-07 8.288423734406254e-06 0.000186151370764668 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +9.36844864368356e-06 1.9223644807676324e-05 1.9979026246524356e-05 3.627062812549574e-05 9.775578281629195e-06 -5.894357549683858e-06 6.470814473155067e-07 2.31805322174729e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00013804169495254125 0.0012238504051117233 0.01461439973735456 0.010197731078827295 0.009003775355755566 0.030381456320656558 0.024785731678029766 0.004637019267552505 -0.005938106654005813 -0.002605150959220643 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 +-2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 +-7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.003917873880791907 -0.0007874629498581528 -2.4595030318112164e-05 -2.8508297646329816e-06 1.8504666071760445e-07 0.0001190800388356091 0.0035373487148805376 0.00037674157183609377 0.0012087894330956167 0.0009651695201594091 4.769364472898923e-05 0.0004612591073953361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 +5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 +4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 +0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0016181071043329578 0.003179470547568356 0.008661622548635572 0.011071785334468471 0.004294892778359652 0.0017845979744737465 0.0034643761195723064 0.015112039067322293 0.022192108732694595 0.008134230944897397 0.0007595380961610584 1.6727218309602107e-05 0.00012823915020345735 0.0001971442066043176 0.0 0.0 0.0 0.0 0.0 +0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 +0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 +6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +-1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 +5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 +0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 +0.00018639122271027446 0.0034767153815636618 0.018231622622978436 0.0042988446466234575 0.05300133577632108 0.7250033316881788 0.4935009383219143 0.42606157195551264 1.5039118559972142 1.2303936880370434 0.22548363428435172 -0.30298333788301807 -0.13073656424500055 -0.010403074319359695 0.005059645288601829 0.0015181780063355998 0.0 0.0 0.0 +0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 +-0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 +-2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 +4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 +0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 +0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 +-0.011510449622067839 -0.0007610595804959427 1.0172131902385016e-05 0.00448473230635448 0.2199020425072735 0.07466247888373397 0.21339517449435372 0.013531084627798973 0.04473458040783101 0.2378714243611067 0.10478901497777 0.37112701147924365 0.27817806337533985 -0.2385293501359752 -0.33578482057600856 -0.004009555340792723 0.0 0.0 0.0 +4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 +-7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 +0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 +6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 +-0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 +4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 +-0.0008465335016788498 -9.208409992139663e-05 -1.1210629044433908e-05 0.004300763141885697 0.1800503541691201 0.016819879476467067 0.060737350690215776 0.042330087306607714 0.0007006095666399378 0.02251352126872946 0.011185142175963118 -0.02716513333374441 0.00952941322650142 0.02210443704516212 0.07011148238258197 0.057840211345517194 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +# From 1ef7b8132c54c86935956770fb8d10cf0625e8de Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 2 Apr 2024 13:16:00 -0400 Subject: [PATCH 40/65] Updated A_A.uf3 to Nb_Nb.uf3 and A_A_A.uf3 to Nb_Nb_Nb.uf3 --- unittest/force-styles/tests/manybody-pair-uf3.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/force-styles/tests/manybody-pair-uf3.yaml b/unittest/force-styles/tests/manybody-pair-uf3.yaml index cd7fbb9196..075891e8f4 100644 --- a/unittest/force-styles/tests/manybody-pair-uf3.yaml +++ b/unittest/force-styles/tests/manybody-pair-uf3.yaml @@ -14,8 +14,8 @@ post_commands: ! "" input_file: in.manybody pair_style: uf3 3 pair_coeff: ! | - * * A_A.uf3 - 3b * * * A_A_A.uf3 + * * Nb_Nb.uf3 + 3b * * * Nb_Nb_Nb.uf3 extract: ! "" natoms: 64 init_vdwl: -76.14388662099438 From 887ce4948a2d0294fb98d0a558556ab0dd8b2896 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 2 Apr 2024 13:16:38 -0400 Subject: [PATCH 41/65] Removed old pot files --- potentials/A_A.uf3 | 7 --- potentials/A_A_A.uf3 | 129 ------------------------------------------- 2 files changed, 136 deletions(-) delete mode 100644 potentials/A_A.uf3 delete mode 100644 potentials/A_A_A.uf3 diff --git a/potentials/A_A.uf3 b/potentials/A_A.uf3 deleted file mode 100644 index a50b48bae9..0000000000 --- a/potentials/A_A.uf3 +++ /dev/null @@ -1,7 +0,0 @@ -#UF3 POT -2B 0 3 nk -8.0 31 -0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8 -27 -79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0 -# diff --git a/potentials/A_A_A.uf3 b/potentials/A_A_A.uf3 deleted file mode 100644 index 18f79c3b8a..0000000000 --- a/potentials/A_A_A.uf3 +++ /dev/null @@ -1,129 +0,0 @@ -#UF3 POT -3B 0 3 nk -8.0 4.0 4.0 23 15 15 -0.001 0.001 0.001 0.001 0.50093749999999992 1.000875 1.5008124999999999 2.00075 2.5006874999999997 3.0006249999999999 3.5005624999999996 4.0004999999999997 4.5004375000000003 5.000375 5.5003124999999997 6.0002500000000003 6.5001875 7.0001249999999997 7.5000625000000003 8 8 8 8 -0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 -0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 -11 11 19 --1.1790416072105636e-06 6.589114265858035e-08 2.1094970065385374e-06 4.7014910818419987e-07 8.288423734406254e-06 0.000186151370764668 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -3.2366723157260956e-05 2.6208783380066457e-05 1.0239981836366566e-05 1.8487993936404763e-05 2.1943710009352506e-05 2.6899947783571087e-07 5.002786118380638e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -9.36844864368356e-06 1.9223644807676324e-05 1.9979026246524356e-05 3.627062812549574e-05 9.775578281629195e-06 -5.894357549683858e-06 6.470814473155067e-07 2.31805322174729e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.0696915445106504e-05 6.184559535738335e-05 5.870203846064511e-05 -1.112085789465658e-05 -4.7600144351359347e-07 -5.861397594145908e-08 1.4524208784805573e-08 2.300649782987421e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -2.2218614171918013e-06 5.325319655352672e-06 7.766746363269582e-06 9.361315506075464e-06 5.0417710282874456e-05 9.822946186678772e-05 0.00026400568406806884 0.00033610865151919737 0.00013239814531221768 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.00013804169495254125 0.0012238504051117233 0.01461439973735456 0.010197731078827295 0.009003775355755566 0.030381456320656558 0.024785731678029766 0.004637019267552505 -0.005938106654005813 -0.002605150959220643 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 --2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 --7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -5.282737863089323e-05 6.328946161646202e-06 1.8329325276370316e-05 1.6423572667388823e-05 1.2653184610977003e-06 7.181714140248046e-06 3.491501462345434e-06 -7.285463619241614e-06 3.2609159022388403e-06 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.4850777249143735e-05 7.094600012126306e-05 0.00030581781354430576 0.00044661036994300023 0.00016699596636619577 1.5860625743775105e-05 9.74250537001798e-07 5.385650613476577e-06 8.091278451728344e-06 1.2460869401480828e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --0.0002216303488927365 0.0001541319391627563 4.83626397765333e-05 2.1041902272582753e-05 0.00026610797279588076 0.00045665788403242036 0.00017325291338578903 0.0035336618936866277 0.018540440861910777 0.003501320637152642 0.002219074201926699 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.003917873880791907 -0.0007874629498581528 -2.4595030318112164e-05 -2.8508297646329816e-06 1.8504666071760445e-07 0.0001190800388356091 0.0035373487148805376 0.00037674157183609377 0.0012087894330956167 0.0009651695201594091 4.769364472898923e-05 0.0004612591073953361 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 -5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 -4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 -0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -6.9413198850914024e-06 2.107626397843018e-05 1.8155172114721186e-05 2.0928626557075606e-06 1.5632037328512312e-06 -2.7335717313450097e-07 -7.2126792356200426e-09 9.213093725547886e-09 4.186629643010996e-08 8.198811769753182e-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0001028691918645833 0.0002737040057685444 0.0003861446001781946 0.0004042287651515365 0.0017229200225725174 0.003198296698131205 0.008774096120579751 0.011237818178923189 0.004334800036723805 0.0007344916552783145 -0.0001506915192259342 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.01652594711887213 0.011725805945708163 0.011173124362203699 0.0024178633067081135 -0.01796173780303683 -0.011618890946870497 -0.0008528234196397706 -9.706084806556783e-05 -2.754043401157181e-06 0.0001324948483342069 5.482811058752758e-05 0.0003886706609323921 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.00022640297379380707 -0.0005111351623843819 0.0002024994190007784 0.00044921539785371963 0.001393999756415734 0.0011754659552919043 7.761533188706794e-05 5.8170561410888746e-05 -1.0918989217761552e-05 -2.9455190099531973e-07 2.0845708467284646e-07 1.0072947935068441e-06 2.449241542240889e-06 0.0 0.0 0.0 0.0 0.0 0.0 -0.0016181071043329578 0.003179470547568356 0.008661622548635572 0.011071785334468471 0.004294892778359652 0.0017845979744737465 0.0034643761195723064 0.015112039067322293 0.022192108732694595 0.008134230944897397 0.0007595380961610584 1.6727218309602107e-05 0.00012823915020345735 0.0001971442066043176 0.0 0.0 0.0 0.0 0.0 -0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 -0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 -6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.4231393739579515e-06 3.630746449160232e-07 9.318604659023228e-07 4.92311430374376e-07 -3.701479331898353e-09 2.1280257031614452e-07 1.2240989510544568e-06 5.3432540178806065e-06 2.043230389835189e-06 3.2740024159475547e-07 6.717304982644579e-07 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --1.2482511756156149e-05 1.365124801275985e-05 1.3894049203809568e-05 2.3985465221727954e-05 3.3458449092465795e-05 0.00028172299406359233 0.00040056109827889085 0.0004621959325200118 0.0034637215474633033 0.009153352872912168 0.012804683731760212 0.010674833967812809 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.008855607599180339 0.015278371659152929 0.0023879884417463693 0.000935102721182137 0.0034651523786104546 0.005282714096158778 0.0012741283037854573 0.006268847413803995 0.004013755514818873 0.010363477891131097 0.007109323912817858 -0.0002600093944564617 -0.00034633976332068713 0.0 0.0 0.0 0.0 0.0 0.0 -5.3159155089314414e-05 1.2012438398909825e-05 3.274115317951001e-05 1.689353008824745e-05 -4.232110203859359e-07 7.656160171407207e-06 5.754938338062256e-05 0.0002687156220968384 9.768544317740195e-05 1.0129360414562531e-05 2.293272526112481e-05 1.8260890221186993e-05 1.7288534885724222e-06 1.8856324749638164e-06 0.0 0.0 0.0 0.0 0.0 -0.00033854327480422193 0.0032940012133255356 0.008932075729876752 0.012661798131960687 0.013919159699477152 0.08208818801401566 0.15644219608737447 0.4341503084393359 0.557964838826116 0.21173866865770563 0.03478604116524652 -0.007972916161324952 -0.0007132020154210059 0.0004420932693293155 0.0003860741867263207 0.0 0.0 0.0 0.0 -0.00018639122271027446 0.0034767153815636618 0.018231622622978436 0.0042988446466234575 0.05300133577632108 0.7250033316881788 0.4935009383219143 0.42606157195551264 1.5039118559972142 1.2303936880370434 0.22548363428435172 -0.30298333788301807 -0.13073656424500055 -0.010403074319359695 0.005059645288601829 0.0015181780063355998 0.0 0.0 0.0 -0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 --0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 5.196157077391817e-07 6.938124100654148e-08 7.597564197383545e-08 1.863740632660483e-07 4.437837629589167e-07 5.453941063185757e-07 1.5602917821833568e-06 3.404289212094662e-07 9.967447994956849e-07 5.8845599651090215e-06 1.5052240335012455e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.005346497059990333 -0.002010348201210142 -0.0010943235863089423 0.0001661513182702165 0.00012025969610516196 2.4949866002221845e-05 6.627236360802077e-06 3.003757825105864e-06 3.997348910159012e-05 0.000427961841918743 0.0007451357800599296 0.0011219432594133996 0.009685550613014016 0.0 0.0 0.0 0.0 0.0 0.0 --2.698386662730078e-05 2.754973422173369e-07 0.0001320534807487939 0.004372176148977807 0.0015642026255259442 0.004248632573013906 0.00040885420395593786 0.001088966135412402 0.004766232525411325 0.002205157762668968 0.007459939889093756 0.005587608653898612 -0.004720162133268877 -0.006593174803103767 0.0 0.0 0.0 0.0 0.0 -4.542360076931743e-06 1.2329326209575631e-05 1.7173803033436737e-05 5.0102066463061734e-05 1.09067765324765e-05 4.930240898900306e-05 0.00028721835291257015 0.0007503332386451459 0.00015238128535605624 -6.391111549761724e-05 -4.677072820313549e-06 -5.572104125200205e-06 2.707663268609677e-05 5.022846595129856e-05 0.00012970076559689836 0.0 0.0 0.0 0.0 -0.0005943091729493132 0.0009672866630600067 0.009096489467732383 0.01304005169719466 0.01734885651081947 0.1652472792755658 0.44880261475702005 0.6329167707872334 0.5244926606398645 0.26270394857828266 -0.10487776273847933 -0.05845317239353218 0.0032135333670803676 0.003777214235598332 0.0007681993725802362 0.00011959437074006901 0.0 0.0 0.0 -0.0005854549915295117 0.008715343377777027 0.015086646356161998 0.00551449475752511 0.16771008674532747 0.9262472909137329 0.16287454314633398 0.10026082406557575 0.8138824998965698 0.5734788502649438 0.5447903546528722 0.10618098607332271 -0.9103493511412221 -0.576660316279193 -0.03402023384277208 -0.0031478924709104684 0.0 0.0 0.0 --0.011510449622067839 -0.0007610595804959427 1.0172131902385016e-05 0.00448473230635448 0.2199020425072735 0.07466247888373397 0.21339517449435372 0.013531084627798973 0.04473458040783101 0.2378714243611067 0.10478901497777 0.37112701147924365 0.27817806337533985 -0.2385293501359752 -0.33578482057600856 -0.004009555340792723 0.0 0.0 0.0 -4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 3.196534127251379e-06 -1.1872677866681306e-06 -2.5678892066098854e-08 5.139117071436217e-09 1.1142431390092631e-06 2.0605776537608227e-06 5.297265009242829e-06 6.713907186544732e-06 2.7028644452395994e-06 1.149242737988068e-06 2.2449682976927855e-06 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.013431011504370738 0.007883426617122005 0.007935899204760883 0.005880150773602205 0.0009832099103910489 0.005414528729313218 0.0015950126575825377 0.00024127039666882992 -1.5674461809944553e-05 1.0711548076574028e-05 7.830483572860064e-06 0.00011012649333888752 0.0005497452692208139 0.0 0.0 0.0 0.0 0.0 --7.940872165606751e-05 2.276762148612182e-06 0.00010635762128769112 2.049233578255131e-05 0.00042145671490654473 0.01249692872936893 0.0020370917425772224 0.0017316344055948985 0.0006574004028558345 0.0012283310563930355 0.0014629455315045585 -4.492954039177435e-06 0.00029547002108771967 0.002683727758662211 0.004096710661285439 0.0 0.0 0.0 0.0 -0.0001650881267658455 6.548635015912796e-05 3.282822556024051e-05 7.205996516588195e-05 0.00030710620226134084 0.0007279352507540159 0.000909918529220897 0.0017257383928761386 0.00047543969768972346 -0.00030462814537952123 2.7321207199326783e-05 0.00010130812246147248 5.4817489360932934e-05 0.00012640103175376577 0.00018995742264027741 0.00023929212126678798 0.0 0.0 0.0 -6.489304732024981e-05 0.0011748014116558024 0.014162497237899634 0.024470256017495366 0.046651858009005745 0.46415330969555396 0.6536160620847673 0.38295932353650225 0.39318393240673155 0.2877811024545165 0.03747496490739291 0.2654106688863148 0.074634565935104 0.012330295300167044 -0.0004996457463809098 0.00023089219471653216 0.0 0.0 0.0 --0.00011090752856021898 0.0043805342288213535 0.0016927729283659975 0.012954305343473369 0.4368797400066579 0.7614408833500013 0.10944765261392181 0.0412051224385603 0.15805652281823218 0.2585893276179897 0.05949650977132904 0.30356693149425945 0.19493804255113664 0.5122323478146567 0.35279041052227494 -0.007488446744915854 0.0 0.0 0.0 -4.1934884152796484e-05 0.0035902058234846823 0.0005824017329515572 0.01441762880686721 0.6293209695433368 0.09572421881003676 0.08586090788885907 0.031601835145355577 0.06121858995657405 0.07315778164682188 -0.0013308261229131521 0.012882908917780034 0.13273058077548822 0.2035107778991338 0.1961396131043037 -0.04170252478795313 0.0 0.0 0.0 --0.0008465335016788498 -9.208409992139663e-05 -1.1210629044433908e-05 0.004300763141885697 0.1800503541691201 0.016819879476467067 0.060737350690215776 0.042330087306607714 0.0007006095666399378 0.02251352126872946 0.011185142175963118 -0.02716513333374441 0.00952941322650142 0.02210443704516212 0.07011148238258197 0.057840211345517194 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -# From 0809d8b72206819f4664acade72a00ca32ed3f6f Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 2 Apr 2024 13:17:13 -0400 Subject: [PATCH 42/65] Updated documentation about METADATA in the uf3 lammps pot files --- doc/src/pair_uf3.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index 49ca018b85..4c8e25d05b 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -11,14 +11,13 @@ Syntax .. code-block:: LAMMPS - pair_style style BodyFlag NumAtomType + pair_style style BodyFlag * style = *uf3* or *uf3/kk* .. parsed-literal:: BodyFlag = Indicates whether to calculate only 2-body or 2 and 3-body interactions. Possible values: 2 or 3 - NumAtomType = Number of atoms types in the simulation Examples """""""" @@ -110,7 +109,7 @@ LAMMPS potential file for multiple interaction. For example- .. code-block:: LAMMPS - pair_style uf3 3 2 + pair_style uf3 3 pair_coeff * * A_A pair_coeff 3b 1 * * A_A_A pair_coeff 3b 2 * * B_B_B @@ -130,7 +129,7 @@ shows the format of a generic 2-body UF3 LAMMPS potential file- .. code-block:: LAMMPS - #UF3 POT + #UF3 POT UNITS: units DATE: POT_GEN_DATE AUTHOR: AUTHOR_NAME CITATION: CITE 2B LEADING_TRIM TRAILING_TRIM Rij_CUTOFF NUM_OF_KNOTS BSPLINE_KNOTS @@ -144,7 +143,7 @@ The format of a generic 3-body UF3 LAMMPS potential file is as follow- .. code-block:: LAMMPS - #UF3 POT + #UF3 POT UNITS: units DATE: POT_GEN_DATE AUTHOR: AUTHOR_NAME CITATION: CITE 3B LEADING_TRIM TRAILING_TRIM Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ BSPLINE_KNOTS_FOR_JK From c502dd4033409bb7cc781e98133f83ca3e3da68c Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Tue, 2 Apr 2024 13:20:29 -0400 Subject: [PATCH 43/65] Fixed trailing whitespace --- src/ML-UF3/pair_uf3.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index f4c77e7b4c..b6bdd7705b 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -245,7 +245,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" "files contain '#UF3 POT'. Found {} in the header", potf_name, temp_line); - + if (file_header.contains("UNITS:") == 0) error->all(FLERR, "UF3: {} file does not contain the 'UNITS:' metadata in \n" @@ -375,7 +375,7 @@ void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name "UF3: {} file does not contain the 'UNITS:' metadata in \n" "the header", potf_name); - + temp_line = txtfilereader.next_line(1); ValueTokenizer fp2nd_line(temp_line); @@ -598,7 +598,7 @@ void PairUF3::uf3_read_pot_file(char *potf_name) "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" "files contain '#UF3 POT'. Found {} in the header", potf_name, temp_line); - + if (fp1st_line.contains("UNITS:") == 0) error->all(FLERR, "UF3: {} file does not contain the 'UNITS:' metadata in \n" From fcf8500887110c270141766850c902fba76d0e9d Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 15 Apr 2024 10:37:21 -0400 Subject: [PATCH 44/65] Added uf3_read_unified_pot_file() to read single potential file on rank 0 and communicate() to broadcast the data to other ranks Added one_ceoff --- src/ML-UF3/pair_uf3.cpp | 926 +++++++++++++++++++++++++++++++++++++++- src/ML-UF3/pair_uf3.h | 22 + 2 files changed, 935 insertions(+), 13 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index b6bdd7705b..b6986d422f 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -44,6 +44,7 @@ namespace LAMMPS_NS{ std::unordered_map>>> n3b_coeff_matrix; std::vector> UFBS2b; std::vector>> UFBS3b; + }; } @@ -58,12 +59,24 @@ PairUF3::PairUF3(LAMMPS *lmp) : { uf3_impl = new UF3Impl; single_enable = 1; // 1 if single() routine exists + one_coeff = 1; // 1 if allows only one coeff * * call restartinfo = 0; // 1 if pair style writes restart info maxshort = 10; neighshort = nullptr; centroidstressflag = CENTROID_AVAIL; manybody_flag = 1; bsplines_created = 0; + + n2b_knots_array = nullptr; + n2b_coeff_array = nullptr; + n2b_knots_array_size = nullptr; + n2b_coeff_array_size = nullptr; + + map_3b = nullptr; + n3b_knots_array = nullptr; + n3b_coeff_array = nullptr; + n3b_knots_array_size = nullptr; + n3b_coeff_array_size = nullptr; } /* ---------------------------------------------------------------------- */ @@ -76,6 +89,10 @@ PairUF3::~PairUF3() memory->destroy(cutsq); memory->destroy(cut); memory->destroy(knot_spacing_type_2b); + memory->destroy(n2b_knots_array_size); + memory->destroy(n2b_coeff_array_size); + memory->destroy(n2b_knots_array); + memory->destroy(n2b_coeff_array); if (pot_3b) { memory->destroy(setflag_3b); @@ -84,6 +101,11 @@ PairUF3::~PairUF3() memory->destroy(min_cut_3b); memory->destroy(neighshort); memory->destroy(knot_spacing_type_3b); + memory->destroy(map_3b); + memory->destroy(n3b_knots_array_size); + memory->destroy(n3b_coeff_array_size); + memory->destroy(n3b_knots_array); + memory->destroy(n3b_coeff_array); } } delete uf3_impl; @@ -115,6 +137,7 @@ void PairUF3::settings(int narg, char **arg) tot_pot_files = n2body_pot_files + n3body_pot_files; } else error->all(FLERR, "Pair style uf3 not (yet) implemented for {}-body terms", nbody_flag); + } /* ---------------------------------------------------------------------- @@ -122,11 +145,19 @@ void PairUF3::settings(int narg, char **arg) * ---------------------------------------------------------------------- */ void PairUF3::coeff(int narg, char **arg) { + if (narg != 3+atom->ntypes) + error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); + if (!allocated) allocate(); - if (narg != 3 && narg != 5) error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); + map_element2type(narg-3, arg+3, false); - int ilo, ihi, jlo, jhi, klo, khi; + if (comm->me == 0) + uf3_read_unified_pot_file(arg[2]); + communicate(); + //if (narg != 3 && narg != 5) error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); + + /*int ilo, ihi, jlo, jhi, klo, khi; if (narg == 3) { utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); @@ -145,6 +176,87 @@ void PairUF3::coeff(int narg, char **arg) for (int k = MAX(klo, jlo); k <= khi; k++) uf3_read_pot_file(i, j, k, arg[4]); } } + }*/ +} + +//Broadcast data read from potential file to all processors +void PairUF3::communicate() +{ + const int num_of_elements = atom->ntypes; + MPI_Bcast(&cut[0][0], (num_of_elements + 1)*(num_of_elements + 1), + MPI_DOUBLE, 0, world); + + MPI_Bcast(&n2b_knots_array_size[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + MPI_Bcast(&n2b_coeff_array_size[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + MPI_Bcast(&max_num_knots_2b, 1, MPI_INT, 0, world); + MPI_Bcast(&max_num_coeff_2b, 1, MPI_INT, 0, world); + + if (pot_3b){ + MPI_Bcast(&cut_3b_list[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_DOUBLE, 0, world); + + MPI_Bcast(&cut_3b[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), + MPI_DOUBLE, 0, world); + + MPI_Bcast(&n3b_knots_array_size[0][0], tot_interaction_count_3b*3, + MPI_INT, 0, world); + MPI_Bcast(&n3b_coeff_array_size[0][0], tot_interaction_count_3b*3, + MPI_INT, 0, world); + + MPI_Bcast(&max_num_knots_3b, 1, MPI_INT, 0, world); + MPI_Bcast(&max_num_coeff_3b, 1, MPI_INT, 0, world); + } + + if (comm->me != 0) { + memory->destroy(n2b_knots_array); + memory->destroy(n2b_coeff_array); + + memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, + max_num_knots_2b, "pair:n2b_knots_array"); + memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, + max_num_coeff_2b, "pair:n2b_coeff_array"); + if (pot_3b) { + memory->destroy(n3b_knots_array); + memory->destroy(n3b_coeff_array); + + memory->create(n3b_knots_array, tot_interaction_count_3b, 3, + max_num_knots_3b, "pair:n3b_knots_array"); + + memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, + max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); + } + } + + MPI_Bcast(&knot_spacing_type_2b[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + MPI_Bcast(&n2b_knots_array[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*max_num_knots_2b, MPI_DOUBLE, 0, world); + MPI_Bcast(&n2b_coeff_array[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*max_num_coeff_2b, MPI_DOUBLE, 0, world); + + MPI_Bcast(&setflag[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + if (pot_3b) { + MPI_Bcast(&knot_spacing_type_3b[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), + MPI_INT, 0, world); + MPI_Bcast(&n3b_knots_array[0][0][0], + tot_interaction_count_3b*3*max_num_knots_3b, MPI_DOUBLE, 0, world); + MPI_Bcast(&n3b_coeff_array[0][0][0][0], + tot_interaction_count_3b*max_num_coeff_3b*max_num_coeff_3b*max_num_coeff_3b, + MPI_DOUBLE, 0, world); + MPI_Bcast(&setflag_3b[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), + MPI_INT, 0, world); + MPI_Bcast(&min_cut_3b[0][0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1)*3, + MPI_DOUBLE, 0, world); } } @@ -153,6 +265,8 @@ void PairUF3::allocate() allocated = 1; const int num_of_elements = atom->ntypes; + map = new int[num_of_elements+1]; //No need to delete map as ~Pair deletes map + // Contains info about wether UF potential were found for type i and j memory->create(setflag, num_of_elements + 1, num_of_elements + 1, "pair:setflag"); @@ -168,6 +282,12 @@ void PairUF3::allocate() memory->create(knot_spacing_type_2b, num_of_elements + 1, num_of_elements + 1, "pair:knot_spacing_2b"); + //Contains size of 2b knots vectors and 2b coeff matrices + memory->create(n2b_knots_array_size, num_of_elements + 1, num_of_elements + 1, + "pair:n2b_knots_array_size"); + memory->create(n2b_coeff_array_size, num_of_elements + 1, num_of_elements + 1, + "pair:n2b_coeff_array_size"); + // Contains knot_vect of 2-body potential for type i and j uf3_impl->n2b_knot.resize(num_of_elements + 1); uf3_impl->n2b_coeff.resize(num_of_elements + 1); @@ -196,7 +316,12 @@ void PairUF3::allocate() memory->create(knot_spacing_type_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1, "pair:knot_spacing_3b"); - // setting cut_3b and setflag = 0 + tot_interaction_count_3b = 0; + //conatins map of I-J-K interaction + memory->create(map_3b, num_of_elements + 1, num_of_elements + 1, + num_of_elements + 1, "pair:map_3b"); + + // setting cut_3b, setflag = 0 and map_3b for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { cut_3b_list[i][j] = 0; @@ -205,9 +330,21 @@ void PairUF3::allocate() min_cut_3b[i][j][k][0] = 0; min_cut_3b[i][j][k][1] = 0; min_cut_3b[i][j][k][2] = 0; + + setflag_3b[i][j][k] = 0; + + map_3b[i][j][k] = tot_interaction_count_3b; + tot_interaction_count_3b++; } } } + + //contains sizes of 3b knots vectors and 3b coeff matrices + memory->create(n3b_knots_array_size, tot_interaction_count_3b, 3, + "pair:n3b_knots_array_size"); + memory->create(n3b_coeff_array_size, tot_interaction_count_3b, 3, + "pair:n3b_coeff_array_size"); + uf3_impl->n3b_knot_matrix.resize(num_of_elements + 1); uf3_impl->UFBS3b.resize(num_of_elements + 1); for (int i = 1; i < num_of_elements + 1; i++) { @@ -219,6 +356,732 @@ void PairUF3::allocate() } } memory->create(neighshort, maxshort, "pair:neighshort"); + + } +} + +void PairUF3::uf3_read_unified_pot_file(char *potf_name) +{ + //Go through the entire file and get the sizes of knot vectors and + //coeff vectors/matrices + // + //Create arrays + // + //Go through the file again and read the knots and coefficients + // + + const int num_of_elements = atom->ntypes; + + //if (true) { + FILE *fp = utils::open_potential(potf_name, lmp, nullptr); + if (!fp) + error->all(FLERR, + "Cannot open UF3 potential file {}: {}", + potf_name, utils::getsyserror()); + + TextFileReader txtfilereader(fp, "UF3:POTFP"); + txtfilereader.ignore_comments = false; + + //while loop over the entire file, find blocks starting with #UF3 POT + //if block found read the very next line to determine 2B or 3B block + //if 2B read the knot vector and coeff vector size + //if 3B read the knot vectors and coeff matrix size + int line_counter = 1; + char *line; + while((line = txtfilereader.next_line(1))){ + Tokenizer line_token(line); + + //Detect start of a block + if (line_token.contains("#UF3 POT")) { + //Block start detected + if (line_token.contains("UNITS:") == 0) + error->all(FLERR, + "UF3: {} file does not contain the 'UNITS:' metadata in " + "the header", + potf_name); + + //Read the 2nd line of the block + std::string temp_line = txtfilereader.next_line(1); + line_counter++; + ValueTokenizer fp2nd_line(temp_line); + + std::string nbody_on_file = fp2nd_line.next_string(); + if (nbody_on_file == "2B") { + //2B block + if (fp2nd_line.count() != 6) + error->all(FLERR, "UF3: Expected 6 words on line {} of {} file " + "but found {} word/s", + line_counter, potf_name, fp2nd_line.count()); + + //get the elements + std::string element1 = fp2nd_line.next_string(); + std::string element2 = fp2nd_line.next_string(); + int itype = 0; + int jtype = 0; + for (int i=1; iall(FLERR, + "UF3: Current implementation is throughly tested only " + "for leading_trim=0"); + if (trailing_trim != 3) + error->all(FLERR, + "UF3: Current implementation is throughly tested only " + "for trailing_trim=3"); + + //read next line, should contain cutoff and size of knot vector + temp_line = txtfilereader.next_line(1); + line_counter++; + ValueTokenizer fp3rd_line(temp_line); + if (fp3rd_line.count() != 2) + error->all(FLERR, + "UF3: Expected only 2 words on 3rd line => " + "Rij_CUTOFF NUM_OF_KNOTS. Found {} word/s", + fp3rd_line.count()); + + //cut is used in init_one which is called by pair.cpp at line 267 + //where the return of init_one is squared + cut[itype][jtype] = fp3rd_line.next_double(); //MPI_Bcast + cut[jtype][itype] = cut[itype][jtype]; + + int num_knots_2b = fp3rd_line.next_int(); + n2b_knots_array_size[itype][jtype] = num_knots_2b; //MPI_Bcast + n2b_knots_array_size[jtype][itype] = num_knots_2b; //MPI_Bcast + max_num_knots_2b = std::max(max_num_knots_2b, num_knots_2b); //MPI_Bcast + + //skip next line + txtfilereader.skip_line(); + line_counter++; + + //read number of coeff + temp_line = txtfilereader.next_line(1); + line_counter++; + ValueTokenizer fp5th_line(temp_line); + + int num_coeff_2b = fp5th_line.next_int(); + n2b_coeff_array_size[itype][jtype] = num_coeff_2b; //MPI_Bcast + n2b_coeff_array_size[jtype][itype] = num_coeff_2b; //MPI_Bcast + max_num_coeff_2b = std::max(max_num_coeff_2b, num_coeff_2b); //MPI_Bcast + } + } + else if ((nbody_on_file == "3B") && (pot_3b)) { + //3B block + if (fp2nd_line.count() != 7) + error->all(FLERR, "UF3: Expected 7 words on line {} of {} file" + "but found {} word/s", + line_counter, potf_name, fp2nd_line.count()); + + if (nbody_on_file == "3B") { + //get the elements + std::string element1 = fp2nd_line.next_string(); + std::string element2 = fp2nd_line.next_string(); + std::string element3 = fp2nd_line.next_string(); + int itype = 0; + int jtype = 0; + int ktype = 0; + for (int i=1; iall(FLERR, + "UF3: Current implementation is throughly tested " + "only for leading_trim=0"); + if (trailing_trim != 3) + error->all(FLERR, + "UF3: Current implementation is throughly tested " + "only for trailing_trim=3"); + + //read next line, should contain cutoffs and size of knot vectors + temp_line = txtfilereader.next_line(6); + line_counter++; + ValueTokenizer fp3rd_line(temp_line); + + if (fp3rd_line.count() != 6) + error->all(FLERR, + "UF3: Expected only 6 numbers on 3rd line => " + "Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK " + "NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ Found {} number/s", + fp3rd_line.count()); + + double cut3b_rjk = fp3rd_line.next_double(); + double cut3b_rij = fp3rd_line.next_double(); + double cut3b_rik = fp3rd_line.next_double(); + + if (cut3b_rij != cut3b_rik) + error->all(FLERR, + "UF3: rij!=rik for {}-{}-{}. " + "Current implementation only works for rij=rik", + element1, element2, element3); + + if (2 * cut3b_rik != cut3b_rjk) + error->all(FLERR, + "UF3: 2rij=2rik!=rik for {}-{}-{}. " + "Current implementation only works for 2rij=2rik!=rik", + element1, element2, element3); + + cut_3b_list[itype][jtype] = + std::max(cut3b_rij, cut_3b_list[itype][jtype]); //MPI_Bcast + cut_3b_list[itype][ktype] = + std::max(cut_3b_list[itype][ktype], cut3b_rik); //MPI_Bcast + + cut_3b[itype][jtype][ktype] = cut3b_rij; //MPI_Bcast + cut_3b[itype][ktype][jtype] = cut3b_rik; //MPI_Bcast + + int num_knots_3b_jk = fp3rd_line.next_int(); + int num_knots_3b_ik = fp3rd_line.next_int(); + int num_knots_3b_ij = fp3rd_line.next_int(); + + n3b_knots_array_size[map_3b[itype][jtype][ktype]][0] = num_knots_3b_jk; //MPI_Bcast + n3b_knots_array_size[map_3b[itype][jtype][ktype]][1] = num_knots_3b_ik; + n3b_knots_array_size[map_3b[itype][jtype][ktype]][2] = num_knots_3b_ij; + + n3b_knots_array_size[map_3b[itype][ktype][jtype]][0] = num_knots_3b_jk; //MPI_Bcast + n3b_knots_array_size[map_3b[itype][ktype][jtype]][1] = num_knots_3b_ij; + n3b_knots_array_size[map_3b[itype][ktype][jtype]][2] = num_knots_3b_ik; + + max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_jk); + max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_ik); + max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_ij); //MPI_Bcast + + //skip next 3 line + txtfilereader.skip_line(); + line_counter++; + txtfilereader.skip_line(); + line_counter++; + txtfilereader.skip_line(); + line_counter++; + + //read number of coeff + temp_line = txtfilereader.next_line(3); + line_counter++; + ValueTokenizer fp7th_line(temp_line); + + if (fp7th_line.count() != 3) + error->all(FLERR, + "UF3: Expected 3 numbers on 7th line => " + "SHAPE_OF_COEFF_MATRIX[I][J][K] " + "found {} numbers", + fp7th_line.count()); + + int coeff_matrix_dim1 = fp7th_line.next_int(); + int coeff_matrix_dim2 = fp7th_line.next_int(); + int coeff_matrix_dim3 = fp7th_line.next_int(); + + n3b_coeff_array_size[map_3b[itype][jtype][ktype]][0] = coeff_matrix_dim1; //MPI_Bcast + n3b_coeff_array_size[map_3b[itype][jtype][ktype]][1] = coeff_matrix_dim2; + n3b_coeff_array_size[map_3b[itype][jtype][ktype]][2] = coeff_matrix_dim3; + + n3b_coeff_array_size[map_3b[itype][ktype][jtype]][0] = coeff_matrix_dim2; + n3b_coeff_array_size[map_3b[itype][ktype][jtype]][1] = coeff_matrix_dim1; + n3b_coeff_array_size[map_3b[itype][ktype][jtype]][2] = coeff_matrix_dim3; + + max_num_coeff_3b = std::max(max_num_coeff_3b,coeff_matrix_dim1); + max_num_coeff_3b = std::max(max_num_coeff_3b,coeff_matrix_dim2); + max_num_coeff_3b = std::max(max_num_coeff_3b,coeff_matrix_dim3); + } + } + } + else { + if (!((nbody_on_file == "3B") && (!pot_3b))) + error->all(FLERR, + "UF3: Expected either '2B' or '3B' word on line {} of {} file", + line_counter, potf_name); + } + } //if of #UF3 POT + line_counter++; + } // while + //fclose(fp); + + //Create knot and coeff arrays + if (max_num_knots_2b > 0) { + //if (comm->me == 0) + memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, + max_num_knots_2b, "pair:n2b_knots_array"); + } + else + error->all(FLERR, + "UF3: Error reading the size of 2B knot vector\n" + "Possibly no 2B UF3 potential block detected in {} file", + potf_name); + + if (max_num_coeff_2b > 0) { + //if (comm->me == 0) + /*utils::logmesg(lmp, + "max_num_coeff_2b = {}\n", max_num_coeff_2b);*/ + memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, + max_num_coeff_2b, "pair:n2b_coeff_array"); + } + else + error->all(FLERR, + "UF3: Error reading the size of 2B coeff vector\n" + "Possibly no 2B UF3 potential block detected in {} file", + potf_name); + + if (pot_3b) { + if (max_num_knots_3b > 0) + memory->create(n3b_knots_array, tot_interaction_count_3b, 3, + max_num_knots_3b, "pair:n3b_knots_array"); + + else + error->all(FLERR, + "UF3: Error reading the size of 3B knot vector\n" + "Possibly no 3B UF3 potential block detected in {} file", + potf_name); + + if (max_num_coeff_3b > 0) + memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, + max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); + else + error->all(FLERR, + "UF3: Error reading the size of 3B coeff matrices\n" + "Possibly no 3B UF3 potential block detected in {} file", + potf_name); + } + + //Go back to the begning of the file + txtfilereader.rewind(); + + //Go through the file again and fill knot and coeff arrays + //while loop to read the data + //if (true) { + /*FILE *fp = utils::open_potential(potf_name, lmp, nullptr); + if (!fp) + error->all(FLERR, + "Cannot open UF3 potential file {}: {}", + potf_name, utils::getsyserror()); + + TextFileReader txtfilereader(fp, "UF3:POTFP"); + txtfilereader.ignore_comments = false; + char *line;*/ + while((line = txtfilereader.next_line(1))){ + Tokenizer line_token(line); + + //Detect start of a block + if (line_token.contains("#UF3 POT")) { + //Block start detected + //Read the 2nd line of the block + std::string temp_line = txtfilereader.next_line(1); + ValueTokenizer fp2nd_line(temp_line); + std::string nbody_on_file = fp2nd_line.next_string(); + + if (nbody_on_file == "2B") { + //get the elements + std::string element1 = fp2nd_line.next_string(); + std::string element2 = fp2nd_line.next_string(); + int itype = 0; + int jtype = 0; + for (int i=1; iall(FLERR, + "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots). " + "Found {} on the 2nd line of {}-{} interaction block", + knot_type, element1, element2); + + if ((itype != 0) && (jtype != 0)) { + //skip line containing info of cutoff and knot vect size + txtfilereader.skip_line(); + + int num_knots_2b = n2b_knots_array_size[itype][jtype]; + + temp_line = txtfilereader.next_line(num_knots_2b); + ValueTokenizer fp4th_line(temp_line); + + if (fp4th_line.count() != num_knots_2b) + error->all(FLERR, "UF3: Error readig the 2B potential block for {}-{}\n" + "Expecter {} numbers on 4th line of the block but found {} " + "numbers", num_knots_2b,fp4th_line.count()); + + for (int k = 0; k < num_knots_2b; k++) { + n2b_knots_array[itype][jtype][k] = fp4th_line.next_double(); //MPI_Bcast + n2b_knots_array[jtype][itype][k] = n2b_knots_array[itype][jtype][k]; + } + + //skip next line + txtfilereader.skip_line(); + + int num_of_coeff_2b = n2b_coeff_array_size[itype][jtype]; + + temp_line = txtfilereader.next_line(num_of_coeff_2b); + ValueTokenizer fp6th_line(temp_line); + + if (fp6th_line.count() != num_of_coeff_2b) + error->all(FLERR, + "UF3: Error readig the 2B potential block for {}-{}\n" + "Expecter {} numbers on 6th line of the block but found {} " + "numbers", num_knots_2b,fp4th_line.count()); + + for (int k = 0; k < num_of_coeff_2b; k++) { + n2b_coeff_array[itype][jtype][k] = fp6th_line.next_double(); //MPI_Bcast + n2b_coeff_array[jtype][itype][k] = n2b_coeff_array[itype][jtype][k]; + } + + if (num_knots_2b != num_of_coeff_2b + 4) + error->all(FLERR, + "UF3: {}-{} interaction block has incorrect knot and " + "coeff data nknots!=ncoeffs + 3 + 1", + element1, element2); + + setflag[itype][jtype] = 1; //MPI_Bcast + setflag[jtype][itype] = 1; + } + } + + if ((nbody_on_file == "3B") && (pot_3b)) { + //get the elements + std::string element1 = fp2nd_line.next_string(); + std::string element2 = fp2nd_line.next_string(); + std::string element3 = fp2nd_line.next_string(); + int itype = 0; + int jtype = 0; + int ktype = 0; + for (int i=1; iall(FLERR, + "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " + "Found {} on the 2nd line of {}-{}-{} interaction block", + knot_type, element1, element2, element3); + + if ((itype != 0) && (jtype != 0) && (ktype!=0)) { + //skip line containing info of cutoffs and knot vector sizes + txtfilereader.skip_line(); + + int num_knots_3b_jk = n3b_knots_array_size[map_3b[itype][jtype][ktype]][0]; + int num_knots_3b_ik = n3b_knots_array_size[map_3b[itype][jtype][ktype]][1]; + int num_knots_3b_ij = n3b_knots_array_size[map_3b[itype][jtype][ktype]][2]; + + temp_line = txtfilereader.next_line(num_knots_3b_jk); + ValueTokenizer fp4th_line(temp_line); + if (fp4th_line.count() != num_knots_3b_jk) + error->all(FLERR, + "UF3: Error readig the 3B potential block for {}-{}-{}\n" + "Expected {} numbers on 4th line of the block but found {} " + "numbers", element1, element2, element3, + num_knots_3b_jk, fp4th_line.count()); + + for (int i = 0; i < num_knots_3b_jk; i++) { + n3b_knots_array[map_3b[itype][jtype][ktype]][0][i] = + fp4th_line.next_double(); //MPI_Bcast + n3b_knots_array[map_3b[itype][ktype][jtype]][0][i] = + n3b_knots_array[map_3b[itype][jtype][ktype]][0][i]; + } + + min_cut_3b[itype][jtype][ktype][0] = + n3b_knots_array[map_3b[itype][jtype][ktype]][0][0]; //MPI_Bcast + min_cut_3b[itype][ktype][jtype][0] = + n3b_knots_array[map_3b[itype][ktype][jtype]][0][0]; + + temp_line = txtfilereader.next_line(num_knots_3b_ik); + ValueTokenizer fp5th_line(temp_line); + if (fp5th_line.count() != num_knots_3b_ik) + error->all(FLERR, + "UF3: Error readig the 3B potential block for {}-{}-{}\n" + "Expected {} numbers on 5th line of the block but found {} " + "numbers", element1, element2, element3, + num_knots_3b_ik, fp5th_line.count()); + + for (int i = 0; i < num_knots_3b_ik; i++) { + n3b_knots_array[map_3b[itype][jtype][ktype]][1][i] = + fp5th_line.next_double(); //MPI_Bcast + n3b_knots_array[map_3b[itype][ktype][jtype]][2][i] = + n3b_knots_array[map_3b[itype][jtype][ktype]][1][i]; + } + + min_cut_3b[itype][jtype][ktype][1] = + n3b_knots_array[map_3b[itype][jtype][ktype]][1][0]; + min_cut_3b[itype][ktype][jtype][2] = + n3b_knots_array[map_3b[itype][ktype][jtype]][2][0]; + + temp_line = txtfilereader.next_line(num_knots_3b_ij); + ValueTokenizer fp6th_line(temp_line); + if (fp6th_line.count() != num_knots_3b_ij) + error->all(FLERR, + "UF3: Error readig the 3B potential block for {}-{}-{}\n" + "Expected {} numbers on 6th line of the block but found {} " + "numbers", element1, element2, element3, + num_knots_3b_ij, fp6th_line.count()); + + for (int i = 0; i < num_knots_3b_ij; i++) { + n3b_knots_array[map_3b[itype][jtype][ktype]][2][i] = + fp6th_line.next_double(); + n3b_knots_array[map_3b[itype][ktype][jtype]][1][i] = + n3b_knots_array[map_3b[itype][jtype][ktype]][2][i]; + } + + min_cut_3b[itype][jtype][ktype][2] = n3b_knots_array[map_3b[itype][jtype][ktype]][2][0]; + min_cut_3b[itype][ktype][jtype][1] = n3b_knots_array[map_3b[itype][ktype][jtype]][1][0]; + + //skip next line + txtfilereader.skip_line(); + + int coeff_matrix_dim1 = n3b_coeff_array_size[map_3b[itype][jtype][ktype]][0]; + int coeff_matrix_dim2 = n3b_coeff_array_size[map_3b[itype][jtype][ktype]][1]; + int coeff_matrix_dim3 = n3b_coeff_array_size[map_3b[itype][jtype][ktype]][2]; + + if (num_knots_3b_jk != coeff_matrix_dim3 + 3 + 1) + error->all(FLERR, + "UF3: {}-{}-{} interaction block has incorrect knot " + "(NUM_OF_KNOTS_JK) and coeff (coeff_matrix_dim3) data " + "nknots!=ncoeffs + 3 + 1", + element1, element2, element3); + + if (num_knots_3b_ik != coeff_matrix_dim2 + 3 + 1) + error->all(FLERR, + "UF3: {}-{}-{} interaction block has incorrect knot " + "(NUM_OF_KNOTS_IK) and coeff (coeff_matrix_dim2) data " + "nknots!=ncoeffs + 3 + 1", + element1, element2, element3); + + if (num_knots_3b_ij != coeff_matrix_dim1 + 3 + 1) + error->all(FLERR, + "UF3: {}-{}-{} interaction block has incorrect knot " + "(NUM_OF_KNOTS_IJ) and coeff (coeff_matrix_dim1) data " + "nknots!=ncoeffs + 3 + 1", + element1, element2, element3); + + int coeff_matrix_elements_len = coeff_matrix_dim3; + int key1 = map_3b[itype][jtype][ktype]; + int key2 = map_3b[itype][ktype][jtype]; + + int line_count = 0; + for (int i = 0; i < coeff_matrix_dim1; i++) { + for (int j = 0; j < coeff_matrix_dim2; j++) { + temp_line = txtfilereader.next_line(coeff_matrix_elements_len); + ValueTokenizer coeff_line(temp_line); + if (coeff_line.count() != coeff_matrix_elements_len) + error->all(FLERR, + "UF3: Error reading 3B potential block for {}-{}-{}\n" + "Expected {} numbers on {}th line of the block but found {} " + "numbers", element1, element2, element3, + coeff_matrix_elements_len, line_count + 8, + coeff_line.count()); + + for (int k = 0; k < coeff_matrix_dim3; k++) { + n3b_coeff_array[key1][i][j][k] = coeff_line.next_double(); + } + line_count += 1; + } + } + + for (int i = 0; i < coeff_matrix_dim1; i++) { + for (int j = 0; j < coeff_matrix_dim2; j++) { + for (int k = 0; k < coeff_matrix_dim3; k++) { + n3b_coeff_array[key2][j][i][k] = n3b_coeff_array[key1][i][j][k]; //MPI_Bcast + } + } + } + + setflag_3b[itype][jtype][ktype] = 1; //MPI_Bcast + setflag_3b[itype][ktype][jtype] = 1; + } + } + } // if #UF3 POT + } //while + fclose(fp); + + //Set interaction of atom types of the same elements + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + if (setflag[i][j] != 1){ + //i-j interaction not set + + //maybe i-j is mapped to some other atom type interaction? + int i_mapped_to = map[i]+1; //+1 as map starts from 0 + int j_mapped_to = map[j]+1; //+1 as map starts from 0 + + if ((i_mapped_to == i) && (j_mapped_to == j)) + //i-j is not mapped to some other atom type ie interaction is missing on file + error->all(FLERR, + "UF3: Potential for interaction {}-{} ie {}-{} not found " + "in {} file", + i, j, elements[i_mapped_to-1], elements[j_mapped_to-1], + potf_name); + + //utils::logmesg(lmp,"Setting stuff for {}-{} mapped to {}-{}\n",i,j, + // i_mapped_to, j_mapped_to); + + cut[i][j] = cut[i_mapped_to][j_mapped_to]; + + n2b_knots_array_size[i][j] = n2b_knots_array_size[i_mapped_to][j_mapped_to]; + n2b_coeff_array_size[i][j] = n2b_coeff_array_size[i_mapped_to][j_mapped_to]; + + knot_spacing_type_2b[i][j] = knot_spacing_type_2b[i_mapped_to][j_mapped_to]; + + for (int knot_no = 0; knot_no < max_num_knots_2b; knot_no++) + n2b_knots_array[i][j][knot_no] = + n2b_knots_array[i_mapped_to][j_mapped_to][knot_no]; + + for (int coeff_no = 0; coeff_no < max_num_coeff_2b; coeff_no++) + n2b_coeff_array[i][j][coeff_no] = + n2b_coeff_array[i_mapped_to][j_mapped_to][coeff_no]; + + setflag[i][j] = 1; + } + } + } + + if (pot_3b) { + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + //for (int k = j; k < num_of_elements + 1; k++) { + for (int k = 1; k < num_of_elements + 1; k++) { + if (setflag_3b[i][j][k] != 1) { + //i-j-k interaction not set + + //maybe i-j-k is mapped to some other atom type interaction? + int i_mapped_to = map[i]+1; //+1 as map starts from 0 + int j_mapped_to = map[j]+1; //+1 as map starts from 0 + int k_mapped_to = map[k]+1; //+1 as map starts from 0 + + if ((i_mapped_to == i) && (j_mapped_to == j) && (k_mapped_to == k)) + error->all(FLERR, + "UF3: Potential for interaction {}-{}-{} ie {}-{}-{} " + " not found in {} file", + i, j, k, elements[i_mapped_to-1], elements[j_mapped_to-1], + elements[k_mapped_to-1], potf_name); + if (setflag_3b[i_mapped_to][j_mapped_to][k_mapped_to] != 1) + error->all(FLERR, + "UF3: Interaction {}-{}-{} was mapped to {}-{}-{}, but " + "potential interaction for {}-{}-{} was not found in " + "{} file", + i, j, k, i_mapped_to, j_mapped_to, k_mapped_to, + i_mapped_to, j_mapped_to, k_mapped_to, potf_name); + + + cut_3b_list[i][j] = std::max(cut_3b_list[i_mapped_to][j_mapped_to], + cut_3b_list[i][j]); + + + cut_3b[i][j][k] = cut_3b[i_mapped_to][j_mapped_to][k_mapped_to]; + + knot_spacing_type_3b[i][j][k] = + knot_spacing_type_3b[i_mapped_to][j_mapped_to][k_mapped_to]; + + int key = map_3b[i][j][k]; + int mapped_to_key = map_3b[i_mapped_to][j_mapped_to][k_mapped_to]; + + n3b_knots_array_size[key][0] = n3b_knots_array_size[mapped_to_key][0]; + n3b_knots_array_size[key][1] = n3b_knots_array_size[mapped_to_key][1]; + n3b_knots_array_size[key][2] = n3b_knots_array_size[mapped_to_key][2]; + + n3b_coeff_array_size[key][0] = n3b_coeff_array_size[mapped_to_key][0]; + n3b_coeff_array_size[key][1] = n3b_coeff_array_size[mapped_to_key][1]; + n3b_coeff_array_size[key][2] = n3b_coeff_array_size[mapped_to_key][2]; + + min_cut_3b[i][j][k][0] = + min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][0];//n3b_knots_array[key][0][0]; + + min_cut_3b[i][j][k][1] = + min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][1];//n3b_knots_array[key][1][0]; + + min_cut_3b[i][j][k][2] = + min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][2];//n3b_knots_array[key][2][0]; + + for (int knot_no = 0; knot_no < n3b_knots_array_size[key][0]; knot_no++) + n3b_knots_array[key][0][knot_no] = n3b_knots_array[mapped_to_key][0][knot_no]; + + for (int knot_no = 0; knot_no < n3b_knots_array_size[key][1]; knot_no++) + n3b_knots_array[key][1][knot_no] = n3b_knots_array[mapped_to_key][1][knot_no]; + + for (int knot_no = 0; knot_no < n3b_knots_array_size[key][2]; knot_no++) + n3b_knots_array[key][2][knot_no] = n3b_knots_array[mapped_to_key][2][knot_no]; + + for (int coeff1 = 0; coeff1 < n3b_coeff_array_size[key][0]; coeff1++) + for (int coeff2 = 0; coeff2 < n3b_coeff_array_size[key][1]; coeff2++) + for (int coeff3 = 0; coeff3 < n3b_coeff_array_size[key][2]; coeff3++) + n3b_coeff_array[key][coeff1][coeff2][coeff3] = + n3b_coeff_array[mapped_to_key][coeff1][coeff2][coeff3]; + setflag_3b[i][j][k] = 1; + } + } + } + } } } @@ -826,7 +1689,7 @@ void PairUF3::create_bsplines() if (setflag[i][j] != 1) error->all(FLERR, "UF3: Not all 2-body UF potentials are set, " - "missing potential file for {}-{} interaction", + "missing potential for {}-{} interaction", i, j); } } @@ -837,7 +1700,7 @@ void PairUF3::create_bsplines() if (setflag_3b[i][j][k] != 1) error->all(FLERR, "UF3: Not all 3-body UF potentials are set, " - "missing potential file for {}-{}-{} interaction", + "missing potential for {}-{}-{} interaction", i, j, k); } } @@ -846,20 +1709,41 @@ void PairUF3::create_bsplines() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - uf3_impl->UFBS2b[i][j] = + /*uf3_impl->UFBS2b[i][j] = uf3_pair_bspline(lmp, uf3_impl->n2b_knot[i][j], uf3_impl->n2b_coeff[i][j], - knot_spacing_type_2b[i][j]); + knot_spacing_type_2b[i][j]);*/ + + uf3_impl->UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knots_array[i][j], + n2b_knots_array_size[i][j], + n2b_coeff_array[i][j], + n2b_coeff_array_size[i][j], + knot_spacing_type_2b[i][j]); uf3_impl->UFBS2b[j][i] = uf3_impl->UFBS2b[i][j]; } if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { - std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); + /*std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( - lmp, uf3_impl->n3b_knot_matrix[i][j][k], uf3_impl->n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); - std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); + lmp, uf3_impl->n3b_knot_matrix[i][j][k], uf3_impl->n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]);*/ + int key = map_3b[i][j][k]; + int key2 = map_3b[i][k][j]; + /*utils::logmesg(lmp, "Setting UFBS3b for {}-{}-{} map_3b={} and for {}-{}-{} " + "map_3b={}\n", i, j, k, key, i, k, j, + key2);*/ + uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( + lmp, n3b_knots_array[key], n3b_knots_array_size[key], + n3b_coeff_array[key], n3b_coeff_array_size[key], + knot_spacing_type_3b[i][j][k]); + + /*std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); uf3_impl->UFBS3b[i][k][j] = uf3_triplet_bspline( - lmp, uf3_impl->n3b_knot_matrix[i][k][j], uf3_impl->n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]); + lmp, uf3_impl->n3b_knot_matrix[i][k][j], uf3_impl->n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]);*/ + //int key2 = map_3b[i][k][j]; + uf3_impl->UFBS3b[i][k][j] = uf3_triplet_bspline( + lmp, n3b_knots_array[key2], n3b_knots_array_size[key2], + n3b_coeff_array[key2], n3b_coeff_array_size[key2], + knot_spacing_type_3b[i][k][j]); } } } @@ -1172,7 +2056,23 @@ double PairUF3::memory_usage() bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * 3 * sizeof(double); //min_cut_3b - for (int i = 1; i < num_of_elements + 1; i++) { + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //n2b_knots_array_size + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //n2b_coeff_array_size + + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_knots_2b * + sizeof(double); //n2b_knots_array + + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_coeff_2b * + sizeof(double); //n2b_coeff_array + + if (pot_3b) { + bytes += (double) tot_interaction_count_3b * 3 * sizeof(double); //n3b_knots_array_size + bytes += (double) tot_interaction_count_3b * 3 * sizeof(double); //n3b_coeff_array_size + bytes += (double) tot_interaction_count_3b * 3 * max_num_knots_3b * sizeof(double); //n3b_knots_array + bytes += (double) tot_interaction_count_3b * max_num_coeff_3b * max_num_coeff_3b * + max_num_coeff_3b * sizeof(double); //n3b_coeff_array + } + /*for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { bytes += (double) 2 * uf3_impl->n2b_knot[i][j].size() * sizeof(double); //n2b_knot bytes += (double) 2 * uf3_impl->n2b_coeff[i][j].size() * sizeof(double); //n2b_coeff @@ -1196,7 +2096,7 @@ double PairUF3::memory_usage() } } } - } + }*/ for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 293d359c3f..82ce716042 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -49,6 +49,8 @@ class PairUF3 : public Pair { void uf3_read_pot_file(char *potf_name); void uf3_read_pot_file(int i, int j, char *potf_name); void uf3_read_pot_file(int i, int j, int k, char *potf_name); + void uf3_read_unified_pot_file(char *potf_name); + void communicate(); int nbody_flag, n2body_pot_files, n3body_pot_files, tot_pot_files; int bsplines_created; bool pot_3b; @@ -59,6 +61,26 @@ class PairUF3 : public Pair { struct UF3Impl *uf3_impl; //PIMPLE (pointer-to-implementation) UF3Impl *get_UF3Impl(); + int max_num_knots_2b = 0; + int max_num_coeff_2b = 0; + int max_num_knots_3b = 0; + int max_num_coeff_3b = 0; + double ***n2b_knots_array, ***n2b_coeff_array; + int **n2b_knots_array_size, **n2b_coeff_array_size; + + int ***map_3b, tot_interaction_count_3b; + double ***n3b_knots_array, ****n3b_coeff_array; + int **n3b_knots_array_size, **n3b_coeff_array_size; + + /*void uf3_read_2b_pot_block(int itype, int jtype, std::string iele, + std::string jele, + TextFileReader &txtfilereader); + + void uf3_read_3b_pot_block(int itype, int jtype, int ktype, + std::string iele, std::string jele, + std::string kele, + TextFileReader &txtfilereader);*/ + //Accessor function called by pair_uf3_kokkos.cpp //Will probably be removed once std::vector are converted to arrays std::vector>>& get_n2b_knot(); From cf729fc358fc96be2ee1eed622d32fded730b775 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 15 Apr 2024 10:38:00 -0400 Subject: [PATCH 45/65] Added new constructor functions in uf3_pair_bspline and uf3_triplet_bspline to construct std::vectors of knots and coefficients rom memory block --- src/ML-UF3/uf3_pair_bspline.cpp | 56 +++++++++++ src/ML-UF3/uf3_pair_bspline.h | 7 ++ src/ML-UF3/uf3_triplet_bspline.cpp | 147 +++++++++++++++++++++++++++++ src/ML-UF3/uf3_triplet_bspline.h | 5 + 4 files changed, 215 insertions(+) diff --git a/src/ML-UF3/uf3_pair_bspline.cpp b/src/ML-UF3/uf3_pair_bspline.cpp index 3ecdb2f626..1e8e2eeffa 100644 --- a/src/ML-UF3/uf3_pair_bspline.cpp +++ b/src/ML-UF3/uf3_pair_bspline.cpp @@ -78,6 +78,62 @@ uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const std::vector &ukno dnbspline_bases.push_back(uf3_bspline_basis2(lmp, &dnknot_vect[i], dncoeff_vect[i])); } +// Constructor +// Passing arrays +uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const double* uknot_array, + const int uknot_array_size, + const double* ucoeff_array, + const int ucoeff_array_size, + const int uknot_spacing_type) +{ + lmp = ulmp; + + knot_vect = std::vector (uknot_array, uknot_array + uknot_array_size); + coeff_vect = std::vector (ucoeff_array, ucoeff_array + ucoeff_array_size); + + knot_spacing_type = uknot_spacing_type; + if (knot_spacing_type==0){ + knot_spacing = knot_vect[4]-knot_vect[3]; + get_starting_index=&uf3_pair_bspline::get_starting_index_uniform; + } + else if (knot_spacing_type==1){ + knot_spacing = 0; + get_starting_index=&uf3_pair_bspline::get_starting_index_nonuniform; + } + + else + lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ + '1'(non-uniform knots)"); + + knot_vect_size = uknot_array_size; + coeff_vect_size = ucoeff_array_size; + + // Initialize B-Spline Basis Functions + for (int i = 0; i < knot_vect.size() - 4; i++) + bspline_bases.push_back(uf3_bspline_basis3(lmp, &knot_vect[i], coeff_vect[i])); + + // Initialize Coefficients and Knots for Derivatives + // The last coefficient needs to be droped + for (int i = 0; i < coeff_vect_size - 1; i++) { + double dntemp4 = 3 / (knot_vect[i + 4] - knot_vect[i + 1]); + dncoeff_vect.push_back((coeff_vect[i + 1] - coeff_vect[i]) * dntemp4); + } + //What we have is a clamped bspline -->i.e value of the bspline curve at the + //knots with multiplicity equal to the degree of bspline is equal to the coefficient + // + //Therefore for the derivative bspline the very first and last knot needs to be droped + //to change their multiplicity from 4 (necessary condition for clamped cubic bspline) + //to 3 (necessary condition for clamped quadratic bspline) + // + //Also if the coeff vector size of decreases by 1 for the derivative bspline + //knots size needs to go down by 2 as ==> knots = coefficient + degree + 1 + for (int i = 1; i < knot_vect_size - 1; i++) dnknot_vect.push_back(knot_vect[i]); + + // Initialize B-Spline Derivative Basis Functions + for (int i = 0; i < dnknot_vect.size() - 3; i++) + dnbspline_bases.push_back(uf3_bspline_basis2(lmp, &dnknot_vect[i], dncoeff_vect[i])); +} + uf3_pair_bspline::~uf3_pair_bspline() {} int uf3_pair_bspline::get_starting_index_uniform(double r) diff --git a/src/ML-UF3/uf3_pair_bspline.h b/src/ML-UF3/uf3_pair_bspline.h index d10bfb430e..e471f02ac4 100644 --- a/src/ML-UF3/uf3_pair_bspline.h +++ b/src/ML-UF3/uf3_pair_bspline.h @@ -41,6 +41,13 @@ class uf3_pair_bspline { uf3_pair_bspline(LAMMPS *ulmp, const std::vector &uknot_vect, const std::vector &ucoeff_vect, const int &uknot_spacing_type); + + uf3_pair_bspline(LAMMPS *ulmp, const double* uknot_array, + const int uknot_array_size, + const double* ucoeff_array, + const int ucoeff_array_size, + const int uknot_spacing_type); + ~uf3_pair_bspline(); int knot_spacing_type; double knot_spacing=0; diff --git a/src/ML-UF3/uf3_triplet_bspline.cpp b/src/ML-UF3/uf3_triplet_bspline.cpp index a2087bd3a1..0527599965 100644 --- a/src/ML-UF3/uf3_triplet_bspline.cpp +++ b/src/ML-UF3/uf3_triplet_bspline.cpp @@ -145,6 +145,153 @@ uf3_triplet_bspline::uf3_triplet_bspline( } } +// Construct a new 3D B-Spline from arrays +uf3_triplet_bspline::uf3_triplet_bspline( + LAMMPS *ulmp, double **uknot_array, const int *uknot_array_size, + double ***ucoeff_array, const int *ucoeff_array_size, + const int &uknot_spacing_type) +{ + lmp = ulmp; + + knot_matrix.resize(3); + //utils::logmesg(lmp, "knot_matrix dim = {} {} {}\nknots = ",uknot_array_size[0], + // uknot_array_size[1], uknot_array_size[2]); + for (int i = 0; i < 3; i++) { + knot_matrix[i].resize(uknot_array_size[i]); + //utils::logmesg(lmp, "{}= ",i); + for (int j = 0; j < uknot_array_size[i]; j++) { + //utils::logmesg(lmp, "{} ", uknot_array[i][j]); + knot_matrix[i][j] = uknot_array[i][j]; + } + //utils::logmesg(lmp,"\n"); + } + + coeff_matrix.resize(ucoeff_array_size[0]); + for (int i = 0; i < ucoeff_array_size[0]; i++) { + coeff_matrix[i].resize(ucoeff_array_size[1]); + for (int j = 0; j < ucoeff_array_size[1]; j++) { + coeff_matrix[i][j].resize(ucoeff_array_size[2]); + for (int k = 0; k < ucoeff_array_size[2]; k++){ + coeff_matrix[i][j][k] = ucoeff_array[i][j][k]; + } + } + } + + knot_spacing_type = uknot_spacing_type; + if (knot_spacing_type==0){ + knot_spacing_ij = knot_matrix[2][4]-knot_matrix[2][3]; + knot_spacing_ik = knot_matrix[1][4]-knot_matrix[1][3]; + knot_spacing_jk = knot_matrix[0][4]-knot_matrix[0][3]; + get_starting_index=&uf3_triplet_bspline::get_starting_index_uniform; + } + else if (knot_spacing_type==1){ + knot_spacing_ij = 0; + knot_spacing_ik = 0; + knot_spacing_jk = 0; + get_starting_index=&uf3_triplet_bspline::get_starting_index_nonuniform; + } + + else + lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ + '1'(non-uniform knots)"); + + knot_vect_size_ij = knot_matrix[2].size(); + knot_vect_size_ik = knot_matrix[1].size(); + knot_vect_size_jk = knot_matrix[0].size(); + + int resolution_ij = knot_vect_size_ij - 4; + int resolution_ik = knot_vect_size_ik - 4; + int resolution_jk = knot_vect_size_jk - 4; + + // Cache Spline Basis Functions + for (int l = 0; l < resolution_ij; l++) { + bsplines_ij.push_back(uf3_bspline_basis3(lmp, &knot_matrix[2][l], 1)); + } + + for (int l = 0; l < resolution_ik; l++) { + // Reuse jk Basis if Knots match + if (knot_matrix[1][l] == knot_matrix[2][l] && knot_matrix[1][l + 1] == knot_matrix[2][l + 1] && + knot_matrix[1][l + 2] == knot_matrix[2][l + 2] && + knot_matrix[1][l + 3] == knot_matrix[2][l + 3]) + bsplines_ik.push_back(bsplines_ij[l]); + else + bsplines_ik.push_back(uf3_bspline_basis3(lmp, &knot_matrix[1][l], 1)); + } + + for (int l = 0; l < resolution_jk; l++) { + bsplines_jk.push_back(uf3_bspline_basis3(lmp, &knot_matrix[0][l], 1)); + } + + // Initialize Coefficients for Derivatives + for (int i = 0; i < coeff_matrix.size(); i++) { + std::vector> dncoeff_vect2; + for (int j = 0; j < coeff_matrix[0].size(); j++) { + std::vector dncoeff_vect; + for (int k = 0; k < coeff_matrix[0][0].size() - 1; k++) { + double dntemp4 = 3 / (knot_matrix[0][k + 4] - knot_matrix[0][k + 1]); + dncoeff_vect.push_back((coeff_matrix[i][j][k + 1] - coeff_matrix[i][j][k]) * dntemp4); + } + dncoeff_vect2.push_back(dncoeff_vect); + } + dncoeff_matrix_jk.push_back(dncoeff_vect2); + } + + for (int i = 0; i < coeff_matrix.size(); i++) { + std::vector> dncoeff_vect2; + for (int j = 0; j < coeff_matrix[0].size() - 1; j++) { + double dntemp4 = 3 / (knot_matrix[1][j + 4] - knot_matrix[1][j + 1]); + std::vector dncoeff_vect; + for (int k = 0; k < coeff_matrix[0][0].size(); k++) { + dncoeff_vect.push_back((coeff_matrix[i][j + 1][k] - coeff_matrix[i][j][k]) * dntemp4); + } + dncoeff_vect2.push_back(dncoeff_vect); + } + dncoeff_matrix_ik.push_back(dncoeff_vect2); + } + + for (int i = 0; i < coeff_matrix.size() - 1; i++) { + std::vector> dncoeff_vect2; + double dntemp4 = 3 / (knot_matrix[2][i + 4] - knot_matrix[2][i + 1]); + for (int j = 0; j < coeff_matrix[0].size(); j++) { + std::vector dncoeff_vect; + for (int k = 0; k < coeff_matrix[0][0].size(); k++) { + dncoeff_vect.push_back((coeff_matrix[i + 1][j][k] - coeff_matrix[i][j][k]) * dntemp4); + } + dncoeff_vect2.push_back(dncoeff_vect); + } + dncoeff_matrix_ij.push_back(dncoeff_vect2); + } + + std::vector> dnknot_matrix; + for (int i = 0; i < knot_matrix.size(); i++) { + std::vector dnknot_vect; + for (int j = 1; j < knot_matrix[0].size() - 1; j++) { + dnknot_vect.push_back(knot_matrix[i][j]); + } + dnknot_matrix.push_back(dnknot_vect); + } + + // Cache Derivative Spline Basis Functions + for (int l = 0; l < resolution_ij - 1; l++) { + dnbsplines_ij.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[2][l], 1)); + } + + for (int l = 0; l < resolution_ik - 1; l++) { + // Reuse jk Basis if Knots match + if (dnknot_matrix[1][l] == dnknot_matrix[2][l] && + dnknot_matrix[1][l + 1] == dnknot_matrix[2][l + 1] && + dnknot_matrix[1][l + 2] == dnknot_matrix[2][l + 2]) + dnbsplines_ik.push_back(dnbsplines_ij[l]); + else + dnbsplines_ik.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[1][l], 1)); + } + + for (int l = 0; l < resolution_jk - 1; l++) { + dnbsplines_jk.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[0][l], 1)); + } +} + + // Destructor uf3_triplet_bspline::~uf3_triplet_bspline() {} diff --git a/src/ML-UF3/uf3_triplet_bspline.h b/src/ML-UF3/uf3_triplet_bspline.h index 642201d879..e627a61f9e 100644 --- a/src/ML-UF3/uf3_triplet_bspline.h +++ b/src/ML-UF3/uf3_triplet_bspline.h @@ -47,6 +47,11 @@ class uf3_triplet_bspline { uf3_triplet_bspline(LAMMPS *ulmp, const std::vector> &uknot_matrix, const std::vector>> &ucoeff_matrix, const int &uknot_spacing_type); + + uf3_triplet_bspline(LAMMPS *ulmp, double **uknot_array, const int *uknot_array_size, + double ***ucoeff_array, const int *ucoeff_array_size, + const int &uknot_spacing_type); + ~uf3_triplet_bspline(); int knot_spacing_type; double knot_spacing_ij=0,knot_spacing_ik=0,knot_spacing_jk=0; From f6c8bd117869d3379358eb59ec476f162a0f2ca1 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 15 Apr 2024 10:51:39 -0400 Subject: [PATCH 46/65] Updated pair_coeff in unittest to read only one potential file; added Nb.uf3 unified potential file --- potentials/{Nb_Nb_Nb.uf3 => Nb.uf3} | 9 ++++++++- potentials/Nb_Nb.uf3 | 7 ------- unittest/force-styles/tests/manybody-pair-uf3.yaml | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) rename potentials/{Nb_Nb_Nb.uf3 => Nb.uf3} (95%) delete mode 100644 potentials/Nb_Nb.uf3 diff --git a/potentials/Nb_Nb_Nb.uf3 b/potentials/Nb.uf3 similarity index 95% rename from potentials/Nb_Nb_Nb.uf3 rename to potentials/Nb.uf3 index ac3748b33c..5f1cdb6f63 100644 --- a/potentials/Nb_Nb_Nb.uf3 +++ b/potentials/Nb.uf3 @@ -1,5 +1,12 @@ #UF3 POT UNITS: metal DATE: 2024-04-02 12:18:15.359106 AUTHOR: Ajinkya_Hire CITATION: -3B 0 3 nk +2B Nb Nb 0 3 nk +8.0 31 +0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8 +27 +79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0 +# +#UF3 POT UNITS: metal DATE: 2024-04-02 12:18:15.359106 AUTHOR: Ajinkya_Hire CITATION: +3B Nb Nb Nb 0 3 nk 8.0 4.0 4.0 23 15 15 0.001 0.001 0.001 0.001 0.50093749999999992 1.000875 1.5008124999999999 2.00075 2.5006874999999997 3.0006249999999999 3.5005624999999996 4.0004999999999997 4.5004375000000003 5.000375 5.5003124999999997 6.0002500000000003 6.5001875 7.0001249999999997 7.5000625000000003 8 8 8 8 0.001 0.001 0.001 0.001 0.50087499999999996 1.00075 1.5006249999999999 2.0005000000000002 2.500375 3.0002499999999999 3.5001250000000002 4 4 4 4 diff --git a/potentials/Nb_Nb.uf3 b/potentials/Nb_Nb.uf3 deleted file mode 100644 index a8583b105d..0000000000 --- a/potentials/Nb_Nb.uf3 +++ /dev/null @@ -1,7 +0,0 @@ -#UF3 POT UNITS: metal DATE: 2024-04-02 12:18:15.359106 AUTHOR: Ajinkya_Hire CITATION: -2B 0 3 nk -8.0 31 -0.001 0.001 0.001 0.001 0.33429166666666665 0.66758333333333331 1.000875 1.3341666666666665 1.6674583333333333 2.00075 2.3340416666666663 2.6673333333333331 3.0006249999999999 3.3339166666666666 3.667208333333333 4.0004999999999997 4.3337916666666665 4.6670833333333333 5.000375 5.3336666666666668 5.6669583333333335 6.0002500000000003 6.3335416666666671 6.6668333333333338 7.0001249999999997 7.3334166666666665 7.6667083333333332 8 8 8 8 -27 -79.140244588519465 79.140244588519465 55.85833391113556 36.597903318706138 21.358952811231141 12.290000872768841 1.9593931914091953 -0.65697974623243804 -0.85177956270573463 -0.68929688239869991 -0.46787243412973262 -0.27624655899523165 -0.11912921944351409 -0.056302369393035338 -0.0049812809608429064 0.0085637634684603507 0.0034716161454604712 -0.0058751075573311978 -0.005453415412748467 -0.0015123194244718201 0.0011577919587182201 0.001583772506713282 -0.00049823976100720228 -0.0013902809146717273 0 0 0 -# diff --git a/unittest/force-styles/tests/manybody-pair-uf3.yaml b/unittest/force-styles/tests/manybody-pair-uf3.yaml index 075891e8f4..534b489c78 100644 --- a/unittest/force-styles/tests/manybody-pair-uf3.yaml +++ b/unittest/force-styles/tests/manybody-pair-uf3.yaml @@ -14,8 +14,7 @@ post_commands: ! "" input_file: in.manybody pair_style: uf3 3 pair_coeff: ! | - * * Nb_Nb.uf3 - 3b * * * Nb_Nb_Nb.uf3 + * * Nb.uf3 Nb Nb Nb Nb Nb Nb Nb Nb extract: ! "" natoms: 64 init_vdwl: -76.14388662099438 From d468ee8f7dc462da6a852136b07175ae877df2a1 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 15 Apr 2024 15:22:22 -0400 Subject: [PATCH 47/65] Updated the code as we are no longer using std::vector for knots and coefficients --- src/KOKKOS/pair_uf3_kokkos.cpp | 180 ++++++++++++++++++++------------- 1 file changed, 107 insertions(+), 73 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 7bc6ef22d5..5e0882d90b 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -272,8 +272,8 @@ template void PairUF3Kokkos::create_coefficients( template void PairUF3Kokkos::create_2b_coefficients() { const int num_of_elements = atom->ntypes; - std::vector>>& n2b_knot = get_n2b_knot(); - std::vector>>& n2b_coeff = get_n2b_coeff(); + //std::vector>>& n2b_knot = get_n2b_knot(); + //std::vector>>& n2b_coeff = get_n2b_coeff(); // Setup interaction pair map //TODO: Instead of using map2b and map3b use simple indexing @@ -291,9 +291,9 @@ template void PairUF3Kokkos::create_2b_coefficien // Count max knots for array size - int max_knots = 0; - for (int i = 1; i < n2b_knot.size(); i++) - for (int j = i; j < n2b_knot[i].size(); j++) max_knots = max(max_knots, n2b_knot[i][j].size()); + int max_knots = max_num_knots_2b; + /*for (int i = 1; i < n2b_knot.size(); i++) + for (int j = i; j < n2b_knot[i].size(); j++) max_knots = max(max_knots, n2b_knot[i][j].size());*/ // Copy coefficients to view @@ -302,8 +302,9 @@ template void PairUF3Kokkos::create_2b_coefficien for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - for (int k = 0; k < n2b_coeff[i][j].size(); k++) { - d_coefficients_2b_view(map2b_view(i, j), k) = n2b_coeff[i][j][k]; + for (int k = 0; k < max_num_coeff_2b; k++) { + //n2b_coeff[i][j].size(); k++) { + d_coefficients_2b_view(map2b_view(i, j), k) = n2b_coeff_array[i][j][k]; } } } @@ -318,10 +319,11 @@ template void PairUF3Kokkos::create_2b_coefficien for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - for (int k = 0; k < n2b_knot[i][j].size(); k++) { - d_n2b_knot_view(map2b_view(i, j), k) = n2b_knot[i][j][k]; + for (int k = 0; k < max_num_knots_2b; k++) { + //n2b_knot[i][j].size(); k++) { + d_n2b_knot_view(map2b_view(i, j), k) = n2b_knots_array[i][j][k]; } - d_n2b_knot_spacings_view(map2b_view(i, j)) = get_knot_spacing_2b(i,j); + d_n2b_knot_spacings_view(map2b_view(i, j)) = n2b_knots_array[i][j][4] - n2b_knots_array[i][j][3];//get_knot_spacing_2b(i,j); } } @@ -334,8 +336,9 @@ template void PairUF3Kokkos::create_2b_coefficien for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - for (int l = 0; l < n2b_knot[i][j].size() - 4; l++) { - auto c = get_constants(&n2b_knot[i][j][l], n2b_coeff[i][j][l]); + for (int l = 0; l < n2b_knots_array_size[i][j] - 4; l++) { + //n2b_knot[i][j].size() - 4; l++) { + auto c = get_constants(&n2b_knots_array[i][j][l], n2b_coeff_array[i][j][l]); for (int k = 0; k < 16; k++) constants_2b_view(map2b_view(i, j), l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; @@ -349,10 +352,11 @@ template void PairUF3Kokkos::create_2b_coefficien for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - for (int l = 0; l < n2b_knot[i][j].size() - 5; l++) { - double dntemp4 = 3 / (n2b_knot[i][j][l + 4] - n2b_knot[i][j][l + 1]); - double coeff = (n2b_coeff[i][j][l + 1] - n2b_coeff[i][j][l]) * dntemp4; - auto c = get_dnconstants(&n2b_knot[i][j][l + 1], coeff); + for (int l = 0; l < n2b_knots_array_size[i][j] - 5; l++) { + //n2b_knot[i][j].size() - 5; l++) { + double dntemp4 = 3 / (n2b_knots_array[i][j][l + 4] - n2b_knots_array[i][j][l + 1]); + double coeff = (n2b_coeff_array[i][j][l + 1] - n2b_coeff_array[i][j][l]) * dntemp4; + auto c = get_dnconstants(&n2b_knots_array[i][j][l + 1], coeff); for (int k = 0; k < 9; k++) dnconstants_2b_view(map2b_view(i, j), l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; @@ -365,8 +369,8 @@ template void PairUF3Kokkos::create_2b_coefficien template void PairUF3Kokkos::create_3b_coefficients() { const int num_of_elements = atom->ntypes; - std::vector>>>>& n3b_knot_matrix = - get_n3b_knot_matrix(); + //std::vector>>>>& n3b_knot_matrix = + // get_n3b_knot_matrix(); //std::unordered_map>>>& // n3b_coeff_matrix = get_n3b_coeff_matrix(); // Init interaction map for 3B @@ -388,21 +392,21 @@ template void PairUF3Kokkos::create_3b_coefficien // Count max knots for view - int max_knots = 0; + int max_knots = max_num_knots_3b; //In n3b_knot_matrix[i][j][k], //n3b_knot_matrix[i][j][k][0] is the knot_vector along jk, //n3b_knot_matrix[i][j][k][1] is the knot_vector along ik, //n3b_knot_matrix[i][j][k][2] is the knot_vector along ij, //see pair_uf3.cpp for more details - for (int i = 1; i < n3b_knot_matrix.size(); i++) + /*for (int i = 1; i < n3b_knot_matrix.size(); i++) for (int j = 1; j < n3b_knot_matrix[i].size(); j++) for (int k = 1; k < n3b_knot_matrix[i][j].size(); k++) max_knots = max(max_knots, max(n3b_knot_matrix[i][j][k][0].size(), max(n3b_knot_matrix[i][j][k][1].size(), - n3b_knot_matrix[i][j][k][2].size()))); + n3b_knot_matrix[i][j][k][2].size())));*/ // Init knot matrix view @@ -411,21 +415,27 @@ template void PairUF3Kokkos::create_3b_coefficien auto d_n3b_knot_matrix_view = Kokkos::create_mirror(d_n3b_knot_matrix); auto d_n3b_knot_matrix_spacings_view = Kokkos::create_mirror(d_n3b_knot_matrix_spacings); - for (int i = 1; i < n3b_knot_matrix.size(); i++) - for (int j = 1; j < n3b_knot_matrix[i].size(); j++) - for (int k = 1; k < n3b_knot_matrix[i][j].size(); k++) { - for (int m = 0; m < n3b_knot_matrix[i][j][k][0].size(); m++) - d_n3b_knot_matrix_view(map3b_view(i, j, k), 0, m) = n3b_knot_matrix[i][j][k][0][m]; - for (int m = 0; m < n3b_knot_matrix[i][j][k][1].size(); m++) - d_n3b_knot_matrix_view(map3b_view(i, j, k), 1, m) = n3b_knot_matrix[i][j][k][1][m]; - for (int m = 0; m < n3b_knot_matrix[i][j][k][2].size(); m++) - d_n3b_knot_matrix_view(map3b_view(i, j, k), 2, m) = n3b_knot_matrix[i][j][k][2][m]; + for (int i = 1; i < num_of_elements + 1; i++)//n3b_knot_matrix.size(); i++) + for (int j = 1; j < num_of_elements + 1; j++)//n3b_knot_matrix[i].size(); j++) + for (int k = 1; k < num_of_elements + 1; k++){//n3b_knot_matrix[i][j].size(); k++) { + for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][0]; m++)//n3b_knot_matrix[i][j][k][0].size(); m++) + d_n3b_knot_matrix_view(map3b_view(i, j, k), 0, m) = + n3b_knots_array[map_3b[i][j][k]][0][m];//n3b_knot_matrix[i][j][k][0][m]; + for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][1]; m++)//n3b_knot_matrix[i][j][k][1].size(); m++) + d_n3b_knot_matrix_view(map3b_view(i, j, k), 1, m) = + n3b_knots_array[map_3b[i][j][k]][1][m];//n3b_knot_matrix[i][j][k][1][m]; + for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][2]; m++)//n3b_knot_matrix[i][j][k][2].size(); m++) + d_n3b_knot_matrix_view(map3b_view(i, j, k), 2, m) = + n3b_knots_array[map_3b[i][j][k]][2][m];//n3b_knot_matrix[i][j][k][2][m]; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = get_knot_spacing_3b_ij(i,j,k); + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = + n3b_knots_array[map_3b[i][j][k]][2][4] - n3b_knots_array[map_3b[i][j][k]][2][3];//get_knot_spacing_3b_ij(i,j,k); //uf3_impl->UFBS3b[i][j][k].knot_spacing_ij; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = get_knot_spacing_3b_ik(i,j,k); + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = + n3b_knots_array[map_3b[i][j][k]][1][4] - n3b_knots_array[map_3b[i][j][k]][1][3];//get_knot_spacing_3b_ik(i,j,k); //uf3_impl->UFBS3b[i][j][k].knot_spacing_ik; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = get_knot_spacing_3b_jk(i,j,k); + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = + n3b_knots_array[map_3b[i][j][k]][0][4] - n3b_knots_array[map_3b[i][j][k]][0][3];//get_knot_spacing_3b_jk(i,j,k); //uf3_impl->UFBS3b[i][j][k].knot_spacing_jk; } Kokkos::deep_copy(d_n3b_knot_matrix, d_n3b_knot_matrix_view); @@ -440,11 +450,14 @@ template void PairUF3Kokkos::create_3b_coefficien for (int j = 1; j < num_of_elements + 1; j++) { for (int k = 1; k < num_of_elements + 1; k++) { d_n3b_knot_spacings_view(map3b_view(i, j, k), 0) = - 1 / (n3b_knot_matrix[i][j][k][0][5] - n3b_knot_matrix[i][j][k][0][4]); + 1 / (n3b_knots_array[map_3b[i][j][k]][0][5] - n3b_knots_array[map_3b[i][j][k]][0][4]); + //(n3b_knot_matrix[i][j][k][0][5] - n3b_knot_matrix[i][j][k][0][4]); d_n3b_knot_spacings_view(map3b_view(i, j, k), 1) = - 1 / (n3b_knot_matrix[i][j][k][1][5] - n3b_knot_matrix[i][j][k][1][4]); + 1 / (n3b_knots_array[map_3b[i][j][k]][1][5] - n3b_knots_array[map_3b[i][j][k]][1][4]); + //(n3b_knot_matrix[i][j][k][1][5] - n3b_knot_matrix[i][j][k][1][4]); d_n3b_knot_spacings_view(map3b_view(i, j, k), 2) = - 1 / (n3b_knot_matrix[i][j][k][2][5] - n3b_knot_matrix[i][j][k][2][4]); + 1 / (n3b_knots_array[map_3b[i][j][k]][2][5] - n3b_knots_array[map_3b[i][j][k]][2][4]); + //(n3b_knot_matrix[i][j][k][2][5] - n3b_knot_matrix[i][j][k][2][4]); } } } @@ -459,14 +472,14 @@ template void PairUF3Kokkos::create_3b_coefficien for (int n = 1; n < num_of_elements + 1; n++) { for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { - std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); - std::vector>> n3b_coeff_matrix_key = - get_n3b_coeff_matrix_key(key); - for (int i = 0; i < n3b_coeff_matrix_key.size(); i++) { - for (int j = 0; j < n3b_coeff_matrix_key[i].size(); j++) { - for (int k = 0; k < n3b_coeff_matrix_key[i][j].size() - 1; k++) { + //std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); + //std::vector>> n3b_coeff_matrix_key = + // get_n3b_coeff_matrix_key(key); + for (int i = 0; i < n3b_coeff_array_size[map_3b[n][m][o]][0]; i++) {//n3b_coeff_matrix_key.size(); i++) { + for (int j = 0; j < n3b_coeff_array_size[map_3b[n][m][o]][1]; j++) {//n3b_coeff_matrix_key[i].size(); j++) { + for (int k = 0; k < n3b_coeff_array_size[map_3b[n][m][o]][2]; k++) {//n3b_coeff_matrix_key[i][j].size() - 1; k++) { d_coefficients_3b_view(map3b_view(n, m, o), i, j, k) = - n3b_coeff_matrix_key[i][j][k]; + n3b_coeff_array[map_3b[n][m][o]][i][j][k];//n3b_coeff_matrix_key[i][j][k]; } } } @@ -497,40 +510,49 @@ template void PairUF3Kokkos::create_3b_coefficien for (int n = 1; n < num_of_elements + 1; n++) { for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { - std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); - std::vector>> n3b_coeff_matrix_key = - get_n3b_coeff_matrix_key(key); - for (int i = 0; i < n3b_coeff_matrix_key.size(); i++) { - for (int j = 0; j < n3b_coeff_matrix_key[i].size(); j++) { - for (int k = 0; k < n3b_coeff_matrix_key[i][j].size() - 1; k++) { + //std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); + //std::vector>> n3b_coeff_matrix_key = + // get_n3b_coeff_matrix_key(key); + int coeff_dim1 = n3b_coeff_array_size[map_3b[n][m][o]][0]; + int coeff_dim2 = n3b_coeff_array_size[map_3b[n][m][o]][1]; + int coeff_dim3 = n3b_coeff_array_size[map_3b[n][m][o]][2]; + for (int i = 0; i < coeff_dim1; i++) {//n3b_coeff_matrix_key.size(); i++) { + for (int j = 0; j < coeff_dim2; j++) {//n3b_coeff_matrix_key[i].size(); j++) { + for (int k = 0; k < coeff_dim3; k++) {//n3b_coeff_matrix_key[i][j].size() - 1; k++) { F_FLOAT dntemp4 = - 3 / (n3b_knot_matrix[n][m][o][0][k + 4] - n3b_knot_matrix[n][m][o][0][k + 1]); + 3 / (n3b_knots_array[map_3b[n][m][o]][0][k + 4] - n3b_knots_array[map_3b[n][m][o]][0][k + 1]); + //(n3b_knot_matrix[n][m][o][0][k + 4] - n3b_knot_matrix[n][m][o][0][k + 1]); d_dncoefficients_3b_view(map3b_view(n, m, o), 2, i, j, k) = - (n3b_coeff_matrix_key[i][j][k + 1] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; + (n3b_coeff_array[map_3b[n][m][o]][i][j][k + 1] - n3b_coeff_array[map_3b[n][m][o]][i][j][k]) * dntemp4; + //(n3b_coeff_matrix_key[i][j][k + 1] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } - for (int i = 0; i < n3b_coeff_matrix_key.size(); i++) { + for (int i = 0; i < coeff_dim1; i++) {//n3b_coeff_matrix_key.size(); i++) { std::vector> dncoeff_vect2; - for (int j = 0; j < n3b_coeff_matrix_key[i].size() - 1; j++) { + for (int j = 0; j < coeff_dim2; j++) {//n3b_coeff_matrix_key[i].size() - 1; j++) { F_FLOAT dntemp4 = - 3 / (n3b_knot_matrix[n][m][o][1][j + 4] - n3b_knot_matrix[n][m][o][1][j + 1]); + 3 / (n3b_knots_array[map_3b[n][m][o]][1][j + 4] - n3b_knots_array[map_3b[n][m][o]][1][j + 1]); + //(n3b_knot_matrix[n][m][o][1][j + 4] - n3b_knot_matrix[n][m][o][1][j + 1]); std::vector dncoeff_vect; - for (int k = 0; k < n3b_coeff_matrix_key[i][j].size(); k++) { + for (int k = 0; k < coeff_dim3; k++) {//n3b_coeff_matrix_key[i][j].size(); k++) { d_dncoefficients_3b_view(map3b_view(n, m, o), 1, i, j, k) = - (n3b_coeff_matrix_key[i][j + 1][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; + (n3b_coeff_array[map_3b[n][m][o]][i][j + 1][k] - n3b_coeff_array[map_3b[n][m][o]][i][j][k]) * dntemp4; + //(n3b_coeff_matrix_key[i][j + 1][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } - for (int i = 0; i < n3b_coeff_matrix_key.size() - 1; i++) { + for (int i = 0; i < coeff_dim1; i++) {//n3b_coeff_matrix_key.size() - 1; i++) { F_FLOAT dntemp4 = - 3 / (n3b_knot_matrix[n][m][o][2][i + 4] - n3b_knot_matrix[n][m][o][2][i + 1]); - for (int j = 0; j < n3b_coeff_matrix_key[i].size(); j++) { - for (int k = 0; k < n3b_coeff_matrix_key[i][j].size(); k++) { + 3 / (n3b_knots_array[map_3b[n][m][o]][2][i + 4] - n3b_knots_array[map_3b[n][m][o]][2][i + 1]); + //(n3b_knot_matrix[n][m][o][2][i + 4] - n3b_knot_matrix[n][m][o][2][i + 1]); + for (int j = 0; j < coeff_dim2; j++) {//n3b_coeff_matrix_key[i].size(); j++) { + for (int k = 0; k < coeff_dim3; k++) {//n3b_coeff_matrix_key[i][j].size(); k++) { d_dncoefficients_3b_view(map3b_view(n, m, o), 0, i, j, k) = - (n3b_coeff_matrix_key[i + 1][j][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; + (n3b_coeff_array[map_3b[n][m][o]][i + 1][j][k] - n3b_coeff_array[map_3b[n][m][o]][i][j][k]) * dntemp4; + //(n3b_coeff_matrix_key[i + 1][j][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } @@ -552,20 +574,26 @@ template void PairUF3Kokkos::create_3b_coefficien for (int n = 1; n < num_of_elements + 1; n++) { for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { - for (int l = 0; l < n3b_knot_matrix[n][m][o][2].size() - 4; l++) { - auto c = get_constants(&n3b_knot_matrix[n][m][o][2][l], 1); + for (int l = 0; l < n3b_knots_array_size[map_3b[n][m][o]][2] - 4; l++) { + //n3b_knot_matrix[n][m][o][2].size() - 4; l++) { + auto c = get_constants(&n3b_knots_array[map_3b[n][m][o]][2][l], 1); + //auto c = get_constants(&n3b_knot_matrix[n][m][o][2][l], 1); for (int k = 0; k < 16; k++) constants_3b_view(map3b_view(n, m, o), 0, l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } - for (int l = 0; l < n3b_knot_matrix[n][m][o][1].size() - 4; l++) { - auto c = get_constants(&n3b_knot_matrix[n][m][o][1][l], 1); + for (int l = 0; l < n3b_knots_array_size[map_3b[n][m][o]][1] - 4; l++) { + //n3b_knot_matrix[n][m][o][1].size() - 4; l++) { + auto c = get_constants(&n3b_knots_array[map_3b[n][m][o]][1][l], 1); + //auto c = get_constants(&n3b_knot_matrix[n][m][o][1][l], 1); for (int k = 0; k < 16; k++) constants_3b_view(map3b_view(n, m, o), 1, l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } - for (int l = 0; l < n3b_knot_matrix[n][m][o][0].size() - 4; l++) { - auto c = get_constants(&n3b_knot_matrix[n][m][o][0][l], 1); + for (int l = 0; l < n3b_knots_array_size[map_3b[n][m][o]][0] -4; l++) { + //n3b_knot_matrix[n][m][o][0].size() - 4; l++) { + auto c = get_constants(&n3b_knots_array[map_3b[n][m][o]][0][l], 1); + //auto c = get_constants(&n3b_knot_matrix[n][m][o][0][l], 1); for (int k = 0; k < 16; k++) constants_3b_view(map3b_view(n, m, o), 2, l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; @@ -581,20 +609,26 @@ template void PairUF3Kokkos::create_3b_coefficien for (int n = 1; n < num_of_elements + 1; n++) { for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { - for (int l = 1; l < n3b_knot_matrix[n][m][o][2].size() - 5; l++) { - auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][2][l], 1); + for (int l = 1; l < n3b_knots_array_size[map_3b[n][m][o]][2] - 5; l++) { + //n3b_knot_matrix[n][m][o][2].size() - 5; l++) { + auto c = get_dnconstants(&n3b_knots_array[map_3b[n][m][o]][2][l], 1); + //auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][2][l], 1); for (int k = 0; k < 9; k++) dnconstants_3b_view(map3b_view(n, m, o), 0, l - 1, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } - for (int l = 1; l < n3b_knot_matrix[n][m][o][1].size() - 5; l++) { - auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][1][l], 1); + for (int l = 1; l < n3b_knots_array_size[map_3b[n][m][o]][1] - 5; l++) { + //n3b_knot_matrix[n][m][o][1].size() - 5; l++) { + auto c = get_dnconstants(&n3b_knots_array[map_3b[n][m][o]][1][l], 1); + //auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][1][l], 1); for (int k = 0; k < 9; k++) dnconstants_3b_view(map3b_view(n, m, o), 1, l - 1, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } - for (int l = 1; l < n3b_knot_matrix[n][m][o][0].size() - 5; l++) { - auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][0][l], 1); + for (int l = 1; l < n3b_knots_array_size[map_3b[n][m][o]][0] - 5; l++) { + //n3b_knot_matrix[n][m][o][0].size() - 5; l++) { + auto c = get_dnconstants(&n3b_knots_array[map_3b[n][m][o]][0][l], 1); + //auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][0][l], 1); for (int k = 0; k < 9; k++) dnconstants_3b_view(map3b_view(n, m, o), 2, l - 1, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; From 4c1be999fa8aebf264db7fe94f4cf0d095540e16 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Mon, 15 Apr 2024 15:31:42 -0400 Subject: [PATCH 48/65] Removed reference to std::vector knots and coefficients; commented out getter functions --- src/ML-UF3/pair_uf3.cpp | 38 ++++++++++++++++++++------------------ src/ML-UF3/pair_uf3.h | 4 ++-- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index b6986d422f..8e853ab35b 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -39,9 +39,9 @@ namespace LAMMPS_NS{ struct UF3Impl { - std::vector>> n2b_knot, n2b_coeff; - std::vector>>>> n3b_knot_matrix; - std::unordered_map>>> n3b_coeff_matrix; + //std::vector>> n2b_knot, n2b_coeff; + //std::vector>>>> n3b_knot_matrix; + //std::unordered_map>>> n3b_coeff_matrix; std::vector> UFBS2b; std::vector>> UFBS3b; @@ -289,12 +289,12 @@ void PairUF3::allocate() "pair:n2b_coeff_array_size"); // Contains knot_vect of 2-body potential for type i and j - uf3_impl->n2b_knot.resize(num_of_elements + 1); - uf3_impl->n2b_coeff.resize(num_of_elements + 1); + //uf3_impl->n2b_knot.resize(num_of_elements + 1); + //uf3_impl->n2b_coeff.resize(num_of_elements + 1); uf3_impl->UFBS2b.resize(num_of_elements + 1); for (int i = 1; i < num_of_elements + 1; i++) { - uf3_impl->n2b_knot[i].resize(num_of_elements + 1); - uf3_impl->n2b_coeff[i].resize(num_of_elements + 1); + //uf3_impl->n2b_knot[i].resize(num_of_elements + 1); + //uf3_impl->n2b_coeff[i].resize(num_of_elements + 1); uf3_impl->UFBS2b[i].resize(num_of_elements + 1); } if (pot_3b) { @@ -345,13 +345,13 @@ void PairUF3::allocate() memory->create(n3b_coeff_array_size, tot_interaction_count_3b, 3, "pair:n3b_coeff_array_size"); - uf3_impl->n3b_knot_matrix.resize(num_of_elements + 1); + //uf3_impl->n3b_knot_matrix.resize(num_of_elements + 1); uf3_impl->UFBS3b.resize(num_of_elements + 1); for (int i = 1; i < num_of_elements + 1; i++) { - uf3_impl->n3b_knot_matrix[i].resize(num_of_elements + 1); + //uf3_impl->n3b_knot_matrix[i].resize(num_of_elements + 1); uf3_impl->UFBS3b[i].resize(num_of_elements + 1); for (int j = 1; j < num_of_elements + 1; j++) { - uf3_impl->n3b_knot_matrix[i][j].resize(num_of_elements + 1); + //uf3_impl->n3b_knot_matrix[i][j].resize(num_of_elements + 1); uf3_impl->UFBS3b[i][j].resize(num_of_elements + 1); } } @@ -1085,7 +1085,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) } } -void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) +/*void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) { FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) @@ -1646,7 +1646,7 @@ void PairUF3::uf3_read_pot_file(char *potf_name) "UF3: {} file does not contain right words indicating whether it is 2 or 3 body potential", potf_name); fclose(fp); -} +}*/ /* ---------------------------------------------------------------------- init specific to this pair style @@ -2118,25 +2118,27 @@ double PairUF3::memory_usage() //Accessor function called by pair_uf3_kokkos.cpp //Will probably be removed once std::vector are converted to arrays -std::vector>>& PairUF3::get_n2b_knot() +/*std::vector>>& PairUF3::get_n2b_knot() { return uf3_impl->n2b_knot; -} - +}*/ +/* std::vector>>& PairUF3::get_n2b_coeff() { return uf3_impl->n2b_coeff; -} +}*/ //Accessor function called by pair_uf3_kokkos.cpp //Will probably be removed once std::vector are converted to arrays +/* std::vector>>>>& PairUF3::get_n3b_knot_matrix() { return uf3_impl->n3b_knot_matrix; -} +}*/ //Accessor function called by pair_uf3_kokkos.cpp //Will probably be removed once std::vector are converted to arrays +/* std::vector>>& PairUF3::get_n3b_coeff_matrix_key(std::string key) { @@ -2160,4 +2162,4 @@ double PairUF3::get_knot_spacing_3b_jk(int i, int j, int k) { return uf3_impl->UFBS3b[i][j][k].knot_spacing_jk; } - +*/ diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 82ce716042..4c70ab7efe 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -83,14 +83,14 @@ class PairUF3 : public Pair { //Accessor function called by pair_uf3_kokkos.cpp //Will probably be removed once std::vector are converted to arrays - std::vector>>& get_n2b_knot(); + /*std::vector>>& get_n2b_knot(); std::vector>>& get_n2b_coeff(); std::vector>>>>& get_n3b_knot_matrix(); std::vector>>& get_n3b_coeff_matrix_key(std::string key); double get_knot_spacing_2b(int i, int j); double get_knot_spacing_3b_ij(int i, int j, int k); double get_knot_spacing_3b_ik(int i, int j, int k); - double get_knot_spacing_3b_jk(int i, int j, int k); + double get_knot_spacing_3b_jk(int i, int j, int k);*/ int *neighshort, maxshort; // short neighbor list array for 3body interaction }; From 18ae98201b35dc93e7409c8512bbe40a09f885d6 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Wed, 17 Apr 2024 10:51:21 -0400 Subject: [PATCH 49/65] Updated the documentation about UF3 LAMMPS potential file --- doc/src/pair_uf3.rst | 111 ++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 70 deletions(-) diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index 4c8e25d05b..dfebf4babd 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -25,24 +25,13 @@ Examples .. code-block:: LAMMPS pair_style uf3 3 - pair_coeff 1 1 Nb_Nb.uf3 - pair_coeff 3b 1 1 1 Nb_Nb_Nb.uf3 + pair_coeff * * Nb.uf3 Nb pair_style uf3 2 - pair_coeff 1 1 Nb_Nb.uf3 - pair_coeff 1 2 Nb_Sn.uf3 - pair_coeff 2 2 Sn_Sn.uf3 + pair_coeff * * NbSn.uf3 Nb Sn pair_style uf3 3 - pair_coeff 1 1 Nb_Nb.uf3 - pair_coeff 1 2 Nb_Sn.uf3 - pair_coeff 2 2 Sn_Sn.uf3 - pair_style 3b 1 1 1 Nb_Nb_Nb.uf3 - pair_style 3b 1 1 2 Nb_Nb_Sn.uf3 - pair_style 3b 1 2 2 Nb_Sn_Sn.uf3 - pair_style 3b 2 1 1 Sn_Nb_Nb.uf3 - pair_style 3b 2 1 2 Sn_Nb_Sn.uf3 - pair_style 3b 2 2 2 Sn_Sn_Sn.uf3 + pair_coeff * * NbSn.uf3 Nb Sn Description """"""""""" @@ -70,16 +59,13 @@ interaction parameters and :math:`N`, :math:`N_l`, :math:`N_m`, and :math:`N_n` denote the number of basis functions per spline or tensor spline dimension. -The UF3 LAMMPS potential files are provided using multiple pair_coeff -commands. A single UF3 LAMMPS potential file contains information about -one particular interaction only. +With *uf3* style only a single pair_coeff command is used to indicate the +UF3 LAMMPS potential file containing all the two- and three-body interactions +followed by N additional arguments specifying the mapping of UF3 elements to +LAMMPS atom types, where N is the number of LAMMPS atom types: -.. note:: - - Unlike other MANYBODY and ML potentials in LAMMPS, the atom type for - which the specified potential file should be used for is not - determined from the potential file, but is rather determined from the - user provided atom type numbers after pair_coeff. +* UF3 LAMMPS potential file +* N elements names = mapping of UF3 elements to atom types As an example, if a LAMMPS simulation contains 2 atom types (elements 'A' and 'B'), the pair_coeff command will be: @@ -87,64 +73,37 @@ As an example, if a LAMMPS simulation contains 2 atom types (elements .. code-block:: LAMMPS pair_style uf3 3 - pair_coeff 1 1 A_A.uf3 - pair_coeff 1 2 A_B.uf3 - pair_coeff 2 2 B_B.uf3 - pair_coeff 3b 1 1 1 A_A_A.uf3 - pair_coeff 3b 1 1 2 A_A_B.uf3 - pair_coeff 3b 1 2 2 A_B_B.uf3 - pair_coeff 3b 2 1 1 B_A_A.uf3 - pair_coeff 3b 2 1 2 B_A_B.uf3 - pair_coeff 3b 2 2 2 B_B_B.uf3 + pair_coeff * * AB.uf3 A B + +The AB.uf3 file should conatin all two-body (A-A, A-B, B-B) and three-body +(A-A-A, A-A-B, A-B-B, B-A-A, B-A-B, B-B-B). If a value of "2" is specified in the :code:`pair_style uf3` command, -only the two-body potential files are needed. For 3-body interaction the +only the two-body potentials are needed. For 3-body interaction the first atom type is the central atom. We recommend using the :code:`generate_uf3_lammps_pots.py` script (found `here -`_) for -generating the UF3 LAMMPS potential files from the UF3 JSON potentials. - -LAMMPS wild-card character "*" can also be used to specify a single UF3 -LAMMPS potential file for multiple interaction. For example- - -.. code-block:: LAMMPS - - pair_style uf3 3 - pair_coeff * * A_A - pair_coeff 3b 1 * * A_A_A - pair_coeff 3b 2 * * B_B_B - -The file A_A will be used for 2-body interaction between atom types 1-1, -1-2 and 2-2; file A_A_A will be used 3-body interaction for atom types -1-1-1, 1-1-2, 1-2-2; and so on. Note, using a single interaction file -for all types of interactions is **not** the recommended way of using -:code:`pair_style uf3` and will often lead to **incorrect results**. +`_) for +generating the UF3 LAMMPS potential file from the UF3 JSON potentials. ---------- -UF3 LAMMPS potential files in the *potentials* directory of the LAMMPS -distribution have a ".uf3" suffix. All UF3 LAMMPS potential files should -start with :code:`#UF3 POT` and end with :code:`#` characters. Following -shows the format of a generic 2-body UF3 LAMMPS potential file- +UF3 LAMMPS potential file in the *potentials* directory of the LAMMPS +distribution have a ".uf3" suffix. The interaction block in UF3 LAMMPS potential +file should start with :code:`#UF3 POT` and end with :code:`#` characters. +Following shows the format of a generic 2-body and 3-body potential block in +UF3 LAMMPS potential file- .. code-block:: LAMMPS #UF3 POT UNITS: units DATE: POT_GEN_DATE AUTHOR: AUTHOR_NAME CITATION: CITE - 2B LEADING_TRIM TRAILING_TRIM + 2B ELEMENT1 ELEMENT2 LEADING_TRIM TRAILING_TRIM Rij_CUTOFF NUM_OF_KNOTS BSPLINE_KNOTS NUM_OF_COEFF COEFF # - -The second line indicates whether the potential file contains data for 2-body (:code:`2B`) or 3-body (:code:`3B`) interaction. This is followed by :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` number on the same line. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS is terminated after issuing an error message. The :code:`Rij_CUTOFF` sets the 2-body cutoff for the interaction described by the potential file. :code:`NUM_OF_KNOTS` is the number of knots (or the length of the knot vector) present on the very next line. The :code:`BSPLINE_KNOTS` line should contain all the knots in ascending order. :code:`NUM_OF_COEFF` is the number of coefficients in the :code:`COEFF` line. All the numbers in the BSPLINE_KNOTS and COEFF line should be space-separated. - -The format of a generic 3-body UF3 LAMMPS potential file is as follow- - -.. code-block:: LAMMPS - #UF3 POT UNITS: units DATE: POT_GEN_DATE AUTHOR: AUTHOR_NAME CITATION: CITE - 3B LEADING_TRIM TRAILING_TRIM + 3B ELEMENT1 ELEMENT2 ELEMENT3 LEADING_TRIM TRAILING_TRIM Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ BSPLINE_KNOTS_FOR_JK BSPLINE_KNOTS_FOR_IK @@ -164,10 +123,22 @@ The format of a generic 3-body UF3 LAMMPS potential file is as follow- . # -Similar to the 2-body potential file, the third line sets the cutoffs -and length of the knots. The cutoff distance between atom-type I and J -is :code:`Rij_CUTOFF`, atom-type I and K is :code:`Rik_CUTOFF` and -between J and K is :code:`Rjk_CUTOFF`. +The second line indicates whether the block contains data for 2-body +(:code:`2B`) or 3-body (:code:`3B`) interaction. This is followed by element +combination interaction, :code:`LEADING_TRIM` and :code:`TRAILING_TRIM` +number on the same line. The current implementation is only tested for +:code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. +If other values are used LAMMPS is terminated after issuing an error message. +The :code:`Rij_CUTOFF` sets the 2-body cutoff for the interaction described +by the potential block. :code:`NUM_OF_KNOTS` is the number of knots +(or the length of the knot vector) present on the very next line. The +:code:`BSPLINE_KNOTS` line should contain all the knots in ascending order. +:code:`NUM_OF_COEFF` is the number of coefficients in the :code:`COEFF` line. +All the numbers in the BSPLINE_KNOTS and COEFF line should be space-separated. +Similar to the 2-body potential block, the third line sets the cutoffs and +length of the knots. The cutoff distance between atom-type I and J is +:code:`Rij_CUTOFF`, atom-type I and K is :code:`Rik_CUTOFF` and between +J and K is :code:`Rjk_CUTOFF`. .. note:: @@ -204,7 +175,7 @@ This pair style does not support the :doc:`pair_modify ` shift, table, and tail options. This pair style does not write its information to :doc:`binary restart -files `, since it is stored in potential files. +files `, since it is stored in potential file. This pair style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the @@ -219,7 +190,7 @@ if LAMMPS was built with that package. See the :doc:`Build package This pair style requires the :doc:`newton ` setting to be "on". -The UF3 LAMMPS potential files provided with LAMMPS (see the potentials +The UF3 LAMMPS potential file provided with LAMMPS (see the potentials directory) are parameterized for metal :doc:`units `. The single() function of 'uf3' pair style only return the 2-body From 3310180a9ff8481c4bef2b990e5030f552f77026 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Wed, 17 Apr 2024 16:45:05 -0400 Subject: [PATCH 50/65] Fixed trailing whitespaces --- doc/src/pair_uf3.rst | 4 +- src/KOKKOS/pair_uf3_kokkos.cpp | 14 ++--- src/ML-UF3/pair_uf3.cpp | 98 ++++++++++++++++---------------- src/ML-UF3/pair_uf3.h | 2 +- src/ML-UF3/uf3_pair_bspline.cpp | 2 +- src/ML-UF3/uf3_pair_bspline.h | 2 +- src/ML-UF3/uf3_triplet_bspline.h | 2 +- 7 files changed, 62 insertions(+), 62 deletions(-) diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index dfebf4babd..d89fdb21bf 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -74,7 +74,7 @@ As an example, if a LAMMPS simulation contains 2 atom types (elements pair_style uf3 3 pair_coeff * * AB.uf3 A B - + The AB.uf3 file should conatin all two-body (A-A, A-B, B-B) and three-body (A-A-A, A-A-B, A-B-B, B-A-A, B-A-B, B-B-B). @@ -130,7 +130,7 @@ number on the same line. The current implementation is only tested for :code:`LEADING_TRIM=0` and :code:`TRAILING_TRIM=3`. If other values are used LAMMPS is terminated after issuing an error message. The :code:`Rij_CUTOFF` sets the 2-body cutoff for the interaction described -by the potential block. :code:`NUM_OF_KNOTS` is the number of knots +by the potential block. :code:`NUM_OF_KNOTS` is the number of knots (or the length of the knot vector) present on the very next line. The :code:`BSPLINE_KNOTS` line should contain all the knots in ascending order. :code:`NUM_OF_COEFF` is the number of coefficients in the :code:`COEFF` line. diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index 5e0882d90b..d24ba44d9f 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -419,22 +419,22 @@ template void PairUF3Kokkos::create_3b_coefficien for (int j = 1; j < num_of_elements + 1; j++)//n3b_knot_matrix[i].size(); j++) for (int k = 1; k < num_of_elements + 1; k++){//n3b_knot_matrix[i][j].size(); k++) { for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][0]; m++)//n3b_knot_matrix[i][j][k][0].size(); m++) - d_n3b_knot_matrix_view(map3b_view(i, j, k), 0, m) = + d_n3b_knot_matrix_view(map3b_view(i, j, k), 0, m) = n3b_knots_array[map_3b[i][j][k]][0][m];//n3b_knot_matrix[i][j][k][0][m]; for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][1]; m++)//n3b_knot_matrix[i][j][k][1].size(); m++) - d_n3b_knot_matrix_view(map3b_view(i, j, k), 1, m) = + d_n3b_knot_matrix_view(map3b_view(i, j, k), 1, m) = n3b_knots_array[map_3b[i][j][k]][1][m];//n3b_knot_matrix[i][j][k][1][m]; for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][2]; m++)//n3b_knot_matrix[i][j][k][2].size(); m++) - d_n3b_knot_matrix_view(map3b_view(i, j, k), 2, m) = + d_n3b_knot_matrix_view(map3b_view(i, j, k), 2, m) = n3b_knots_array[map_3b[i][j][k]][2][m];//n3b_knot_matrix[i][j][k][2][m]; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = n3b_knots_array[map_3b[i][j][k]][2][4] - n3b_knots_array[map_3b[i][j][k]][2][3];//get_knot_spacing_3b_ij(i,j,k); //uf3_impl->UFBS3b[i][j][k].knot_spacing_ij; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = n3b_knots_array[map_3b[i][j][k]][1][4] - n3b_knots_array[map_3b[i][j][k]][1][3];//get_knot_spacing_3b_ik(i,j,k); //uf3_impl->UFBS3b[i][j][k].knot_spacing_ik; - d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = n3b_knots_array[map_3b[i][j][k]][0][4] - n3b_knots_array[map_3b[i][j][k]][0][3];//get_knot_spacing_3b_jk(i,j,k); //uf3_impl->UFBS3b[i][j][k].knot_spacing_jk; } @@ -456,7 +456,7 @@ template void PairUF3Kokkos::create_3b_coefficien 1 / (n3b_knots_array[map_3b[i][j][k]][1][5] - n3b_knots_array[map_3b[i][j][k]][1][4]); //(n3b_knot_matrix[i][j][k][1][5] - n3b_knot_matrix[i][j][k][1][4]); d_n3b_knot_spacings_view(map3b_view(i, j, k), 2) = - 1 / (n3b_knots_array[map_3b[i][j][k]][2][5] - n3b_knots_array[map_3b[i][j][k]][2][4]); + 1 / (n3b_knots_array[map_3b[i][j][k]][2][5] - n3b_knots_array[map_3b[i][j][k]][2][4]); //(n3b_knot_matrix[i][j][k][2][5] - n3b_knot_matrix[i][j][k][2][4]); } } diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 8e853ab35b..6252f30d40 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -59,7 +59,7 @@ PairUF3::PairUF3(LAMMPS *lmp) : { uf3_impl = new UF3Impl; single_enable = 1; // 1 if single() routine exists - one_coeff = 1; // 1 if allows only one coeff * * call + one_coeff = 1; // 1 if allows only one coeff * * call restartinfo = 0; // 1 if pair style writes restart info maxshort = 10; neighshort = nullptr; @@ -190,7 +190,7 @@ void PairUF3::communicate() (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); MPI_Bcast(&n2b_coeff_array_size[0][0], (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - + MPI_Bcast(&max_num_knots_2b, 1, MPI_INT, 0, world); MPI_Bcast(&max_num_coeff_2b, 1, MPI_INT, 0, world); @@ -214,7 +214,7 @@ void PairUF3::communicate() if (comm->me != 0) { memory->destroy(n2b_knots_array); memory->destroy(n2b_coeff_array); - + memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, max_num_knots_2b, "pair:n2b_knots_array"); memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, @@ -225,12 +225,12 @@ void PairUF3::communicate() memory->create(n3b_knots_array, tot_interaction_count_3b, 3, max_num_knots_3b, "pair:n3b_knots_array"); - + memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); } } - + MPI_Bcast(&knot_spacing_type_2b[0][0], (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); @@ -356,7 +356,7 @@ void PairUF3::allocate() } } memory->create(neighshort, maxshort, "pair:neighshort"); - + } } @@ -372,7 +372,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) const int num_of_elements = atom->ntypes; - //if (true) { + //if (true) { FILE *fp = utils::open_potential(potf_name, lmp, nullptr); if (!fp) error->all(FLERR, @@ -412,7 +412,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) error->all(FLERR, "UF3: Expected 6 words on line {} of {} file " "but found {} word/s", line_counter, potf_name, fp2nd_line.count()); - + //get the elements std::string element1 = fp2nd_line.next_string(); std::string element2 = fp2nd_line.next_string(); @@ -430,7 +430,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) break; } } - + if ((itype != 0) && (jtype != 0)) { //Trailing and leading trim check int leading_trim = fp2nd_line.next_int(); @@ -457,7 +457,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) //cut is used in init_one which is called by pair.cpp at line 267 //where the return of init_one is squared cut[itype][jtype] = fp3rd_line.next_double(); //MPI_Bcast - cut[jtype][itype] = cut[itype][jtype]; + cut[jtype][itype] = cut[itype][jtype]; int num_knots_2b = fp3rd_line.next_int(); n2b_knots_array_size[itype][jtype] = num_knots_2b; //MPI_Bcast @@ -472,7 +472,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) temp_line = txtfilereader.next_line(1); line_counter++; ValueTokenizer fp5th_line(temp_line); - + int num_coeff_2b = fp5th_line.next_int(); n2b_coeff_array_size[itype][jtype] = num_coeff_2b; //MPI_Bcast n2b_coeff_array_size[jtype][itype] = num_coeff_2b; //MPI_Bcast @@ -485,7 +485,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) error->all(FLERR, "UF3: Expected 7 words on line {} of {} file" "but found {} word/s", line_counter, potf_name, fp2nd_line.count()); - + if (nbody_on_file == "3B") { //get the elements std::string element1 = fp2nd_line.next_string(); @@ -512,7 +512,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) break; } } - + if ((itype != 0) && (jtype != 0) && (ktype!=0)) { //Trailing and leading trim check int leading_trim = fp2nd_line.next_int(); @@ -530,33 +530,33 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) temp_line = txtfilereader.next_line(6); line_counter++; ValueTokenizer fp3rd_line(temp_line); - + if (fp3rd_line.count() != 6) error->all(FLERR, "UF3: Expected only 6 numbers on 3rd line => " "Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK " "NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ Found {} number/s", fp3rd_line.count()); - + double cut3b_rjk = fp3rd_line.next_double(); double cut3b_rij = fp3rd_line.next_double(); double cut3b_rik = fp3rd_line.next_double(); - + if (cut3b_rij != cut3b_rik) error->all(FLERR, "UF3: rij!=rik for {}-{}-{}. " "Current implementation only works for rij=rik", element1, element2, element3); - + if (2 * cut3b_rik != cut3b_rjk) error->all(FLERR, "UF3: 2rij=2rik!=rik for {}-{}-{}. " "Current implementation only works for 2rij=2rik!=rik", element1, element2, element3); - cut_3b_list[itype][jtype] = + cut_3b_list[itype][jtype] = std::max(cut3b_rij, cut_3b_list[itype][jtype]); //MPI_Bcast - cut_3b_list[itype][ktype] = + cut_3b_list[itype][ktype] = std::max(cut_3b_list[itype][ktype], cut3b_rik); //MPI_Bcast cut_3b[itype][jtype][ktype] = cut3b_rij; //MPI_Bcast @@ -569,7 +569,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) n3b_knots_array_size[map_3b[itype][jtype][ktype]][0] = num_knots_3b_jk; //MPI_Bcast n3b_knots_array_size[map_3b[itype][jtype][ktype]][1] = num_knots_3b_ik; n3b_knots_array_size[map_3b[itype][jtype][ktype]][2] = num_knots_3b_ij; - + n3b_knots_array_size[map_3b[itype][ktype][jtype]][0] = num_knots_3b_jk; //MPI_Bcast n3b_knots_array_size[map_3b[itype][ktype][jtype]][1] = num_knots_3b_ij; n3b_knots_array_size[map_3b[itype][ktype][jtype]][2] = num_knots_3b_ik; @@ -577,7 +577,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_jk); max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_ik); max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_ij); //MPI_Bcast - + //skip next 3 line txtfilereader.skip_line(); line_counter++; @@ -597,7 +597,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) "SHAPE_OF_COEFF_MATRIX[I][J][K] " "found {} numbers", fp7th_line.count()); - + int coeff_matrix_dim1 = fp7th_line.next_int(); int coeff_matrix_dim2 = fp7th_line.next_int(); int coeff_matrix_dim3 = fp7th_line.next_int(); @@ -609,7 +609,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) n3b_coeff_array_size[map_3b[itype][ktype][jtype]][0] = coeff_matrix_dim2; n3b_coeff_array_size[map_3b[itype][ktype][jtype]][1] = coeff_matrix_dim1; n3b_coeff_array_size[map_3b[itype][ktype][jtype]][2] = coeff_matrix_dim3; - + max_num_coeff_3b = std::max(max_num_coeff_3b,coeff_matrix_dim1); max_num_coeff_3b = std::max(max_num_coeff_3b,coeff_matrix_dim2); max_num_coeff_3b = std::max(max_num_coeff_3b,coeff_matrix_dim3); @@ -656,14 +656,14 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) if (max_num_knots_3b > 0) memory->create(n3b_knots_array, tot_interaction_count_3b, 3, max_num_knots_3b, "pair:n3b_knots_array"); - + else error->all(FLERR, "UF3: Error reading the size of 3B knot vector\n" "Possibly no 3B UF3 potential block detected in {} file", potf_name); - - if (max_num_coeff_3b > 0) + + if (max_num_coeff_3b > 0) memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); else @@ -673,7 +673,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) potf_name); } - //Go back to the begning of the file + //Go back to the begning of the file txtfilereader.rewind(); //Go through the file again and fill knot and coeff arrays @@ -720,7 +720,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) //skip the next two tokens fp2nd_line.skip(2); - + //uk or nk? std::string knot_type = fp2nd_line.next_string(); if (knot_type == "uk") { @@ -738,7 +738,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) if ((itype != 0) && (jtype != 0)) { //skip line containing info of cutoff and knot vect size txtfilereader.skip_line(); - + int num_knots_2b = n2b_knots_array_size[itype][jtype]; temp_line = txtfilereader.next_line(num_knots_2b); @@ -748,7 +748,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) error->all(FLERR, "UF3: Error readig the 2B potential block for {}-{}\n" "Expecter {} numbers on 4th line of the block but found {} " "numbers", num_knots_2b,fp4th_line.count()); - + for (int k = 0; k < num_knots_2b; k++) { n2b_knots_array[itype][jtype][k] = fp4th_line.next_double(); //MPI_Bcast n2b_knots_array[jtype][itype][k] = n2b_knots_array[itype][jtype][k]; @@ -810,7 +810,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) break; } } - + //skip the next two tokens fp2nd_line.skip(2); @@ -828,10 +828,10 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) "Found {} on the 2nd line of {}-{}-{} interaction block", knot_type, element1, element2, element3); - if ((itype != 0) && (jtype != 0) && (ktype!=0)) { + if ((itype != 0) && (jtype != 0) && (ktype!=0)) { //skip line containing info of cutoffs and knot vector sizes txtfilereader.skip_line(); - + int num_knots_3b_jk = n3b_knots_array_size[map_3b[itype][jtype][ktype]][0]; int num_knots_3b_ik = n3b_knots_array_size[map_3b[itype][jtype][ktype]][1]; int num_knots_3b_ij = n3b_knots_array_size[map_3b[itype][jtype][ktype]][2]; @@ -904,21 +904,21 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) int coeff_matrix_dim2 = n3b_coeff_array_size[map_3b[itype][jtype][ktype]][1]; int coeff_matrix_dim3 = n3b_coeff_array_size[map_3b[itype][jtype][ktype]][2]; - if (num_knots_3b_jk != coeff_matrix_dim3 + 3 + 1) + if (num_knots_3b_jk != coeff_matrix_dim3 + 3 + 1) error->all(FLERR, "UF3: {}-{}-{} interaction block has incorrect knot " "(NUM_OF_KNOTS_JK) and coeff (coeff_matrix_dim3) data " "nknots!=ncoeffs + 3 + 1", element1, element2, element3); - if (num_knots_3b_ik != coeff_matrix_dim2 + 3 + 1) + if (num_knots_3b_ik != coeff_matrix_dim2 + 3 + 1) error->all(FLERR, "UF3: {}-{}-{} interaction block has incorrect knot " "(NUM_OF_KNOTS_IK) and coeff (coeff_matrix_dim2) data " "nknots!=ncoeffs + 3 + 1", element1, element2, element3); - - if (num_knots_3b_ij != coeff_matrix_dim1 + 3 + 1) + + if (num_knots_3b_ij != coeff_matrix_dim1 + 3 + 1) error->all(FLERR, "UF3: {}-{}-{} interaction block has incorrect knot " "(NUM_OF_KNOTS_IJ) and coeff (coeff_matrix_dim1) data " @@ -994,11 +994,11 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) knot_spacing_type_2b[i][j] = knot_spacing_type_2b[i_mapped_to][j_mapped_to]; for (int knot_no = 0; knot_no < max_num_knots_2b; knot_no++) - n2b_knots_array[i][j][knot_no] = + n2b_knots_array[i][j][knot_no] = n2b_knots_array[i_mapped_to][j_mapped_to][knot_no]; for (int coeff_no = 0; coeff_no < max_num_coeff_2b; coeff_no++) - n2b_coeff_array[i][j][coeff_no] = + n2b_coeff_array[i][j][coeff_no] = n2b_coeff_array[i_mapped_to][j_mapped_to][coeff_no]; setflag[i][j] = 1; @@ -1013,7 +1013,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) for (int k = 1; k < num_of_elements + 1; k++) { if (setflag_3b[i][j][k] != 1) { //i-j-k interaction not set - + //maybe i-j-k is mapped to some other atom type interaction? int i_mapped_to = map[i]+1; //+1 as map starts from 0 int j_mapped_to = map[j]+1; //+1 as map starts from 0 @@ -1032,7 +1032,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) "{} file", i, j, k, i_mapped_to, j_mapped_to, k_mapped_to, i_mapped_to, j_mapped_to, k_mapped_to, potf_name); - + cut_3b_list[i][j] = std::max(cut_3b_list[i_mapped_to][j_mapped_to], cut_3b_list[i][j]); @@ -1054,15 +1054,15 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) n3b_coeff_array_size[key][1] = n3b_coeff_array_size[mapped_to_key][1]; n3b_coeff_array_size[key][2] = n3b_coeff_array_size[mapped_to_key][2]; - min_cut_3b[i][j][k][0] = + min_cut_3b[i][j][k][0] = min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][0];//n3b_knots_array[key][0][0]; - - min_cut_3b[i][j][k][1] = + + min_cut_3b[i][j][k][1] = min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][1];//n3b_knots_array[key][1][0]; - - min_cut_3b[i][j][k][2] = + + min_cut_3b[i][j][k][2] = min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][2];//n3b_knots_array[key][2][0]; - + for (int knot_no = 0; knot_no < n3b_knots_array_size[key][0]; knot_no++) n3b_knots_array[key][0][knot_no] = n3b_knots_array[mapped_to_key][0][knot_no]; @@ -1075,7 +1075,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) for (int coeff1 = 0; coeff1 < n3b_coeff_array_size[key][0]; coeff1++) for (int coeff2 = 0; coeff2 < n3b_coeff_array_size[key][1]; coeff2++) for (int coeff3 = 0; coeff3 < n3b_coeff_array_size[key][2]; coeff3++) - n3b_coeff_array[key][coeff1][coeff2][coeff3] = + n3b_coeff_array[key][coeff1][coeff2][coeff3] = n3b_coeff_array[mapped_to_key][coeff1][coeff2][coeff3]; setflag_3b[i][j][k] = 1; } @@ -2058,7 +2058,7 @@ double PairUF3::memory_usage() bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //n2b_knots_array_size bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //n2b_coeff_array_size - + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_knots_2b * sizeof(double); //n2b_knots_array diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 4c70ab7efe..3bb0fe0381 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -75,7 +75,7 @@ class PairUF3 : public Pair { /*void uf3_read_2b_pot_block(int itype, int jtype, std::string iele, std::string jele, TextFileReader &txtfilereader); - + void uf3_read_3b_pot_block(int itype, int jtype, int ktype, std::string iele, std::string jele, std::string kele, diff --git a/src/ML-UF3/uf3_pair_bspline.cpp b/src/ML-UF3/uf3_pair_bspline.cpp index 1e8e2eeffa..92068d117d 100644 --- a/src/ML-UF3/uf3_pair_bspline.cpp +++ b/src/ML-UF3/uf3_pair_bspline.cpp @@ -87,7 +87,7 @@ uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const double* uknot_array, const int uknot_spacing_type) { lmp = ulmp; - + knot_vect = std::vector (uknot_array, uknot_array + uknot_array_size); coeff_vect = std::vector (ucoeff_array, ucoeff_array + ucoeff_array_size); diff --git a/src/ML-UF3/uf3_pair_bspline.h b/src/ML-UF3/uf3_pair_bspline.h index e471f02ac4..3f4fe696ef 100644 --- a/src/ML-UF3/uf3_pair_bspline.h +++ b/src/ML-UF3/uf3_pair_bspline.h @@ -41,7 +41,7 @@ class uf3_pair_bspline { uf3_pair_bspline(LAMMPS *ulmp, const std::vector &uknot_vect, const std::vector &ucoeff_vect, const int &uknot_spacing_type); - + uf3_pair_bspline(LAMMPS *ulmp, const double* uknot_array, const int uknot_array_size, const double* ucoeff_array, diff --git a/src/ML-UF3/uf3_triplet_bspline.h b/src/ML-UF3/uf3_triplet_bspline.h index e627a61f9e..11fb575570 100644 --- a/src/ML-UF3/uf3_triplet_bspline.h +++ b/src/ML-UF3/uf3_triplet_bspline.h @@ -47,7 +47,7 @@ class uf3_triplet_bspline { uf3_triplet_bspline(LAMMPS *ulmp, const std::vector> &uknot_matrix, const std::vector>> &ucoeff_matrix, const int &uknot_spacing_type); - + uf3_triplet_bspline(LAMMPS *ulmp, double **uknot_array, const int *uknot_array_size, double ***ucoeff_array, const int *ucoeff_array_size, const int &uknot_spacing_type); From dbca2b087dacc572c52f1e2ec48c40d763da362e Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 14:27:11 -0400 Subject: [PATCH 51/65] Made 'constants' variable public --- src/ML-UF3/uf3_bspline_basis2.h | 3 ++- src/ML-UF3/uf3_bspline_basis3.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ML-UF3/uf3_bspline_basis2.h b/src/ML-UF3/uf3_bspline_basis2.h index 423a366fe0..90c6166f8c 100644 --- a/src/ML-UF3/uf3_bspline_basis2.h +++ b/src/ML-UF3/uf3_bspline_basis2.h @@ -23,11 +23,12 @@ namespace LAMMPS_NS { class uf3_bspline_basis2 { private: LAMMPS *lmp; - std::vector constants; + //std::vector constants; public: uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double coefficient); ~uf3_bspline_basis2(); + std::vector constants; double eval0(double, double); double eval1(double, double); double eval2(double, double); diff --git a/src/ML-UF3/uf3_bspline_basis3.h b/src/ML-UF3/uf3_bspline_basis3.h index 676c8da453..099a2302c7 100644 --- a/src/ML-UF3/uf3_bspline_basis3.h +++ b/src/ML-UF3/uf3_bspline_basis3.h @@ -24,11 +24,12 @@ namespace LAMMPS_NS { class uf3_bspline_basis3 { private: LAMMPS *lmp; - std::vector constants; + //std::vector constants; public: uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double coefficient); ~uf3_bspline_basis3(); + std::vector constants; double eval0(double, double, double); double eval1(double, double, double); double eval2(double, double, double); From 9915f86f6320f2eb5e8518b71b28239e2cb07427 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 14:35:45 -0400 Subject: [PATCH 52/65] Removed UFBS2b and UFBS3b std::vector objects. These objects held the bspline basis set object (uf3_pair_bspline and uf3_triplet_bspline) for 2- and 3-body interaction at UFBS2b[itype][jtype] and UFBS3b[itype][jtype][ktype]. These std:vectors were removed. New arrays (cached_constants_2b, cached_constants_2b_deri, cached_constants_3b, cached_constants_3b_deri) were added that holds the cached coefficients of the bspline basis set. The UF3Impl PIMPLE was also removed as it is not longer needed. The memory_usage function needs to updated --- src/ML-UF3/pair_uf3.cpp | 722 +++++++++++++++++++++++++++++++++++++--- src/ML-UF3/pair_uf3.h | 17 +- 2 files changed, 691 insertions(+), 48 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 6252f30d40..125899ec61 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -20,8 +20,8 @@ #include "pair_uf3.h" -#include "uf3_pair_bspline.h" -#include "uf3_triplet_bspline.h" +#include "uf3_bspline_basis2.h" +#include "uf3_bspline_basis3.h" #include "atom.h" #include "comm.h" @@ -37,7 +37,7 @@ #include namespace LAMMPS_NS{ - struct UF3Impl { + /*struct UF3Impl { //std::vector>> n2b_knot, n2b_coeff; //std::vector>>>> n3b_knot_matrix; @@ -45,7 +45,7 @@ namespace LAMMPS_NS{ std::vector> UFBS2b; std::vector>> UFBS3b; - }; + };*/ } using namespace LAMMPS_NS; @@ -55,9 +55,10 @@ using MathConst::THIRD; PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp), setflag_3b(nullptr), knot_spacing_type_2b(nullptr), knot_spacing_type_3b(nullptr), - cut(nullptr), cut_3b(nullptr), cut_3b_list(nullptr), min_cut_3b(nullptr) + cut(nullptr), cut_3b(nullptr), cut_3b_list(nullptr), min_cut_3b(nullptr), + knot_spacing_2b(nullptr), knot_spacing_3b(nullptr) { - uf3_impl = new UF3Impl; + //uf3_impl = new UF3Impl; single_enable = 1; // 1 if single() routine exists one_coeff = 1; // 1 if allows only one coeff * * call restartinfo = 0; // 1 if pair style writes restart info @@ -71,12 +72,19 @@ PairUF3::PairUF3(LAMMPS *lmp) : n2b_coeff_array = nullptr; n2b_knots_array_size = nullptr; n2b_coeff_array_size = nullptr; + cached_constants_2b = nullptr; + cached_constants_2b_deri = nullptr; map_3b = nullptr; n3b_knots_array = nullptr; n3b_coeff_array = nullptr; n3b_knots_array_size = nullptr; n3b_coeff_array_size = nullptr; + coeff_for_der_jk = nullptr; + coeff_for_der_ik = nullptr; + coeff_for_der_ij = nullptr; + cached_constants_3b = nullptr; + cached_constants_3b_deri = nullptr; } /* ---------------------------------------------------------------------- */ @@ -89,10 +97,13 @@ PairUF3::~PairUF3() memory->destroy(cutsq); memory->destroy(cut); memory->destroy(knot_spacing_type_2b); + memory->destroy(knot_spacing_2b); memory->destroy(n2b_knots_array_size); memory->destroy(n2b_coeff_array_size); memory->destroy(n2b_knots_array); memory->destroy(n2b_coeff_array); + memory->destroy(cached_constants_2b); + memory->destroy(cached_constants_2b_deri); if (pot_3b) { memory->destroy(setflag_3b); @@ -101,14 +112,20 @@ PairUF3::~PairUF3() memory->destroy(min_cut_3b); memory->destroy(neighshort); memory->destroy(knot_spacing_type_3b); + memory->destroy(knot_spacing_3b); memory->destroy(map_3b); memory->destroy(n3b_knots_array_size); memory->destroy(n3b_coeff_array_size); memory->destroy(n3b_knots_array); memory->destroy(n3b_coeff_array); + memory->destroy(coeff_for_der_jk); + memory->destroy(coeff_for_der_ik); + memory->destroy(coeff_for_der_ij); + memory->destroy(cached_constants_3b); + memory->destroy(cached_constants_3b_deri); } } - delete uf3_impl; + //delete uf3_impl; } /* ---------------------------------------------------------------------- @@ -233,6 +250,9 @@ void PairUF3::communicate() MPI_Bcast(&knot_spacing_type_2b[0][0], (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + MPI_Bcast(&knot_spacing_2b[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); MPI_Bcast(&n2b_knots_array[0][0][0], (num_of_elements + 1)*(num_of_elements + 1)*max_num_knots_2b, MPI_DOUBLE, 0, world); @@ -246,6 +266,10 @@ void PairUF3::communicate() MPI_Bcast(&knot_spacing_type_3b[0][0][0], (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + MPI_Bcast(&knot_spacing_3b[0][0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1)*3, + MPI_INT, 0, world); MPI_Bcast(&n3b_knots_array[0][0][0], tot_interaction_count_3b*3*max_num_knots_3b, MPI_DOUBLE, 0, world); MPI_Bcast(&n3b_coeff_array[0][0][0][0], @@ -280,6 +304,8 @@ void PairUF3::allocate() //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) //1 = non-uniform knot spacing memory->create(knot_spacing_type_2b, num_of_elements + 1, num_of_elements + 1, + "pair:knot_spacing_type_2b"); + memory->create(knot_spacing_2b, num_of_elements + 1, num_of_elements + 1, "pair:knot_spacing_2b"); //Contains size of 2b knots vectors and 2b coeff matrices @@ -291,12 +317,12 @@ void PairUF3::allocate() // Contains knot_vect of 2-body potential for type i and j //uf3_impl->n2b_knot.resize(num_of_elements + 1); //uf3_impl->n2b_coeff.resize(num_of_elements + 1); - uf3_impl->UFBS2b.resize(num_of_elements + 1); + /*uf3_impl->UFBS2b.resize(num_of_elements + 1); for (int i = 1; i < num_of_elements + 1; i++) { //uf3_impl->n2b_knot[i].resize(num_of_elements + 1); //uf3_impl->n2b_coeff[i].resize(num_of_elements + 1); uf3_impl->UFBS2b[i].resize(num_of_elements + 1); - } + }*/ if (pot_3b) { // Contains info about wether UF potential were found for type i, j and k memory->create(setflag_3b, num_of_elements + 1, num_of_elements + 1, @@ -314,7 +340,9 @@ void PairUF3::allocate() //Contains info about type of knot_spacing--> 0 = uniform knot spacing (default) //1 = non-uniform knot spacing memory->create(knot_spacing_type_3b, num_of_elements + 1, num_of_elements + 1, - num_of_elements + 1, "pair:knot_spacing_3b"); + num_of_elements + 1, "pair:knot_spacing_type_3b"); + memory->create(knot_spacing_3b, num_of_elements + 1, num_of_elements + 1, + num_of_elements + 1, 3, "pair:knot_spacing_3b"); tot_interaction_count_3b = 0; //conatins map of I-J-K interaction @@ -346,7 +374,7 @@ void PairUF3::allocate() "pair:n3b_coeff_array_size"); //uf3_impl->n3b_knot_matrix.resize(num_of_elements + 1); - uf3_impl->UFBS3b.resize(num_of_elements + 1); + /*uf3_impl->UFBS3b.resize(num_of_elements + 1); for (int i = 1; i < num_of_elements + 1; i++) { //uf3_impl->n3b_knot_matrix[i].resize(num_of_elements + 1); uf3_impl->UFBS3b[i].resize(num_of_elements + 1); @@ -354,7 +382,7 @@ void PairUF3::allocate() //uf3_impl->n3b_knot_matrix[i][j].resize(num_of_elements + 1); uf3_impl->UFBS3b[i][j].resize(num_of_elements + 1); } - } + }*/ memory->create(neighshort, maxshort, "pair:neighshort"); } @@ -640,9 +668,6 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) potf_name); if (max_num_coeff_2b > 0) { - //if (comm->me == 0) - /*utils::logmesg(lmp, - "max_num_coeff_2b = {}\n", max_num_coeff_2b);*/ memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, max_num_coeff_2b, "pair:n2b_coeff_array"); } @@ -754,6 +779,10 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) n2b_knots_array[jtype][itype][k] = n2b_knots_array[itype][jtype][k]; } + knot_spacing_2b[itype][jtype] = n2b_knots_array[itype][jtype][4] - + n2b_knots_array[itype][jtype][3]; + knot_spacing_2b[jtype][itype] = knot_spacing_2b[itype][jtype]; + //skip next line txtfilereader.skip_line(); @@ -857,6 +886,12 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) min_cut_3b[itype][ktype][jtype][0] = n3b_knots_array[map_3b[itype][ktype][jtype]][0][0]; + knot_spacing_3b[itype][jtype][ktype][0] = + n3b_knots_array[map_3b[itype][jtype][ktype]][0][4] - + n3b_knots_array[map_3b[itype][jtype][ktype]][0][3]; + knot_spacing_3b[itype][ktype][jtype][0] = + knot_spacing_3b[itype][jtype][ktype][0]; + temp_line = txtfilereader.next_line(num_knots_3b_ik); ValueTokenizer fp5th_line(temp_line); if (fp5th_line.count() != num_knots_3b_ik) @@ -878,6 +913,12 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) min_cut_3b[itype][ktype][jtype][2] = n3b_knots_array[map_3b[itype][ktype][jtype]][2][0]; + knot_spacing_3b[itype][jtype][ktype][1] = + n3b_knots_array[map_3b[itype][jtype][ktype]][1][4] - + n3b_knots_array[map_3b[itype][jtype][ktype]][1][3]; + knot_spacing_3b[itype][ktype][jtype][2] = + knot_spacing_3b[itype][jtype][ktype][1]; + temp_line = txtfilereader.next_line(num_knots_3b_ij); ValueTokenizer fp6th_line(temp_line); if (fp6th_line.count() != num_knots_3b_ij) @@ -894,8 +935,16 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) n3b_knots_array[map_3b[itype][jtype][ktype]][2][i]; } - min_cut_3b[itype][jtype][ktype][2] = n3b_knots_array[map_3b[itype][jtype][ktype]][2][0]; - min_cut_3b[itype][ktype][jtype][1] = n3b_knots_array[map_3b[itype][ktype][jtype]][1][0]; + min_cut_3b[itype][jtype][ktype][2] = + n3b_knots_array[map_3b[itype][jtype][ktype]][2][0]; + min_cut_3b[itype][ktype][jtype][1] = + n3b_knots_array[map_3b[itype][ktype][jtype]][1][0]; + + knot_spacing_3b[itype][jtype][ktype][2] = + n3b_knots_array[map_3b[itype][jtype][ktype]][2][4] - + n3b_knots_array[map_3b[itype][jtype][ktype]][2][3]; + knot_spacing_3b[itype][ktype][jtype][1] = + knot_spacing_3b[itype][jtype][ktype][2]; //skip next line txtfilereader.skip_line(); @@ -983,15 +1032,13 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) i, j, elements[i_mapped_to-1], elements[j_mapped_to-1], potf_name); - //utils::logmesg(lmp,"Setting stuff for {}-{} mapped to {}-{}\n",i,j, - // i_mapped_to, j_mapped_to); - cut[i][j] = cut[i_mapped_to][j_mapped_to]; n2b_knots_array_size[i][j] = n2b_knots_array_size[i_mapped_to][j_mapped_to]; n2b_coeff_array_size[i][j] = n2b_coeff_array_size[i_mapped_to][j_mapped_to]; knot_spacing_type_2b[i][j] = knot_spacing_type_2b[i_mapped_to][j_mapped_to]; + knot_spacing_2b[i][j] = knot_spacing_2b[i_mapped_to][j_mapped_to]; for (int knot_no = 0; knot_no < max_num_knots_2b; knot_no++) n2b_knots_array[i][j][knot_no] = @@ -1042,6 +1089,12 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) knot_spacing_type_3b[i][j][k] = knot_spacing_type_3b[i_mapped_to][j_mapped_to][k_mapped_to]; + knot_spacing_3b[i][j][k][0] = + knot_spacing_3b[i_mapped_to][j_mapped_to][k_mapped_to][0]; + knot_spacing_3b[i][j][k][1] = + knot_spacing_3b[i_mapped_to][j_mapped_to][k_mapped_to][1]; + knot_spacing_3b[i][j][k][2] = + knot_spacing_3b[i_mapped_to][j_mapped_to][k_mapped_to][2]; int key = map_3b[i][j][k]; int mapped_to_key = map_3b[i_mapped_to][j_mapped_to][k_mapped_to]; @@ -1684,6 +1737,7 @@ void PairUF3::create_bsplines() { const int num_of_elements = atom->ntypes; bsplines_created = 1; + int spacing_type = knot_spacing_type_2b[1][1]; for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { if (setflag[i][j] != 1) @@ -1691,6 +1745,13 @@ void PairUF3::create_bsplines() "UF3: Not all 2-body UF potentials are set, " "missing potential for {}-{} interaction", i, j); + if (spacing_type != knot_spacing_type_2b[i][j]) + error->all(FLERR, + "UF3: In the current version the knot spacing type, " + "for all interactions needs to be same. For {}-{} " + "i.e. {}-{} interaction expected {}, but found {}", + i,j,elements[map[i]],elements[map[j]],spacing_type, + knot_spacing_type_2b[i][j]); } } if (pot_3b) { @@ -1702,16 +1763,39 @@ void PairUF3::create_bsplines() "UF3: Not all 3-body UF potentials are set, " "missing potential for {}-{}-{} interaction", i, j, k); + if (spacing_type != knot_spacing_type_3b[i][j][k]) + error->all(FLERR, + "UF3: In the current version the knot spacing type, " + "for all interactions needs to be same. For {}-{}-{} " + "i.e. {}-{}-{} interaction expected{}, but found {}", + i,j,k,elements[map[i]],elements[map[j]],elements[map[k]], + spacing_type,knot_spacing_type_3b[i][j][k]); } } } } - for (int i = 1; i < num_of_elements + 1; i++) { + + if (spacing_type) { + get_starting_index_2b = &PairUF3::get_starting_index_nonuniform_2b; + if (pot_3b) + get_starting_index_3b = &PairUF3::get_starting_index_nonuniform_3b; + } + else { + get_starting_index_2b = &PairUF3::get_starting_index_uniform_2b; + if (pot_3b) + get_starting_index_3b = &PairUF3::get_starting_index_uniform_3b; + } + + create_cached_constants_2b(); + if (pot_3b) + create_cached_constants_3b(); + + /*for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { - /*uf3_impl->UFBS2b[i][j] = + uf3_impl->UFBS2b[i][j] = uf3_pair_bspline(lmp, uf3_impl->n2b_knot[i][j], uf3_impl->n2b_coeff[i][j], - knot_spacing_type_2b[i][j]);*/ + knot_spacing_type_2b[i][j]); uf3_impl->UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knots_array[i][j], n2b_knots_array_size[i][j], @@ -1723,22 +1807,20 @@ void PairUF3::create_bsplines() if (pot_3b) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = j; k < num_of_elements + 1; k++) { - /*std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); + std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( - lmp, uf3_impl->n3b_knot_matrix[i][j][k], uf3_impl->n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]);*/ + lmp, uf3_impl->n3b_knot_matrix[i][j][k], uf3_impl->n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); int key = map_3b[i][j][k]; int key2 = map_3b[i][k][j]; - /*utils::logmesg(lmp, "Setting UFBS3b for {}-{}-{} map_3b={} and for {}-{}-{} " - "map_3b={}\n", i, j, k, key, i, k, j, - key2);*/ + uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( lmp, n3b_knots_array[key], n3b_knots_array_size[key], n3b_coeff_array[key], n3b_coeff_array_size[key], knot_spacing_type_3b[i][j][k]); - /*std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); + std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); uf3_impl->UFBS3b[i][k][j] = uf3_triplet_bspline( - lmp, uf3_impl->n3b_knot_matrix[i][k][j], uf3_impl->n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]);*/ + lmp, uf3_impl->n3b_knot_matrix[i][k][j], uf3_impl->n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]); //int key2 = map_3b[i][k][j]; uf3_impl->UFBS3b[i][k][j] = uf3_triplet_bspline( lmp, n3b_knots_array[key2], n3b_knots_array_size[key2], @@ -1747,6 +1829,250 @@ void PairUF3::create_bsplines() } } } + }*/ +} + +int PairUF3::get_starting_index_uniform_2b(int i, int j, double r) +{ + //return 3+(int)((r-n2b_knots_array[i][j][0])/(n2b_knots_array[i][j][4]-n2b_knots_array[i][j][3])); + return 3+(int)((r-n2b_knots_array[i][j][0])/(knot_spacing_2b[i][j])); +} + +int PairUF3::get_starting_index_uniform_3b(int i, int j, int k, double r, int knot_dim) +{ + /*return 3+(int)((r-n3b_knots_array[map_3b[i][j][k]][knot_dim][0])/ + (n3b_knots_array[map_3b[i][j][k]][knot_dim][4] - + n3b_knots_array[map_3b[i][j][k]][knot_dim][3]));*/ + return 3+(int)(((r-n3b_knots_array[map_3b[i][j][k]][knot_dim][0])/ + knot_spacing_3b[i][j][k][knot_dim])); +} + +int PairUF3::get_starting_index_nonuniform_2b(int i, int j, double r) +{ + for (int l = 3; l < n2b_knots_array_size[i][j]-1; ++l) { + if ((n2b_knots_array[i][j][l] <= r) && (r < n2b_knots_array[i][j][l+1])) + return l; + } + return -1; +} + +int PairUF3::get_starting_index_nonuniform_3b(int i, int j, int k, double r, int knot_dim) +{ + for (int l = 3; l < n3b_knots_array_size[map_3b[i][j][k]][knot_dim]-1; ++l) { + if ((n3b_knots_array[map_3b[i][j][k]][knot_dim][l] <= r) && + (r < n3b_knots_array[map_3b[i][j][k]][knot_dim][l+1])) + return l; + } + return -1; +} + +void PairUF3::create_cached_constants_2b() +{ + const int num_of_elements = atom->ntypes; + memory->create(cached_constants_2b, num_of_elements + 1, num_of_elements + 1, + max_num_coeff_2b, 16, "pair:cached_constants_2b"); + + memory->create(cached_constants_2b_deri, num_of_elements + 1, + num_of_elements + 1, max_num_coeff_2b - 1, 9, + "pair:cached_constants_2b_deri"); + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++ ) { + for (int l = 0; l < n2b_coeff_array_size[i][j]; l++) { + uf3_bspline_basis3 bspline_basis(lmp, &n2b_knots_array[i][j][l], + n2b_coeff_array[i][j][l]); + for (int cc = 0; cc < 16; cc++) { + /*if (std::isinf(bspline_basis.constants[cc]) || + std::isnan(bspline_basis.constants[cc])) + utils::logmesg(lmp, + "UF3: Bspline coefficients for" + " {}-{} interaction, {} basis set, {} constant\n", + i,j,l,cc);*/ + cached_constants_2b[i][j][l][cc] = bspline_basis.constants[cc]; + } + } + } + } + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++) { + //initialize coeff and knots for derivative + double* knots_for_deri = new double[n2b_knots_array_size[i][j]-2]; + + for (int l = 1; l < n2b_knots_array_size[i][j] - 1; l++) + knots_for_deri[l-1] = n2b_knots_array[i][j][l]; + + + double* coeff_for_deri = new double[n2b_coeff_array_size[i][j]-1]; + for (int l = 0; l < n2b_coeff_array_size[i][j] - 1; l++) { + double dntemp = 3 / (n2b_knots_array[i][j][l + 4] - + n2b_knots_array[i][j][l + 1]); + coeff_for_deri[l] = + (n2b_coeff_array[i][j][l+1] - n2b_coeff_array[i][j][l]) * dntemp; + } + + for (int l = 0; l < n2b_coeff_array_size[i][j] - 1; l++) { + uf3_bspline_basis2 bspline_basis_deri(lmp, &knots_for_deri[l], + coeff_for_deri[l]); + for (int cc = 0; cc < 9; cc++) { + /*if (std::isinf(bspline_basis_deri.constants[cc]) || + std::isnan(bspline_basis_deri.constants[cc])) + utils::logmesg(lmp, + "UF3: Bspline coefficients for" + " derivative of {}-{} interaction, {}th basis set," + " {} constant\n",i,j,l,cc);*/ + cached_constants_2b_deri[i][j][l][cc] = bspline_basis_deri.constants[cc]; + } + } + delete[] knots_for_deri; + delete[] coeff_for_deri; + } + } +} + +void PairUF3::create_cached_constants_3b() +{ + const int num_of_elements = atom->ntypes; + memory->create(coeff_for_der_jk, tot_interaction_count_3b, max_num_coeff_3b, + max_num_coeff_3b, max_num_coeff_3b, "pair:coeff_for_der_jk"); + + memory->create(coeff_for_der_ik, tot_interaction_count_3b, max_num_coeff_3b, + max_num_coeff_3b, max_num_coeff_3b, "pair:coeff_for_der_ik"); + + memory->create(coeff_for_der_ij, tot_interaction_count_3b, max_num_coeff_3b, + max_num_coeff_3b, max_num_coeff_3b, "pair:coeff_for_der_ij"); + + memory->create(cached_constants_3b, tot_interaction_count_3b, 3, + max_num_coeff_3b, 16, "pair:cached_constants_3b"); + + memory->create(cached_constants_3b_deri, tot_interaction_count_3b, 3, + max_num_coeff_3b - 1, 9, "pair:cached_constants_3b_deri"); + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++ ) { + for(int k = 1; k < num_of_elements + 1; k++) { + int map_to = map_3b[i][j][k]; + + for (int l = 0; l < n3b_knots_array_size[map_to][2] - 4; l++) { + uf3_bspline_basis3 bspline_basis_ij(lmp, &n3b_knots_array[map_to][2][l], 1); + for (int cc = 0; cc < 16; cc++) + cached_constants_3b[map_to][0][l][cc] = bspline_basis_ij.constants[cc]; + } + + for (int l = 0; l < n3b_knots_array_size[map_to][1] - 4; l++) { + uf3_bspline_basis3 bspline_basis_ik(lmp, &n3b_knots_array[map_to][1][l], 1); + for (int cc = 0; cc < 16; cc++) + cached_constants_3b[map_to][1][l][cc] = bspline_basis_ik.constants[cc]; + } + + for (int l = 0; l < n3b_knots_array_size[map_to][0] - 4; l++) { + uf3_bspline_basis3 bspline_basis_jk(lmp, &n3b_knots_array[map_to][0][l], 1); + for (int cc = 0; cc < 16; cc++) + cached_constants_3b[map_to][2][l][cc] = bspline_basis_jk.constants[cc]; + } + } + } + } + + for (int i = 1; i < num_of_elements + 1; i++) { + for (int j = 1; j < num_of_elements + 1; j++ ) { + for(int k = 1; k < num_of_elements + 1; k++) { + int map_to = map_3b[i][j][k]; + double **knots_for_der = nullptr;//new double*[3]; + //double ***coeff_for_der_jk = nullptr; + //double ***coeff_for_der_ik = nullptr; + //double ***coeff_for_der_ij = nullptr; + + //n3b_knots_array_size[map_to][0] for jk knot vector --> always largest + memory->create(knots_for_der, 3, n3b_knots_array_size[map_to][0]-1, + "pair:knots_for_der"); + + //--deri_basis_jk + for (int l = 1; l < n3b_knots_array_size[map_to][0] - 1; l++) + knots_for_der[0][l-1] = n3b_knots_array[map_to][0][l]; + + for(int l = 0; l < n3b_coeff_array_size[map_to][0]; l++) { + for(int m = 0; m < n3b_coeff_array_size[map_to][1]; m++) { + for(int n = 0; n < n3b_coeff_array_size[map_to][2] - 1; n++) { + double dntemp = 3/(n3b_knots_array[map_to][0][n + 4] - + n3b_knots_array[map_to][0][n + 1]); + coeff_for_der_jk[map_to][l][m][n] = + ((n3b_coeff_array[map_to][l][m][n + 1] - + n3b_coeff_array[map_to][l][m][n])*dntemp); + } + } + } + + //--deri_basis_ik + for (int l = 1; l < n3b_knots_array_size[map_to][1] - 1; l++) + knots_for_der[1][l-1] = n3b_knots_array[map_to][1][l]; + + for (int l = 0; l < n3b_coeff_array_size[map_to][0]; l++) { + for (int m = 0; m < n3b_coeff_array_size[map_to][1] - 1; m++) { + double dntemp = 3/(n3b_knots_array[map_to][1][m + 4] - + n3b_knots_array[map_to][1][m + 1]); + for (int n = 0; n < n3b_coeff_array_size[map_to][2]; n++) { + coeff_for_der_ik[map_to][l][m][n] = + ((n3b_coeff_array[map_to][l][m + 1][n] - + n3b_coeff_array[map_to][l][m][n])*dntemp); + } + } + } + + //--deri_basis_ij + for (int l = 1; l < n3b_knots_array_size[map_to][2] - 1; l++) + knots_for_der[2][l-1] = n3b_knots_array[map_to][2][l]; + + for (int l = 0; l < n3b_coeff_array_size[map_to][0] - 1; l++) { + double dntemp = 3/(n3b_knots_array[map_to][2][l + 4] - + n3b_knots_array[map_to][2][l + 1]); + for(int m = 0; m < n3b_coeff_array_size[map_to][1]; m++) { + for(int n = 0; n < n3b_coeff_array_size[map_to][2]; n++) { + coeff_for_der_ij[map_to][l][m][n] = + ((n3b_coeff_array[map_to][l + 1][m][n] - + n3b_coeff_array[map_to][l][m][n]) * dntemp); + } + } + } + + //cached_constants_3b_deri + //utils::logmesg(lmp, "UF3: {} {} {}\n",i,j,k); + //utils::logmesg(lmp, "UF3: bspline_basis_deri_ij"); + for (int l = 0; l < n3b_coeff_array_size[map_to][0] - 1; l++) { + uf3_bspline_basis2 bspline_basis_deri_ij(lmp, &knots_for_der[2][l], 1); + for (int cc = 0; cc < 9; cc++) { + cached_constants_3b_deri[map_to][0][l][cc] = bspline_basis_deri_ij.constants[cc]; + //utils::logmesg(lmp," {}",bspline_basis_deri_ij.constants[cc]); + } + //utils::logmesg(lmp,"\n"); + } + + //utils::logmesg(lmp, "UF3: bspline_basis_deri_ik"); + for (int l = 0; l < n3b_coeff_array_size[map_to][1] - 1; l++) { + uf3_bspline_basis2 bspline_basis_deri_ik(lmp, &knots_for_der[1][l], 1); + for (int cc = 0; cc < 9; cc++) { + cached_constants_3b_deri[map_to][1][l][cc] = bspline_basis_deri_ik.constants[cc]; + //utils::logmesg(lmp," {}",bspline_basis_deri_ik.constants[cc]); + } + //utils::logmesg(lmp,"\n"); + } + + //utils::logmesg(lmp, "UF3: bspline_basis_deri_jk"); + for (int l = 0; l < n3b_coeff_array_size[map_to][2] - 1; l++) { + uf3_bspline_basis2 bspline_basis_deri_jk(lmp, &knots_for_der[0][l], 1); + for (int cc = 0; cc < 9; cc++) { + cached_constants_3b_deri[map_to][2][l][cc] = bspline_basis_deri_jk.constants[cc]; + //utils::logmesg(lmp," {}",bspline_basis_deri_jk.constants[cc]); + } + //utils::logmesg(lmp,"\n"); + } + + memory->destroy(knots_for_der); + //memory->destroy(coeff_for_der_jk) + //memory->destroy(coeff_for_der_ik) + //memory->destroy(coeff_for_der_ij); + } + } } } @@ -1759,6 +2085,7 @@ void PairUF3::compute(int eflag, int vflag) double fji[3], fki[3], fkj[3]; double Fi[3], Fj[3], Fk[3]; double rsq, rij, rik, rjk; + double rij_sq, rik_sq, rjk_sq; int *ilist, *jlist, *numneigh, **firstneigh; ev_init(eflag, vflag); @@ -1811,9 +2138,20 @@ void PairUF3::compute(int eflag, int vflag) } } - double *pair_eval = uf3_impl->UFBS2b[itype][jtype].eval(rij); + int knot_start_index = (this->*get_starting_index_2b)(itype,jtype,rij); - fpair = -1 * pair_eval[1] / rij; + //double *pair_eval = uf3_impl->UFBS2b[itype][jtype].eval(rij); + double force_2b = cached_constants_2b_deri[itype][jtype][knot_start_index - 1][0]; + force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][1]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][2]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 2][3]; + force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][4]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][5]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 3][6]; + force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][7]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][8]; + + fpair = -1 * force_2b / rij; fx = delx * fpair; fy = dely * fpair; @@ -1826,7 +2164,27 @@ void PairUF3::compute(int eflag, int vflag) f[j][1] -= fy; f[j][2] -= fz; - if (eflag) evdwl = pair_eval[0]; + if (eflag) { + //evdwl = pair_eval[0] + double rth = rsq*rij; + evdwl = cached_constants_2b[itype][jtype][knot_start_index][0]; + evdwl += rij*cached_constants_2b[itype][jtype][knot_start_index][1]; + evdwl += rsq*cached_constants_2b[itype][jtype][knot_start_index][2]; + evdwl += rth*cached_constants_2b[itype][jtype][knot_start_index][3]; + evdwl += cached_constants_2b[itype][jtype][knot_start_index-1][4]; + evdwl += rij*cached_constants_2b[itype][jtype][knot_start_index-1][5]; + evdwl += rsq*cached_constants_2b[itype][jtype][knot_start_index-1][6]; + evdwl += rth*cached_constants_2b[itype][jtype][knot_start_index-1][7]; + evdwl += cached_constants_2b[itype][jtype][knot_start_index-2][8]; + evdwl += rij*cached_constants_2b[itype][jtype][knot_start_index-2][9]; + evdwl += rsq*cached_constants_2b[itype][jtype][knot_start_index-2][10]; + evdwl += rth*cached_constants_2b[itype][jtype][knot_start_index-2][11]; + evdwl += cached_constants_2b[itype][jtype][knot_start_index-3][12]; + evdwl += rij*cached_constants_2b[itype][jtype][knot_start_index-3][13]; + evdwl += rsq*cached_constants_2b[itype][jtype][knot_start_index-3][14]; + evdwl += rth*cached_constants_2b[itype][jtype][knot_start_index-3][15]; + //utils::logmesg(lmp,"UF3: {} {} {} {}\n",itype,jtype,evdwl,force_2b); + }; if (evflag) { ev_tally_xyz(i, j, nlocal, newton_pair, evdwl, 0.0, fx, fy, fz, delx, dely, delz); @@ -1878,8 +2236,9 @@ void PairUF3::compute(int eflag, int vflag) del_rji[0] = x[j][0] - xtmp; del_rji[1] = x[j][1] - ytmp; del_rji[2] = x[j][2] - ztmp; - rij = - sqrt(((del_rji[0] * del_rji[0]) + (del_rji[1] * del_rji[1]) + (del_rji[2] * del_rji[2]))); + rij_sq = (del_rji[0] * del_rji[0]) + (del_rji[1] * del_rji[1]) + (del_rji[2] * del_rji[2]); + rij = sqrt(rij_sq); + //sqrt(((del_rji[0] * del_rji[0]) + (del_rji[1] * del_rji[1]) + (del_rji[2] * del_rji[2]))); // kth atom for (kk = jj + 1; kk < numshort; kk++) { @@ -1897,8 +2256,9 @@ void PairUF3::compute(int eflag, int vflag) del_rki[0] = x[k][0] - xtmp; del_rki[1] = x[k][1] - ytmp; del_rki[2] = x[k][2] - ztmp; - rik = sqrt( - ((del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]))); + rik_sq = (del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]); + rik = sqrt(rik_sq); + //((del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]))); if ((rij <= cut_3b[itype][jtype][ktype]) && (rik <= cut_3b[itype][ktype][jtype]) && @@ -1908,11 +2268,237 @@ void PairUF3::compute(int eflag, int vflag) del_rkj[0] = x[k][0] - x[j][0]; del_rkj[1] = x[k][1] - x[j][1]; del_rkj[2] = x[k][2] - x[j][2]; - rjk = sqrt( - ((del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]))); + + rjk_sq = (del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]); + rjk = sqrt(rjk_sq); + //((del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]))); if (rjk >= min_cut_3b[itype][jtype][ktype][0]) { - double *triangle_eval = uf3_impl->UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); + double rij_th = rij*rij_sq; + double rik_th = rik*rik_sq; + double rjk_th = rjk*rjk_sq; + //double *triangle_eval = uf3_impl->UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); + int map_to = map_3b[itype][jtype][ktype]; + int knot_start_index_ij = (this->*get_starting_index_3b)(itype,jtype,ktype,rij,2); + int knot_start_index_ik = (this->*get_starting_index_3b)(itype,jtype,ktype,rik,1); + int knot_start_index_jk = (this->*get_starting_index_3b)(itype,jtype,ktype,rjk,0); + double basis_ij[4]; + double basis_ik[4]; + double basis_jk[4]; + double basis_ij_der[3]; + double basis_ik_der[3]; + double basis_jk_der[3]; + + //--------------basis_ij + //utils::logmesg(lmp, "UF3: {} {}\n",map_to,knot_start_index_ij); + basis_ij[0] = cached_constants_3b[map_to][0][knot_start_index_ij - 3][12]; + basis_ij[0] += rij*cached_constants_3b[map_to][0][knot_start_index_ij - 3][13]; + basis_ij[0] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij - 3][14]; + basis_ij[0] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij - 3][15]; + + basis_ij[1] = cached_constants_3b[map_to][0][knot_start_index_ij - 2][8]; + basis_ij[1] += rij*cached_constants_3b[map_to][0][knot_start_index_ij - 2][9]; + basis_ij[1] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij - 2][10]; + basis_ij[1] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij - 2][11]; + + basis_ij[2] = cached_constants_3b[map_to][0][knot_start_index_ij - 1][4]; + basis_ij[2] += rij*cached_constants_3b[map_to][0][knot_start_index_ij - 1][5]; + basis_ij[2] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij - 1][6]; + basis_ij[2] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij - 1][7]; + + basis_ij[3] = cached_constants_3b[map_to][0][knot_start_index_ij][0]; + basis_ij[3] += rij*cached_constants_3b[map_to][0][knot_start_index_ij][1]; + basis_ij[3] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij][2]; + basis_ij[3] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij][3]; + + //utils::logmesg(lmp,"UF3: basis_ij = {} {} {} {}\n",basis_ij[0],basis_ij[1], + // basis_ij[2],basis_ij[3]); + + //--------------basis_ik + basis_ik[0] = cached_constants_3b[map_to][1][knot_start_index_ik - 3][12]; + basis_ik[0] += rik*cached_constants_3b[map_to][1][knot_start_index_ik - 3][13]; + basis_ik[0] += rik_sq*cached_constants_3b[map_to][1][knot_start_index_ik - 3][14]; + basis_ik[0] += rik_th*cached_constants_3b[map_to][1][knot_start_index_ik - 3][15]; + + basis_ik[1] = cached_constants_3b[map_to][1][knot_start_index_ik - 2][8]; + basis_ik[1] += rik*cached_constants_3b[map_to][1][knot_start_index_ik - 2][9]; + basis_ik[1] += rik_sq*cached_constants_3b[map_to][1][knot_start_index_ik - 2][10]; + basis_ik[1] += rik_th*cached_constants_3b[map_to][1][knot_start_index_ik - 2][11]; + + basis_ik[2] = cached_constants_3b[map_to][1][knot_start_index_ik - 1][4]; + basis_ik[2] += rik*cached_constants_3b[map_to][1][knot_start_index_ik - 1][5]; + basis_ik[2] += rik_sq*cached_constants_3b[map_to][1][knot_start_index_ik - 1][6]; + basis_ik[2] += rik_th*cached_constants_3b[map_to][1][knot_start_index_ik - 1][7]; + + basis_ik[3] = cached_constants_3b[map_to][1][knot_start_index_ik][0]; + basis_ik[3] += rik*cached_constants_3b[map_to][1][knot_start_index_ik][1]; + basis_ik[3] += rik_sq*cached_constants_3b[map_to][1][knot_start_index_ik][2]; + basis_ik[3] += rik_th*cached_constants_3b[map_to][1][knot_start_index_ik][3]; + + //utils::logmesg(lmp,"UF3: basis_ik = {} {} {} {}\n",basis_ik[0],basis_ik[1], + // basis_ik[2],basis_ik[3]); + + //--------------basis_jk + basis_jk[0] = cached_constants_3b[map_to][2][knot_start_index_jk - 3][12]; + basis_jk[0] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk - 3][13]; + basis_jk[0] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk - 3][14]; + basis_jk[0] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk - 3][15]; + + basis_jk[1] = cached_constants_3b[map_to][2][knot_start_index_jk - 2][8]; + basis_jk[1] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk - 2][9]; + basis_jk[1] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk - 2][10]; + basis_jk[1] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk - 2][11]; + + basis_jk[2] = cached_constants_3b[map_to][2][knot_start_index_jk - 1][4]; + basis_jk[2] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk - 1][5]; + basis_jk[2] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk - 1][6]; + basis_jk[2] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk - 1][7]; + + basis_jk[3] = cached_constants_3b[map_to][2][knot_start_index_jk][0]; + basis_jk[3] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk][1]; + basis_jk[3] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk][2]; + basis_jk[3] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk][3]; + + //utils::logmesg(lmp,"UF3: basis_jk = {} {} {} {}\n",basis_jk[0],basis_jk[1], + // basis_jk[2],basis_jk[3]); + //----------------basis_ij_der + basis_ij_der[0] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][6]; + basis_ij_der[0] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][7]; + basis_ij_der[0] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][8]; + /*utils::logmesg(lmp,"UF3 cached_constants 2 = {} {} {}\n", + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][6], + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][7], + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][8]);*/ + + basis_ij_der[1] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][3]; + basis_ij_der[1] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][4]; + basis_ij_der[1] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][5]; + /*utils::logmesg(lmp,"UF3 cached_constants 1 = {} {} {}\n", + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][3], + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][4], + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][5]);*/ + + basis_ij_der[2] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][0]; + basis_ij_der[2] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][1]; + basis_ij_der[2] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][2]; + /*utils::logmesg(lmp,"UF3 cached_constants 0 = {} {} {}\n", + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][0], + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][1], + cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][2]);*/ + + //utils::logmesg(lmp,"UF3: basis_ij_der = {} {} {}\n",basis_ij_der[0],basis_ij_der[1], + // basis_ij_der[2]); + + //----------------basis_ik_der + basis_ik_der[0] = cached_constants_3b_deri[map_to][1][knot_start_index_ik - 3][6]; + basis_ik_der[0] += rik*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 3][7]; + basis_ik_der[0] += rik_sq*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 3][8]; + + basis_ik_der[1] = cached_constants_3b_deri[map_to][1][knot_start_index_ik - 2][3]; + basis_ik_der[1] += rik*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 2][4]; + basis_ik_der[1] += rik_sq*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 2][5]; + + basis_ik_der[2] = cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][0]; + basis_ik_der[2] += rik*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][1]; + basis_ik_der[2] += rik_sq*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][2]; + + //utils::logmesg(lmp,"UF3: basis_ik_der = {} {} {}\n",basis_ik_der[0],basis_ik_der[1], + // basis_ik_der[2]); + + //----------------basis_jk_der + basis_jk_der[0] = cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][6]; + basis_jk_der[0] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][7]; + basis_jk_der[0] += rjk_sq*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][8]; + + basis_jk_der[1] = cached_constants_3b_deri[map_to][2][knot_start_index_jk - 2][3]; + basis_jk_der[1] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 2][4]; + basis_jk_der[1] += rjk_sq*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 2][5]; + + basis_jk_der[2] = cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][0]; + basis_jk_der[2] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][1]; + basis_jk_der[2] += rjk_sq*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][2]; + + //utils::logmesg(lmp,"UF3: basis_jk_der = {} {} {}\n",basis_jk_der[0],basis_jk_der[1], + // basis_jk_der[2]); + + double triangle_eval[4] = {0,0,0,0}; + + int iknot_ij = knot_start_index_ij - 3; + int iknot_ik = knot_start_index_ik - 3; + int iknot_jk = knot_start_index_jk - 3; + + /*if (eflag) { + for (int l = 0; l < 4; l++) { + const double basis_ij_i = basis_ij[l]; + for (int m = 0; m < 4; m++) { + const double factor = basis_ij_i * basis_ik[m]; + const double* slice = + &n3b_coeff_array[map_to][iknot_ij + l][iknot_ik + m][iknot_jk]; + double tmp[4]; + tmp[0] = slice[0] * basis_jk[0]; + tmp[1] = slice[1] * basis_jk[1]; + tmp[2] = slice[2] * basis_jk[2]; + tmp[3] = slice[3] * basis_jk[3]; + double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; + triangle_eval[0] += factor * sum; + } + } + }*/ + //else + // triangle_eval[0] = 0; + + for (int l = 0; l < 3; l++) { + const double basis_ij_der_i = basis_ij_der[l]; + for (int m = 0; m < 4; m++) { + const double factor = basis_ij_der_i * basis_ik[m]; + const double* slice = + &coeff_for_der_ij[map_to][iknot_ij + l][iknot_ik + m][iknot_jk]; + double tmp[4]; + tmp[0] = slice[0] * basis_jk[0]; + tmp[1] = slice[1] * basis_jk[1]; + tmp[2] = slice[2] * basis_jk[2]; + tmp[3] = slice[3] * basis_jk[3]; + double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; + triangle_eval[1] += factor * sum; + //utils::logmesg(lmp, "UF3: {} {} {} {} {} {}\n", basis_ij_der[l], + // factor, slice[0], slice[1], slice[2], slice[3]); + } + } + + for (int l = 0; l < 4; l++) { + const double basis_ij_i = basis_ij[l]; + for (int m = 0; m < 3; m++) { + const double factor = basis_ij_i * basis_ik_der[m]; + const double* slice = + &coeff_for_der_ik[map_to][iknot_ij + l][iknot_ik + m][iknot_jk]; + double tmp[4]; + tmp[0] = slice[0] * basis_jk[0]; + tmp[1] = slice[1] * basis_jk[1]; + tmp[2] = slice[2] * basis_jk[2]; + tmp[3] = slice[3] * basis_jk[3]; + double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; + triangle_eval[2] += factor * sum; + } + } + + for (int l = 0; l < 4; l++) { + const double basis_ij_i = basis_ij[l]; + for (int m = 0; m < 4; m++) { + const double factor = basis_ij_i * basis_ik[m]; + const double* slice = + &coeff_for_der_jk[map_to][iknot_ij + l][iknot_ik + m][iknot_jk]; + double tmp[3]; + tmp[0] = slice[0] * basis_jk_der[0]; + tmp[1] = slice[1] * basis_jk_der[1]; + tmp[2] = slice[2] * basis_jk_der[2]; + double sum = tmp[0] + tmp[1] + tmp[2]; + triangle_eval[3] += factor * sum; + } + } + + /*utils::logmesg(lmp,"UF3: {} {} {} {} {} {} {}\n",itype,jtype,ktype, + *triangle_eval,*(triangle_eval + 1),*(triangle_eval + 2), + *(triangle_eval + 3));*/ fij[0] = *(triangle_eval + 1) * (del_rji[0] / rij); fji[0] = -fij[0]; @@ -1956,7 +2542,24 @@ void PairUF3::compute(int eflag, int vflag) f[k][1] += Fk[1]; f[k][2] += Fk[2]; - if (eflag) evdwl = *triangle_eval; + if (eflag) { + for (int l = 0; l < 4; l++) { + const double basis_ij_i = basis_ij[l]; + for (int m = 0; m < 4; m++) { + const double factor = basis_ij_i * basis_ik[m]; + const double* slice = + &n3b_coeff_array[map_to][iknot_ij + l][iknot_ik + m][iknot_jk]; + double tmp[4]; + tmp[0] = slice[0] * basis_jk[0]; + tmp[1] = slice[1] * basis_jk[1]; + tmp[2] = slice[2] * basis_jk[2]; + tmp[3] = slice[3] * basis_jk[3]; + double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; + triangle_eval[0] += factor * sum; + } + } + evdwl = *triangle_eval; + } if (evflag) { ev_tally3(i, j, k, evdwl, 0, Fj, Fk, del_rji, del_rki); @@ -2023,9 +2626,36 @@ double PairUF3::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, double r = sqrt(rsq); if (r < cut[itype][jtype]) { - double *pair_eval = uf3_impl->UFBS2b[itype][jtype].eval(r); - value = pair_eval[0]; - fforce = factor_lj * pair_eval[1]; + int knot_start_index = (this->*get_starting_index_2b)(itype,jtype,r); + + double force_2b = cached_constants_2b_deri[itype][jtype][knot_start_index - 1][0]; + force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][1]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][2]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 2][3]; + force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][4]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][5]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 3][6]; + force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][7]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][8]; + fforce = factor_lj * force_2b; + + double rth = rsq*r; + value = cached_constants_2b[itype][jtype][knot_start_index][0]; + value += r*cached_constants_2b[itype][jtype][knot_start_index][1]; + value += rsq*cached_constants_2b[itype][jtype][knot_start_index][2]; + value += rth*cached_constants_2b[itype][jtype][knot_start_index][3]; + value += cached_constants_2b[itype][jtype][knot_start_index-1][4]; + value += r*cached_constants_2b[itype][jtype][knot_start_index-1][5]; + value += rsq*cached_constants_2b[itype][jtype][knot_start_index-1][6]; + value += rth*cached_constants_2b[itype][jtype][knot_start_index-1][7]; + value += cached_constants_2b[itype][jtype][knot_start_index-2][8]; + value += r*cached_constants_2b[itype][jtype][knot_start_index-2][9]; + value += rsq*cached_constants_2b[itype][jtype][knot_start_index-2][10]; + value += rth*cached_constants_2b[itype][jtype][knot_start_index-2][11]; + value += cached_constants_2b[itype][jtype][knot_start_index-3][12]; + value += r*cached_constants_2b[itype][jtype][knot_start_index-3][13]; + value += rsq*cached_constants_2b[itype][jtype][knot_start_index-3][14]; + value += rth*cached_constants_2b[itype][jtype][knot_start_index-3][15]; } return factor_lj * value; @@ -2098,7 +2728,7 @@ double PairUF3::memory_usage() } }*/ - for (int i = 1; i < num_of_elements + 1; i++) { + /*for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { bytes += (double) 2 * uf3_impl->UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] } @@ -2109,7 +2739,7 @@ double PairUF3::memory_usage() } } } - } + }*/ bytes += (double) (maxshort + 1) * sizeof(int); //neighshort, maxshort diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 3bb0fe0381..a300cbf838 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -56,10 +56,19 @@ class PairUF3 : public Pair { bool pot_3b; int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; double **cut, ***cut_3b, **cut_3b_list, ****min_cut_3b; + double **knot_spacing_2b, ****knot_spacing_3b; virtual void allocate(); void create_bsplines(); - struct UF3Impl *uf3_impl; //PIMPLE (pointer-to-implementation) - UF3Impl *get_UF3Impl(); + void create_cached_constants_2b(); + void create_cached_constants_3b(); + //struct UF3Impl *uf3_impl; //PIMPLE (pointer-to-implementation) + //UF3Impl *get_UF3Impl(); + int get_starting_index_uniform_2b(int i, int j, double r); + int get_starting_index_uniform_3b(int i, int j, int k, double r, int knot_dim); + int get_starting_index_nonuniform_2b(int i, int j, double r); + int get_starting_index_nonuniform_3b(int i, int j, int k, double r, int knot_dim); + int (PairUF3::*get_starting_index_2b)(int i, int j, double r); + int (PairUF3::*get_starting_index_3b)(int i, int j, int k, double r, int knot_dim); int max_num_knots_2b = 0; int max_num_coeff_2b = 0; @@ -67,10 +76,14 @@ class PairUF3 : public Pair { int max_num_coeff_3b = 0; double ***n2b_knots_array, ***n2b_coeff_array; int **n2b_knots_array_size, **n2b_coeff_array_size; + double ****cached_constants_2b, ****cached_constants_2b_deri; int ***map_3b, tot_interaction_count_3b; double ***n3b_knots_array, ****n3b_coeff_array; int **n3b_knots_array_size, **n3b_coeff_array_size; + double ****coeff_for_der_jk, ****coeff_for_der_ik,****coeff_for_der_ij; + double ****cached_constants_3b, ****cached_constants_3b_deri; + /*void uf3_read_2b_pot_block(int itype, int jtype, std::string iele, std::string jele, From e55d77470b3e0c10c6129e9c89e8ce80a10e90d5 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 15:23:48 -0400 Subject: [PATCH 53/65] Removed trailing whitespace --- src/ML-UF3/pair_uf3.cpp | 118 ++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 125899ec61..b1bacf09e6 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -250,7 +250,7 @@ void PairUF3::communicate() MPI_Bcast(&knot_spacing_type_2b[0][0], (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - + MPI_Bcast(&knot_spacing_2b[0][0], (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); @@ -779,7 +779,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) n2b_knots_array[jtype][itype][k] = n2b_knots_array[itype][jtype][k]; } - knot_spacing_2b[itype][jtype] = n2b_knots_array[itype][jtype][4] - + knot_spacing_2b[itype][jtype] = n2b_knots_array[itype][jtype][4] - n2b_knots_array[itype][jtype][3]; knot_spacing_2b[jtype][itype] = knot_spacing_2b[itype][jtype]; @@ -886,8 +886,8 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) min_cut_3b[itype][ktype][jtype][0] = n3b_knots_array[map_3b[itype][ktype][jtype]][0][0]; - knot_spacing_3b[itype][jtype][ktype][0] = - n3b_knots_array[map_3b[itype][jtype][ktype]][0][4] - + knot_spacing_3b[itype][jtype][ktype][0] = + n3b_knots_array[map_3b[itype][jtype][ktype]][0][4] - n3b_knots_array[map_3b[itype][jtype][ktype]][0][3]; knot_spacing_3b[itype][ktype][jtype][0] = knot_spacing_3b[itype][jtype][ktype][0]; @@ -913,12 +913,12 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) min_cut_3b[itype][ktype][jtype][2] = n3b_knots_array[map_3b[itype][ktype][jtype]][2][0]; - knot_spacing_3b[itype][jtype][ktype][1] = + knot_spacing_3b[itype][jtype][ktype][1] = n3b_knots_array[map_3b[itype][jtype][ktype]][1][4] - n3b_knots_array[map_3b[itype][jtype][ktype]][1][3]; knot_spacing_3b[itype][ktype][jtype][2] = knot_spacing_3b[itype][jtype][ktype][1]; - + temp_line = txtfilereader.next_line(num_knots_3b_ij); ValueTokenizer fp6th_line(temp_line); if (fp6th_line.count() != num_knots_3b_ij) @@ -943,7 +943,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) knot_spacing_3b[itype][jtype][ktype][2] = n3b_knots_array[map_3b[itype][jtype][ktype]][2][4] - n3b_knots_array[map_3b[itype][jtype][ktype]][2][3]; - knot_spacing_3b[itype][ktype][jtype][1] = + knot_spacing_3b[itype][ktype][jtype][1] = knot_spacing_3b[itype][jtype][ktype][2]; //skip next line @@ -1089,11 +1089,11 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) knot_spacing_type_3b[i][j][k] = knot_spacing_type_3b[i_mapped_to][j_mapped_to][k_mapped_to]; - knot_spacing_3b[i][j][k][0] = + knot_spacing_3b[i][j][k][0] = knot_spacing_3b[i_mapped_to][j_mapped_to][k_mapped_to][0]; - knot_spacing_3b[i][j][k][1] = + knot_spacing_3b[i][j][k][1] = knot_spacing_3b[i_mapped_to][j_mapped_to][k_mapped_to][1]; - knot_spacing_3b[i][j][k][2] = + knot_spacing_3b[i][j][k][2] = knot_spacing_3b[i_mapped_to][j_mapped_to][k_mapped_to][2]; int key = map_3b[i][j][k]; @@ -1812,7 +1812,7 @@ void PairUF3::create_bsplines() lmp, uf3_impl->n3b_knot_matrix[i][j][k], uf3_impl->n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); int key = map_3b[i][j][k]; int key2 = map_3b[i][k][j]; - + uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( lmp, n3b_knots_array[key], n3b_knots_array_size[key], n3b_coeff_array[key], n3b_coeff_array_size[key], @@ -1841,7 +1841,7 @@ int PairUF3::get_starting_index_uniform_2b(int i, int j, double r) int PairUF3::get_starting_index_uniform_3b(int i, int j, int k, double r, int knot_dim) { /*return 3+(int)((r-n3b_knots_array[map_3b[i][j][k]][knot_dim][0])/ - (n3b_knots_array[map_3b[i][j][k]][knot_dim][4] - + (n3b_knots_array[map_3b[i][j][k]][knot_dim][4] - n3b_knots_array[map_3b[i][j][k]][knot_dim][3]));*/ return 3+(int)(((r-n3b_knots_array[map_3b[i][j][k]][knot_dim][0])/ knot_spacing_3b[i][j][k][knot_dim])); @@ -1859,7 +1859,7 @@ int PairUF3::get_starting_index_nonuniform_2b(int i, int j, double r) int PairUF3::get_starting_index_nonuniform_3b(int i, int j, int k, double r, int knot_dim) { for (int l = 3; l < n3b_knots_array_size[map_3b[i][j][k]][knot_dim]-1; ++l) { - if ((n3b_knots_array[map_3b[i][j][k]][knot_dim][l] <= r) && + if ((n3b_knots_array[map_3b[i][j][k]][knot_dim][l] <= r) && (r < n3b_knots_array[map_3b[i][j][k]][knot_dim][l+1])) return l; } @@ -1905,9 +1905,9 @@ void PairUF3::create_cached_constants_2b() double* coeff_for_deri = new double[n2b_coeff_array_size[i][j]-1]; for (int l = 0; l < n2b_coeff_array_size[i][j] - 1; l++) { - double dntemp = 3 / (n2b_knots_array[i][j][l + 4] - + double dntemp = 3 / (n2b_knots_array[i][j][l + 4] - n2b_knots_array[i][j][l + 1]); - coeff_for_deri[l] = + coeff_for_deri[l] = (n2b_coeff_array[i][j][l+1] - n2b_coeff_array[i][j][l]) * dntemp; } @@ -1921,7 +1921,7 @@ void PairUF3::create_cached_constants_2b() "UF3: Bspline coefficients for" " derivative of {}-{} interaction, {}th basis set," " {} constant\n",i,j,l,cc);*/ - cached_constants_2b_deri[i][j][l][cc] = bspline_basis_deri.constants[cc]; + cached_constants_2b_deri[i][j][l][cc] = bspline_basis_deri.constants[cc]; } } delete[] knots_for_deri; @@ -1938,13 +1938,13 @@ void PairUF3::create_cached_constants_3b() memory->create(coeff_for_der_ik, tot_interaction_count_3b, max_num_coeff_3b, max_num_coeff_3b, max_num_coeff_3b, "pair:coeff_for_der_ik"); - + memory->create(coeff_for_der_ij, tot_interaction_count_3b, max_num_coeff_3b, max_num_coeff_3b, max_num_coeff_3b, "pair:coeff_for_der_ij"); - + memory->create(cached_constants_3b, tot_interaction_count_3b, 3, max_num_coeff_3b, 16, "pair:cached_constants_3b"); - + memory->create(cached_constants_3b_deri, tot_interaction_count_3b, 3, max_num_coeff_3b - 1, 9, "pair:cached_constants_3b_deri"); @@ -1999,7 +1999,7 @@ void PairUF3::create_cached_constants_3b() coeff_for_der_jk[map_to][l][m][n] = ((n3b_coeff_array[map_to][l][m][n + 1] - n3b_coeff_array[map_to][l][m][n])*dntemp); - } + } } } @@ -2009,10 +2009,10 @@ void PairUF3::create_cached_constants_3b() for (int l = 0; l < n3b_coeff_array_size[map_to][0]; l++) { for (int m = 0; m < n3b_coeff_array_size[map_to][1] - 1; m++) { - double dntemp = 3/(n3b_knots_array[map_to][1][m + 4] - + double dntemp = 3/(n3b_knots_array[map_to][1][m + 4] - n3b_knots_array[map_to][1][m + 1]); for (int n = 0; n < n3b_coeff_array_size[map_to][2]; n++) { - coeff_for_der_ik[map_to][l][m][n] = + coeff_for_der_ik[map_to][l][m][n] = ((n3b_coeff_array[map_to][l][m + 1][n] - n3b_coeff_array[map_to][l][m][n])*dntemp); } @@ -2046,7 +2046,7 @@ void PairUF3::create_cached_constants_3b() } //utils::logmesg(lmp,"\n"); } - + //utils::logmesg(lmp, "UF3: bspline_basis_deri_ik"); for (int l = 0; l < n3b_coeff_array_size[map_to][1] - 1; l++) { uf3_bspline_basis2 bspline_basis_deri_ik(lmp, &knots_for_der[1][l], 1); @@ -2142,14 +2142,14 @@ void PairUF3::compute(int eflag, int vflag) //double *pair_eval = uf3_impl->UFBS2b[itype][jtype].eval(rij); double force_2b = cached_constants_2b_deri[itype][jtype][knot_start_index - 1][0]; - force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][1]; + force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][1]; force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][2]; - force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 2][3]; - force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][4]; - force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][5]; - force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 3][6]; - force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][7]; - force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][8]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 2][3]; + force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][4]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][5]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 3][6]; + force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][7]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][8]; fpair = -1 * force_2b / rij; @@ -2278,7 +2278,7 @@ void PairUF3::compute(int eflag, int vflag) double rik_th = rik*rik_sq; double rjk_th = rjk*rjk_sq; //double *triangle_eval = uf3_impl->UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); - int map_to = map_3b[itype][jtype][ktype]; + int map_to = map_3b[itype][jtype][ktype]; int knot_start_index_ij = (this->*get_starting_index_3b)(itype,jtype,ktype,rij,2); int knot_start_index_ik = (this->*get_starting_index_3b)(itype,jtype,ktype,rik,1); int knot_start_index_jk = (this->*get_starting_index_3b)(itype,jtype,ktype,rjk,0); @@ -2295,7 +2295,7 @@ void PairUF3::compute(int eflag, int vflag) basis_ij[0] += rij*cached_constants_3b[map_to][0][knot_start_index_ij - 3][13]; basis_ij[0] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij - 3][14]; basis_ij[0] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij - 3][15]; - + basis_ij[1] = cached_constants_3b[map_to][0][knot_start_index_ij - 2][8]; basis_ij[1] += rij*cached_constants_3b[map_to][0][knot_start_index_ij - 2][9]; basis_ij[1] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij - 2][10]; @@ -2305,12 +2305,12 @@ void PairUF3::compute(int eflag, int vflag) basis_ij[2] += rij*cached_constants_3b[map_to][0][knot_start_index_ij - 1][5]; basis_ij[2] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij - 1][6]; basis_ij[2] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij - 1][7]; - + basis_ij[3] = cached_constants_3b[map_to][0][knot_start_index_ij][0]; basis_ij[3] += rij*cached_constants_3b[map_to][0][knot_start_index_ij][1]; basis_ij[3] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij][2]; basis_ij[3] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij][3]; - + //utils::logmesg(lmp,"UF3: basis_ij = {} {} {} {}\n",basis_ij[0],basis_ij[1], // basis_ij[2],basis_ij[3]); @@ -2329,31 +2329,31 @@ void PairUF3::compute(int eflag, int vflag) basis_ik[2] += rik*cached_constants_3b[map_to][1][knot_start_index_ik - 1][5]; basis_ik[2] += rik_sq*cached_constants_3b[map_to][1][knot_start_index_ik - 1][6]; basis_ik[2] += rik_th*cached_constants_3b[map_to][1][knot_start_index_ik - 1][7]; - + basis_ik[3] = cached_constants_3b[map_to][1][knot_start_index_ik][0]; basis_ik[3] += rik*cached_constants_3b[map_to][1][knot_start_index_ik][1]; basis_ik[3] += rik_sq*cached_constants_3b[map_to][1][knot_start_index_ik][2]; basis_ik[3] += rik_th*cached_constants_3b[map_to][1][knot_start_index_ik][3]; - + //utils::logmesg(lmp,"UF3: basis_ik = {} {} {} {}\n",basis_ik[0],basis_ik[1], // basis_ik[2],basis_ik[3]); - + //--------------basis_jk basis_jk[0] = cached_constants_3b[map_to][2][knot_start_index_jk - 3][12]; basis_jk[0] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk - 3][13]; basis_jk[0] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk - 3][14]; basis_jk[0] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk - 3][15]; - + basis_jk[1] = cached_constants_3b[map_to][2][knot_start_index_jk - 2][8]; basis_jk[1] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk - 2][9]; basis_jk[1] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk - 2][10]; basis_jk[1] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk - 2][11]; - + basis_jk[2] = cached_constants_3b[map_to][2][knot_start_index_jk - 1][4]; basis_jk[2] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk - 1][5]; basis_jk[2] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk - 1][6]; basis_jk[2] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk - 1][7]; - + basis_jk[3] = cached_constants_3b[map_to][2][knot_start_index_jk][0]; basis_jk[3] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk][1]; basis_jk[3] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk][2]; @@ -2369,7 +2369,7 @@ void PairUF3::compute(int eflag, int vflag) cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][6], cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][7], cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][8]);*/ - + basis_ij_der[1] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][3]; basis_ij_der[1] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][4]; basis_ij_der[1] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][5]; @@ -2377,7 +2377,7 @@ void PairUF3::compute(int eflag, int vflag) cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][3], cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][4], cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][5]);*/ - + basis_ij_der[2] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][0]; basis_ij_der[2] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][1]; basis_ij_der[2] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][2]; @@ -2385,7 +2385,7 @@ void PairUF3::compute(int eflag, int vflag) cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][0], cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][1], cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][2]);*/ - + //utils::logmesg(lmp,"UF3: basis_ij_der = {} {} {}\n",basis_ij_der[0],basis_ij_der[1], // basis_ij_der[2]); @@ -2397,11 +2397,11 @@ void PairUF3::compute(int eflag, int vflag) basis_ik_der[1] = cached_constants_3b_deri[map_to][1][knot_start_index_ik - 2][3]; basis_ik_der[1] += rik*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 2][4]; basis_ik_der[1] += rik_sq*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 2][5]; - + basis_ik_der[2] = cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][0]; basis_ik_der[2] += rik*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][1]; basis_ik_der[2] += rik_sq*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][2]; - + //utils::logmesg(lmp,"UF3: basis_ik_der = {} {} {}\n",basis_ik_der[0],basis_ik_der[1], // basis_ik_der[2]); @@ -2409,7 +2409,7 @@ void PairUF3::compute(int eflag, int vflag) basis_jk_der[0] = cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][6]; basis_jk_der[0] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][7]; basis_jk_der[0] += rjk_sq*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][8]; - + basis_jk_der[1] = cached_constants_3b_deri[map_to][2][knot_start_index_jk - 2][3]; basis_jk_der[1] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 2][4]; basis_jk_der[1] += rjk_sq*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 2][5]; @@ -2417,10 +2417,10 @@ void PairUF3::compute(int eflag, int vflag) basis_jk_der[2] = cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][0]; basis_jk_der[2] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][1]; basis_jk_der[2] += rjk_sq*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][2]; - + //utils::logmesg(lmp,"UF3: basis_jk_der = {} {} {}\n",basis_jk_der[0],basis_jk_der[1], // basis_jk_der[2]); - + double triangle_eval[4] = {0,0,0,0}; int iknot_ij = knot_start_index_ij - 3; @@ -2446,12 +2446,12 @@ void PairUF3::compute(int eflag, int vflag) }*/ //else // triangle_eval[0] = 0; - + for (int l = 0; l < 3; l++) { const double basis_ij_der_i = basis_ij_der[l]; for (int m = 0; m < 4; m++) { const double factor = basis_ij_der_i * basis_ik[m]; - const double* slice = + const double* slice = &coeff_for_der_ij[map_to][iknot_ij + l][iknot_ik + m][iknot_jk]; double tmp[4]; tmp[0] = slice[0] * basis_jk[0]; @@ -2492,10 +2492,10 @@ void PairUF3::compute(int eflag, int vflag) tmp[1] = slice[1] * basis_jk_der[1]; tmp[2] = slice[2] * basis_jk_der[2]; double sum = tmp[0] + tmp[1] + tmp[2]; - triangle_eval[3] += factor * sum; + triangle_eval[3] += factor * sum; } } - + /*utils::logmesg(lmp,"UF3: {} {} {} {} {} {} {}\n",itype,jtype,ktype, *triangle_eval,*(triangle_eval + 1),*(triangle_eval + 2), *(triangle_eval + 3));*/ @@ -2629,14 +2629,14 @@ double PairUF3::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, int knot_start_index = (this->*get_starting_index_2b)(itype,jtype,r); double force_2b = cached_constants_2b_deri[itype][jtype][knot_start_index - 1][0]; - force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][1]; + force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][1]; force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][2]; - force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 2][3]; - force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][4]; - force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][5]; - force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 3][6]; - force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][7]; - force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][8]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 2][3]; + force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][4]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 2][5]; + force_2b += cached_constants_2b_deri[itype][jtype][knot_start_index - 3][6]; + force_2b += r*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][7]; + force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 3][8]; fforce = factor_lj * force_2b; double rth = rsq*r; From 49181bfe8d70959d9ae17c7be46e54acd91b8dc3 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 18:58:26 -0400 Subject: [PATCH 54/65] constants was changed from std::vector to fixed length array --- src/ML-UF3/uf3_bspline_basis2.cpp | 29 +++++++++++------- src/ML-UF3/uf3_bspline_basis2.h | 3 +- src/ML-UF3/uf3_bspline_basis3.cpp | 50 ++++++++++++++++++++----------- src/ML-UF3/uf3_bspline_basis3.h | 2 +- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/src/ML-UF3/uf3_bspline_basis2.cpp b/src/ML-UF3/uf3_bspline_basis2.cpp index 7c16ab79d0..bb73e07970 100644 --- a/src/ML-UF3/uf3_bspline_basis2.cpp +++ b/src/ML-UF3/uf3_bspline_basis2.cpp @@ -36,9 +36,12 @@ uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); c2 = coefficient * (1.0 / (square(knots[0]) - knots[0] * knots[1] - knots[0] * knots[2] + knots[1] * knots[2])); - constants.push_back(c0); - constants.push_back(c1); - constants.push_back(c2); + //constants.push_back(c0); + //constants.push_back(c1); + //constants.push_back(c2); + constants[0] = c0; + constants[1] = c1; + constants[2] = c2; c0 = coefficient * (-knots[1] * knots[3] / (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - @@ -56,9 +59,12 @@ uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double c2 = coefficient * (-1.0 / (square(knots[1]) - knots[1] * knots[2] - knots[1] * knots[3] + knots[2] * knots[3]) - 1.0 / (knots[0] * knots[1] - knots[0] * knots[2] - knots[1] * knots[2] + square(knots[2]))); - constants.push_back(c0); - constants.push_back(c1); - constants.push_back(c2); + //constants.push_back(c0); + //constants.push_back(c1); + //constants.push_back(c2); + constants[3] = c0; + constants[4] = c1; + constants[5] = c2; c0 = coefficient * (square(knots[3]) / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); @@ -67,9 +73,12 @@ uf3_bspline_basis2::uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); c2 = coefficient * (1.0 / (knots[1] * knots[2] - knots[1] * knots[3] - knots[2] * knots[3] + square(knots[3]))); - constants.push_back(c0); - constants.push_back(c1); - constants.push_back(c2); + //constants.push_back(c0); + //constants.push_back(c1); + //constants.push_back(c2); + constants[6] = c0; + constants[7] = c1; + constants[8] = c2; } uf3_bspline_basis2::~uf3_bspline_basis2() {} @@ -96,7 +105,7 @@ double uf3_bspline_basis2::memory_usage() { double bytes = 0; - bytes += (double)constants.size()*sizeof(double); + bytes += (double)9*sizeof(double); return bytes; } diff --git a/src/ML-UF3/uf3_bspline_basis2.h b/src/ML-UF3/uf3_bspline_basis2.h index 90c6166f8c..b577e0c92a 100644 --- a/src/ML-UF3/uf3_bspline_basis2.h +++ b/src/ML-UF3/uf3_bspline_basis2.h @@ -28,7 +28,8 @@ class uf3_bspline_basis2 { public: uf3_bspline_basis2(LAMMPS *ulmp, const double *knots, double coefficient); ~uf3_bspline_basis2(); - std::vector constants; + //std::vector constants; + double constants[9] = {}; double eval0(double, double); double eval1(double, double); double eval2(double, double); diff --git a/src/ML-UF3/uf3_bspline_basis3.cpp b/src/ML-UF3/uf3_bspline_basis3.cpp index 3ed256777b..b2c7aa2acb 100644 --- a/src/ML-UF3/uf3_bspline_basis3.cpp +++ b/src/ML-UF3/uf3_bspline_basis3.cpp @@ -53,10 +53,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double square(knots[0]) * knots[3] - knots[0] * knots[1] * knots[2] - knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + knots[1] * knots[2] * knots[3])); - constants.push_back(c0); - constants.push_back(c1); - constants.push_back(c2); - constants.push_back(c3); + //constants.push_back(c0); + //constants.push_back(c1); + //constants.push_back(c2); + //constants.push_back(c3); + constants[0] = c0; + constants[1] = c1; + constants[2] = c2; + constants[3] = c3; c0 = coefficient * (square(knots[1]) * knots[4] / (-cube(knots[1]) + square(knots[1]) * knots[2] + square(knots[1]) * knots[3] + @@ -161,10 +165,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double knots[0] * knots[1] * knots[3] - knots[0] * knots[2] * knots[3] + square(knots[1]) * knots[3] - knots[1] * knots[2] * knots[3] - knots[1] * square(knots[3]) + knots[2] * square(knots[3]))); - constants.push_back(c0); - constants.push_back(c1); - constants.push_back(c2); - constants.push_back(c3); + //constants.push_back(c0); + //constants.push_back(c1); + //constants.push_back(c2); + //constants.push_back(c3); + constants[4] = c0; + constants[5] = c1; + constants[6] = c2; + constants[7] = c3; c0 = coefficient * (-knots[0] * square(knots[3]) / (-knots[0] * knots[1] * knots[2] + knots[0] * knots[1] * knots[3] + @@ -269,10 +277,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double knots[1] * knots[2] * knots[4] - knots[1] * knots[3] * knots[4] + square(knots[2]) * knots[4] - knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) + knots[3] * square(knots[4]))); - constants.push_back(c0); - constants.push_back(c1); - constants.push_back(c2); - constants.push_back(c3); + //constants.push_back(c0); + //constants.push_back(c1); + //constants.push_back(c2); + //constants.push_back(c3); + constants[8] = c0; + constants[9] = c1; + constants[10] = c2; + constants[11] = c3; c0 = coefficient * (cube(knots[4]) / (-knots[1] * knots[2] * knots[3] + knots[1] * knots[2] * knots[4] + @@ -297,10 +309,14 @@ uf3_bspline_basis3::uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double knots[1] * knots[3] * knots[4] - knots[1] * square(knots[4]) + knots[2] * knots[3] * knots[4] - knots[2] * square(knots[4]) - knots[3] * square(knots[4]) + cube(knots[4]))); - constants.push_back(c0); - constants.push_back(c1); - constants.push_back(c2); - constants.push_back(c3); + //constants.push_back(c0); + //constants.push_back(c1); + //constants.push_back(c2); + //constants.push_back(c3); + constants[12] = c0; + constants[13] = c1; + constants[14] = c2; + constants[15] = c3; } uf3_bspline_basis3::~uf3_bspline_basis3() {} @@ -333,7 +349,7 @@ double uf3_bspline_basis3::memory_usage() { double bytes = 0; - bytes += (double)constants.size()*sizeof(double); + bytes += (double)16*sizeof(double); return bytes; } diff --git a/src/ML-UF3/uf3_bspline_basis3.h b/src/ML-UF3/uf3_bspline_basis3.h index 099a2302c7..70e1bbd2aa 100644 --- a/src/ML-UF3/uf3_bspline_basis3.h +++ b/src/ML-UF3/uf3_bspline_basis3.h @@ -29,7 +29,7 @@ class uf3_bspline_basis3 { public: uf3_bspline_basis3(LAMMPS *ulmp, const double *knots, double coefficient); ~uf3_bspline_basis3(); - std::vector constants; + double constants[16] = {}; double eval0(double, double, double); double eval1(double, double, double); double eval2(double, double, double); From f02c65e12e15abaf89c26fc3f616437052a6c77e Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 18:59:49 -0400 Subject: [PATCH 55/65] Removed uf3_pair_bspline and uf3_triplet_bspline --- src/ML-UF3/uf3_pair_bspline.cpp | 213 ------------ src/ML-UF3/uf3_pair_bspline.h | 59 ---- src/ML-UF3/uf3_triplet_bspline.cpp | 508 ----------------------------- src/ML-UF3/uf3_triplet_bspline.h | 63 ---- 4 files changed, 843 deletions(-) delete mode 100644 src/ML-UF3/uf3_pair_bspline.cpp delete mode 100644 src/ML-UF3/uf3_pair_bspline.h delete mode 100644 src/ML-UF3/uf3_triplet_bspline.cpp delete mode 100644 src/ML-UF3/uf3_triplet_bspline.h diff --git a/src/ML-UF3/uf3_pair_bspline.cpp b/src/ML-UF3/uf3_pair_bspline.cpp deleted file mode 100644 index 92068d117d..0000000000 --- a/src/ML-UF3/uf3_pair_bspline.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "uf3_pair_bspline.h" - -#include "uf3_bspline_basis2.h" -#include "uf3_bspline_basis3.h" - -#include "utils.h" -#include "error.h" -#include - -using namespace LAMMPS_NS; - -// Dummy constructor -uf3_pair_bspline::uf3_pair_bspline() {} - -// Constructor -// Passing vectors by reference -uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const std::vector &uknot_vect, - const std::vector &ucoeff_vect, - const int &uknot_spacing_type) -{ - lmp = ulmp; - knot_vect = uknot_vect; - coeff_vect = ucoeff_vect; - - knot_spacing_type = uknot_spacing_type; - if (knot_spacing_type==0){ - knot_spacing = knot_vect[4]-knot_vect[3]; - get_starting_index=&uf3_pair_bspline::get_starting_index_uniform; - } - else if (knot_spacing_type==1){ - knot_spacing = 0; - get_starting_index=&uf3_pair_bspline::get_starting_index_nonuniform; - } - - else - lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ - '1'(non-uniform knots)"); - - knot_vect_size = uknot_vect.size(); - coeff_vect_size = ucoeff_vect.size(); - - // Initialize B-Spline Basis Functions - for (int i = 0; i < knot_vect.size() - 4; i++) - bspline_bases.push_back(uf3_bspline_basis3(lmp, &knot_vect[i], coeff_vect[i])); - - // Initialize Coefficients and Knots for Derivatives - // The last coefficient needs to be droped - for (int i = 0; i < coeff_vect_size - 1; i++) { - double dntemp4 = 3 / (knot_vect[i + 4] - knot_vect[i + 1]); - dncoeff_vect.push_back((coeff_vect[i + 1] - coeff_vect[i]) * dntemp4); - } - //What we have is a clamped bspline -->i.e value of the bspline curve at the - //knots with multiplicity equal to the degree of bspline is equal to the coefficient - // - //Therefore for the derivative bspline the very first and last knot needs to be droped - //to change their multiplicity from 4 (necessary condition for clamped cubic bspline) - //to 3 (necessary condition for clamped quadratic bspline) - // - //Also if the coeff vector size of decreases by 1 for the derivative bspline - //knots size needs to go down by 2 as ==> knots = coefficient + degree + 1 - for (int i = 1; i < knot_vect_size - 1; i++) dnknot_vect.push_back(knot_vect[i]); - - // Initialize B-Spline Derivative Basis Functions - for (int i = 0; i < dnknot_vect.size() - 3; i++) - dnbspline_bases.push_back(uf3_bspline_basis2(lmp, &dnknot_vect[i], dncoeff_vect[i])); -} - -// Constructor -// Passing arrays -uf3_pair_bspline::uf3_pair_bspline(LAMMPS *ulmp, const double* uknot_array, - const int uknot_array_size, - const double* ucoeff_array, - const int ucoeff_array_size, - const int uknot_spacing_type) -{ - lmp = ulmp; - - knot_vect = std::vector (uknot_array, uknot_array + uknot_array_size); - coeff_vect = std::vector (ucoeff_array, ucoeff_array + ucoeff_array_size); - - knot_spacing_type = uknot_spacing_type; - if (knot_spacing_type==0){ - knot_spacing = knot_vect[4]-knot_vect[3]; - get_starting_index=&uf3_pair_bspline::get_starting_index_uniform; - } - else if (knot_spacing_type==1){ - knot_spacing = 0; - get_starting_index=&uf3_pair_bspline::get_starting_index_nonuniform; - } - - else - lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ - '1'(non-uniform knots)"); - - knot_vect_size = uknot_array_size; - coeff_vect_size = ucoeff_array_size; - - // Initialize B-Spline Basis Functions - for (int i = 0; i < knot_vect.size() - 4; i++) - bspline_bases.push_back(uf3_bspline_basis3(lmp, &knot_vect[i], coeff_vect[i])); - - // Initialize Coefficients and Knots for Derivatives - // The last coefficient needs to be droped - for (int i = 0; i < coeff_vect_size - 1; i++) { - double dntemp4 = 3 / (knot_vect[i + 4] - knot_vect[i + 1]); - dncoeff_vect.push_back((coeff_vect[i + 1] - coeff_vect[i]) * dntemp4); - } - //What we have is a clamped bspline -->i.e value of the bspline curve at the - //knots with multiplicity equal to the degree of bspline is equal to the coefficient - // - //Therefore for the derivative bspline the very first and last knot needs to be droped - //to change their multiplicity from 4 (necessary condition for clamped cubic bspline) - //to 3 (necessary condition for clamped quadratic bspline) - // - //Also if the coeff vector size of decreases by 1 for the derivative bspline - //knots size needs to go down by 2 as ==> knots = coefficient + degree + 1 - for (int i = 1; i < knot_vect_size - 1; i++) dnknot_vect.push_back(knot_vect[i]); - - // Initialize B-Spline Derivative Basis Functions - for (int i = 0; i < dnknot_vect.size() - 3; i++) - dnbspline_bases.push_back(uf3_bspline_basis2(lmp, &dnknot_vect[i], dncoeff_vect[i])); -} - -uf3_pair_bspline::~uf3_pair_bspline() {} - -int uf3_pair_bspline::get_starting_index_uniform(double r) -{ - return 3+(int)((r-knot_vect[0])/knot_spacing); -} - -int uf3_pair_bspline::get_starting_index_nonuniform(double r) -{ - if (knot_vect.front() <= r && r < knot_vect.back()) { - //Determine the interval for value_rij - for (int i = 3; i < knot_vect_size - 1; ++i) { - if (knot_vect[i] <= r && r < knot_vect[i + 1]) { - return i; - } - } - } -} - -double *uf3_pair_bspline::eval(double r) -{ - - // Find knot starting position - - int start_index=(this->*get_starting_index)(r); - /*if (knot_vect.front() <= r && r < knot_vect.back()) { - //Determine the interval for value_rij - for (int i = 3; i < knot_vect_size - 1; ++i) { - if (knot_vect[i] <= r && r < knot_vect[i + 1]) { - start_index = i; - break; - } - } - }*/ - - int knot_affect_start = start_index - 3; - - double rsq = r * r; - double rth = rsq * r; - - // Calculate energy - - ret_val[0] = bspline_bases[knot_affect_start + 3].eval0(rth, rsq, r); - ret_val[0] += bspline_bases[knot_affect_start + 2].eval1(rth, rsq, r); - ret_val[0] += bspline_bases[knot_affect_start + 1].eval2(rth, rsq, r); - ret_val[0] += bspline_bases[knot_affect_start].eval3(rth, rsq, r); - - // Calculate force - - ret_val[1] = dnbspline_bases[knot_affect_start + 2].eval0(rsq, r); - ret_val[1] += dnbspline_bases[knot_affect_start + 1].eval1(rsq, r); - ret_val[1] += dnbspline_bases[knot_affect_start].eval2(rsq, r); - - return ret_val; -} - -double uf3_pair_bspline::memory_usage() -{ - double bytes = 0; - - bytes += (double)2*sizeof(int); //knot_vect_size, - //coeff_vect_size - bytes += (double)knot_vect.size()*sizeof(double); //knot_vect - bytes += (double)dnknot_vect.size()*sizeof(double); //dnknot_vect - bytes += (double)coeff_vect.size()*sizeof(double); //coeff_vect - bytes += (double)dncoeff_vect.size()*sizeof(double); //dncoeff_vect - - for (int i = 0; i < knot_vect.size() - 4; i++) - bytes += (double)bspline_bases[i].memory_usage(); //bspline_basis3 - - for (int i = 0; i < dnknot_vect.size() - 3; i++) - bytes += (double)dnbspline_bases[i].memory_usage(); //bspline_basis2 - - bytes += (double)2*sizeof(double); //ret_val - - return bytes; -} diff --git a/src/ML-UF3/uf3_pair_bspline.h b/src/ML-UF3/uf3_pair_bspline.h deleted file mode 100644 index 3f4fe696ef..0000000000 --- a/src/ML-UF3/uf3_pair_bspline.h +++ /dev/null @@ -1,59 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "pointers.h" - -#include "uf3_bspline_basis2.h" -#include "uf3_bspline_basis3.h" - -#include - -#ifndef UF3_PAIR_BSPLINE_H -#define UF3_PAIR_BSPLINE_H - -namespace LAMMPS_NS { - -class uf3_pair_bspline { - private: - int knot_vect_size, coeff_vect_size; - std::vector knot_vect, dnknot_vect; - std::vector coeff_vect, dncoeff_vect; - std::vector bspline_bases; - std::vector dnbspline_bases; - int get_starting_index_uniform(double), get_starting_index_nonuniform(double); - int (uf3_pair_bspline::*get_starting_index)(double); - //double knot_spacing=0; - LAMMPS *lmp; - - public: - // dummy constructor - uf3_pair_bspline(); - uf3_pair_bspline(LAMMPS *ulmp, const std::vector &uknot_vect, - const std::vector &ucoeff_vect, - const int &uknot_spacing_type); - - uf3_pair_bspline(LAMMPS *ulmp, const double* uknot_array, - const int uknot_array_size, - const double* ucoeff_array, - const int ucoeff_array_size, - const int uknot_spacing_type); - - ~uf3_pair_bspline(); - int knot_spacing_type; - double knot_spacing=0; - double ret_val[2]; - double *eval(double value_rij); - double memory_usage(); -}; -} // namespace LAMMPS_NS -#endif diff --git a/src/ML-UF3/uf3_triplet_bspline.cpp b/src/ML-UF3/uf3_triplet_bspline.cpp deleted file mode 100644 index 0527599965..0000000000 --- a/src/ML-UF3/uf3_triplet_bspline.cpp +++ /dev/null @@ -1,508 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "uf3_triplet_bspline.h" -#include "error.h" - -#include - -using namespace LAMMPS_NS; - -// Dummy constructor -uf3_triplet_bspline::uf3_triplet_bspline(){}; - -// Construct a new 3D B-Spline -uf3_triplet_bspline::uf3_triplet_bspline( - LAMMPS *ulmp, const std::vector> &uknot_matrix, - const std::vector>> &ucoeff_matrix, - const int &uknot_spacing_type) -{ - lmp = ulmp; - knot_matrix = uknot_matrix; - coeff_matrix = ucoeff_matrix; - - knot_spacing_type = uknot_spacing_type; - if (knot_spacing_type==0){ - knot_spacing_ij = knot_matrix[2][4]-knot_matrix[2][3]; - knot_spacing_ik = knot_matrix[1][4]-knot_matrix[1][3]; - knot_spacing_jk = knot_matrix[0][4]-knot_matrix[0][3]; - get_starting_index=&uf3_triplet_bspline::get_starting_index_uniform; - } - else if (knot_spacing_type==1){ - knot_spacing_ij = 0; - knot_spacing_ik = 0; - knot_spacing_jk = 0; - get_starting_index=&uf3_triplet_bspline::get_starting_index_nonuniform; - } - - else - lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ - '1'(non-uniform knots)"); - - knot_vect_size_ij = knot_matrix[2].size(); - knot_vect_size_ik = knot_matrix[1].size(); - knot_vect_size_jk = knot_matrix[0].size(); - - int resolution_ij = knot_vect_size_ij - 4; - int resolution_ik = knot_vect_size_ik - 4; - int resolution_jk = knot_vect_size_jk - 4; - - // Cache Spline Basis Functions - for (int l = 0; l < resolution_ij; l++) { - bsplines_ij.push_back(uf3_bspline_basis3(lmp, &knot_matrix[2][l], 1)); - } - - for (int l = 0; l < resolution_ik; l++) { - // Reuse jk Basis if Knots match - if (knot_matrix[1][l] == knot_matrix[2][l] && knot_matrix[1][l + 1] == knot_matrix[2][l + 1] && - knot_matrix[1][l + 2] == knot_matrix[2][l + 2] && - knot_matrix[1][l + 3] == knot_matrix[2][l + 3]) - bsplines_ik.push_back(bsplines_ij[l]); - else - bsplines_ik.push_back(uf3_bspline_basis3(lmp, &knot_matrix[1][l], 1)); - } - - for (int l = 0; l < resolution_jk; l++) { - bsplines_jk.push_back(uf3_bspline_basis3(lmp, &knot_matrix[0][l], 1)); - } - - // Initialize Coefficients for Derivatives - for (int i = 0; i < coeff_matrix.size(); i++) { - std::vector> dncoeff_vect2; - for (int j = 0; j < coeff_matrix[0].size(); j++) { - std::vector dncoeff_vect; - for (int k = 0; k < coeff_matrix[0][0].size() - 1; k++) { - double dntemp4 = 3 / (knot_matrix[0][k + 4] - knot_matrix[0][k + 1]); - dncoeff_vect.push_back((coeff_matrix[i][j][k + 1] - coeff_matrix[i][j][k]) * dntemp4); - } - dncoeff_vect2.push_back(dncoeff_vect); - } - dncoeff_matrix_jk.push_back(dncoeff_vect2); - } - - for (int i = 0; i < coeff_matrix.size(); i++) { - std::vector> dncoeff_vect2; - for (int j = 0; j < coeff_matrix[0].size() - 1; j++) { - double dntemp4 = 3 / (knot_matrix[1][j + 4] - knot_matrix[1][j + 1]); - std::vector dncoeff_vect; - for (int k = 0; k < coeff_matrix[0][0].size(); k++) { - dncoeff_vect.push_back((coeff_matrix[i][j + 1][k] - coeff_matrix[i][j][k]) * dntemp4); - } - dncoeff_vect2.push_back(dncoeff_vect); - } - dncoeff_matrix_ik.push_back(dncoeff_vect2); - } - - for (int i = 0; i < coeff_matrix.size() - 1; i++) { - std::vector> dncoeff_vect2; - double dntemp4 = 3 / (knot_matrix[2][i + 4] - knot_matrix[2][i + 1]); - for (int j = 0; j < coeff_matrix[0].size(); j++) { - std::vector dncoeff_vect; - for (int k = 0; k < coeff_matrix[0][0].size(); k++) { - dncoeff_vect.push_back((coeff_matrix[i + 1][j][k] - coeff_matrix[i][j][k]) * dntemp4); - } - dncoeff_vect2.push_back(dncoeff_vect); - } - dncoeff_matrix_ij.push_back(dncoeff_vect2); - } - - std::vector> dnknot_matrix; - for (int i = 0; i < knot_matrix.size(); i++) { - std::vector dnknot_vect; - for (int j = 1; j < knot_matrix[0].size() - 1; j++) { - dnknot_vect.push_back(knot_matrix[i][j]); - } - dnknot_matrix.push_back(dnknot_vect); - } - - // Cache Derivative Spline Basis Functions - for (int l = 0; l < resolution_ij - 1; l++) { - dnbsplines_ij.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[2][l], 1)); - } - - for (int l = 0; l < resolution_ik - 1; l++) { - // Reuse jk Basis if Knots match - if (dnknot_matrix[1][l] == dnknot_matrix[2][l] && - dnknot_matrix[1][l + 1] == dnknot_matrix[2][l + 1] && - dnknot_matrix[1][l + 2] == dnknot_matrix[2][l + 2]) - dnbsplines_ik.push_back(dnbsplines_ij[l]); - else - dnbsplines_ik.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[1][l], 1)); - } - - for (int l = 0; l < resolution_jk - 1; l++) { - dnbsplines_jk.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[0][l], 1)); - } -} - -// Construct a new 3D B-Spline from arrays -uf3_triplet_bspline::uf3_triplet_bspline( - LAMMPS *ulmp, double **uknot_array, const int *uknot_array_size, - double ***ucoeff_array, const int *ucoeff_array_size, - const int &uknot_spacing_type) -{ - lmp = ulmp; - - knot_matrix.resize(3); - //utils::logmesg(lmp, "knot_matrix dim = {} {} {}\nknots = ",uknot_array_size[0], - // uknot_array_size[1], uknot_array_size[2]); - for (int i = 0; i < 3; i++) { - knot_matrix[i].resize(uknot_array_size[i]); - //utils::logmesg(lmp, "{}= ",i); - for (int j = 0; j < uknot_array_size[i]; j++) { - //utils::logmesg(lmp, "{} ", uknot_array[i][j]); - knot_matrix[i][j] = uknot_array[i][j]; - } - //utils::logmesg(lmp,"\n"); - } - - coeff_matrix.resize(ucoeff_array_size[0]); - for (int i = 0; i < ucoeff_array_size[0]; i++) { - coeff_matrix[i].resize(ucoeff_array_size[1]); - for (int j = 0; j < ucoeff_array_size[1]; j++) { - coeff_matrix[i][j].resize(ucoeff_array_size[2]); - for (int k = 0; k < ucoeff_array_size[2]; k++){ - coeff_matrix[i][j][k] = ucoeff_array[i][j][k]; - } - } - } - - knot_spacing_type = uknot_spacing_type; - if (knot_spacing_type==0){ - knot_spacing_ij = knot_matrix[2][4]-knot_matrix[2][3]; - knot_spacing_ik = knot_matrix[1][4]-knot_matrix[1][3]; - knot_spacing_jk = knot_matrix[0][4]-knot_matrix[0][3]; - get_starting_index=&uf3_triplet_bspline::get_starting_index_uniform; - } - else if (knot_spacing_type==1){ - knot_spacing_ij = 0; - knot_spacing_ik = 0; - knot_spacing_jk = 0; - get_starting_index=&uf3_triplet_bspline::get_starting_index_nonuniform; - } - - else - lmp->error->all(FLERR, "UF3: Expected either '0'(uniform-knots) or \n\ - '1'(non-uniform knots)"); - - knot_vect_size_ij = knot_matrix[2].size(); - knot_vect_size_ik = knot_matrix[1].size(); - knot_vect_size_jk = knot_matrix[0].size(); - - int resolution_ij = knot_vect_size_ij - 4; - int resolution_ik = knot_vect_size_ik - 4; - int resolution_jk = knot_vect_size_jk - 4; - - // Cache Spline Basis Functions - for (int l = 0; l < resolution_ij; l++) { - bsplines_ij.push_back(uf3_bspline_basis3(lmp, &knot_matrix[2][l], 1)); - } - - for (int l = 0; l < resolution_ik; l++) { - // Reuse jk Basis if Knots match - if (knot_matrix[1][l] == knot_matrix[2][l] && knot_matrix[1][l + 1] == knot_matrix[2][l + 1] && - knot_matrix[1][l + 2] == knot_matrix[2][l + 2] && - knot_matrix[1][l + 3] == knot_matrix[2][l + 3]) - bsplines_ik.push_back(bsplines_ij[l]); - else - bsplines_ik.push_back(uf3_bspline_basis3(lmp, &knot_matrix[1][l], 1)); - } - - for (int l = 0; l < resolution_jk; l++) { - bsplines_jk.push_back(uf3_bspline_basis3(lmp, &knot_matrix[0][l], 1)); - } - - // Initialize Coefficients for Derivatives - for (int i = 0; i < coeff_matrix.size(); i++) { - std::vector> dncoeff_vect2; - for (int j = 0; j < coeff_matrix[0].size(); j++) { - std::vector dncoeff_vect; - for (int k = 0; k < coeff_matrix[0][0].size() - 1; k++) { - double dntemp4 = 3 / (knot_matrix[0][k + 4] - knot_matrix[0][k + 1]); - dncoeff_vect.push_back((coeff_matrix[i][j][k + 1] - coeff_matrix[i][j][k]) * dntemp4); - } - dncoeff_vect2.push_back(dncoeff_vect); - } - dncoeff_matrix_jk.push_back(dncoeff_vect2); - } - - for (int i = 0; i < coeff_matrix.size(); i++) { - std::vector> dncoeff_vect2; - for (int j = 0; j < coeff_matrix[0].size() - 1; j++) { - double dntemp4 = 3 / (knot_matrix[1][j + 4] - knot_matrix[1][j + 1]); - std::vector dncoeff_vect; - for (int k = 0; k < coeff_matrix[0][0].size(); k++) { - dncoeff_vect.push_back((coeff_matrix[i][j + 1][k] - coeff_matrix[i][j][k]) * dntemp4); - } - dncoeff_vect2.push_back(dncoeff_vect); - } - dncoeff_matrix_ik.push_back(dncoeff_vect2); - } - - for (int i = 0; i < coeff_matrix.size() - 1; i++) { - std::vector> dncoeff_vect2; - double dntemp4 = 3 / (knot_matrix[2][i + 4] - knot_matrix[2][i + 1]); - for (int j = 0; j < coeff_matrix[0].size(); j++) { - std::vector dncoeff_vect; - for (int k = 0; k < coeff_matrix[0][0].size(); k++) { - dncoeff_vect.push_back((coeff_matrix[i + 1][j][k] - coeff_matrix[i][j][k]) * dntemp4); - } - dncoeff_vect2.push_back(dncoeff_vect); - } - dncoeff_matrix_ij.push_back(dncoeff_vect2); - } - - std::vector> dnknot_matrix; - for (int i = 0; i < knot_matrix.size(); i++) { - std::vector dnknot_vect; - for (int j = 1; j < knot_matrix[0].size() - 1; j++) { - dnknot_vect.push_back(knot_matrix[i][j]); - } - dnknot_matrix.push_back(dnknot_vect); - } - - // Cache Derivative Spline Basis Functions - for (int l = 0; l < resolution_ij - 1; l++) { - dnbsplines_ij.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[2][l], 1)); - } - - for (int l = 0; l < resolution_ik - 1; l++) { - // Reuse jk Basis if Knots match - if (dnknot_matrix[1][l] == dnknot_matrix[2][l] && - dnknot_matrix[1][l + 1] == dnknot_matrix[2][l + 1] && - dnknot_matrix[1][l + 2] == dnknot_matrix[2][l + 2]) - dnbsplines_ik.push_back(dnbsplines_ij[l]); - else - dnbsplines_ik.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[1][l], 1)); - } - - for (int l = 0; l < resolution_jk - 1; l++) { - dnbsplines_jk.push_back(uf3_bspline_basis2(lmp, &dnknot_matrix[0][l], 1)); - } -} - - -// Destructor -uf3_triplet_bspline::~uf3_triplet_bspline() {} - -// Evaluate 3D B-Spline value -double *uf3_triplet_bspline::eval(double value_rij, double value_rik, double value_rjk) -{ - - // Find starting knots - - //int iknot_ij = starting_knot(knot_matrix[2], knot_vect_size_ij, value_rij) - 3; - //int iknot_ik = starting_knot(knot_matrix[1], knot_vect_size_ik, value_rik) - 3; - //int iknot_jk = starting_knot(knot_matrix[0], knot_vect_size_jk, value_rjk) - 3; - int iknot_ij = (this->*get_starting_index)(knot_matrix[2], knot_vect_size_ij, value_rij,knot_spacing_ij) - 3; - int iknot_ik = (this->*get_starting_index)(knot_matrix[1], knot_vect_size_ik, value_rik,knot_spacing_ik) - 3; - int iknot_jk = (this->*get_starting_index)(knot_matrix[0], knot_vect_size_jk, value_rjk,knot_spacing_jk) - 3; - - double rsq_ij = value_rij * value_rij; - double rsq_ik = value_rik * value_rik; - double rsq_jk = value_rjk * value_rjk; - double rth_ij = rsq_ij * value_rij; - double rth_ik = rsq_ik * value_rik; - double rth_jk = rsq_jk * value_rjk; - - // Calculate energies - - double basis_ij[4]; - basis_ij[0] = bsplines_ij[iknot_ij].eval3(rth_ij, rsq_ij, value_rij); - basis_ij[1] = bsplines_ij[iknot_ij + 1].eval2(rth_ij, rsq_ij, value_rij); - basis_ij[2] = bsplines_ij[iknot_ij + 2].eval1(rth_ij, rsq_ij, value_rij); - basis_ij[3] = bsplines_ij[iknot_ij + 3].eval0(rth_ij, rsq_ij, value_rij); - - double basis_ik[4]; - basis_ik[0] = bsplines_ik[iknot_ik].eval3(rth_ik, rsq_ik, value_rik); - basis_ik[1] = bsplines_ik[iknot_ik + 1].eval2(rth_ik, rsq_ik, value_rik); - basis_ik[2] = bsplines_ik[iknot_ik + 2].eval1(rth_ik, rsq_ik, value_rik); - basis_ik[3] = bsplines_ik[iknot_ik + 3].eval0(rth_ik, rsq_ik, value_rik); - - double basis_jk[4]; - basis_jk[0] = bsplines_jk[iknot_jk].eval3(rth_jk, rsq_jk, value_rjk); - basis_jk[1] = bsplines_jk[iknot_jk + 1].eval2(rth_jk, rsq_jk, value_rjk); - basis_jk[2] = bsplines_jk[iknot_jk + 2].eval1(rth_jk, rsq_jk, value_rjk); - basis_jk[3] = bsplines_jk[iknot_jk + 3].eval0(rth_jk, rsq_jk, value_rjk); - - ret_val[0] = 0; - ret_val[1] = 0; - ret_val[2] = 0; - ret_val[3] = 0; - - for (int i = 0; i < 4; i++) { - const double basis_iji = basis_ij[i]; // prevent repeated access of same memory location - for (int j = 0; j < 4; j++) { - const double factor = basis_iji * basis_ik[j]; // prevent repeated access of same memory location - const double* slice = &coeff_matrix[i + iknot_ij][j + iknot_ik][iknot_jk]; // declare a contigues 1D slice of memory - double tmp[4]; // declare tmp array that holds the 4 tmp values so the can be computed simultaniously in 4 separate registeres. - tmp[0] = slice[0] * basis_jk[0]; - tmp[1] = slice[1] * basis_jk[1]; - tmp[2] = slice[2] * basis_jk[2]; - tmp[3] = slice[3] * basis_jk[3]; - double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; - ret_val[0] += factor * sum; // use 1 fused multiply-add (FMA) - } - } - - // Calculate forces - - double dnbasis_ij[4]; - dnbasis_ij[0] = dnbsplines_ij[iknot_ij].eval2(rsq_ij, value_rij); - dnbasis_ij[1] = dnbsplines_ij[iknot_ij + 1].eval1(rsq_ij, value_rij); - dnbasis_ij[2] = dnbsplines_ij[iknot_ij + 2].eval0(rsq_ij, value_rij); - dnbasis_ij[3] = 0; - - double dnbasis_ik[4]; - dnbasis_ik[0] = dnbsplines_ik[iknot_ik].eval2(rsq_ik, value_rik); - dnbasis_ik[1] = dnbsplines_ik[iknot_ik + 1].eval1(rsq_ik, value_rik); - dnbasis_ik[2] = dnbsplines_ik[iknot_ik + 2].eval0(rsq_ik, value_rik); - dnbasis_ik[3] = 0; - - double dnbasis_jk[4]; - dnbasis_jk[0] = dnbsplines_jk[iknot_jk].eval2(rsq_jk, value_rjk); - dnbasis_jk[1] = dnbsplines_jk[iknot_jk + 1].eval1(rsq_jk, value_rjk); - dnbasis_jk[2] = dnbsplines_jk[iknot_jk + 2].eval0(rsq_jk, value_rjk); - dnbasis_jk[3] = 0; - - for (int i = 0; i < 3; i++) { - const double dnbasis_iji = dnbasis_ij[i]; - for (int j = 0; j < 4; j++) { - const double factor = dnbasis_iji * basis_ik[j]; - const double* slice = &dncoeff_matrix_ij[iknot_ij + i][iknot_ik + j][iknot_jk]; - double tmp[4]; - tmp[0] = slice[0] * basis_jk[0]; - tmp[1] = slice[1] * basis_jk[1]; - tmp[2] = slice[2] * basis_jk[2]; - tmp[3] = slice[3] * basis_jk[3]; - double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; - ret_val[1] += factor * sum; - } - } - - for (int i = 0; i < 4; i++) { - const double basis_iji = basis_ij[i]; - for (int j = 0; j < 3; j++) { - const double factor = basis_iji * dnbasis_ik[j]; - const double* slice = &dncoeff_matrix_ik[iknot_ij + i][iknot_ik + j][iknot_jk]; - double tmp[4]; - tmp[0] = slice[0] * basis_jk[0]; - tmp[1] = slice[1] * basis_jk[1]; - tmp[2] = slice[2] * basis_jk[2]; - tmp[3] = slice[3] * basis_jk[3]; - double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; - ret_val[2] += factor * sum; - } - } - - for (int i = 0; i < 4; i++) { - const double basis_iji = basis_ij[i]; - for (int j = 0; j < 4; j++) { - const double factor = basis_iji * basis_ik[j]; - const double* slice = &dncoeff_matrix_jk[iknot_ij + i][iknot_ik + j][iknot_jk]; - double tmp[3]; - tmp[0] = slice[0] * dnbasis_jk[0]; - tmp[1] = slice[1] * dnbasis_jk[1]; - tmp[2] = slice[2] * dnbasis_jk[2]; - double sum = tmp[0] + tmp[1] + tmp[2]; - ret_val[3] += factor * sum; - } - } - - return ret_val; -} - -// Find starting knot for spline evaluation - -int uf3_triplet_bspline::starting_knot(const std::vector knot_vect, int knot_vect_size, - double r) -{ - if (knot_vect.front() <= r && r < knot_vect.back()) { - for (int i = 3; i < knot_vect_size - 1; i++) { - if (knot_vect[i] <= r && r < knot_vect[i + 1]) return i; - } - } - - return 0; -} - -int uf3_triplet_bspline::get_starting_index_uniform(const std::vector knot_vect, int knot_vect_size, - double r, double knot_spacing) -{ - return 3+(int)((r-knot_vect[0])/knot_spacing); -} - -int uf3_triplet_bspline::get_starting_index_nonuniform(const std::vector knot_vect, int knot_vect_size, - double r, double knot_spacing) -{ - if (knot_vect.front() <= r && r < knot_vect.back()) { - //Determine the interval for value_rij - for (int i = 3; i < knot_vect_size - 1; ++i) { - if (knot_vect[i] <= r && r < knot_vect[i + 1]) { - return i; - } - } - } - return -1; -} - -double uf3_triplet_bspline::memory_usage() -{ - double bytes = 0; - - bytes += (double) 3*sizeof(int); //knot_vect_size_ij, - //knot_vect_size_ik, - //knot_vect_size_jk; - - for (int i=0; i - -#ifndef UF3_TRIPLET_BSPLINE_H -#define UF3_TRIPLET_BSPLINE_H - -namespace LAMMPS_NS { -class uf3_triplet_bspline { - private: - LAMMPS *lmp; - int knot_vect_size_ij, knot_vect_size_ik, knot_vect_size_jk; - std::vector>> coeff_matrix, dncoeff_matrix_ij, dncoeff_matrix_ik, - dncoeff_matrix_jk; - std::vector> knot_matrix; - std::vector bsplines_ij, bsplines_ik, bsplines_jk; - std::vector dnbsplines_ij, dnbsplines_ik, dnbsplines_jk; - int get_starting_index_uniform(const std::vector, int, double, double); - int get_starting_index_nonuniform(const std::vector, int, double, double); - int (uf3_triplet_bspline::*get_starting_index)(const std::vector, int, double, double); - //double knot_spacing_ij=0,knot_spacing_ik=0,knot_spacing_jk=0; - //double _alignvar(, 8) ret_val[4]; // Force memory alignment on 8 byte boundaries - double ret_val[4]; - - int starting_knot(const std::vector, int, double); - - public: - //Dummy Constructor - uf3_triplet_bspline(); - uf3_triplet_bspline(LAMMPS *ulmp, const std::vector> &uknot_matrix, - const std::vector>> &ucoeff_matrix, - const int &uknot_spacing_type); - - uf3_triplet_bspline(LAMMPS *ulmp, double **uknot_array, const int *uknot_array_size, - double ***ucoeff_array, const int *ucoeff_array_size, - const int &uknot_spacing_type); - - ~uf3_triplet_bspline(); - int knot_spacing_type; - double knot_spacing_ij=0,knot_spacing_ik=0,knot_spacing_jk=0; - double *eval(double value_rij, double value_rik, double value_rjk); - - double memory_usage(); -}; -} // namespace LAMMPS_NS -#endif From 5f2cae0e088ffa7f167eb2621e5fcfbc73a2eafe Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 19:00:43 -0400 Subject: [PATCH 56/65] Commented out the uniform knot spacing logic as for more than 1 processors was getting some weird errors. Deleted commented (dead) code. Updated the memory_usage function. Reordered some functions to refelect the calling order --- src/ML-UF3/pair_uf3.cpp | 1152 ++++++--------------------------------- 1 file changed, 159 insertions(+), 993 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index b1bacf09e6..1f306b5204 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -36,18 +36,6 @@ #include #include -namespace LAMMPS_NS{ - /*struct UF3Impl { - - //std::vector>> n2b_knot, n2b_coeff; - //std::vector>>>> n3b_knot_matrix; - //std::unordered_map>>> n3b_coeff_matrix; - std::vector> UFBS2b; - std::vector>> UFBS3b; - - };*/ -} - using namespace LAMMPS_NS; using MathConst::THIRD; @@ -56,35 +44,23 @@ using MathConst::THIRD; PairUF3::PairUF3(LAMMPS *lmp) : Pair(lmp), setflag_3b(nullptr), knot_spacing_type_2b(nullptr), knot_spacing_type_3b(nullptr), cut(nullptr), cut_3b(nullptr), cut_3b_list(nullptr), min_cut_3b(nullptr), - knot_spacing_2b(nullptr), knot_spacing_3b(nullptr) + knot_spacing_2b(nullptr), knot_spacing_3b(nullptr), n2b_knots_array(nullptr), + n2b_coeff_array(nullptr), n2b_knots_array_size(nullptr), + n2b_coeff_array_size(nullptr), cached_constants_2b(nullptr), + cached_constants_2b_deri(nullptr), map_3b(nullptr), n3b_knots_array(nullptr), + n3b_coeff_array(nullptr), n3b_knots_array_size(nullptr), + n3b_coeff_array_size(nullptr), coeff_for_der_jk(nullptr), + coeff_for_der_ik(nullptr), coeff_for_der_ij(nullptr), + cached_constants_3b(nullptr), cached_constants_3b_deri(nullptr), + neighshort(nullptr) { - //uf3_impl = new UF3Impl; single_enable = 1; // 1 if single() routine exists one_coeff = 1; // 1 if allows only one coeff * * call restartinfo = 0; // 1 if pair style writes restart info - maxshort = 10; - neighshort = nullptr; + maxshort = 20; centroidstressflag = CENTROID_AVAIL; manybody_flag = 1; bsplines_created = 0; - - n2b_knots_array = nullptr; - n2b_coeff_array = nullptr; - n2b_knots_array_size = nullptr; - n2b_coeff_array_size = nullptr; - cached_constants_2b = nullptr; - cached_constants_2b_deri = nullptr; - - map_3b = nullptr; - n3b_knots_array = nullptr; - n3b_coeff_array = nullptr; - n3b_knots_array_size = nullptr; - n3b_coeff_array_size = nullptr; - coeff_for_der_jk = nullptr; - coeff_for_der_ik = nullptr; - coeff_for_der_ij = nullptr; - cached_constants_3b = nullptr; - cached_constants_3b_deri = nullptr; } /* ---------------------------------------------------------------------- */ @@ -125,7 +101,6 @@ PairUF3::~PairUF3() memory->destroy(cached_constants_3b_deri); } } - //delete uf3_impl; } /* ---------------------------------------------------------------------- @@ -144,14 +119,9 @@ void PairUF3::settings(int narg, char **arg) if (nbody_flag == 2) { pot_3b = false; manybody_flag = 0; - n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; - tot_pot_files = n2body_pot_files; } else if (nbody_flag == 3) { pot_3b = true; single_enable = 0; - n2body_pot_files = num_of_elements * (num_of_elements + 1) / 2; - n3body_pot_files = num_of_elements * (num_of_elements * (num_of_elements + 1) / 2); - tot_pot_files = n2body_pot_files + n3body_pot_files; } else error->all(FLERR, "Pair style uf3 not (yet) implemented for {}-body terms", nbody_flag); @@ -172,116 +142,7 @@ void PairUF3::coeff(int narg, char **arg) if (comm->me == 0) uf3_read_unified_pot_file(arg[2]); communicate(); - //if (narg != 3 && narg != 5) error->all(FLERR, "Invalid number of arguments uf3 in pair coeffs."); - /*int ilo, ihi, jlo, jhi, klo, khi; - if (narg == 3) { - utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); - utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); - for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo, i); j <= jhi; j++) uf3_read_pot_file(i, j, arg[2]); - } - } else if (narg == 5) { - utils::bounds(FLERR, arg[1], 1, atom->ntypes, ilo, ihi, error); - utils::bounds(FLERR, arg[2], 1, atom->ntypes, jlo, jhi, error); - utils::bounds(FLERR, arg[3], 1, atom->ntypes, klo, khi, error); - if (!utils::strmatch(arg[0], "^3b$")) - error->all(FLERR, "Pair style uf3 3-body terms require the first argument to be 3b"); - - for (int i = ilo; i <= ihi; i++) { - for (int j = jlo; j <= jhi; j++) { - for (int k = MAX(klo, jlo); k <= khi; k++) uf3_read_pot_file(i, j, k, arg[4]); - } - } - }*/ -} - -//Broadcast data read from potential file to all processors -void PairUF3::communicate() -{ - const int num_of_elements = atom->ntypes; - MPI_Bcast(&cut[0][0], (num_of_elements + 1)*(num_of_elements + 1), - MPI_DOUBLE, 0, world); - - MPI_Bcast(&n2b_knots_array_size[0][0], - (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - MPI_Bcast(&n2b_coeff_array_size[0][0], - (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - - MPI_Bcast(&max_num_knots_2b, 1, MPI_INT, 0, world); - MPI_Bcast(&max_num_coeff_2b, 1, MPI_INT, 0, world); - - if (pot_3b){ - MPI_Bcast(&cut_3b_list[0][0], - (num_of_elements + 1)*(num_of_elements + 1), MPI_DOUBLE, 0, world); - - MPI_Bcast(&cut_3b[0][0][0], - (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), - MPI_DOUBLE, 0, world); - - MPI_Bcast(&n3b_knots_array_size[0][0], tot_interaction_count_3b*3, - MPI_INT, 0, world); - MPI_Bcast(&n3b_coeff_array_size[0][0], tot_interaction_count_3b*3, - MPI_INT, 0, world); - - MPI_Bcast(&max_num_knots_3b, 1, MPI_INT, 0, world); - MPI_Bcast(&max_num_coeff_3b, 1, MPI_INT, 0, world); - } - - if (comm->me != 0) { - memory->destroy(n2b_knots_array); - memory->destroy(n2b_coeff_array); - - memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, - max_num_knots_2b, "pair:n2b_knots_array"); - memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, - max_num_coeff_2b, "pair:n2b_coeff_array"); - if (pot_3b) { - memory->destroy(n3b_knots_array); - memory->destroy(n3b_coeff_array); - - memory->create(n3b_knots_array, tot_interaction_count_3b, 3, - max_num_knots_3b, "pair:n3b_knots_array"); - - memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, - max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); - } - } - - MPI_Bcast(&knot_spacing_type_2b[0][0], - (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - - MPI_Bcast(&knot_spacing_2b[0][0], - (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - - MPI_Bcast(&n2b_knots_array[0][0][0], - (num_of_elements + 1)*(num_of_elements + 1)*max_num_knots_2b, MPI_DOUBLE, 0, world); - MPI_Bcast(&n2b_coeff_array[0][0][0], - (num_of_elements + 1)*(num_of_elements + 1)*max_num_coeff_2b, MPI_DOUBLE, 0, world); - - MPI_Bcast(&setflag[0][0], - (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - - if (pot_3b) { - MPI_Bcast(&knot_spacing_type_3b[0][0][0], - (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), - MPI_INT, 0, world); - - MPI_Bcast(&knot_spacing_3b[0][0][0][0], - (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1)*3, - MPI_INT, 0, world); - MPI_Bcast(&n3b_knots_array[0][0][0], - tot_interaction_count_3b*3*max_num_knots_3b, MPI_DOUBLE, 0, world); - MPI_Bcast(&n3b_coeff_array[0][0][0][0], - tot_interaction_count_3b*max_num_coeff_3b*max_num_coeff_3b*max_num_coeff_3b, - MPI_DOUBLE, 0, world); - MPI_Bcast(&setflag_3b[0][0][0], - (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), - MPI_INT, 0, world); - MPI_Bcast(&min_cut_3b[0][0][0][0], - (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1)*3, - MPI_DOUBLE, 0, world); - } } void PairUF3::allocate() @@ -314,15 +175,6 @@ void PairUF3::allocate() memory->create(n2b_coeff_array_size, num_of_elements + 1, num_of_elements + 1, "pair:n2b_coeff_array_size"); - // Contains knot_vect of 2-body potential for type i and j - //uf3_impl->n2b_knot.resize(num_of_elements + 1); - //uf3_impl->n2b_coeff.resize(num_of_elements + 1); - /*uf3_impl->UFBS2b.resize(num_of_elements + 1); - for (int i = 1; i < num_of_elements + 1; i++) { - //uf3_impl->n2b_knot[i].resize(num_of_elements + 1); - //uf3_impl->n2b_coeff[i].resize(num_of_elements + 1); - uf3_impl->UFBS2b[i].resize(num_of_elements + 1); - }*/ if (pot_3b) { // Contains info about wether UF potential were found for type i, j and k memory->create(setflag_3b, num_of_elements + 1, num_of_elements + 1, @@ -373,16 +225,6 @@ void PairUF3::allocate() memory->create(n3b_coeff_array_size, tot_interaction_count_3b, 3, "pair:n3b_coeff_array_size"); - //uf3_impl->n3b_knot_matrix.resize(num_of_elements + 1); - /*uf3_impl->UFBS3b.resize(num_of_elements + 1); - for (int i = 1; i < num_of_elements + 1; i++) { - //uf3_impl->n3b_knot_matrix[i].resize(num_of_elements + 1); - uf3_impl->UFBS3b[i].resize(num_of_elements + 1); - for (int j = 1; j < num_of_elements + 1; j++) { - //uf3_impl->n3b_knot_matrix[i][j].resize(num_of_elements + 1); - uf3_impl->UFBS3b[i][j].resize(num_of_elements + 1); - } - }*/ memory->create(neighshort, maxshort, "pair:neighshort"); } @@ -484,13 +326,13 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) //cut is used in init_one which is called by pair.cpp at line 267 //where the return of init_one is squared - cut[itype][jtype] = fp3rd_line.next_double(); //MPI_Bcast + cut[itype][jtype] = fp3rd_line.next_double(); cut[jtype][itype] = cut[itype][jtype]; int num_knots_2b = fp3rd_line.next_int(); - n2b_knots_array_size[itype][jtype] = num_knots_2b; //MPI_Bcast - n2b_knots_array_size[jtype][itype] = num_knots_2b; //MPI_Bcast - max_num_knots_2b = std::max(max_num_knots_2b, num_knots_2b); //MPI_Bcast + n2b_knots_array_size[itype][jtype] = num_knots_2b; + n2b_knots_array_size[jtype][itype] = num_knots_2b; + max_num_knots_2b = std::max(max_num_knots_2b, num_knots_2b); //skip next line txtfilereader.skip_line(); @@ -502,9 +344,9 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) ValueTokenizer fp5th_line(temp_line); int num_coeff_2b = fp5th_line.next_int(); - n2b_coeff_array_size[itype][jtype] = num_coeff_2b; //MPI_Bcast - n2b_coeff_array_size[jtype][itype] = num_coeff_2b; //MPI_Bcast - max_num_coeff_2b = std::max(max_num_coeff_2b, num_coeff_2b); //MPI_Bcast + n2b_coeff_array_size[itype][jtype] = num_coeff_2b; + n2b_coeff_array_size[jtype][itype] = num_coeff_2b; + max_num_coeff_2b = std::max(max_num_coeff_2b, num_coeff_2b); } } else if ((nbody_on_file == "3B") && (pot_3b)) { @@ -583,28 +425,28 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) element1, element2, element3); cut_3b_list[itype][jtype] = - std::max(cut3b_rij, cut_3b_list[itype][jtype]); //MPI_Bcast + std::max(cut3b_rij, cut_3b_list[itype][jtype]); cut_3b_list[itype][ktype] = - std::max(cut_3b_list[itype][ktype], cut3b_rik); //MPI_Bcast + std::max(cut_3b_list[itype][ktype], cut3b_rik); - cut_3b[itype][jtype][ktype] = cut3b_rij; //MPI_Bcast - cut_3b[itype][ktype][jtype] = cut3b_rik; //MPI_Bcast + cut_3b[itype][jtype][ktype] = cut3b_rij; + cut_3b[itype][ktype][jtype] = cut3b_rik; int num_knots_3b_jk = fp3rd_line.next_int(); int num_knots_3b_ik = fp3rd_line.next_int(); int num_knots_3b_ij = fp3rd_line.next_int(); - n3b_knots_array_size[map_3b[itype][jtype][ktype]][0] = num_knots_3b_jk; //MPI_Bcast + n3b_knots_array_size[map_3b[itype][jtype][ktype]][0] = num_knots_3b_jk; n3b_knots_array_size[map_3b[itype][jtype][ktype]][1] = num_knots_3b_ik; n3b_knots_array_size[map_3b[itype][jtype][ktype]][2] = num_knots_3b_ij; - n3b_knots_array_size[map_3b[itype][ktype][jtype]][0] = num_knots_3b_jk; //MPI_Bcast + n3b_knots_array_size[map_3b[itype][ktype][jtype]][0] = num_knots_3b_jk; n3b_knots_array_size[map_3b[itype][ktype][jtype]][1] = num_knots_3b_ij; n3b_knots_array_size[map_3b[itype][ktype][jtype]][2] = num_knots_3b_ik; max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_jk); max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_ik); - max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_ij); //MPI_Bcast + max_num_knots_3b = std::max(max_num_knots_3b, num_knots_3b_ij); //skip next 3 line txtfilereader.skip_line(); @@ -630,7 +472,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) int coeff_matrix_dim2 = fp7th_line.next_int(); int coeff_matrix_dim3 = fp7th_line.next_int(); - n3b_coeff_array_size[map_3b[itype][jtype][ktype]][0] = coeff_matrix_dim1; //MPI_Bcast + n3b_coeff_array_size[map_3b[itype][jtype][ktype]][0] = coeff_matrix_dim1; n3b_coeff_array_size[map_3b[itype][jtype][ktype]][1] = coeff_matrix_dim2; n3b_coeff_array_size[map_3b[itype][jtype][ktype]][2] = coeff_matrix_dim3; @@ -653,11 +495,9 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) } //if of #UF3 POT line_counter++; } // while - //fclose(fp); //Create knot and coeff arrays if (max_num_knots_2b > 0) { - //if (comm->me == 0) memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, max_num_knots_2b, "pair:n2b_knots_array"); } @@ -703,16 +543,6 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) //Go through the file again and fill knot and coeff arrays //while loop to read the data - //if (true) { - /*FILE *fp = utils::open_potential(potf_name, lmp, nullptr); - if (!fp) - error->all(FLERR, - "Cannot open UF3 potential file {}: {}", - potf_name, utils::getsyserror()); - - TextFileReader txtfilereader(fp, "UF3:POTFP"); - txtfilereader.ignore_comments = false; - char *line;*/ while((line = txtfilereader.next_line(1))){ Tokenizer line_token(line); @@ -749,7 +579,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) //uk or nk? std::string knot_type = fp2nd_line.next_string(); if (knot_type == "uk") { - knot_spacing_type_2b[itype][jtype] = 0; //MPI_Bcast + knot_spacing_type_2b[itype][jtype] = 0; knot_spacing_type_2b[jtype][itype] = 0; } else if (knot_type == "nk") { knot_spacing_type_2b[itype][jtype] = 1; @@ -775,7 +605,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) "numbers", num_knots_2b,fp4th_line.count()); for (int k = 0; k < num_knots_2b; k++) { - n2b_knots_array[itype][jtype][k] = fp4th_line.next_double(); //MPI_Bcast + n2b_knots_array[itype][jtype][k] = fp4th_line.next_double(); n2b_knots_array[jtype][itype][k] = n2b_knots_array[itype][jtype][k]; } @@ -798,7 +628,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) "numbers", num_knots_2b,fp4th_line.count()); for (int k = 0; k < num_of_coeff_2b; k++) { - n2b_coeff_array[itype][jtype][k] = fp6th_line.next_double(); //MPI_Bcast + n2b_coeff_array[itype][jtype][k] = fp6th_line.next_double(); n2b_coeff_array[jtype][itype][k] = n2b_coeff_array[itype][jtype][k]; } @@ -808,7 +638,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) "coeff data nknots!=ncoeffs + 3 + 1", element1, element2); - setflag[itype][jtype] = 1; //MPI_Bcast + setflag[itype][jtype] = 1; setflag[jtype][itype] = 1; } } @@ -846,7 +676,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) //uk or nk? std::string knot_type = fp2nd_line.next_string(); if (knot_type == "uk") { - knot_spacing_type_3b[itype][jtype][ktype] = 0; //MPI_Bcast + knot_spacing_type_3b[itype][jtype][ktype] = 0; knot_spacing_type_3b[itype][ktype][jtype] = 0; } else if (knot_type == "nk") { knot_spacing_type_3b[itype][jtype][ktype] = 1; @@ -876,13 +706,13 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) for (int i = 0; i < num_knots_3b_jk; i++) { n3b_knots_array[map_3b[itype][jtype][ktype]][0][i] = - fp4th_line.next_double(); //MPI_Bcast + fp4th_line.next_double(); n3b_knots_array[map_3b[itype][ktype][jtype]][0][i] = n3b_knots_array[map_3b[itype][jtype][ktype]][0][i]; } min_cut_3b[itype][jtype][ktype][0] = - n3b_knots_array[map_3b[itype][jtype][ktype]][0][0]; //MPI_Bcast + n3b_knots_array[map_3b[itype][jtype][ktype]][0][0]; min_cut_3b[itype][ktype][jtype][0] = n3b_knots_array[map_3b[itype][ktype][jtype]][0][0]; @@ -903,7 +733,7 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) for (int i = 0; i < num_knots_3b_ik; i++) { n3b_knots_array[map_3b[itype][jtype][ktype]][1][i] = - fp5th_line.next_double(); //MPI_Bcast + fp5th_line.next_double(); n3b_knots_array[map_3b[itype][ktype][jtype]][2][i] = n3b_knots_array[map_3b[itype][jtype][ktype]][1][i]; } @@ -1001,12 +831,12 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) for (int i = 0; i < coeff_matrix_dim1; i++) { for (int j = 0; j < coeff_matrix_dim2; j++) { for (int k = 0; k < coeff_matrix_dim3; k++) { - n3b_coeff_array[key2][j][i][k] = n3b_coeff_array[key1][i][j][k]; //MPI_Bcast + n3b_coeff_array[key2][j][i][k] = n3b_coeff_array[key1][i][j][k]; } } } - setflag_3b[itype][jtype][ktype] = 1; //MPI_Bcast + setflag_3b[itype][jtype][ktype] = 1; setflag_3b[itype][ktype][jtype] = 1; } } @@ -1108,13 +938,13 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) n3b_coeff_array_size[key][2] = n3b_coeff_array_size[mapped_to_key][2]; min_cut_3b[i][j][k][0] = - min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][0];//n3b_knots_array[key][0][0]; + min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][0]; min_cut_3b[i][j][k][1] = - min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][1];//n3b_knots_array[key][1][0]; + min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][1]; min_cut_3b[i][j][k][2] = - min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][2];//n3b_knots_array[key][2][0]; + min_cut_3b[i_mapped_to][j_mapped_to][k_mapped_to][2]; for (int knot_no = 0; knot_no < n3b_knots_array_size[key][0]; knot_no++) n3b_knots_array[key][0][knot_no] = n3b_knots_array[mapped_to_key][0][knot_no]; @@ -1138,569 +968,94 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) } } -/*void PairUF3::uf3_read_pot_file(int itype, int jtype, char *potf_name) +//Broadcast data read from potential file to all processors +void PairUF3::communicate() { - FILE *fp = utils::open_potential(potf_name, lmp, nullptr); - if (!fp) - error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); + const int num_of_elements = atom->ntypes; + MPI_Bcast(&cut[0][0], (num_of_elements + 1)*(num_of_elements + 1), + MPI_DOUBLE, 0, world); - TextFileReader txtfilereader(fp, "UF3:POTFP"); - txtfilereader.ignore_comments = false; + MPI_Bcast(&n2b_knots_array_size[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + MPI_Bcast(&n2b_coeff_array_size[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); - std::string temp_line = txtfilereader.next_line(1); - Tokenizer file_header(temp_line); + MPI_Bcast(&max_num_knots_2b, 1, MPI_INT, 0, world); + MPI_Bcast(&max_num_coeff_2b, 1, MPI_INT, 0, world); - if (file_header.count() <= 2) - error->all(FLERR, - "UF3: Expected more than two words on 1st line of {} \n" - "but found {} word/s", - potf_name, file_header.count()); + if (pot_3b){ + MPI_Bcast(&cut_3b_list[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_DOUBLE, 0, world); - if (file_header.contains("#UF3 POT") == 0) - error->all(FLERR, - "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" - "files contain '#UF3 POT'. Found {} in the header", - potf_name, temp_line); + MPI_Bcast(&cut_3b[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), + MPI_DOUBLE, 0, world); - if (file_header.contains("UNITS:") == 0) - error->all(FLERR, - "UF3: {} file does not contain the 'UNITS:' metadata in \n" - "the header", - potf_name); + MPI_Bcast(&n3b_knots_array_size[0][0], tot_interaction_count_3b*3, + MPI_INT, 0, world); + MPI_Bcast(&n3b_coeff_array_size[0][0], tot_interaction_count_3b*3, + MPI_INT, 0, world); - temp_line = txtfilereader.next_line(1); - ValueTokenizer fp2nd_line(temp_line); - - if (fp2nd_line.count() != 4) - error->all(FLERR, - "UF3: Expected 4 words on 2nd line =>\n" - " nBody leading_trim trailing_trim type_of_knot_spacing\n" - " Found {}", - temp_line); - - std::string nbody_on_file = fp2nd_line.next_string(); - if (nbody_on_file != "2B") - error->all(FLERR, "UF3: Expected a 2B UF3 file but found {}", nbody_on_file); - - int leading_trim = fp2nd_line.next_int(); - int trailing_trim = fp2nd_line.next_int(); - if (leading_trim != 0) - error->all(FLERR, - "UF3: Current implementation is throughly tested only for " - "leading_trim=0"); - if (trailing_trim != 3) - error->all(FLERR, - "UF3: Current implementation is throughly tested only for " - "trailing_trim=3"); - - std::string knot_type = fp2nd_line.next_string(); - if (knot_type == "uk") { - knot_spacing_type_2b[itype][jtype] = 0; - knot_spacing_type_2b[jtype][itype] = 0; - } else if (knot_type == "nk") { - knot_spacing_type_2b[itype][jtype] = 1; - knot_spacing_type_2b[jtype][itype] = 1; - } else - error->all(FLERR, - "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots). " - "Found {} on the 2nd line of {} pot file", - knot_type, potf_name); - - temp_line = txtfilereader.next_line(1); - ValueTokenizer fp3rd_line(temp_line); - if (fp3rd_line.count() != 2) - error->all(FLERR, - "UF3: Expected only 2 numbers on 3rd line => " - "Rij_CUTOFF NUM_OF_KNOTS. Found {} number/s", - fp3rd_line.count()); - - //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared - cut[itype][jtype] = fp3rd_line.next_double(); - cut[jtype][itype] = cut[itype][jtype]; - - int num_knots_2b = fp3rd_line.next_int(); - - temp_line = txtfilereader.next_line(num_knots_2b); - ValueTokenizer fp4th_line(temp_line); - - if (fp4th_line.count() != num_knots_2b) - error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_2b, - fp4th_line.count()); - - uf3_impl->n2b_knot[itype][jtype].resize(num_knots_2b); - uf3_impl->n2b_knot[jtype][itype].resize(num_knots_2b); - for (int k = 0; k < num_knots_2b; k++) { - uf3_impl->n2b_knot[itype][jtype][k] = fp4th_line.next_double(); - uf3_impl->n2b_knot[jtype][itype][k] = uf3_impl->n2b_knot[itype][jtype][k]; + MPI_Bcast(&max_num_knots_3b, 1, MPI_INT, 0, world); + MPI_Bcast(&max_num_coeff_3b, 1, MPI_INT, 0, world); } - temp_line = txtfilereader.next_line(1); - ValueTokenizer fp5th_line(temp_line); - int num_of_coeff_2b = fp5th_line.next_int(); + if (comm->me != 0) { + memory->destroy(n2b_knots_array); + memory->destroy(n2b_coeff_array); - temp_line = txtfilereader.next_line(num_of_coeff_2b); - ValueTokenizer fp6th_line(temp_line); + memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, + max_num_knots_2b, "pair:n2b_knots_array"); + memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, + max_num_coeff_2b, "pair:n2b_coeff_array"); + if (pot_3b) { + memory->destroy(n3b_knots_array); + memory->destroy(n3b_coeff_array); - if (fp6th_line.count() != num_of_coeff_2b) - error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", num_of_coeff_2b, - fp6th_line.count()); + memory->create(n3b_knots_array, tot_interaction_count_3b, 3, + max_num_knots_3b, "pair:n3b_knots_array"); - uf3_impl->n2b_coeff[itype][jtype].resize(num_of_coeff_2b); - uf3_impl->n2b_coeff[jtype][itype].resize(num_of_coeff_2b); - for (int k = 0; k < num_of_coeff_2b; k++) { - uf3_impl->n2b_coeff[itype][jtype][k] = fp6th_line.next_double(); - uf3_impl->n2b_coeff[jtype][itype][k] = uf3_impl->n2b_coeff[itype][jtype][k]; + memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, + max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); + } } - if (uf3_impl->n2b_knot[itype][jtype].size() != uf3_impl->n2b_coeff[itype][jtype].size() + 4) { - error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", - potf_name); + MPI_Bcast(&knot_spacing_type_2b[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + MPI_Bcast(&knot_spacing_2b[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + MPI_Bcast(&n2b_knots_array[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*max_num_knots_2b, MPI_DOUBLE, 0, world); + MPI_Bcast(&n2b_coeff_array[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*max_num_coeff_2b, MPI_DOUBLE, 0, world); + + MPI_Bcast(&setflag[0][0], + (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + + if (pot_3b) { + MPI_Bcast(&knot_spacing_type_3b[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), + MPI_INT, 0, world); + + MPI_Bcast(&knot_spacing_3b[0][0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1)*3, + MPI_INT, 0, world); + MPI_Bcast(&n3b_knots_array[0][0][0], + tot_interaction_count_3b*3*max_num_knots_3b, MPI_DOUBLE, 0, world); + MPI_Bcast(&n3b_coeff_array[0][0][0][0], + tot_interaction_count_3b*max_num_coeff_3b*max_num_coeff_3b*max_num_coeff_3b, + MPI_DOUBLE, 0, world); + MPI_Bcast(&setflag_3b[0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1), + MPI_INT, 0, world); + MPI_Bcast(&min_cut_3b[0][0][0][0], + (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1)*3, + MPI_DOUBLE, 0, world); } - setflag[itype][jtype] = 1; - setflag[jtype][itype] = 1; - fclose(fp); } -void PairUF3::uf3_read_pot_file(int itype, int jtype, int ktype, char *potf_name) -{ - int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; - FILE *fp = utils::open_potential(potf_name, lmp, nullptr); - if (!fp) - error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); - - TextFileReader txtfilereader(fp, "UF3:POTFP"); - txtfilereader.ignore_comments = false; - - std::string temp_line = txtfilereader.next_line(1); - Tokenizer file_header(temp_line); - - if (file_header.count() <= 2) - error->all(FLERR, - "UF3: Expected more than two words on 1st line of {} \n" - "but found {} word/s", - potf_name, file_header.count()); - - if (file_header.contains("#UF3 POT") == 0) - error->all(FLERR, - "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" - "files contain '#UF3 POT'. Found {} in the header", - potf_name, temp_line); - - if (file_header.contains("UNITS:") == 0) - error->all(FLERR, - "UF3: {} file does not contain the 'UNITS:' metadata in \n" - "the header", - potf_name); - - temp_line = txtfilereader.next_line(1); - ValueTokenizer fp2nd_line(temp_line); - - if (fp2nd_line.count() != 4) - error->all(FLERR, - "UF3: Expected 3 words on 2nd line => " - "nBody leading_trim trailing_trim type_of_knot_spacing " - "Found {}", - temp_line); - - std::string nbody_on_file = fp2nd_line.next_string(); - if (nbody_on_file != "3B") - error->all(FLERR, "UF3: Expected a 3B UF3 file but found {}", nbody_on_file); - - int leading_trim = fp2nd_line.next_int(); - int trailing_trim = fp2nd_line.next_int(); - if (leading_trim != 0) - error->all(FLERR, "UF3: Current implementation is throughly tested only for leading_trim=0"); - if (trailing_trim != 3) - error->all(FLERR, "UF3: Current implementation is throughly tested only for trailing_trim=3"); - - std::string knot_type = fp2nd_line.next_string(); - if (knot_type == "uk") { - knot_spacing_type_3b[itype][jtype][ktype] = 0; - knot_spacing_type_3b[itype][ktype][jtype] = 0; - } else if (knot_type == "nk") { - knot_spacing_type_3b[itype][jtype][ktype] = 1; - knot_spacing_type_3b[itype][ktype][jtype] = 1; - } else - error->all(FLERR, - "UF3: Expected either 'uk'(uniform-knots) or 'nk'(non-uniform knots) " - "Found {} on the 2nd line of {} pot file", - knot_type, potf_name); - - temp_line = txtfilereader.next_line(6); - ValueTokenizer fp3rd_line(temp_line); - - if (fp3rd_line.count() != 6) - error->all(FLERR, - "UF3: Expected only 6 numbers on 3rd line => " - "Rjk_CUTOFF Rik_CUTOFF Rij_CUTOFF NUM_OF_KNOTS_JK NUM_OF_KNOTS_IK NUM_OF_KNOTS_IJ " - "Found {} number/s", - fp3rd_line.count()); - - double cut3b_rjk = fp3rd_line.next_double(); - double cut3b_rij = fp3rd_line.next_double(); - double cut3b_rik = fp3rd_line.next_double(); - - if (cut3b_rij != cut3b_rik) { - error->all(FLERR, "UF3: rij!=rik, Current implementation only works for rij=rik"); - } - - if (2 * cut3b_rik != cut3b_rjk) { - error->all(FLERR, - "UF3: 2rij=2rik!=rik, Current implementation only works " - "for 2rij=2rik!=rik"); - } - - cut_3b_list[itype][jtype] = std::max(cut3b_rij, cut_3b_list[itype][jtype]); - cut_3b_list[itype][ktype] = std::max(cut_3b_list[itype][ktype], cut3b_rik); - - cut_3b[itype][jtype][ktype] = cut3b_rij; - cut_3b[itype][ktype][jtype] = cut3b_rik; - - int num_knots_3b_jk = fp3rd_line.next_int(); - temp_line = txtfilereader.next_line(num_knots_3b_jk); - ValueTokenizer fp4th_line(temp_line); - - if (fp4th_line.count() != num_knots_3b_jk) - error->all(FLERR, "UF3: Expected {} numbers on 4th line but found {} numbers", num_knots_3b_jk, - fp4th_line.count()); - - uf3_impl->n3b_knot_matrix[itype][jtype][ktype].resize(3); - uf3_impl->n3b_knot_matrix[itype][ktype][jtype].resize(3); - - uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0].resize(num_knots_3b_jk); - uf3_impl->n3b_knot_matrix[itype][ktype][jtype][0].resize(num_knots_3b_jk); - - for (int i = 0; i < num_knots_3b_jk; i++) { - uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0][i] = fp4th_line.next_double(); - uf3_impl->n3b_knot_matrix[itype][ktype][jtype][0][i] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0][i]; - } - - min_cut_3b[itype][jtype][ktype][0] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0][0]; - min_cut_3b[itype][ktype][jtype][0] = uf3_impl->n3b_knot_matrix[itype][ktype][jtype][0][0]; - - int num_knots_3b_ik = fp3rd_line.next_int(); - temp_line = txtfilereader.next_line(num_knots_3b_ik); - ValueTokenizer fp5th_line(temp_line); - - if (fp5th_line.count() != num_knots_3b_ik) - error->all(FLERR, "UF3: Expected {} numbers on 5th line but found {} numbers", num_knots_3b_ik, - fp5th_line.count()); - - uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1].resize(num_knots_3b_ik); - uf3_impl->n3b_knot_matrix[itype][ktype][jtype][2].resize(num_knots_3b_ik); - for (int i = 0; i < num_knots_3b_ik; i++) { - uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1][i] = fp5th_line.next_double(); - uf3_impl->n3b_knot_matrix[itype][ktype][jtype][2][i] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1][i]; - } - - min_cut_3b[itype][jtype][ktype][1] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1][0]; - min_cut_3b[itype][ktype][jtype][2] = uf3_impl->n3b_knot_matrix[itype][ktype][jtype][2][0]; - - int num_knots_3b_ij = fp3rd_line.next_int(); - temp_line = txtfilereader.next_line(num_knots_3b_ij); - ValueTokenizer fp6th_line(temp_line); - - if (fp6th_line.count() != num_knots_3b_ij) - error->all(FLERR, "UF3: Expected {} numbers on 6th line but found {} numbers", num_knots_3b_ij, - fp5th_line.count()); - - uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2].resize(num_knots_3b_ij); - uf3_impl->n3b_knot_matrix[itype][ktype][jtype][1].resize(num_knots_3b_ij); - for (int i = 0; i < num_knots_3b_ij; i++) { - uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2][i] = fp6th_line.next_double(); - uf3_impl->n3b_knot_matrix[itype][ktype][jtype][1][i] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2][i]; - } - - min_cut_3b[itype][jtype][ktype][2] = uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2][0]; - min_cut_3b[itype][ktype][jtype][1] = uf3_impl->n3b_knot_matrix[itype][ktype][jtype][1][0]; - - temp_line = txtfilereader.next_line(3); - ValueTokenizer fp7th_line(temp_line); - - if (fp7th_line.count() != 3) - error->all(FLERR, - "UF3: Expected 3 numbers on 7th line => " - "SHAPE_OF_COEFF_MATRIX[I][J][K] " - "found {} numbers", - fp7th_line.count()); - - coeff_matrix_dim1 = fp7th_line.next_int(); - coeff_matrix_dim2 = fp7th_line.next_int(); - coeff_matrix_dim3 = fp7th_line.next_int(); - - if (uf3_impl->n3b_knot_matrix[itype][jtype][ktype][0].size() != coeff_matrix_dim3 + 3 + 1) - error->all(FLERR, - "UF3: {} has incorrect knot (NUM_OF_KNOTS_JK) and " - "coeff (coeff_matrix_dim3) data nknots!=ncoeffs + 3 +1", - potf_name); - - if (uf3_impl->n3b_knot_matrix[itype][jtype][ktype][1].size() != coeff_matrix_dim2 + 3 + 1) - error->all(FLERR, - "UF3: {} has incorrect knot (NUM_OF_KNOTS_IK) and " - "coeff (coeff_matrix_dim2) data nknots!=ncoeffs + 3 +1", - potf_name); - - if (uf3_impl->n3b_knot_matrix[itype][jtype][ktype][2].size() != coeff_matrix_dim1 + 3 + 1) - error->all(FLERR, - "UF3: {} has incorrect knot (NUM_OF_KNOTS_IJ) and " - "coeff ()coeff_matrix_dim1 data nknots!=ncoeffs + 3 +1", - potf_name); - - coeff_matrix_elements_len = coeff_matrix_dim3; - - std::string key = std::to_string(itype) + std::to_string(jtype) + std::to_string(ktype); - uf3_impl->n3b_coeff_matrix[key].resize(coeff_matrix_dim1); - - int line_count = 0; - for (int i = 0; i < coeff_matrix_dim1; i++) { - uf3_impl->n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); - for (int j = 0; j < coeff_matrix_dim2; j++) { - temp_line = txtfilereader.next_line(coeff_matrix_elements_len); - ValueTokenizer coeff_line(temp_line); - uf3_impl->n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); - - if (coeff_line.count() != coeff_matrix_elements_len) - error->all(FLERR, "UF3: Expected {} numbers on {}th line but found {} numbers", - coeff_matrix_elements_len, line_count + 8, coeff_line.count()); - for (int k = 0; k < coeff_matrix_dim3; k++) { - uf3_impl->n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); - } - line_count += 1; - } - } - - std::string key2 = std::to_string(itype) + std::to_string(ktype) + std::to_string(jtype); - uf3_impl->n3b_coeff_matrix[key2].resize(coeff_matrix_dim2); - for (int j = 0; j < coeff_matrix_dim2; j++) { - uf3_impl->n3b_coeff_matrix[key2][j].resize(coeff_matrix_dim1); - for (int i = 0; i < coeff_matrix_dim1; i++) { - uf3_impl->n3b_coeff_matrix[key2][j][i].resize(coeff_matrix_dim3); - } - } - - for (int i = 0; i < coeff_matrix_dim1; i++) { - for (int j = 0; j < coeff_matrix_dim2; j++) { - for (int k = 0; k < coeff_matrix_dim3; k++) { - uf3_impl->n3b_coeff_matrix[key2][j][i][k] = uf3_impl->n3b_coeff_matrix[key][i][j][k]; - } - } - } - - setflag_3b[itype][jtype][ktype] = 1; - setflag_3b[itype][ktype][jtype] = 1; - fclose(fp); -} - -void PairUF3::uf3_read_pot_file(char *potf_name) -{ - FILE *fp = utils::open_potential(potf_name, lmp, nullptr); - if (!fp) - error->all(FLERR, "Cannot open UF3 potential file {}: {}", potf_name, utils::getsyserror()); - - TextFileReader txtfilereader(fp, "UF3:POTFP"); - txtfilereader.ignore_comments = false; - - std::string temp_line = txtfilereader.next_line(2); - Tokenizer fp1st_line(temp_line); - - if (fp1st_line.count() <= 2) - error->all(FLERR, - "UF3: Expected more than two words on 1st line of {} \n" - "but found {} word/s", - potf_name, fp1st_line.count()); - - if (fp1st_line.contains("#UF3 POT") == 0) - error->all(FLERR, - "UF3: {} file is not UF3 POT type, 1st line of UF3 POT \n" - "files contain '#UF3 POT'. Found {} in the header", - potf_name, temp_line); - - if (fp1st_line.contains("UNITS:") == 0) - error->all(FLERR, - "UF3: {} file does not contain the 'UNITS:' metadata in \n" - "the header", - potf_name); - - temp_line = txtfilereader.next_line(1); - Tokenizer fp2nd_line(temp_line); - if (fp2nd_line.contains("2B") == 1) { - temp_line = txtfilereader.next_line(4); - ValueTokenizer fp3rd_line(temp_line); - int temp_type1 = fp3rd_line.next_int(); - int temp_type2 = fp3rd_line.next_int(); - - //cut is used in init_one which is called by pair.cpp at line 267 where the return of init_one is squared - cut[temp_type1][temp_type2] = fp3rd_line.next_double(); - cut[temp_type2][temp_type1] = cut[temp_type1][temp_type2]; - - int temp_line_len = fp3rd_line.next_int(); - - temp_line = txtfilereader.next_line(temp_line_len); - ValueTokenizer fp4th_line(temp_line); - - uf3_impl->n2b_knot[temp_type1][temp_type2].resize(temp_line_len); - uf3_impl->n2b_knot[temp_type2][temp_type1].resize(temp_line_len); - for (int k = 0; k < temp_line_len; k++) { - uf3_impl->n2b_knot[temp_type1][temp_type2][k] = fp4th_line.next_double(); - uf3_impl->n2b_knot[temp_type2][temp_type1][k] = uf3_impl->n2b_knot[temp_type1][temp_type2][k]; - } - - temp_line = txtfilereader.next_line(1); - ValueTokenizer fp5th_line(temp_line); - - temp_line_len = fp5th_line.next_int(); - - temp_line = txtfilereader.next_line(temp_line_len); - ValueTokenizer fp6th_line(temp_line); - uf3_impl->n2b_coeff[temp_type1][temp_type2].resize(temp_line_len); - uf3_impl->n2b_coeff[temp_type2][temp_type1].resize(temp_line_len); - - for (int k = 0; k < temp_line_len; k++) { - uf3_impl->n2b_coeff[temp_type1][temp_type2][k] = fp6th_line.next_double(); - uf3_impl->n2b_coeff[temp_type2][temp_type1][k] = uf3_impl->n2b_coeff[temp_type1][temp_type2][k]; - } - if (uf3_impl->n2b_knot[temp_type1][temp_type2].size() != uf3_impl->n2b_coeff[temp_type1][temp_type2].size() + 4) { - error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", - potf_name); - } - setflag[temp_type1][temp_type2] = 1; - setflag[temp_type2][temp_type1] = 1; - } else if (fp2nd_line.contains("3B") == 1) { - int coeff_matrix_dim1, coeff_matrix_dim2, coeff_matrix_dim3, coeff_matrix_elements_len; - temp_line = txtfilereader.next_line(9); - ValueTokenizer fp3rd_line(temp_line); - int temp_type1 = fp3rd_line.next_int(); - int temp_type2 = fp3rd_line.next_int(); - int temp_type3 = fp3rd_line.next_int(); - - double cut3b_rjk = fp3rd_line.next_double(); - double cut3b_rij = fp3rd_line.next_double(); - // cut_3b[temp_type1][temp_type2] = std::max(cut3b_rij, - // cut_3b[temp_type1][temp_type2]); - cut_3b_list[temp_type1][temp_type2] = - std::max(cut3b_rij, cut_3b_list[temp_type1][temp_type2]); - - double cut3b_rik = fp3rd_line.next_double(); - if (cut3b_rij != cut3b_rik) { - error->all(FLERR, "UF3: rij!=rik, Current implementation only works for rij=rik"); - } - if (2 * cut3b_rik != cut3b_rjk) { - error->all(FLERR, - "UF3: 2rij=2rik!=rik, Current implementation only works for 2rij=2rik!=rik"); - } - // cut_3b[temp_type1][temp_type3] = std::max(cut_3b[temp_type1][temp_type3],cut3b_rik); - cut_3b_list[temp_type1][temp_type3] = - std::max(cut_3b_list[temp_type1][temp_type3], cut3b_rik); - - cut_3b[temp_type1][temp_type2][temp_type3] = cut3b_rij; - cut_3b[temp_type1][temp_type3][temp_type2] = cut3b_rik; - - int temp_line_len = fp3rd_line.next_int(); - temp_line = txtfilereader.next_line(temp_line_len); - ValueTokenizer fp4th_line(temp_line); - - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3].resize(3); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2].resize(3); - - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].resize(temp_line_len); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0].resize(temp_line_len); - for (int i = 0; i < temp_line_len; i++) { - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i] = fp4th_line.next_double(); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][i] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][i]; - } - - min_cut_3b[temp_type1][temp_type2][temp_type3][0] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0][0]; - min_cut_3b[temp_type1][temp_type3][temp_type2][0] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][0][0]; - - temp_line_len = fp3rd_line.next_int(); - temp_line = txtfilereader.next_line(temp_line_len); - ValueTokenizer fp5th_line(temp_line); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].resize(temp_line_len); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2].resize(temp_line_len); - for (int i = 0; i < temp_line_len; i++) { - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i] = fp5th_line.next_double(); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][i] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][i]; - } - - min_cut_3b[temp_type1][temp_type2][temp_type3][1] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1][0]; - min_cut_3b[temp_type1][temp_type3][temp_type2][2] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][2][0]; - - temp_line_len = fp3rd_line.next_int(); - temp_line = txtfilereader.next_line(temp_line_len); - ValueTokenizer fp6th_line(temp_line); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].resize(temp_line_len); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1].resize(temp_line_len); - for (int i = 0; i < temp_line_len; i++) { - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i] = fp6th_line.next_double(); - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][i] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][i]; - } - - min_cut_3b[temp_type1][temp_type2][temp_type3][2] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2][0]; - min_cut_3b[temp_type1][temp_type3][temp_type2][1] = - uf3_impl->n3b_knot_matrix[temp_type1][temp_type3][temp_type2][1][0]; - - temp_line = txtfilereader.next_line(3); - ValueTokenizer fp7th_line(temp_line); - - coeff_matrix_dim1 = fp7th_line.next_int(); - coeff_matrix_dim2 = fp7th_line.next_int(); - coeff_matrix_dim3 = fp7th_line.next_int(); - if (uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][0].size() != - coeff_matrix_dim3 + 3 + 1) { - error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", - potf_name); - } - if (uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][1].size() != - coeff_matrix_dim2 + 3 + 1) { - error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", - potf_name); - } - if (uf3_impl->n3b_knot_matrix[temp_type1][temp_type2][temp_type3][2].size() != - coeff_matrix_dim1 + 3 + 1) { - error->all(FLERR, "UF3: {} has incorrect knot and coeff data nknots!=ncoeffs + 3 +1", - potf_name); - } - - coeff_matrix_elements_len = coeff_matrix_dim3; - - std::string key = - std::to_string(temp_type1) + std::to_string(temp_type2) + std::to_string(temp_type3); - uf3_impl->n3b_coeff_matrix[key].resize(coeff_matrix_dim1); - for (int i = 0; i < coeff_matrix_dim1; i++) { - uf3_impl->n3b_coeff_matrix[key][i].resize(coeff_matrix_dim2); - for (int j = 0; j < coeff_matrix_dim2; j++) { - temp_line = txtfilereader.next_line(coeff_matrix_elements_len); - ValueTokenizer coeff_line(temp_line); - uf3_impl->n3b_coeff_matrix[key][i][j].resize(coeff_matrix_dim3); - for (int k = 0; k < coeff_matrix_dim3; k++) { - uf3_impl->n3b_coeff_matrix[key][i][j][k] = coeff_line.next_double(); - } - } - } - - key = std::to_string(temp_type1) + std::to_string(temp_type3) + std::to_string(temp_type2); - uf3_impl->n3b_coeff_matrix[key] = - uf3_impl->n3b_coeff_matrix[std::to_string(temp_type1) + - std::to_string(temp_type2) + - std::to_string(temp_type3)]; - setflag_3b[temp_type1][temp_type2][temp_type3] = 1; - setflag_3b[temp_type1][temp_type3][temp_type2] = 1; - } else - error->all( - FLERR, - "UF3: {} file does not contain right words indicating whether it is 2 or 3 body potential", - potf_name); - fclose(fp); -}*/ - /* ---------------------------------------------------------------------- init specific to this pair style ------------------------------------------------------------------------- */ @@ -1745,13 +1100,13 @@ void PairUF3::create_bsplines() "UF3: Not all 2-body UF potentials are set, " "missing potential for {}-{} interaction", i, j); - if (spacing_type != knot_spacing_type_2b[i][j]) + /*if (spacing_type != knot_spacing_type_2b[i][j]) error->all(FLERR, "UF3: In the current version the knot spacing type, " "for all interactions needs to be same. For {}-{} " "i.e. {}-{} interaction expected {}, but found {}", i,j,elements[map[i]],elements[map[j]],spacing_type, - knot_spacing_type_2b[i][j]); + knot_spacing_type_2b[i][j]);*/ } } if (pot_3b) { @@ -1776,73 +1131,29 @@ void PairUF3::create_bsplines() } - if (spacing_type) { - get_starting_index_2b = &PairUF3::get_starting_index_nonuniform_2b; - if (pot_3b) - get_starting_index_3b = &PairUF3::get_starting_index_nonuniform_3b; - } - else { + //if (spacing_type) { + get_starting_index_2b = &PairUF3::get_starting_index_nonuniform_2b; + if (pot_3b) + get_starting_index_3b = &PairUF3::get_starting_index_nonuniform_3b; + //} + /*else { get_starting_index_2b = &PairUF3::get_starting_index_uniform_2b; if (pot_3b) get_starting_index_3b = &PairUF3::get_starting_index_uniform_3b; - } + }*/ create_cached_constants_2b(); if (pot_3b) create_cached_constants_3b(); - - /*for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = i; j < num_of_elements + 1; j++) { - uf3_impl->UFBS2b[i][j] = - uf3_pair_bspline(lmp, uf3_impl->n2b_knot[i][j], uf3_impl->n2b_coeff[i][j], - knot_spacing_type_2b[i][j]); - - uf3_impl->UFBS2b[i][j] = uf3_pair_bspline(lmp, n2b_knots_array[i][j], - n2b_knots_array_size[i][j], - n2b_coeff_array[i][j], - n2b_coeff_array_size[i][j], - knot_spacing_type_2b[i][j]); - uf3_impl->UFBS2b[j][i] = uf3_impl->UFBS2b[i][j]; - } - if (pot_3b) { - for (int j = 1; j < num_of_elements + 1; j++) { - for (int k = j; k < num_of_elements + 1; k++) { - std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( - lmp, uf3_impl->n3b_knot_matrix[i][j][k], uf3_impl->n3b_coeff_matrix[key], knot_spacing_type_3b[i][j][k]); - int key = map_3b[i][j][k]; - int key2 = map_3b[i][k][j]; - - uf3_impl->UFBS3b[i][j][k] = uf3_triplet_bspline( - lmp, n3b_knots_array[key], n3b_knots_array_size[key], - n3b_coeff_array[key], n3b_coeff_array_size[key], - knot_spacing_type_3b[i][j][k]); - - std::string key2 = std::to_string(i) + std::to_string(k) + std::to_string(j); - uf3_impl->UFBS3b[i][k][j] = uf3_triplet_bspline( - lmp, uf3_impl->n3b_knot_matrix[i][k][j], uf3_impl->n3b_coeff_matrix[key2], knot_spacing_type_3b[i][k][j]); - //int key2 = map_3b[i][k][j]; - uf3_impl->UFBS3b[i][k][j] = uf3_triplet_bspline( - lmp, n3b_knots_array[key2], n3b_knots_array_size[key2], - n3b_coeff_array[key2], n3b_coeff_array_size[key2], - knot_spacing_type_3b[i][k][j]); - } - } - } - }*/ } int PairUF3::get_starting_index_uniform_2b(int i, int j, double r) { - //return 3+(int)((r-n2b_knots_array[i][j][0])/(n2b_knots_array[i][j][4]-n2b_knots_array[i][j][3])); return 3+(int)((r-n2b_knots_array[i][j][0])/(knot_spacing_2b[i][j])); } int PairUF3::get_starting_index_uniform_3b(int i, int j, int k, double r, int knot_dim) { - /*return 3+(int)((r-n3b_knots_array[map_3b[i][j][k]][knot_dim][0])/ - (n3b_knots_array[map_3b[i][j][k]][knot_dim][4] - - n3b_knots_array[map_3b[i][j][k]][knot_dim][3]));*/ return 3+(int)(((r-n3b_knots_array[map_3b[i][j][k]][knot_dim][0])/ knot_spacing_3b[i][j][k][knot_dim])); } @@ -1882,12 +1193,6 @@ void PairUF3::create_cached_constants_2b() uf3_bspline_basis3 bspline_basis(lmp, &n2b_knots_array[i][j][l], n2b_coeff_array[i][j][l]); for (int cc = 0; cc < 16; cc++) { - /*if (std::isinf(bspline_basis.constants[cc]) || - std::isnan(bspline_basis.constants[cc])) - utils::logmesg(lmp, - "UF3: Bspline coefficients for" - " {}-{} interaction, {} basis set, {} constant\n", - i,j,l,cc);*/ cached_constants_2b[i][j][l][cc] = bspline_basis.constants[cc]; } } @@ -1915,12 +1220,6 @@ void PairUF3::create_cached_constants_2b() uf3_bspline_basis2 bspline_basis_deri(lmp, &knots_for_deri[l], coeff_for_deri[l]); for (int cc = 0; cc < 9; cc++) { - /*if (std::isinf(bspline_basis_deri.constants[cc]) || - std::isnan(bspline_basis_deri.constants[cc])) - utils::logmesg(lmp, - "UF3: Bspline coefficients for" - " derivative of {}-{} interaction, {}th basis set," - " {} constant\n",i,j,l,cc);*/ cached_constants_2b_deri[i][j][l][cc] = bspline_basis_deri.constants[cc]; } } @@ -1979,10 +1278,7 @@ void PairUF3::create_cached_constants_3b() for(int k = 1; k < num_of_elements + 1; k++) { int map_to = map_3b[i][j][k]; double **knots_for_der = nullptr;//new double*[3]; - //double ***coeff_for_der_jk = nullptr; - //double ***coeff_for_der_ik = nullptr; - //double ***coeff_for_der_ij = nullptr; - + //n3b_knots_array_size[map_to][0] for jk knot vector --> always largest memory->create(knots_for_der, 3, n3b_knots_array_size[map_to][0]-1, "pair:knots_for_der"); @@ -2035,42 +1331,28 @@ void PairUF3::create_cached_constants_3b() } } - //cached_constants_3b_deri - //utils::logmesg(lmp, "UF3: {} {} {}\n",i,j,k); - //utils::logmesg(lmp, "UF3: bspline_basis_deri_ij"); for (int l = 0; l < n3b_coeff_array_size[map_to][0] - 1; l++) { uf3_bspline_basis2 bspline_basis_deri_ij(lmp, &knots_for_der[2][l], 1); for (int cc = 0; cc < 9; cc++) { cached_constants_3b_deri[map_to][0][l][cc] = bspline_basis_deri_ij.constants[cc]; - //utils::logmesg(lmp," {}",bspline_basis_deri_ij.constants[cc]); } - //utils::logmesg(lmp,"\n"); } - //utils::logmesg(lmp, "UF3: bspline_basis_deri_ik"); for (int l = 0; l < n3b_coeff_array_size[map_to][1] - 1; l++) { uf3_bspline_basis2 bspline_basis_deri_ik(lmp, &knots_for_der[1][l], 1); for (int cc = 0; cc < 9; cc++) { cached_constants_3b_deri[map_to][1][l][cc] = bspline_basis_deri_ik.constants[cc]; - //utils::logmesg(lmp," {}",bspline_basis_deri_ik.constants[cc]); } - //utils::logmesg(lmp,"\n"); } - //utils::logmesg(lmp, "UF3: bspline_basis_deri_jk"); for (int l = 0; l < n3b_coeff_array_size[map_to][2] - 1; l++) { uf3_bspline_basis2 bspline_basis_deri_jk(lmp, &knots_for_der[0][l], 1); for (int cc = 0; cc < 9; cc++) { cached_constants_3b_deri[map_to][2][l][cc] = bspline_basis_deri_jk.constants[cc]; - //utils::logmesg(lmp," {}",bspline_basis_deri_jk.constants[cc]); } - //utils::logmesg(lmp,"\n"); } memory->destroy(knots_for_der); - //memory->destroy(coeff_for_der_jk) - //memory->destroy(coeff_for_der_ik) - //memory->destroy(coeff_for_der_ij); } } } @@ -2140,7 +1422,6 @@ void PairUF3::compute(int eflag, int vflag) int knot_start_index = (this->*get_starting_index_2b)(itype,jtype,rij); - //double *pair_eval = uf3_impl->UFBS2b[itype][jtype].eval(rij); double force_2b = cached_constants_2b_deri[itype][jtype][knot_start_index - 1][0]; force_2b += rij*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][1]; force_2b += rsq*cached_constants_2b_deri[itype][jtype][knot_start_index - 1][2]; @@ -2165,7 +1446,6 @@ void PairUF3::compute(int eflag, int vflag) f[j][2] -= fz; if (eflag) { - //evdwl = pair_eval[0] double rth = rsq*rij; evdwl = cached_constants_2b[itype][jtype][knot_start_index][0]; evdwl += rij*cached_constants_2b[itype][jtype][knot_start_index][1]; @@ -2183,7 +1463,6 @@ void PairUF3::compute(int eflag, int vflag) evdwl += rij*cached_constants_2b[itype][jtype][knot_start_index-3][13]; evdwl += rsq*cached_constants_2b[itype][jtype][knot_start_index-3][14]; evdwl += rth*cached_constants_2b[itype][jtype][knot_start_index-3][15]; - //utils::logmesg(lmp,"UF3: {} {} {} {}\n",itype,jtype,evdwl,force_2b); }; if (evflag) { @@ -2238,7 +1517,6 @@ void PairUF3::compute(int eflag, int vflag) del_rji[2] = x[j][2] - ztmp; rij_sq = (del_rji[0] * del_rji[0]) + (del_rji[1] * del_rji[1]) + (del_rji[2] * del_rji[2]); rij = sqrt(rij_sq); - //sqrt(((del_rji[0] * del_rji[0]) + (del_rji[1] * del_rji[1]) + (del_rji[2] * del_rji[2]))); // kth atom for (kk = jj + 1; kk < numshort; kk++) { @@ -2258,7 +1536,6 @@ void PairUF3::compute(int eflag, int vflag) del_rki[2] = x[k][2] - ztmp; rik_sq = (del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]); rik = sqrt(rik_sq); - //((del_rki[0] * del_rki[0]) + (del_rki[1] * del_rki[1]) + (del_rki[2] * del_rki[2]))); if ((rij <= cut_3b[itype][jtype][ktype]) && (rik <= cut_3b[itype][ktype][jtype]) && @@ -2271,13 +1548,12 @@ void PairUF3::compute(int eflag, int vflag) rjk_sq = (del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]); rjk = sqrt(rjk_sq); - //((del_rkj[0] * del_rkj[0]) + (del_rkj[1] * del_rkj[1]) + (del_rkj[2] * del_rkj[2]))); if (rjk >= min_cut_3b[itype][jtype][ktype][0]) { double rij_th = rij*rij_sq; double rik_th = rik*rik_sq; double rjk_th = rjk*rjk_sq; - //double *triangle_eval = uf3_impl->UFBS3b[itype][jtype][ktype].eval(rij, rik, rjk); + int map_to = map_3b[itype][jtype][ktype]; int knot_start_index_ij = (this->*get_starting_index_3b)(itype,jtype,ktype,rij,2); int knot_start_index_ik = (this->*get_starting_index_3b)(itype,jtype,ktype,rik,1); @@ -2290,7 +1566,6 @@ void PairUF3::compute(int eflag, int vflag) double basis_jk_der[3]; //--------------basis_ij - //utils::logmesg(lmp, "UF3: {} {}\n",map_to,knot_start_index_ij); basis_ij[0] = cached_constants_3b[map_to][0][knot_start_index_ij - 3][12]; basis_ij[0] += rij*cached_constants_3b[map_to][0][knot_start_index_ij - 3][13]; basis_ij[0] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij - 3][14]; @@ -2311,9 +1586,6 @@ void PairUF3::compute(int eflag, int vflag) basis_ij[3] += rij_sq*cached_constants_3b[map_to][0][knot_start_index_ij][2]; basis_ij[3] += rij_th*cached_constants_3b[map_to][0][knot_start_index_ij][3]; - //utils::logmesg(lmp,"UF3: basis_ij = {} {} {} {}\n",basis_ij[0],basis_ij[1], - // basis_ij[2],basis_ij[3]); - //--------------basis_ik basis_ik[0] = cached_constants_3b[map_to][1][knot_start_index_ik - 3][12]; basis_ik[0] += rik*cached_constants_3b[map_to][1][knot_start_index_ik - 3][13]; @@ -2359,8 +1631,6 @@ void PairUF3::compute(int eflag, int vflag) basis_jk[3] += rjk_sq*cached_constants_3b[map_to][2][knot_start_index_jk][2]; basis_jk[3] += rjk_th*cached_constants_3b[map_to][2][knot_start_index_jk][3]; - //utils::logmesg(lmp,"UF3: basis_jk = {} {} {} {}\n",basis_jk[0],basis_jk[1], - // basis_jk[2],basis_jk[3]); //----------------basis_ij_der basis_ij_der[0] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][6]; basis_ij_der[0] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][7]; @@ -2373,21 +1643,10 @@ void PairUF3::compute(int eflag, int vflag) basis_ij_der[1] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][3]; basis_ij_der[1] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][4]; basis_ij_der[1] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][5]; - /*utils::logmesg(lmp,"UF3 cached_constants 1 = {} {} {}\n", - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][3], - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][4], - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][5]);*/ basis_ij_der[2] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][0]; basis_ij_der[2] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][1]; basis_ij_der[2] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][2]; - /*utils::logmesg(lmp,"UF3 cached_constants 0 = {} {} {}\n", - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][0], - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][1], - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 1][2]);*/ - - //utils::logmesg(lmp,"UF3: basis_ij_der = {} {} {}\n",basis_ij_der[0],basis_ij_der[1], - // basis_ij_der[2]); //----------------basis_ik_der basis_ik_der[0] = cached_constants_3b_deri[map_to][1][knot_start_index_ik - 3][6]; @@ -2402,9 +1661,6 @@ void PairUF3::compute(int eflag, int vflag) basis_ik_der[2] += rik*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][1]; basis_ik_der[2] += rik_sq*cached_constants_3b_deri[map_to][1][knot_start_index_ik - 1][2]; - //utils::logmesg(lmp,"UF3: basis_ik_der = {} {} {}\n",basis_ik_der[0],basis_ik_der[1], - // basis_ik_der[2]); - //----------------basis_jk_der basis_jk_der[0] = cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][6]; basis_jk_der[0] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 3][7]; @@ -2418,35 +1674,12 @@ void PairUF3::compute(int eflag, int vflag) basis_jk_der[2] += rjk*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][1]; basis_jk_der[2] += rjk_sq*cached_constants_3b_deri[map_to][2][knot_start_index_jk - 1][2]; - //utils::logmesg(lmp,"UF3: basis_jk_der = {} {} {}\n",basis_jk_der[0],basis_jk_der[1], - // basis_jk_der[2]); - double triangle_eval[4] = {0,0,0,0}; int iknot_ij = knot_start_index_ij - 3; int iknot_ik = knot_start_index_ik - 3; int iknot_jk = knot_start_index_jk - 3; - /*if (eflag) { - for (int l = 0; l < 4; l++) { - const double basis_ij_i = basis_ij[l]; - for (int m = 0; m < 4; m++) { - const double factor = basis_ij_i * basis_ik[m]; - const double* slice = - &n3b_coeff_array[map_to][iknot_ij + l][iknot_ik + m][iknot_jk]; - double tmp[4]; - tmp[0] = slice[0] * basis_jk[0]; - tmp[1] = slice[1] * basis_jk[1]; - tmp[2] = slice[2] * basis_jk[2]; - tmp[3] = slice[3] * basis_jk[3]; - double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; - triangle_eval[0] += factor * sum; - } - } - }*/ - //else - // triangle_eval[0] = 0; - for (int l = 0; l < 3; l++) { const double basis_ij_der_i = basis_ij_der[l]; for (int m = 0; m < 4; m++) { @@ -2460,8 +1693,6 @@ void PairUF3::compute(int eflag, int vflag) tmp[3] = slice[3] * basis_jk[3]; double sum = tmp[0] + tmp[1] + tmp[2] + tmp[3]; triangle_eval[1] += factor * sum; - //utils::logmesg(lmp, "UF3: {} {} {} {} {} {}\n", basis_ij_der[l], - // factor, slice[0], slice[1], slice[2], slice[3]); } } @@ -2496,10 +1727,6 @@ void PairUF3::compute(int eflag, int vflag) } } - /*utils::logmesg(lmp,"UF3: {} {} {} {} {} {} {}\n",itype,jtype,ktype, - *triangle_eval,*(triangle_eval + 1),*(triangle_eval + 2), - *(triangle_eval + 3));*/ - fij[0] = *(triangle_eval + 1) * (del_rji[0] / rij); fji[0] = -fij[0]; fik[0] = *(triangle_eval + 2) * (del_rki[0] / rik); @@ -2666,15 +1893,12 @@ double PairUF3::memory_usage() const int num_of_elements = atom->ntypes; double bytes = Pair::memory_usage(); - bytes += (double) 5 * sizeof(double); //num_of_elements, nbody_flag, - //n2body_pot_files, n3body_pot_files, - //tot_pot_files; - - bytes += (double) 5 * sizeof(double); //bsplines_created, coeff_matrix_dim1, - //coeff_matrix_dim2, coeff_matrix_dim3, - //coeff_matrix_elements_len bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * - sizeof(double); //***setflag_3b + sizeof(int); //***setflag_3b + + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(int); //knot_spacing_type_2b + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * + sizeof(int); //knot_spacing_type_3b bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //cut @@ -2685,111 +1909,53 @@ double PairUF3::memory_usage() bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * 3 * sizeof(double); //min_cut_3b - - bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //n2b_knots_array_size - bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //n2b_coeff_array_size + + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //knot_spacing_2b + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * + sizeof(double); //knot_spacing_3b bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_knots_2b * sizeof(double); //n2b_knots_array bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_coeff_2b * sizeof(double); //n2b_coeff_array + + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(int); //n2b_knots_array_size + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(int); //n2b_coeff_array_size + + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_coeff_2b * + 16 * sizeof(double); //cached_constants_2b, + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (max_num_coeff_2b-1) * + 9 * sizeof(double); //cached_constants_2b_deri + if (pot_3b) { - bytes += (double) tot_interaction_count_3b * 3 * sizeof(double); //n3b_knots_array_size - bytes += (double) tot_interaction_count_3b * 3 * sizeof(double); //n3b_coeff_array_size + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * + (num_of_elements + 1) * sizeof(int); //map_3b + bytes += (double) tot_interaction_count_3b * 3 * max_num_knots_3b * sizeof(double); //n3b_knots_array bytes += (double) tot_interaction_count_3b * max_num_coeff_3b * max_num_coeff_3b * max_num_coeff_3b * sizeof(double); //n3b_coeff_array + + bytes += (double) tot_interaction_count_3b * 3 * sizeof(int); //n3b_knots_array_size + bytes += (double) tot_interaction_count_3b * 3 * sizeof(int); //n3b_coeff_array_size + + bytes += (double) tot_interaction_count_3b * max_num_coeff_3b * max_num_coeff_3b + * max_num_coeff_3b * 3 * sizeof(double); //coeff_for_der_jk coeff_for_der_ik coeff_for_der_ij + + bytes += (double) tot_interaction_count_3b * 3 * max_num_coeff_3b * 16 + * sizeof(double); //cached_constants_3b + bytes += (double) tot_interaction_count_3b * 3 * (max_num_coeff_3b - 1) * 16 + * sizeof(double); //cached_constants_3b_deri + } - /*for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = i; j < num_of_elements + 1; j++) { - bytes += (double) 2 * uf3_impl->n2b_knot[i][j].size() * sizeof(double); //n2b_knot - bytes += (double) 2 * uf3_impl->n2b_coeff[i][j].size() * sizeof(double); //n2b_coeff - } - if (pot_3b) { - for (int j = 1; j < num_of_elements + 1; j++) { - for (int k = j; k < num_of_elements + 1; k++) { - bytes += (double) 2 * uf3_impl->n3b_knot_matrix[i][j][k][0].size() * sizeof(double); - bytes += (double) 2 * uf3_impl->n3b_knot_matrix[i][j][k][1].size() * sizeof(double); - bytes += (double) 2 * uf3_impl->n3b_knot_matrix[i][j][k][2].size() * sizeof(double); - std::string key = std::to_string(i) + std::to_string(j) + std::to_string(k); - - for (int l = 0; l < uf3_impl->n3b_coeff_matrix[key].size(); l++) { - for (int m = 0; m < uf3_impl->n3b_coeff_matrix[key][l].size(); m++) { - bytes += (double) 2 * uf3_impl->n3b_coeff_matrix[key][l][m].size() * sizeof(double); - //key = ijk - //key = ikj - } - } - } - } - } - }*/ - - /*for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = i; j < num_of_elements + 1; j++) { - bytes += (double) 2 * uf3_impl->UFBS2b[i][j].memory_usage(); //UFBS2b[i][j] UFBS2b[j][1] - } - if (pot_3b) { - for (int j = 1; j < num_of_elements + 1; j++) { - for (int k = j; k < num_of_elements + 1; k++) { - bytes += (double) 2 * uf3_impl->UFBS3b[i][j][k].memory_usage(); - } - } - } - }*/ - - bytes += (double) (maxshort + 1) * sizeof(int); //neighshort, maxshort + bytes += (double) maxshort * sizeof(int); //neighshort + bytes += (double) 6 * sizeof(int); //maxshort, bsplines_created, nbody_flag, + //max_num_knots_2b, max_num_coeff_2b, + //max_num_knots_3b, max_num_coeff_3b + bytes += (double) 1 * sizeof(bool); //pot_3b + return bytes; } - -//Accessor function called by pair_uf3_kokkos.cpp -//Will probably be removed once std::vector are converted to arrays -/*std::vector>>& PairUF3::get_n2b_knot() -{ - return uf3_impl->n2b_knot; -}*/ -/* -std::vector>>& PairUF3::get_n2b_coeff() -{ - return uf3_impl->n2b_coeff; -}*/ -//Accessor function called by pair_uf3_kokkos.cpp -//Will probably be removed once std::vector are converted to arrays -/* -std::vector>>>>& - PairUF3::get_n3b_knot_matrix() -{ - return uf3_impl->n3b_knot_matrix; -}*/ - -//Accessor function called by pair_uf3_kokkos.cpp -//Will probably be removed once std::vector are converted to arrays -/* -std::vector>>& - PairUF3::get_n3b_coeff_matrix_key(std::string key) -{ - return uf3_impl->n3b_coeff_matrix[key]; -} - -double PairUF3::get_knot_spacing_2b(int i, int j) -{ - return uf3_impl->UFBS2b[i][j].knot_spacing; -} - -double PairUF3::get_knot_spacing_3b_ij(int i, int j, int k) -{ - return uf3_impl->UFBS3b[i][j][k].knot_spacing_ij; -} -double PairUF3::get_knot_spacing_3b_ik(int i, int j, int k) -{ - return uf3_impl->UFBS3b[i][j][k].knot_spacing_ik; -} -double PairUF3::get_knot_spacing_3b_jk(int i, int j, int k) -{ - return uf3_impl->UFBS3b[i][j][k].knot_spacing_jk; -} -*/ From 3340dd5f5499d7bfda377a560de3eb26394718d5 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 19:03:25 -0400 Subject: [PATCH 57/65] Removed unused variables and reordered the code --- src/ML-UF3/pair_uf3.h | 73 ++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 46 deletions(-) diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index a300cbf838..6c1aeae42c 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -46,65 +46,46 @@ class PairUF3 : public Pair { double memory_usage() override; protected: - void uf3_read_pot_file(char *potf_name); - void uf3_read_pot_file(int i, int j, char *potf_name); - void uf3_read_pot_file(int i, int j, int k, char *potf_name); - void uf3_read_unified_pot_file(char *potf_name); - void communicate(); - int nbody_flag, n2body_pot_files, n3body_pot_files, tot_pot_files; - int bsplines_created; - bool pot_3b; int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; double **cut, ***cut_3b, **cut_3b_list, ****min_cut_3b; double **knot_spacing_2b, ****knot_spacing_3b; - virtual void allocate(); - void create_bsplines(); - void create_cached_constants_2b(); - void create_cached_constants_3b(); - //struct UF3Impl *uf3_impl; //PIMPLE (pointer-to-implementation) - //UF3Impl *get_UF3Impl(); - int get_starting_index_uniform_2b(int i, int j, double r); - int get_starting_index_uniform_3b(int i, int j, int k, double r, int knot_dim); - int get_starting_index_nonuniform_2b(int i, int j, double r); - int get_starting_index_nonuniform_3b(int i, int j, int k, double r, int knot_dim); - int (PairUF3::*get_starting_index_2b)(int i, int j, double r); - int (PairUF3::*get_starting_index_3b)(int i, int j, int k, double r, int knot_dim); - - int max_num_knots_2b = 0; - int max_num_coeff_2b = 0; - int max_num_knots_3b = 0; - int max_num_coeff_3b = 0; + double ***n2b_knots_array, ***n2b_coeff_array; int **n2b_knots_array_size, **n2b_coeff_array_size; double ****cached_constants_2b, ****cached_constants_2b_deri; - int ***map_3b, tot_interaction_count_3b; + int ***map_3b; double ***n3b_knots_array, ****n3b_coeff_array; int **n3b_knots_array_size, **n3b_coeff_array_size; double ****coeff_for_der_jk, ****coeff_for_der_ik,****coeff_for_der_ij; double ****cached_constants_3b, ****cached_constants_3b_deri; - - /*void uf3_read_2b_pot_block(int itype, int jtype, std::string iele, - std::string jele, - TextFileReader &txtfilereader); - - void uf3_read_3b_pot_block(int itype, int jtype, int ktype, - std::string iele, std::string jele, - std::string kele, - TextFileReader &txtfilereader);*/ - - //Accessor function called by pair_uf3_kokkos.cpp - //Will probably be removed once std::vector are converted to arrays - /*std::vector>>& get_n2b_knot(); - std::vector>>& get_n2b_coeff(); - std::vector>>>>& get_n3b_knot_matrix(); - std::vector>>& get_n3b_coeff_matrix_key(std::string key); - double get_knot_spacing_2b(int i, int j); - double get_knot_spacing_3b_ij(int i, int j, int k); - double get_knot_spacing_3b_ik(int i, int j, int k); - double get_knot_spacing_3b_jk(int i, int j, int k);*/ int *neighshort, maxshort; // short neighbor list array for 3body interaction + + void uf3_read_unified_pot_file(char *potf_name); + void communicate(); + int bsplines_created; + bool pot_3b; + virtual void allocate(); + void create_bsplines(); + void create_cached_constants_2b(); + void create_cached_constants_3b(); + + int get_starting_index_uniform_2b(int i, int j, double r); + int get_starting_index_uniform_3b(int i, int j, int k, double r, int knot_dim); + + int get_starting_index_nonuniform_2b(int i, int j, double r); + int get_starting_index_nonuniform_3b(int i, int j, int k, double r, int knot_dim); + + int (PairUF3::*get_starting_index_2b)(int i, int j, double r); + int (PairUF3::*get_starting_index_3b)(int i, int j, int k, double r, int knot_dim); + + int nbody_flag = 3; + int max_num_knots_2b = 0; + int max_num_coeff_2b = 0; + int max_num_knots_3b = 0; + int max_num_coeff_3b = 0; + int tot_interaction_count_3b = 0; }; } // namespace LAMMPS_NS From ab8e4b7676ae0db90425b396563404a4955a5688 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 19:28:27 -0400 Subject: [PATCH 58/65] Fixed trailing whitespace --- src/ML-UF3/pair_uf3.cpp | 18 +++++++++--------- src/ML-UF3/pair_uf3.h | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 1f306b5204..19bec2d811 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -1278,7 +1278,7 @@ void PairUF3::create_cached_constants_3b() for(int k = 1; k < num_of_elements + 1; k++) { int map_to = map_3b[i][j][k]; double **knots_for_der = nullptr;//new double*[3]; - + //n3b_knots_array_size[map_to][0] for jk knot vector --> always largest memory->create(knots_for_der, 3, n3b_knots_array_size[map_to][0]-1, "pair:knots_for_der"); @@ -1553,7 +1553,7 @@ void PairUF3::compute(int eflag, int vflag) double rij_th = rij*rij_sq; double rik_th = rik*rik_sq; double rjk_th = rjk*rjk_sq; - + int map_to = map_3b[itype][jtype][ktype]; int knot_start_index_ij = (this->*get_starting_index_3b)(itype,jtype,ktype,rij,2); int knot_start_index_ik = (this->*get_starting_index_3b)(itype,jtype,ktype,rik,1); @@ -1909,7 +1909,7 @@ double PairUF3::memory_usage() bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * 3 * sizeof(double); //min_cut_3b - + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //knot_spacing_2b bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (num_of_elements + 1) * sizeof(double); //knot_spacing_3b @@ -1919,13 +1919,13 @@ double PairUF3::memory_usage() bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_coeff_2b * sizeof(double); //n2b_coeff_array - + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(int); //n2b_knots_array_size bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * sizeof(int); //n2b_coeff_array_size - + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * max_num_coeff_2b * 16 * sizeof(double); //cached_constants_2b, - bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (max_num_coeff_2b-1) * + bytes += (double) (num_of_elements + 1) * (num_of_elements + 1) * (max_num_coeff_2b-1) * 9 * sizeof(double); //cached_constants_2b_deri @@ -1936,13 +1936,13 @@ double PairUF3::memory_usage() bytes += (double) tot_interaction_count_3b * 3 * max_num_knots_3b * sizeof(double); //n3b_knots_array bytes += (double) tot_interaction_count_3b * max_num_coeff_3b * max_num_coeff_3b * max_num_coeff_3b * sizeof(double); //n3b_coeff_array - + bytes += (double) tot_interaction_count_3b * 3 * sizeof(int); //n3b_knots_array_size bytes += (double) tot_interaction_count_3b * 3 * sizeof(int); //n3b_coeff_array_size bytes += (double) tot_interaction_count_3b * max_num_coeff_3b * max_num_coeff_3b * max_num_coeff_3b * 3 * sizeof(double); //coeff_for_der_jk coeff_for_der_ik coeff_for_der_ij - + bytes += (double) tot_interaction_count_3b * 3 * max_num_coeff_3b * 16 * sizeof(double); //cached_constants_3b bytes += (double) tot_interaction_count_3b * 3 * (max_num_coeff_3b - 1) * 16 @@ -1956,6 +1956,6 @@ double PairUF3::memory_usage() //max_num_knots_2b, max_num_coeff_2b, //max_num_knots_3b, max_num_coeff_3b bytes += (double) 1 * sizeof(bool); //pot_3b - + return bytes; } diff --git a/src/ML-UF3/pair_uf3.h b/src/ML-UF3/pair_uf3.h index 6c1aeae42c..9c6ec5022f 100644 --- a/src/ML-UF3/pair_uf3.h +++ b/src/ML-UF3/pair_uf3.h @@ -49,7 +49,7 @@ class PairUF3 : public Pair { int ***setflag_3b, **knot_spacing_type_2b, ***knot_spacing_type_3b; double **cut, ***cut_3b, **cut_3b_list, ****min_cut_3b; double **knot_spacing_2b, ****knot_spacing_3b; - + double ***n2b_knots_array, ***n2b_coeff_array; int **n2b_knots_array_size, **n2b_coeff_array_size; double ****cached_constants_2b, ****cached_constants_2b_deri; @@ -61,7 +61,7 @@ class PairUF3 : public Pair { double ****cached_constants_3b, ****cached_constants_3b_deri; int *neighshort, maxshort; // short neighbor list array for 3body interaction - + void uf3_read_unified_pot_file(char *potf_name); void communicate(); int bsplines_created; @@ -70,13 +70,13 @@ class PairUF3 : public Pair { void create_bsplines(); void create_cached_constants_2b(); void create_cached_constants_3b(); - + int get_starting_index_uniform_2b(int i, int j, double r); int get_starting_index_uniform_3b(int i, int j, int k, double r, int knot_dim); - + int get_starting_index_nonuniform_2b(int i, int j, double r); int get_starting_index_nonuniform_3b(int i, int j, int k, double r, int knot_dim); - + int (PairUF3::*get_starting_index_2b)(int i, int j, double r); int (PairUF3::*get_starting_index_3b)(int i, int j, int k, double r, int knot_dim); From 4a8ed1bc78996d6707faddaffae6dc4d5da8a574 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Thu, 2 May 2024 19:28:58 -0400 Subject: [PATCH 59/65] Removed dead code, fixed trailing whitespace --- src/KOKKOS/pair_uf3_kokkos.cpp | 190 +++++++-------------------------- 1 file changed, 38 insertions(+), 152 deletions(-) diff --git a/src/KOKKOS/pair_uf3_kokkos.cpp b/src/KOKKOS/pair_uf3_kokkos.cpp index d24ba44d9f..4a3bcc164b 100644 --- a/src/KOKKOS/pair_uf3_kokkos.cpp +++ b/src/KOKKOS/pair_uf3_kokkos.cpp @@ -113,32 +113,13 @@ template void PairUF3Kokkos::coeff(int narg, char PairUF3::coeff(narg,arg); //Also calls allocate internally //Grows arrays to the right dimensions --> setflag, cutsq, cut, knot_spacing_type_2b, - //n2b_knot, n2b_coeff, UFBS2b, n2b_knot[i], n2b_coeff[i], UFBS2b[i], setflag_3b, - //cut_3b, cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, - //UFBS3b, neighshort + //knot_spacing_2b, n2b_knots_array_size, n2b_coeff_array_size, setflag_3b, + //cut_3b, cut_3b_list, min_cut_3b, knot_spacing_type_3b, knot_spacing_3b, + //tot_interaction_count_3b, map_3b, n3b_knots_array_size, n3b_coeff_array_size, + //neighshort // //Also reads the pot_files_internally - -/* copy_2d(d_cutsq, cutsq, num_of_elements + 1, num_of_elements + 1); //copy cutsq from - //host to device memory - if (pot_3b) { - copy_3d(d_cut_3b, cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); - copy_2d(d_cut_3b_list, cut_3b_list, num_of_elements + 1, num_of_elements + 1); - } else { - //why are we allocating space to d_cut_3b, d_cut_3b_list if the pot is 2-body only? - Kokkos::realloc(d_cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); - Kokkos::realloc(d_cut_3b_list, num_of_elements + 1, num_of_elements + 1); - } - //No allocation for device equivalent of --> setflag, cut, knot_spacing_type_2b, - //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, - //cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, - //neighshort - - //UFBS2b and UFBS3b are array of objects. Bad idea to use kokkos view(array) - //for it - create_2b_coefficients(); - if (pot_3b) create_3b_coefficients();*/ } template @@ -214,21 +195,10 @@ template void PairUF3Kokkos::create_coefficients( const int num_of_elements = atom->ntypes; coefficients_created = 1; - /*for (int i = 1; i < num_of_elements + 1; i++) { - for (int j = 1; j < num_of_elements + 1; j++) { - //Check for knot_spacing type - //Currently only uniform is supported - if (UFBS2b[i][j].knot_spacing_type != 0) - error->all(FLERR,"UF3Kokkos: Currently only uniform knot-spacing is suupoted"); - } - }*/ - if (pot_3b) { for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { for (int k = 1; k < num_of_elements + 1; k++) { - /*if (UFBS3b[i][j][k].knot_spacing_type != 0) - error->all(FLERR,"UF3Kokkos: Currently only uniform knot-spacing is suupoted");*/ k_cut_3b.h_view(i,j,k) = cut_3b[i][j][k]; // Notice the order of min_cut_3b[i][j][k] @@ -240,24 +210,14 @@ template void PairUF3Kokkos::create_coefficients( k_min_cut_3b.h_view(i,j,k,0) = min_cut_3b[i][j][k][0]; k_min_cut_3b.h_view(i,j,k,1) = min_cut_3b[i][j][k][1]; k_min_cut_3b.h_view(i,j,k,2) = min_cut_3b[i][j][k][2]; - //k_cut_3b.h_view(i,k,j) = cut_3b[i][k][j]; } } } k_cut_3b.template modify(); k_min_cut_3b.template modify(); } - //copy_2d(d_cutsq, cutsq, num_of_elements + 1, num_of_elements + 1); //copy cutsq from - //host to device memory - /*if (pot_3b) { - copy_3d(d_cut_3b, cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); - copy_2d(d_cut_3b_list, cut_3b_list, num_of_elements + 1, num_of_elements + 1); - } else { - //why are we allocating space to d_cut_3b, d_cut_3b_list if the pot is 2-body only? - Kokkos::realloc(d_cut_3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); - Kokkos::realloc(d_cut_3b_list, num_of_elements + 1, num_of_elements + 1); - }*/ - //No allocation for device equivalent of --> setflag, cut, knot_spacing_type_2b, + + //No allocation on device for --> setflag, cut, knot_spacing_type_2b, //n2b_knot, n2b_coeff, n2b_knot[i], n2b_coeff[i], setflag_3b, cut_3b, //cut_3b_list, min_cut_3b, knot_spacing_type_3b, cut_3b_list, n3b_knot_matrix, //neighshort @@ -272,8 +232,6 @@ template void PairUF3Kokkos::create_coefficients( template void PairUF3Kokkos::create_2b_coefficients() { const int num_of_elements = atom->ntypes; - //std::vector>>& n2b_knot = get_n2b_knot(); - //std::vector>>& n2b_coeff = get_n2b_coeff(); // Setup interaction pair map //TODO: Instead of using map2b and map3b use simple indexing @@ -292,8 +250,6 @@ template void PairUF3Kokkos::create_2b_coefficien // Count max knots for array size int max_knots = max_num_knots_2b; - /*for (int i = 1; i < n2b_knot.size(); i++) - for (int j = i; j < n2b_knot[i].size(); j++) max_knots = max(max_knots, n2b_knot[i][j].size());*/ // Copy coefficients to view @@ -303,7 +259,6 @@ template void PairUF3Kokkos::create_2b_coefficien for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { for (int k = 0; k < max_num_coeff_2b; k++) { - //n2b_coeff[i][j].size(); k++) { d_coefficients_2b_view(map2b_view(i, j), k) = n2b_coeff_array[i][j][k]; } } @@ -320,10 +275,9 @@ template void PairUF3Kokkos::create_2b_coefficien for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { for (int k = 0; k < max_num_knots_2b; k++) { - //n2b_knot[i][j].size(); k++) { d_n2b_knot_view(map2b_view(i, j), k) = n2b_knots_array[i][j][k]; } - d_n2b_knot_spacings_view(map2b_view(i, j)) = n2b_knots_array[i][j][4] - n2b_knots_array[i][j][3];//get_knot_spacing_2b(i,j); + d_n2b_knot_spacings_view(map2b_view(i, j)) = n2b_knots_array[i][j][4] - n2b_knots_array[i][j][3]; } } @@ -353,7 +307,6 @@ template void PairUF3Kokkos::create_2b_coefficien for (int i = 1; i < num_of_elements + 1; i++) { for (int j = i; j < num_of_elements + 1; j++) { for (int l = 0; l < n2b_knots_array_size[i][j] - 5; l++) { - //n2b_knot[i][j].size() - 5; l++) { double dntemp4 = 3 / (n2b_knots_array[i][j][l + 4] - n2b_knots_array[i][j][l + 1]); double coeff = (n2b_coeff_array[i][j][l + 1] - n2b_coeff_array[i][j][l]) * dntemp4; auto c = get_dnconstants(&n2b_knots_array[i][j][l + 1], coeff); @@ -369,10 +322,6 @@ template void PairUF3Kokkos::create_2b_coefficien template void PairUF3Kokkos::create_3b_coefficients() { const int num_of_elements = atom->ntypes; - //std::vector>>>>& n3b_knot_matrix = - // get_n3b_knot_matrix(); - //std::unordered_map>>>& - // n3b_coeff_matrix = get_n3b_coeff_matrix(); // Init interaction map for 3B Kokkos::realloc(map3b, num_of_elements + 1, num_of_elements + 1, num_of_elements + 1); @@ -384,7 +333,6 @@ template void PairUF3Kokkos::create_3b_coefficien for (int k = 1; k < num_of_elements + 1; k++) { map3b_view(i, j, k) = interaction_count; interaction_count++; - // map3b_view(i, k, j) = interaction_count++; } } } @@ -399,14 +347,6 @@ template void PairUF3Kokkos::create_3b_coefficien //n3b_knot_matrix[i][j][k][2] is the knot_vector along ij, //see pair_uf3.cpp for more details - /*for (int i = 1; i < n3b_knot_matrix.size(); i++) - for (int j = 1; j < n3b_knot_matrix[i].size(); j++) - for (int k = 1; k < n3b_knot_matrix[i][j].size(); k++) - max_knots = - max(max_knots, - max(n3b_knot_matrix[i][j][k][0].size(), - max(n3b_knot_matrix[i][j][k][1].size(), - n3b_knot_matrix[i][j][k][2].size())));*/ // Init knot matrix view @@ -415,28 +355,27 @@ template void PairUF3Kokkos::create_3b_coefficien auto d_n3b_knot_matrix_view = Kokkos::create_mirror(d_n3b_knot_matrix); auto d_n3b_knot_matrix_spacings_view = Kokkos::create_mirror(d_n3b_knot_matrix_spacings); - for (int i = 1; i < num_of_elements + 1; i++)//n3b_knot_matrix.size(); i++) - for (int j = 1; j < num_of_elements + 1; j++)//n3b_knot_matrix[i].size(); j++) - for (int k = 1; k < num_of_elements + 1; k++){//n3b_knot_matrix[i][j].size(); k++) { - for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][0]; m++)//n3b_knot_matrix[i][j][k][0].size(); m++) + for (int i = 1; i < num_of_elements + 1; i++) + for (int j = 1; j < num_of_elements + 1; j++) + for (int k = 1; k < num_of_elements + 1; k++) { + for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][0]; m++) d_n3b_knot_matrix_view(map3b_view(i, j, k), 0, m) = - n3b_knots_array[map_3b[i][j][k]][0][m];//n3b_knot_matrix[i][j][k][0][m]; - for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][1]; m++)//n3b_knot_matrix[i][j][k][1].size(); m++) + n3b_knots_array[map_3b[i][j][k]][0][m]; + for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][1]; m++) d_n3b_knot_matrix_view(map3b_view(i, j, k), 1, m) = - n3b_knots_array[map_3b[i][j][k]][1][m];//n3b_knot_matrix[i][j][k][1][m]; - for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][2]; m++)//n3b_knot_matrix[i][j][k][2].size(); m++) + n3b_knots_array[map_3b[i][j][k]][1][m]; + for (int m = 0; m < n3b_knots_array_size[map_3b[i][j][k]][2]; m++) d_n3b_knot_matrix_view(map3b_view(i, j, k), 2, m) = - n3b_knots_array[map_3b[i][j][k]][2][m];//n3b_knot_matrix[i][j][k][2][m]; + n3b_knots_array[map_3b[i][j][k]][2][m]; d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),2) = - n3b_knots_array[map_3b[i][j][k]][2][4] - n3b_knots_array[map_3b[i][j][k]][2][3];//get_knot_spacing_3b_ij(i,j,k); - //uf3_impl->UFBS3b[i][j][k].knot_spacing_ij; + n3b_knots_array[map_3b[i][j][k]][2][4] - n3b_knots_array[map_3b[i][j][k]][2][3]; + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),1) = - n3b_knots_array[map_3b[i][j][k]][1][4] - n3b_knots_array[map_3b[i][j][k]][1][3];//get_knot_spacing_3b_ik(i,j,k); - //uf3_impl->UFBS3b[i][j][k].knot_spacing_ik; + n3b_knots_array[map_3b[i][j][k]][1][4] - n3b_knots_array[map_3b[i][j][k]][1][3]; + d_n3b_knot_matrix_spacings_view(map3b_view(i, j, k),0) = - n3b_knots_array[map_3b[i][j][k]][0][4] - n3b_knots_array[map_3b[i][j][k]][0][3];//get_knot_spacing_3b_jk(i,j,k); - //uf3_impl->UFBS3b[i][j][k].knot_spacing_jk; + n3b_knots_array[map_3b[i][j][k]][0][4] - n3b_knots_array[map_3b[i][j][k]][0][3]; } Kokkos::deep_copy(d_n3b_knot_matrix, d_n3b_knot_matrix_view); Kokkos::deep_copy(d_n3b_knot_matrix_spacings, d_n3b_knot_matrix_spacings_view); @@ -451,13 +390,12 @@ template void PairUF3Kokkos::create_3b_coefficien for (int k = 1; k < num_of_elements + 1; k++) { d_n3b_knot_spacings_view(map3b_view(i, j, k), 0) = 1 / (n3b_knots_array[map_3b[i][j][k]][0][5] - n3b_knots_array[map_3b[i][j][k]][0][4]); - //(n3b_knot_matrix[i][j][k][0][5] - n3b_knot_matrix[i][j][k][0][4]); + d_n3b_knot_spacings_view(map3b_view(i, j, k), 1) = 1 / (n3b_knots_array[map_3b[i][j][k]][1][5] - n3b_knots_array[map_3b[i][j][k]][1][4]); - //(n3b_knot_matrix[i][j][k][1][5] - n3b_knot_matrix[i][j][k][1][4]); + d_n3b_knot_spacings_view(map3b_view(i, j, k), 2) = 1 / (n3b_knots_array[map_3b[i][j][k]][2][5] - n3b_knots_array[map_3b[i][j][k]][2][4]); - //(n3b_knot_matrix[i][j][k][2][5] - n3b_knot_matrix[i][j][k][2][4]); } } } @@ -472,14 +410,11 @@ template void PairUF3Kokkos::create_3b_coefficien for (int n = 1; n < num_of_elements + 1; n++) { for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { - //std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); - //std::vector>> n3b_coeff_matrix_key = - // get_n3b_coeff_matrix_key(key); - for (int i = 0; i < n3b_coeff_array_size[map_3b[n][m][o]][0]; i++) {//n3b_coeff_matrix_key.size(); i++) { - for (int j = 0; j < n3b_coeff_array_size[map_3b[n][m][o]][1]; j++) {//n3b_coeff_matrix_key[i].size(); j++) { - for (int k = 0; k < n3b_coeff_array_size[map_3b[n][m][o]][2]; k++) {//n3b_coeff_matrix_key[i][j].size() - 1; k++) { + for (int i = 0; i < n3b_coeff_array_size[map_3b[n][m][o]][0]; i++) { + for (int j = 0; j < n3b_coeff_array_size[map_3b[n][m][o]][1]; j++) { + for (int k = 0; k < n3b_coeff_array_size[map_3b[n][m][o]][2]; k++) { d_coefficients_3b_view(map3b_view(n, m, o), i, j, k) = - n3b_coeff_array[map_3b[n][m][o]][i][j][k];//n3b_coeff_matrix_key[i][j][k]; + n3b_coeff_array[map_3b[n][m][o]][i][j][k]; } } } @@ -510,49 +445,42 @@ template void PairUF3Kokkos::create_3b_coefficien for (int n = 1; n < num_of_elements + 1; n++) { for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { - //std::string key = std::to_string(n) + std::to_string(m) + std::to_string(o); - //std::vector>> n3b_coeff_matrix_key = - // get_n3b_coeff_matrix_key(key); int coeff_dim1 = n3b_coeff_array_size[map_3b[n][m][o]][0]; int coeff_dim2 = n3b_coeff_array_size[map_3b[n][m][o]][1]; int coeff_dim3 = n3b_coeff_array_size[map_3b[n][m][o]][2]; - for (int i = 0; i < coeff_dim1; i++) {//n3b_coeff_matrix_key.size(); i++) { - for (int j = 0; j < coeff_dim2; j++) {//n3b_coeff_matrix_key[i].size(); j++) { - for (int k = 0; k < coeff_dim3; k++) {//n3b_coeff_matrix_key[i][j].size() - 1; k++) { + for (int i = 0; i < coeff_dim1; i++) { + for (int j = 0; j < coeff_dim2; j++) { + for (int k = 0; k < coeff_dim3; k++) { F_FLOAT dntemp4 = 3 / (n3b_knots_array[map_3b[n][m][o]][0][k + 4] - n3b_knots_array[map_3b[n][m][o]][0][k + 1]); - //(n3b_knot_matrix[n][m][o][0][k + 4] - n3b_knot_matrix[n][m][o][0][k + 1]); + d_dncoefficients_3b_view(map3b_view(n, m, o), 2, i, j, k) = (n3b_coeff_array[map_3b[n][m][o]][i][j][k + 1] - n3b_coeff_array[map_3b[n][m][o]][i][j][k]) * dntemp4; - //(n3b_coeff_matrix_key[i][j][k + 1] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } - for (int i = 0; i < coeff_dim1; i++) {//n3b_coeff_matrix_key.size(); i++) { + for (int i = 0; i < coeff_dim1; i++) { std::vector> dncoeff_vect2; - for (int j = 0; j < coeff_dim2; j++) {//n3b_coeff_matrix_key[i].size() - 1; j++) { + for (int j = 0; j < coeff_dim2; j++) { F_FLOAT dntemp4 = 3 / (n3b_knots_array[map_3b[n][m][o]][1][j + 4] - n3b_knots_array[map_3b[n][m][o]][1][j + 1]); - //(n3b_knot_matrix[n][m][o][1][j + 4] - n3b_knot_matrix[n][m][o][1][j + 1]); + std::vector dncoeff_vect; - for (int k = 0; k < coeff_dim3; k++) {//n3b_coeff_matrix_key[i][j].size(); k++) { + for (int k = 0; k < coeff_dim3; k++) { d_dncoefficients_3b_view(map3b_view(n, m, o), 1, i, j, k) = (n3b_coeff_array[map_3b[n][m][o]][i][j + 1][k] - n3b_coeff_array[map_3b[n][m][o]][i][j][k]) * dntemp4; - //(n3b_coeff_matrix_key[i][j + 1][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } - for (int i = 0; i < coeff_dim1; i++) {//n3b_coeff_matrix_key.size() - 1; i++) { + for (int i = 0; i < coeff_dim1; i++) { F_FLOAT dntemp4 = 3 / (n3b_knots_array[map_3b[n][m][o]][2][i + 4] - n3b_knots_array[map_3b[n][m][o]][2][i + 1]); - //(n3b_knot_matrix[n][m][o][2][i + 4] - n3b_knot_matrix[n][m][o][2][i + 1]); - for (int j = 0; j < coeff_dim2; j++) {//n3b_coeff_matrix_key[i].size(); j++) { - for (int k = 0; k < coeff_dim3; k++) {//n3b_coeff_matrix_key[i][j].size(); k++) { + for (int j = 0; j < coeff_dim2; j++) { + for (int k = 0; k < coeff_dim3; k++) { d_dncoefficients_3b_view(map3b_view(n, m, o), 0, i, j, k) = (n3b_coeff_array[map_3b[n][m][o]][i + 1][j][k] - n3b_coeff_array[map_3b[n][m][o]][i][j][k]) * dntemp4; - //(n3b_coeff_matrix_key[i + 1][j][k] - n3b_coeff_matrix_key[i][j][k]) * dntemp4; } } } @@ -575,25 +503,19 @@ template void PairUF3Kokkos::create_3b_coefficien for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { for (int l = 0; l < n3b_knots_array_size[map_3b[n][m][o]][2] - 4; l++) { - //n3b_knot_matrix[n][m][o][2].size() - 4; l++) { auto c = get_constants(&n3b_knots_array[map_3b[n][m][o]][2][l], 1); - //auto c = get_constants(&n3b_knot_matrix[n][m][o][2][l], 1); for (int k = 0; k < 16; k++) constants_3b_view(map3b_view(n, m, o), 0, l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } for (int l = 0; l < n3b_knots_array_size[map_3b[n][m][o]][1] - 4; l++) { - //n3b_knot_matrix[n][m][o][1].size() - 4; l++) { auto c = get_constants(&n3b_knots_array[map_3b[n][m][o]][1][l], 1); - //auto c = get_constants(&n3b_knot_matrix[n][m][o][1][l], 1); for (int k = 0; k < 16; k++) constants_3b_view(map3b_view(n, m, o), 1, l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } for (int l = 0; l < n3b_knots_array_size[map_3b[n][m][o]][0] -4; l++) { - //n3b_knot_matrix[n][m][o][0].size() - 4; l++) { auto c = get_constants(&n3b_knots_array[map_3b[n][m][o]][0][l], 1); - //auto c = get_constants(&n3b_knot_matrix[n][m][o][0][l], 1); for (int k = 0; k < 16; k++) constants_3b_view(map3b_view(n, m, o), 2, l, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; @@ -610,25 +532,19 @@ template void PairUF3Kokkos::create_3b_coefficien for (int m = 1; m < num_of_elements + 1; m++) { for (int o = 1; o < num_of_elements + 1; o++) { for (int l = 1; l < n3b_knots_array_size[map_3b[n][m][o]][2] - 5; l++) { - //n3b_knot_matrix[n][m][o][2].size() - 5; l++) { auto c = get_dnconstants(&n3b_knots_array[map_3b[n][m][o]][2][l], 1); - //auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][2][l], 1); for (int k = 0; k < 9; k++) dnconstants_3b_view(map3b_view(n, m, o), 0, l - 1, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } for (int l = 1; l < n3b_knots_array_size[map_3b[n][m][o]][1] - 5; l++) { - //n3b_knot_matrix[n][m][o][1].size() - 5; l++) { auto c = get_dnconstants(&n3b_knots_array[map_3b[n][m][o]][1][l], 1); - //auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][1][l], 1); for (int k = 0; k < 9; k++) dnconstants_3b_view(map3b_view(n, m, o), 1, l - 1, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; } for (int l = 1; l < n3b_knots_array_size[map_3b[n][m][o]][0] - 5; l++) { - //n3b_knot_matrix[n][m][o][0].size() - 5; l++) { auto c = get_dnconstants(&n3b_knots_array[map_3b[n][m][o]][0][l], 1); - //auto c = get_dnconstants(&n3b_knot_matrix[n][m][o][0][l], 1); for (int k = 0; k < 9; k++) dnconstants_3b_view(map3b_view(n, m, o), 2, l - 1, k) = (std::isinf(c[k]) || std::isnan(c[k])) ? 0 : c[k]; @@ -804,36 +720,6 @@ KOKKOS_INLINE_FUNCTION void PairUF3Kokkos::threebody( } } -/* ---------------------------------------------------------------------- - init specific to this pair style -------------------------------------------------------------------------- */ - -/*template void PairUF3Kokkos::init_style() -{ - - PairUF3::init_style(); - - neighflag = lmp->kokkos->neighflag; - - auto request = neighbor->find_request(this); - request->set_kokkos_host(std::is_same::value && - !std::is_same::value); - request->set_kokkos_device(std::is_same::value); - - request->enable_full(); - // request->enable_ghost(); -}*/ - -/* ---------------------------------------------------------------------- - init list sets the pointer to full neighbour list requested in previous function -------------------------------------------------------------------------- */ - -//template -//void PairUF3Kokkos::init_list(int /*id*/, class NeighList *ptr) -//{ -// list = ptr; -//} - template void PairUF3Kokkos::compute(int eflag_in, int vflag_in) { eflag = eflag_in; From a7f4fc18154190bbbe8287b43d64fd37805db645 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Fri, 3 May 2024 12:58:59 -0400 Subject: [PATCH 60/65] Fixed bug with uniform knot spacing --- src/ML-UF3/pair_uf3.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 19bec2d811..ed4901b536 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -1024,7 +1024,7 @@ void PairUF3::communicate() (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); MPI_Bcast(&knot_spacing_2b[0][0], - (num_of_elements + 1)*(num_of_elements + 1), MPI_INT, 0, world); + (num_of_elements + 1)*(num_of_elements + 1), MPI_DOUBLE, 0, world); MPI_Bcast(&n2b_knots_array[0][0][0], (num_of_elements + 1)*(num_of_elements + 1)*max_num_knots_2b, MPI_DOUBLE, 0, world); @@ -1041,7 +1041,7 @@ void PairUF3::communicate() MPI_Bcast(&knot_spacing_3b[0][0][0][0], (num_of_elements + 1)*(num_of_elements + 1)*(num_of_elements + 1)*3, - MPI_INT, 0, world); + MPI_DOUBLE, 0, world); MPI_Bcast(&n3b_knots_array[0][0][0], tot_interaction_count_3b*3*max_num_knots_3b, MPI_DOUBLE, 0, world); MPI_Bcast(&n3b_coeff_array[0][0][0][0], @@ -1131,16 +1131,16 @@ void PairUF3::create_bsplines() } - //if (spacing_type) { - get_starting_index_2b = &PairUF3::get_starting_index_nonuniform_2b; - if (pot_3b) - get_starting_index_3b = &PairUF3::get_starting_index_nonuniform_3b; - //} - /*else { + if (spacing_type) { + get_starting_index_2b = &PairUF3::get_starting_index_nonuniform_2b; + if (pot_3b) + get_starting_index_3b = &PairUF3::get_starting_index_nonuniform_3b; + } + else { get_starting_index_2b = &PairUF3::get_starting_index_uniform_2b; if (pot_3b) get_starting_index_3b = &PairUF3::get_starting_index_uniform_3b; - }*/ + } create_cached_constants_2b(); if (pot_3b) From 1cfbc04586fa5e47c30bdc10b6b62c00ddd7c22f Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Fri, 3 May 2024 18:28:33 -0400 Subject: [PATCH 61/65] Initialize setflag, n2b_coeff_array_size, n2b_knots_array_size, n3b_coeff_array_size, n3b_knots_array_size arrays to 0; fixed memory leaks; removed some dead code --- src/ML-UF3/pair_uf3.cpp | 83 ++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index ed4901b536..8ba7e45595 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -205,6 +205,10 @@ void PairUF3::allocate() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { cut_3b_list[i][j] = 0; + setflag[i][j] = 0; + n2b_coeff_array_size[i][j] = 0; + n2b_knots_array_size[i][j] = 0; + for (int k = 1; k < num_of_elements + 1; k++) { cut_3b[i][j][k] = 0; min_cut_3b[i][j][k][0] = 0; @@ -224,6 +228,15 @@ void PairUF3::allocate() "pair:n3b_knots_array_size"); memory->create(n3b_coeff_array_size, tot_interaction_count_3b, 3, "pair:n3b_coeff_array_size"); + for (int i = 0; i < tot_interaction_count_3b; i++) { + n3b_coeff_array_size[i][0] = 0; + n3b_coeff_array_size[i][1] = 0; + n3b_coeff_array_size[i][2] = 0; + + n3b_knots_array_size[i][0] = 0; + n3b_knots_array_size[i][1] = 0; + n3b_knots_array_size[i][2] = 0; + } memory->create(neighshort, maxshort, "pair:neighshort"); @@ -344,6 +357,10 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) ValueTokenizer fp5th_line(temp_line); int num_coeff_2b = fp5th_line.next_int(); + if (num_coeff_2b <= 0) + error->all(FLERR, + "UF3: 0 or negative number found for num_coeff_2b" + " on line {} of the potential file",line_counter); n2b_coeff_array_size[itype][jtype] = num_coeff_2b; n2b_coeff_array_size[jtype][itype] = num_coeff_2b; max_num_coeff_2b = std::max(max_num_coeff_2b, num_coeff_2b); @@ -497,45 +514,44 @@ void PairUF3::uf3_read_unified_pot_file(char *potf_name) } // while //Create knot and coeff arrays - if (max_num_knots_2b > 0) { - memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, - max_num_knots_2b, "pair:n2b_knots_array"); - } - else + if (max_num_knots_2b <= 0) error->all(FLERR, "UF3: Error reading the size of 2B knot vector\n" "Possibly no 2B UF3 potential block detected in {} file", potf_name); + memory->destroy(n2b_knots_array); + memory->create(n2b_knots_array, num_of_elements + 1, num_of_elements + 1, + max_num_knots_2b, "pair:n2b_knots_array"); - if (max_num_coeff_2b > 0) { - memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, - max_num_coeff_2b, "pair:n2b_coeff_array"); - } - else + if (max_num_coeff_2b <= 0) error->all(FLERR, "UF3: Error reading the size of 2B coeff vector\n" "Possibly no 2B UF3 potential block detected in {} file", potf_name); - if (pot_3b) { - if (max_num_knots_3b > 0) - memory->create(n3b_knots_array, tot_interaction_count_3b, 3, - max_num_knots_3b, "pair:n3b_knots_array"); + memory->destroy(n2b_coeff_array); + memory->create(n2b_coeff_array, num_of_elements + 1, num_of_elements + 1, + max_num_coeff_2b, "pair:n2b_coeff_array"); - else + + if (pot_3b) { + if (max_num_knots_3b <= 0) error->all(FLERR, "UF3: Error reading the size of 3B knot vector\n" "Possibly no 3B UF3 potential block detected in {} file", potf_name); + memory->destroy(n3b_knots_array); + memory->create(n3b_knots_array, tot_interaction_count_3b, 3, + max_num_knots_3b, "pair:n3b_knots_array"); - if (max_num_coeff_3b > 0) - memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, - max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); - else + if (max_num_coeff_3b <= 0) error->all(FLERR, "UF3: Error reading the size of 3B coeff matrices\n" "Possibly no 3B UF3 potential block detected in {} file", potf_name); + memory->destroy(n3b_coeff_array); + memory->create(n3b_coeff_array, tot_interaction_count_3b, max_num_coeff_3b, + max_num_coeff_3b, max_num_coeff_3b, "pair:n3b_coeff_array"); } //Go back to the begning of the file @@ -1180,6 +1196,8 @@ int PairUF3::get_starting_index_nonuniform_3b(int i, int j, int k, double r, int void PairUF3::create_cached_constants_2b() { const int num_of_elements = atom->ntypes; + memory->destroy(cached_constants_2b); + memory->destroy(cached_constants_2b_deri); memory->create(cached_constants_2b, num_of_elements + 1, num_of_elements + 1, max_num_coeff_2b, 16, "pair:cached_constants_2b"); @@ -1202,13 +1220,17 @@ void PairUF3::create_cached_constants_2b() for (int i = 1; i < num_of_elements + 1; i++) { for (int j = 1; j < num_of_elements + 1; j++) { //initialize coeff and knots for derivative - double* knots_for_deri = new double[n2b_knots_array_size[i][j]-2]; + //double* knots_for_deri = new double[n2b_knots_array_size[i][j]-2]; + double *knots_for_deri = nullptr; + memory->create(knots_for_deri, n2b_knots_array_size[i][j]-2, "pair:knots_for_deri"); for (int l = 1; l < n2b_knots_array_size[i][j] - 1; l++) knots_for_deri[l-1] = n2b_knots_array[i][j][l]; - double* coeff_for_deri = new double[n2b_coeff_array_size[i][j]-1]; + //double* coeff_for_deri = new double[n2b_coeff_array_size[i][j]-1]; + double *coeff_for_deri = nullptr; + memory->create(coeff_for_deri, n2b_coeff_array_size[i][j]-1, "pair:coeff_for_deri"); for (int l = 0; l < n2b_coeff_array_size[i][j] - 1; l++) { double dntemp = 3 / (n2b_knots_array[i][j][l + 4] - n2b_knots_array[i][j][l + 1]); @@ -1223,8 +1245,10 @@ void PairUF3::create_cached_constants_2b() cached_constants_2b_deri[i][j][l][cc] = bspline_basis_deri.constants[cc]; } } - delete[] knots_for_deri; - delete[] coeff_for_deri; + memory->destroy(knots_for_deri); + memory->destroy(coeff_for_deri); + //delete[] knots_for_deri; + //delete[] coeff_for_deri; } } } @@ -1232,6 +1256,12 @@ void PairUF3::create_cached_constants_2b() void PairUF3::create_cached_constants_3b() { const int num_of_elements = atom->ntypes; + memory->destroy(coeff_for_der_jk); + memory->destroy(coeff_for_der_ik); + memory->destroy(coeff_for_der_ij); + memory->destroy(cached_constants_3b); + memory->destroy(cached_constants_3b_deri); + memory->create(coeff_for_der_jk, tot_interaction_count_3b, max_num_coeff_3b, max_num_coeff_3b, max_num_coeff_3b, "pair:coeff_for_der_jk"); @@ -1607,9 +1637,6 @@ void PairUF3::compute(int eflag, int vflag) basis_ik[3] += rik_sq*cached_constants_3b[map_to][1][knot_start_index_ik][2]; basis_ik[3] += rik_th*cached_constants_3b[map_to][1][knot_start_index_ik][3]; - //utils::logmesg(lmp,"UF3: basis_ik = {} {} {} {}\n",basis_ik[0],basis_ik[1], - // basis_ik[2],basis_ik[3]); - //--------------basis_jk basis_jk[0] = cached_constants_3b[map_to][2][knot_start_index_jk - 3][12]; basis_jk[0] += rjk*cached_constants_3b[map_to][2][knot_start_index_jk - 3][13]; @@ -1635,10 +1662,6 @@ void PairUF3::compute(int eflag, int vflag) basis_ij_der[0] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][6]; basis_ij_der[0] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][7]; basis_ij_der[0] += rij_sq*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][8]; - /*utils::logmesg(lmp,"UF3 cached_constants 2 = {} {} {}\n", - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][6], - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][7], - cached_constants_3b_deri[map_to][0][knot_start_index_ij - 3][8]);*/ basis_ij_der[1] = cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][3]; basis_ij_der[1] += rij*cached_constants_3b_deri[map_to][0][knot_start_index_ij - 2][4]; From fe24ddebcd70b89ca1ae7752c313351249fb3b16 Mon Sep 17 00:00:00 2001 From: Ajinkya Hire Date: Fri, 3 May 2024 18:31:12 -0400 Subject: [PATCH 62/65] Removed trailing whitespace --- src/ML-UF3/pair_uf3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ML-UF3/pair_uf3.cpp b/src/ML-UF3/pair_uf3.cpp index 8ba7e45595..1f41ddd336 100644 --- a/src/ML-UF3/pair_uf3.cpp +++ b/src/ML-UF3/pair_uf3.cpp @@ -232,7 +232,7 @@ void PairUF3::allocate() n3b_coeff_array_size[i][0] = 0; n3b_coeff_array_size[i][1] = 0; n3b_coeff_array_size[i][2] = 0; - + n3b_knots_array_size[i][0] = 0; n3b_knots_array_size[i][1] = 0; n3b_knots_array_size[i][2] = 0; From 4302d658113059d4222c9d8503c31de0b89aeb3c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 13 May 2024 20:19:50 -0400 Subject: [PATCH 63/65] fix spelling --- doc/src/pair_uf3.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_uf3.rst b/doc/src/pair_uf3.rst index d89fdb21bf..ce07e2206f 100644 --- a/doc/src/pair_uf3.rst +++ b/doc/src/pair_uf3.rst @@ -75,7 +75,7 @@ As an example, if a LAMMPS simulation contains 2 atom types (elements pair_style uf3 3 pair_coeff * * AB.uf3 A B -The AB.uf3 file should conatin all two-body (A-A, A-B, B-B) and three-body +The AB.uf3 file should contain all two-body (A-A, A-B, B-B) and three-body (A-A-A, A-A-B, A-B-B, B-A-A, B-A-B, B-B-B). If a value of "2" is specified in the :code:`pair_style uf3` command, From 17c099488af08e7b57e32438730b4326cdcaaa2b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 13 May 2024 20:20:03 -0400 Subject: [PATCH 64/65] remove unused variables --- src/replicate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/replicate.cpp b/src/replicate.cpp index e07c7d9a26..4773b731bc 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -45,7 +45,7 @@ Replicate::Replicate(LAMMPS *lmp) : Command(lmp) {} void Replicate::command(int narg, char **arg) { - int i,j,m,n; + int i,n; if (domain->box_exist == 0) error->all(FLERR,"Replicate command before simulation box is defined"); From 1f52d1769de6b64901778d1ed9a8fe2999beeae5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 13 May 2024 20:29:20 -0400 Subject: [PATCH 65/65] update ML-UF3 example --- examples/PACKAGES/uf3/Nb.uf3 | 1 + examples/PACKAGES/uf3/README.md | 4 - examples/PACKAGES/uf3/W_W.uf3 | 7 -- examples/PACKAGES/uf3/W_W_W.uf3 | 89 ------------- examples/PACKAGES/uf3/in.uf3.3b.W | 47 ------- .../PACKAGES/uf3/{in.uf3.2b.W => in.uf3.Nb} | 8 +- .../PACKAGES/uf3/log.13May24.Nb.uf3.g++.1 | 118 ++++++++++++++++++ .../PACKAGES/uf3/log.13May24.Nb.uf3.g++.4 | 118 ++++++++++++++++++ .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 | 117 ----------------- .../PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 | 117 ----------------- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 | 117 ----------------- .../PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 | 117 ----------------- 12 files changed, 241 insertions(+), 619 deletions(-) create mode 120000 examples/PACKAGES/uf3/Nb.uf3 delete mode 100644 examples/PACKAGES/uf3/README.md delete mode 100644 examples/PACKAGES/uf3/W_W.uf3 delete mode 100644 examples/PACKAGES/uf3/W_W_W.uf3 delete mode 100644 examples/PACKAGES/uf3/in.uf3.3b.W rename examples/PACKAGES/uf3/{in.uf3.2b.W => in.uf3.Nb} (88%) create mode 100644 examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.1 create mode 100644 examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.4 delete mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 delete mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 delete mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 delete mode 100644 examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 diff --git a/examples/PACKAGES/uf3/Nb.uf3 b/examples/PACKAGES/uf3/Nb.uf3 new file mode 120000 index 0000000000..cb0fdd480d --- /dev/null +++ b/examples/PACKAGES/uf3/Nb.uf3 @@ -0,0 +1 @@ +../../../potentials/Nb.uf3 \ No newline at end of file diff --git a/examples/PACKAGES/uf3/README.md b/examples/PACKAGES/uf3/README.md deleted file mode 100644 index cfbe0b6cc2..0000000000 --- a/examples/PACKAGES/uf3/README.md +++ /dev/null @@ -1,4 +0,0 @@ -This directory contains a variety of tests for the ML-UF3 package. These include: - -in.uf3.3b.W # UF3 2-body and 3-body potential -in.uf3.2b.W # UF3 2-body potential diff --git a/examples/PACKAGES/uf3/W_W.uf3 b/examples/PACKAGES/uf3/W_W.uf3 deleted file mode 100644 index 4197457323..0000000000 --- a/examples/PACKAGES/uf3/W_W.uf3 +++ /dev/null @@ -1,7 +0,0 @@ -#UF3 POT -2B 0 3 uk -5.5 22 -0.001 0.001 0.001 0.001 0.36759999999999998 0.73419999999999996 1.1007999999999998 1.4673999999999998 1.8339999999999999 2.2005999999999997 2.5671999999999997 2.9337999999999997 3.3003999999999998 3.6669999999999998 4.0335999999999999 4.4001999999999999 4.7667999999999999 5.1334 5.5 5.5 5.5 5.5 -18 -85.256465889606673 85.256465889606673 60.118514370108457 39.372994322346095 23.019905746319598 11.095292589050336 2.5770289203919474 -0.21591409154943711 -0.41582603147952274 -0.29361205978352245 -0.23467230507950282 -0.13083777191249607 -0.031024404500506326 -0.059144784016542738 -0.037145211195670137 0 0 0 -# diff --git a/examples/PACKAGES/uf3/W_W_W.uf3 b/examples/PACKAGES/uf3/W_W_W.uf3 deleted file mode 100644 index b0b9fd5542..0000000000 --- a/examples/PACKAGES/uf3/W_W_W.uf3 +++ /dev/null @@ -1,89 +0,0 @@ -#UF3 POT -3B 0 3 uk -7.0 3.5 3.5 19 13 13 -1.5 1.5 1.5 1.5 1.9583333333333333 2.4166666666666665 2.875 3.333333333333333 3.7916666666666665 4.25 4.708333333333333 5.1666666666666661 5.625 6.083333333333333 6.5416666666666661 7 7 7 7 -1.5 1.5 1.5 1.5 1.8333333333333333 2.1666666666666665 2.5 2.833333333333333 3.1666666666666665 3.5 3.5 3.5 3.5 -1.5 1.5 1.5 1.5 1.8333333333333333 2.1666666666666665 2.5 2.833333333333333 3.1666666666666665 3.5 3.5 3.5 3.5 -9 9 15 --1.0025267383014886e-06 1.627666892216261e-10 8.48457178601592e-09 1.0410120456668556e-08 1.1330088302187643e-06 1.4224457260740182e-05 3.749471162873949e-05 3.695233634472074e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.922778833696604e-05 -1.0222423928319826e-06 -4.8075020979943344e-05 -3.8518708184701e-05 -9.794643241404816e-06 -5.109554485113297e-07 -4.104591531909916e-10 5.419385825688335e-09 2.3261619203718816e-06 0.0 0.0 0.0 0.0 0.0 0.0 -2.829068261701631e-05 3.3565662462635585e-05 -4.4282774329572976e-05 5.3019338472701156e-05 1.656981200092865e-05 5.764723793849365e-06 8.90212763080714e-06 -1.266718085517006e-06 2.431925564724538e-06 -3.3416793274446366e-07 0.0 0.0 0.0 0.0 0.0 -9.661425891180097e-09 1.1180525909838732e-07 7.372128540386131e-06 9.39083445715028e-06 1.0838653682096786e-05 9.806075321172179e-05 7.23071321840456e-05 0.00011393368280907902 7.532201192649856e-05 1.4915718900782886e-05 0.0 0.0 0.0 0.0 0.0 -4.674109331563019e-07 -5.406616138544008e-09 2.0217516565542138e-08 5.815480232140697e-06 2.377543599749233e-05 4.214830983861595e-05 -7.397778428926203e-05 7.061700585974997e-05 3.398811616466058e-05 3.0440209444922143e-05 0.00013514584901612643 0.0 0.0 0.0 0.0 --2.18344999249825e-05 -0.00011697904895508256 -5.553581955175406e-06 2.658838454117769e-08 1.2146153008512734e-05 1.918298817375017e-05 5.40154814815751e-05 1.2944187401636162e-05 3.710536690671586e-05 1.6795050072301748e-05 -7.229556489685409e-06 8.543467581763247e-06 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.922778833696604e-05 -1.0222423928319826e-06 -4.8075020979943344e-05 -3.8518708184701e-05 -9.794643241404816e-06 -5.109554485113297e-07 -4.104591531909916e-10 5.419385825688335e-09 2.3261619203718816e-06 0.0 0.0 0.0 0.0 0.0 0.0 -4.7777593982974866e-05 2.1830415880551608e-05 -8.74161436707018e-06 7.718518436280754e-09 3.872620009304499e-06 2.2808275890118977e-05 4.9693195966817054e-05 -5.792733170014431e-06 4.574471594251372e-05 -2.840624725005251e-05 0.0 0.0 0.0 0.0 0.0 --2.983543176137801e-05 4.9033674735689904e-05 4.195810226183578e-05 0.00010403045298571696 0.0003809288520722337 3.373314734861335e-05 1.0875278462846613e-05 2.680082116524925e-05 2.6236988936225364e-05 3.6338704048890435e-06 0.0 0.0 0.0 0.0 0.0 -2.1399512390776296e-05 2.7931318963336216e-05 1.601611374550643e-05 0.0011462578563508437 0.0020096052304490785 0.0010339536769749804 0.001014125101157229 0.00021102390605096824 -9.581571365103867e-06 -2.280019726143644e-05 3.57351467975471e-07 0.0 0.0 0.0 0.0 -6.2467013661098965e-06 2.658299496065299e-05 0.0007087760404542255 -0.002278488280232273 -0.007044271575650293 0.0038614975616579586 0.009260853457130498 -0.0010473278276317726 -8.516349321648054e-05 0.00020262630262751473 1.3414729868362445e-06 7.953262907187799e-08 0.0 0.0 0.0 -2.3603382351924323e-06 7.146280072503116e-05 0.0012361202483760594 -0.005734465078354871 -0.017135562936976125 -0.0016664758722632735 0.010195949308015286 -0.005412690557758046 -0.0029107216230642853 -0.0007612908343076258 -0.00013449226099999524 2.1468761472671134e-05 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -2.829068261701631e-05 3.3565662462635585e-05 -4.4282774329572976e-05 5.3019338472701156e-05 1.656981200092865e-05 5.764723793849365e-06 8.90212763080714e-06 -1.266718085517006e-06 2.431925564724538e-06 -3.3416793274446366e-07 0.0 0.0 0.0 0.0 0.0 --2.983543176137801e-05 4.9033674735689904e-05 4.195810226183578e-05 0.00010403045298571696 0.0003809288520722337 3.373314734861335e-05 1.0875278462846613e-05 2.680082116524925e-05 2.6236988936225364e-05 3.6338704048890435e-06 0.0 0.0 0.0 0.0 0.0 -4.805582975622838e-05 3.5904852202535306e-05 0.0001861581391418004 0.011742061168666256 0.024776619721352023 0.009905830782079064 0.001165275555230131 0.0004071734306161239 0.00037033988296356686 4.258576293935207e-05 -1.0503156955159468e-06 0.0 0.0 0.0 0.0 --5.680777858210279e-07 7.084011901144194e-05 0.0050124193537796876 0.1029510036679177 0.24007141064120838 0.17886074568759117 0.03778564255583381 -0.01538608134214139 -0.01488601265585909 -0.005013137591006775 1.477967512985198e-07 2.827576677896298e-05 0.0 0.0 0.0 -3.4701391129480595e-05 0.005680635772167662 0.07108357438929552 0.18745843365735923 0.18473391598372302 0.2461411417071668 -0.005111666129467331 -0.24038059036230178 -0.19258370027930355 -0.048958604017684836 -0.0025501911244683846 -4.982008439539256e-06 0.0 0.0 0.0 -1.8054960278101902e-05 0.011611823828717463 0.14139350699353365 0.1678085431015684 -0.22152577092526715 0.26507903411379746 0.08279760718466518 0.02879361559120084 0.04448600527937973 -0.006339073225905362 0.012182164968354765 -0.0016647733469859114 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -9.661425891180097e-09 1.1180525909838732e-07 7.372128540386131e-06 9.39083445715028e-06 1.0838653682096786e-05 9.806075321172179e-05 7.23071321840456e-05 0.00011393368280907902 7.532201192649856e-05 1.4915718900782886e-05 0.0 0.0 0.0 0.0 0.0 -2.1399512390776296e-05 2.7931318963336216e-05 1.601611374550643e-05 0.0011462578563508437 0.0020096052304490785 0.0010339536769749804 0.001014125101157229 0.00021102390605096824 -9.581571365103867e-06 -2.280019726143644e-05 3.57351467975471e-07 0.0 0.0 0.0 0.0 --5.680777858210279e-07 7.084011901144194e-05 0.0050124193537796876 0.1029510036679177 0.24007141064120838 0.17886074568759117 0.03778564255583381 -0.01538608134214139 -0.01488601265585909 -0.005013137591006775 1.477967512985198e-07 2.827576677896298e-05 0.0 0.0 0.0 -3.224364873093737e-05 0.0005926077146340155 0.03682711928362166 0.046898795979650645 0.054125869772576704 0.49020499621758107 0.3614418794239106 0.569703720925391 0.37654073726442117 0.07453613145477757 0.002320760953344357 -4.1320810202123745e-05 0.0 0.0 0.0 -7.181321030642065e-05 0.029059269505937943 0.11884075783303522 0.21076878762972284 -0.36996025259611676 0.35312700844142586 0.16990097184555128 0.15210775765373416 0.6757140775652752 -0.10922320044264704 -0.5849697059462919 -0.027759887396949002 0.0 0.0 0.0 -9.734779590447442e-05 0.06072685888500135 0.09586373042400446 0.2700889438647233 0.06469057221256519 0.1854847883254132 0.08392153868089386 -0.03626027544891736 0.04232832520121794 0.23849583983886427 0.10911730115168922 -0.04380214407208333 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.674109331563019e-07 -5.406616138544008e-09 2.0217516565542138e-08 5.815480232140697e-06 2.377543599749233e-05 4.214830983861595e-05 -7.397778428926203e-05 7.061700585974997e-05 3.398811616466058e-05 3.0440209444922143e-05 0.00013514584901612643 0.0 0.0 0.0 0.0 -6.2467013661098965e-06 2.658299496065299e-05 0.0007087760404542255 -0.002278488280232273 -0.007044271575650293 0.0038614975616579586 0.009260853457130498 -0.0010473278276317726 -8.516349321648054e-05 0.00020262630262751473 1.3414729868362445e-06 7.953262907187799e-08 0.0 0.0 0.0 -3.4701391129480595e-05 0.005680635772167662 0.07108357438929552 0.18745843365735923 0.18473391598372302 0.2461411417071668 -0.005111666129467331 -0.24038059036230178 -0.19258370027930355 -0.048958604017684836 -0.0025501911244683846 -4.982008439539256e-06 0.0 0.0 0.0 -7.181321030642065e-05 0.029059269505937943 0.11884075783303522 0.21076878762972284 -0.36996025259611676 0.35312700844142586 0.16990097184555128 0.15210775765373416 0.6757140775652752 -0.10922320044264704 -0.5849697059462919 -0.027759887396949002 0.0 0.0 0.0 -3.8792902483003914e-05 0.01940944659869733 0.11401272918676479 0.24845559032094336 -0.029040137137018487 0.22760022061135138 -0.14408030764137164 -0.1502303415258775 0.24414290246285578 0.20048840049956973 -0.3098919852331769 0.38455675655513366 0.0 0.0 0.0 -0.0001449154156948679 0.05388868537335966 0.1340445791122114 0.1304729995514306 0.02041924003827766 0.11401975265164792 0.13440972558465583 -0.056806908474571434 0.03945347719095876 0.02504259931146615 0.04957547514580214 0.01854515348232565 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 --2.18344999249825e-05 -0.00011697904895508256 -5.553581955175406e-06 2.658838454117769e-08 1.2146153008512734e-05 1.918298817375017e-05 5.40154814815751e-05 1.2944187401636162e-05 3.710536690671586e-05 1.6795050072301748e-05 -7.229556489685409e-06 8.543467581763247e-06 0.0 0.0 0.0 -2.3603382351924323e-06 7.146280072503116e-05 0.0012361202483760594 -0.005734465078354871 -0.017135562936976125 -0.0016664758722632735 0.010195949308015286 -0.005412690557758046 -0.0029107216230642853 -0.0007612908343076258 -0.00013449226099999524 2.1468761472671134e-05 0.0 0.0 0.0 -1.8054960278101902e-05 0.011611823828717463 0.14139350699353365 0.1678085431015684 -0.22152577092526715 0.26507903411379746 0.08279760718466518 0.02879361559120084 0.04448600527937973 -0.006339073225905362 0.012182164968354765 -0.0016647733469859114 0.0 0.0 0.0 -9.734779590447442e-05 0.06072685888500135 0.09586373042400446 0.2700889438647233 0.06469057221256519 0.1854847883254132 0.08392153868089386 -0.03626027544891736 0.04232832520121794 0.23849583983886427 0.10911730115168922 -0.04380214407208333 0.0 0.0 0.0 -0.0001449154156948679 0.05388868537335966 0.1340445791122114 0.1304729995514306 0.02041924003827766 0.11401975265164792 0.13440972558465583 -0.056806908474571434 0.03945347719095876 0.02504259931146615 0.04957547514580214 0.01854515348232565 0.0 0.0 0.0 -5.588250079169304e-05 -0.012017079745903034 -0.0008295411205340048 0.00043274236043781584 0.036933605134660964 -0.017759680455812197 0.15248826375477179 -0.022974467887332546 0.005116007779072725 -0.01249692329646853 -0.12288470938617652 0.022731129576009593 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -# diff --git a/examples/PACKAGES/uf3/in.uf3.3b.W b/examples/PACKAGES/uf3/in.uf3.3b.W deleted file mode 100644 index 9ca29293b5..0000000000 --- a/examples/PACKAGES/uf3/in.uf3.3b.W +++ /dev/null @@ -1,47 +0,0 @@ -# Demonstrate UF3 W potential - -# # ============= Initialize simulation - -variable nsteps index 100 -variable nrep equal 4 -variable a equal 3.187 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable ny equal ${nrep} -variable nz equal ${nrep} - -boundary p p p - -lattice bcc $a -region box block 0 ${nx} 0 ${ny} 0 ${nz} -create_box 1 box -create_atoms 1 box - -mass 1 183.84 - -# # ============= set pair style - -pair_style uf3 3 -pair_coeff 1 1 W_W.uf3 -pair_coeff 3b 1 1 1 W_W_W.uf3 - - -# # ============= Setup output - -thermo 10 -thermo_modify norm yes - -# # ============= Set up NVE run - -timestep 0.5e-3 -neighbor 1.0 bin -neigh_modify once no every 1 delay 0 check yes - -# # ============= Run MD - -velocity all create 300.0 2367804 loop geom -fix 1 all nve -run ${nsteps} diff --git a/examples/PACKAGES/uf3/in.uf3.2b.W b/examples/PACKAGES/uf3/in.uf3.Nb similarity index 88% rename from examples/PACKAGES/uf3/in.uf3.2b.W rename to examples/PACKAGES/uf3/in.uf3.Nb index bff3529e9c..19b37ccc0b 100644 --- a/examples/PACKAGES/uf3/in.uf3.2b.W +++ b/examples/PACKAGES/uf3/in.uf3.Nb @@ -4,7 +4,7 @@ variable nsteps index 100 variable nrep equal 4 -variable a equal 3.187 +variable a equal 3.3005 units metal # generate the box and atom positions using a BCC lattice @@ -20,12 +20,12 @@ region box block 0 ${nx} 0 ${ny} 0 ${nz} create_box 1 box create_atoms 1 box -mass 1 183.84 +mass 1 92.906 # # ============= set pair style -pair_style uf3 2 -pair_coeff 1 1 W_W.uf3 +pair_style uf3 3 +pair_coeff * * Nb.uf3 Nb # # ============= Setup output diff --git a/examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.1 b/examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.1 new file mode 100644 index 0000000000..0c9c0bffa2 --- /dev/null +++ b/examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.1 @@ -0,0 +1,118 @@ +LAMMPS (17 Apr 2024 - Development - patch_17Apr2024-199-g49f20229ad-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.3005 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.3005 +Lattice spacing in x,y,z = 3.3005 3.3005 3.3005 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0 0 0) to (13.202 13.202 13.202) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 128 atoms + using lattice units in orthogonal box = (0 0 0) to (13.202 13.202 13.202) + create_atoms CPU = 0.000 seconds + +mass 1 92.906 + +# # ============= set pair style + +pair_style uf3 3 +pair_coeff * * Nb.uf3 Nb +Reading potential file Nb.uf3 with DATE: 2024-04-02 + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 9 + ghost atom cutoff = 9 + binsize = 4.5, bins = 3 3 3 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair uf3, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.376 | 3.376 | 3.376 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 300 -4.4256832 0 -4.3872081 90756.437 + 10 294.36659 -4.4249607 0 -4.3872081 91006.427 + 20 277.9021 -4.422849 0 -4.387208 91716.126 + 30 251.88303 -4.4195119 0 -4.3872078 92789.12 + 40 218.42803 -4.4152211 0 -4.3872076 94118.45 + 50 180.40641 -4.4103445 0 -4.3872073 95579.009 + 60 141.2326 -4.4053202 0 -4.3872071 97031.816 + 70 104.54429 -4.4006146 0 -4.3872068 98332.882 + 80 73.787889 -4.3966699 0 -4.3872066 99351.332 + 90 51.759956 -4.3938446 0 -4.3872064 99992.934 + 100 40.209821 -4.3923633 0 -4.3872064 100211.98 +Loop time of 0.385575 on 1 procs for 100 steps with 128 atoms + +Performance: 11.204 ns/day, 2.142 hours/ns, 259.353 timesteps/s, 33.197 katom-step/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.38403 | 0.38403 | 0.38403 | 0.0 | 99.60 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.00090609 | 0.00090609 | 0.00090609 | 0.0 | 0.23 +Output | 0.00017626 | 0.00017626 | 0.00017626 | 0.0 | 0.05 +Modify | 0.00018204 | 0.00018204 | 0.00018204 | 0.0 | 0.05 +Other | | 0.0002795 | | | 0.07 + +Nlocal: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1601 ave 1601 max 1601 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 21504 ave 21504 max 21504 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 21504 +Ave neighs/atom = 168 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.4 b/examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.4 new file mode 100644 index 0000000000..cd46d8da14 --- /dev/null +++ b/examples/PACKAGES/uf3/log.13May24.Nb.uf3.g++.4 @@ -0,0 +1,118 @@ +LAMMPS (17 Apr 2024 - Development - patch_17Apr2024-199-g49f20229ad-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Demonstrate UF3 W potential + +# # ============= Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.3005 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.3005 +Lattice spacing in x,y,z = 3.3005 3.3005 3.3005 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0 0 0) to (13.202 13.202 13.202) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 128 atoms + using lattice units in orthogonal box = (0 0 0) to (13.202 13.202 13.202) + create_atoms CPU = 0.001 seconds + +mass 1 92.906 + +# # ============= set pair style + +pair_style uf3 3 +pair_coeff * * Nb.uf3 Nb +Reading potential file Nb.uf3 with DATE: 2024-04-02 + + +# # ============= Setup output + +thermo 10 +thermo_modify norm yes + +# # ============= Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# # ============= Run MD + +velocity all create 300.0 2367804 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 9 + ghost atom cutoff = 9 + binsize = 4.5, bins = 3 3 3 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair uf3, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.351 | 3.351 | 3.351 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 300 -4.4256832 0 -4.3872081 90756.437 + 10 294.36659 -4.4249607 0 -4.3872081 91006.427 + 20 277.9021 -4.422849 0 -4.387208 91716.126 + 30 251.88303 -4.4195119 0 -4.3872078 92789.12 + 40 218.42803 -4.4152211 0 -4.3872076 94118.45 + 50 180.40641 -4.4103445 0 -4.3872073 95579.009 + 60 141.2326 -4.4053202 0 -4.3872071 97031.816 + 70 104.54429 -4.4006146 0 -4.3872068 98332.882 + 80 73.787889 -4.3966699 0 -4.3872066 99351.332 + 90 51.759956 -4.3938446 0 -4.3872064 99992.934 + 100 40.209821 -4.3923633 0 -4.3872064 100211.98 +Loop time of 0.11881 on 4 procs for 100 steps with 128 atoms + +Performance: 36.361 ns/day, 0.660 hours/ns, 841.679 timesteps/s, 107.735 katom-step/s +99.3% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.10673 | 0.10875 | 0.11236 | 0.7 | 91.53 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.0057324 | 0.0093477 | 0.011375 | 2.4 | 7.87 +Output | 0.00016629 | 0.00018236 | 0.00022483 | 0.0 | 0.15 +Modify | 9.4948e-05 | 0.00010621 | 0.00012066 | 0.0 | 0.09 +Other | | 0.0004263 | | | 0.36 + +Nlocal: 32 ave 32 max 32 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 1049 ave 1049 max 1049 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 5376 ave 5376 max 5376 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 21504 +Ave neighs/atom = 168 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 deleted file mode 100644 index 743e1a1e97..0000000000 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.1 +++ /dev/null @@ -1,117 +0,0 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) - using 1 OpenMP thread(s) per MPI task -# Demonstrate UF3 W potential - -# # ============= Initialize simulation - -variable nsteps index 100 -variable nrep equal 4 -variable a equal 3.187 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable nx equal 4 -variable ny equal ${nrep} -variable ny equal 4 -variable nz equal ${nrep} -variable nz equal 4 - -boundary p p p - -lattice bcc $a -lattice bcc 3.187 -Lattice spacing in x,y,z = 3.187 3.187 3.187 -region box block 0 ${nx} 0 ${ny} 0 ${nz} -region box block 0 4 0 ${ny} 0 ${nz} -region box block 0 4 0 4 0 ${nz} -region box block 0 4 0 4 0 4 -create_box 1 box -Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 128 atoms - using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) - create_atoms CPU = 0.000 seconds - -mass 1 183.84 - -# # ============= set pair style - -pair_style uf3 2 -pair_coeff 1 1 W_W.uf3 - - -# # ============= Setup output - -thermo 10 -thermo_modify norm yes - -# # ============= Set up NVE run - -timestep 0.5e-3 -neighbor 1.0 bin -neigh_modify once no every 1 delay 0 check yes - -# # ============= Run MD - -velocity all create 300.0 2367804 loop geom -fix 1 all nve -run ${nsteps} -run 100 -Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule -Neighbor list info ... - update: every = 1 steps, delay = 0 steps, check = yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.5 - ghost atom cutoff = 6.5 - binsize = 3.25, bins = 4 4 4 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair uf3, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.113 | 3.113 | 3.113 Mbytes - Step Temp E_pair E_mol TotEng Press - 0 300 -4.9097145 0 -4.8712394 -398022.13 - 10 297.43433 -4.9093854 0 -4.8712394 -397994.78 - 20 289.88359 -4.908417 0 -4.8712393 -397922.72 - 30 277.73497 -4.9068589 0 -4.8712393 -397829.84 - 40 261.57286 -4.904786 0 -4.8712392 -397731.28 - 50 242.14207 -4.902294 0 -4.8712392 -397640.01 - 60 220.31079 -4.899494 0 -4.8712391 -397572.33 - 70 197.03391 -4.8965087 0 -4.871239 -397551.93 - 80 173.31044 -4.893466 0 -4.8712389 -397601.62 - 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 - 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0333361 on 1 procs for 100 steps with 128 atoms - -Performance: 129.589 ns/day, 0.185 hours/ns, 2999.749 timesteps/s, 383.968 katom-step/s -99.5% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.032205 | 0.032205 | 0.032205 | 0.0 | 96.61 -Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00067389 | 0.00067389 | 0.00067389 | 0.0 | 2.02 -Output | 9.6021e-05 | 9.6021e-05 | 9.6021e-05 | 0.0 | 0.29 -Modify | 0.00019596 | 0.00019596 | 0.00019596 | 0.0 | 0.59 -Other | | 0.0001652 | | | 0.50 - -Nlocal: 128 ave 128 max 128 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 1113 ave 1113 max 1113 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 8192 ave 8192 max 8192 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 8192 -Ave neighs/atom = 64 -Neighbor list builds = 0 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 deleted file mode 100644 index 3814e71f4e..0000000000 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.2b.g++.4 +++ /dev/null @@ -1,117 +0,0 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) - using 1 OpenMP thread(s) per MPI task -# Demonstrate UF3 W potential - -# # ============= Initialize simulation - -variable nsteps index 100 -variable nrep equal 4 -variable a equal 3.187 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable nx equal 4 -variable ny equal ${nrep} -variable ny equal 4 -variable nz equal ${nrep} -variable nz equal 4 - -boundary p p p - -lattice bcc $a -lattice bcc 3.187 -Lattice spacing in x,y,z = 3.187 3.187 3.187 -region box block 0 ${nx} 0 ${ny} 0 ${nz} -region box block 0 4 0 ${ny} 0 ${nz} -region box block 0 4 0 4 0 ${nz} -region box block 0 4 0 4 0 4 -create_box 1 box -Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 128 atoms - using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) - create_atoms CPU = 0.000 seconds - -mass 1 183.84 - -# # ============= set pair style - -pair_style uf3 2 -pair_coeff 1 1 W_W.uf3 - - -# # ============= Setup output - -thermo 10 -thermo_modify norm yes - -# # ============= Set up NVE run - -timestep 0.5e-3 -neighbor 1.0 bin -neigh_modify once no every 1 delay 0 check yes - -# # ============= Run MD - -velocity all create 300.0 2367804 loop geom -fix 1 all nve -run ${nsteps} -run 100 -Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule -Neighbor list info ... - update: every = 1 steps, delay = 0 steps, check = yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.5 - ghost atom cutoff = 6.5 - binsize = 3.25, bins = 4 4 4 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair uf3, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.104 | 3.104 | 3.104 Mbytes - Step Temp E_pair E_mol TotEng Press - 0 300 -4.9097145 0 -4.8712394 -398022.13 - 10 297.43433 -4.9093854 0 -4.8712394 -397994.78 - 20 289.88359 -4.908417 0 -4.8712393 -397922.72 - 30 277.73497 -4.9068589 0 -4.8712393 -397829.84 - 40 261.57286 -4.904786 0 -4.8712392 -397731.28 - 50 242.14207 -4.902294 0 -4.8712392 -397640.01 - 60 220.31079 -4.899494 0 -4.8712391 -397572.33 - 70 197.03391 -4.8965087 0 -4.871239 -397551.93 - 80 173.31044 -4.893466 0 -4.8712389 -397601.62 - 90 150.12364 -4.8904922 0 -4.8712388 -397739.2 - 100 128.38807 -4.8877046 0 -4.8712388 -397980.01 -Loop time of 0.0147453 on 4 procs for 100 steps with 128 atoms - -Performance: 292.975 ns/day, 0.082 hours/ns, 6781.825 timesteps/s, 868.074 katom-step/s -96.0% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.0086489 | 0.010103 | 0.0115 | 1.4 | 68.52 -Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0027662 | 0.0041052 | 0.0055079 | 2.1 | 27.84 -Output | 0.00012555 | 0.0001367 | 0.00015958 | 0.0 | 0.93 -Modify | 6.4367e-05 | 7.9187e-05 | 9.3374e-05 | 0.0 | 0.54 -Other | | 0.000321 | | | 2.18 - -Nlocal: 32 ave 32 max 32 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 697 ave 697 max 697 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -FullNghs: 2048 ave 2048 max 2048 min -Histogram: 4 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 8192 -Ave neighs/atom = 64 -Neighbor list builds = 0 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 deleted file mode 100644 index 014ef3df49..0000000000 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.1 +++ /dev/null @@ -1,117 +0,0 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) - using 1 OpenMP thread(s) per MPI task -# Demonstrate UF3 W potential - -# # ============= Initialize simulation - -variable nsteps index 100 -variable nrep equal 4 -variable a equal 3.187 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable nx equal 4 -variable ny equal ${nrep} -variable ny equal 4 -variable nz equal ${nrep} -variable nz equal 4 - -boundary p p p - -lattice bcc $a -lattice bcc 3.187 -Lattice spacing in x,y,z = 3.187 3.187 3.187 -region box block 0 ${nx} 0 ${ny} 0 ${nz} -region box block 0 4 0 ${ny} 0 ${nz} -region box block 0 4 0 4 0 ${nz} -region box block 0 4 0 4 0 4 -create_box 1 box -Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 128 atoms - using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) - create_atoms CPU = 0.000 seconds - -mass 1 183.84 - -# # ============= set pair style - -pair_style uf3 3 -pair_coeff 1 1 W_W.uf3 -pair_coeff 3b 1 1 1 W_W_W.uf3 - - -# # ============= Setup output - -thermo 10 -thermo_modify norm yes - -# # ============= Set up NVE run - -timestep 0.5e-3 -neighbor 1.0 bin -neigh_modify once no every 1 delay 0 check yes - -# # ============= Run MD - -velocity all create 300.0 2367804 loop geom -fix 1 all nve -run ${nsteps} -run 100 -Neighbor list info ... - update: every = 1 steps, delay = 0 steps, check = yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.5 - ghost atom cutoff = 6.5 - binsize = 3.25, bins = 4 4 4 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair uf3, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.214 | 3.214 | 3.214 Mbytes - Step Temp E_pair E_mol TotEng Press - 0 300 -4.3916353 0 -4.3531602 -21224 - 10 292.96093 -4.3907325 0 -4.3531602 -21177.095 - 20 272.60651 -4.3881219 0 -4.35316 -21038.525 - 30 241.12074 -4.3840835 0 -4.3531597 -20793.964 - 40 201.8718 -4.3790495 0 -4.3531594 -20444.219 - 50 159.06853 -4.3735596 0 -4.353159 -19996.634 - 60 117.24817 -4.3681958 0 -4.3531587 -19470.011 - 70 80.716097 -4.3635102 0 -4.3531584 -18905.505 - 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 - 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 - 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.48771 on 1 procs for 100 steps with 128 atoms - -Performance: 8.858 ns/day, 2.709 hours/ns, 205.040 timesteps/s, 26.245 katom-step/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.48625 | 0.48625 | 0.48625 | 0.0 | 99.70 -Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00078 | 0.00078 | 0.00078 | 0.0 | 0.16 -Output | 0.0001819 | 0.0001819 | 0.0001819 | 0.0 | 0.04 -Modify | 0.00020794 | 0.00020794 | 0.00020794 | 0.0 | 0.04 -Other | | 0.0002902 | | | 0.06 - -Nlocal: 128 ave 128 max 128 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 1113 ave 1113 max 1113 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 8192 ave 8192 max 8192 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 8192 -Ave neighs/atom = 64 -Neighbor list builds = 0 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 b/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 deleted file mode 100644 index 3dfbf8e5d7..0000000000 --- a/examples/PACKAGES/uf3/log.27Mar24.uf3.3b.g++.4 +++ /dev/null @@ -1,117 +0,0 @@ -LAMMPS (7 Feb 2024 - Development - patch_7Feb2024_update1-337-g6bdf981942-modified) - using 1 OpenMP thread(s) per MPI task -# Demonstrate UF3 W potential - -# # ============= Initialize simulation - -variable nsteps index 100 -variable nrep equal 4 -variable a equal 3.187 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable nx equal 4 -variable ny equal ${nrep} -variable ny equal 4 -variable nz equal ${nrep} -variable nz equal 4 - -boundary p p p - -lattice bcc $a -lattice bcc 3.187 -Lattice spacing in x,y,z = 3.187 3.187 3.187 -region box block 0 ${nx} 0 ${ny} 0 ${nz} -region box block 0 4 0 ${ny} 0 ${nz} -region box block 0 4 0 4 0 ${nz} -region box block 0 4 0 4 0 4 -create_box 1 box -Created orthogonal box = (0 0 0) to (12.748 12.748 12.748) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 128 atoms - using lattice units in orthogonal box = (0 0 0) to (12.748 12.748 12.748) - create_atoms CPU = 0.000 seconds - -mass 1 183.84 - -# # ============= set pair style - -pair_style uf3 3 -pair_coeff 1 1 W_W.uf3 -pair_coeff 3b 1 1 1 W_W_W.uf3 - - -# # ============= Setup output - -thermo 10 -thermo_modify norm yes - -# # ============= Set up NVE run - -timestep 0.5e-3 -neighbor 1.0 bin -neigh_modify once no every 1 delay 0 check yes - -# # ============= Run MD - -velocity all create 300.0 2367804 loop geom -fix 1 all nve -run ${nsteps} -run 100 -Neighbor list info ... - update: every = 1 steps, delay = 0 steps, check = yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.5 - ghost atom cutoff = 6.5 - binsize = 3.25, bins = 4 4 4 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair uf3, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.205 | 3.205 | 3.205 Mbytes - Step Temp E_pair E_mol TotEng Press - 0 300 -4.3916353 0 -4.3531602 -21224 - 10 292.96093 -4.3907325 0 -4.3531602 -21177.095 - 20 272.60651 -4.3881219 0 -4.35316 -21038.525 - 30 241.12074 -4.3840835 0 -4.3531597 -20793.964 - 40 201.8718 -4.3790495 0 -4.3531594 -20444.219 - 50 159.06853 -4.3735596 0 -4.353159 -19996.634 - 60 117.24817 -4.3681958 0 -4.3531587 -19470.011 - 70 80.716097 -4.3635102 0 -4.3531584 -18905.505 - 80 53.030322 -4.3599593 0 -4.3531582 -18362.596 - 90 36.611518 -4.3578535 0 -4.3531581 -17898.612 - 100 32.512413 -4.3573279 0 -4.3531581 -17551.048 -Loop time of 0.2463 on 4 procs for 100 steps with 128 atoms - -Performance: 17.540 ns/day, 1.368 hours/ns, 406.010 timesteps/s, 51.969 katom-step/s -98.6% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.12087 | 0.18077 | 0.24119 | 13.8 | 73.39 -Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.0041617 | 0.064599 | 0.12453 | 23.1 | 26.23 -Output | 0.00029596 | 0.00031702 | 0.00036352 | 0.0 | 0.13 -Modify | 0.00012969 | 0.00013491 | 0.00014544 | 0.0 | 0.05 -Other | | 0.00048 | | | 0.19 - -Nlocal: 32 ave 32 max 32 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 697 ave 697 max 697 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -FullNghs: 2048 ave 2048 max 2048 min -Histogram: 4 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 8192 -Ave neighs/atom = 64 -Neighbor list builds = 0 -Dangerous builds = 0 -Total wall time: 0:00:00