fixed trailing whitespaces

This commit is contained in:
Ajinkya Hire
2024-03-25 17:45:06 -04:00
parent 06c4fc6590
commit b2809996b8
6 changed files with 52 additions and 52 deletions

View File

@ -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 <https://github.com/uf3/uf3/tree/master/lammps_plugin/scripts>`_) 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

View File

@ -71,7 +71,7 @@ template <class DeviceType> PairUF3Kokkos<DeviceType>::~PairUF3Kokkos()
}
template <class DeviceType>
template <typename TYPE>
template <typename TYPE>
void PairUF3Kokkos<DeviceType>::destroy_3d(TYPE data, typename TYPE::value_type*** &array)
{
if (array == nullptr) return;
@ -81,7 +81,7 @@ void PairUF3Kokkos<DeviceType>::destroy_3d(TYPE data, typename TYPE::value_type*
}
template <class DeviceType>
template <typename TYPE>
template <typename TYPE>
void PairUF3Kokkos<DeviceType>::destroy_4d(TYPE data, typename TYPE::value_type**** &array)
{
if (array == nullptr) return;
@ -127,10 +127,10 @@ template <class DeviceType> void PairUF3Kokkos<DeviceType>::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<DeviceType>::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<DeviceType>(); //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 <class DeviceType> double PairUF3Kokkos<DeviceType>::init_one(int i, in
template <class DeviceType> void PairUF3Kokkos<DeviceType>::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 <class DeviceType> void PairUF3Kokkos<DeviceType>::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 <class DeviceType> void PairUF3Kokkos<DeviceType>::compute(int eflag_in
//the array from the host memory; this updates d_cutsq also
k_cut_3b.template sync<DeviceType>();
k_min_cut_3b.template sync<DeviceType>();
inum = list->inum;
const int ignum = inum + list->gnum;
NeighListKokkos<DeviceType> *k_list = static_cast<NeighListKokkos<DeviceType> *>(list);
@ -837,7 +837,7 @@ template <class DeviceType> void PairUF3Kokkos<DeviceType>::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<int **, DeviceType>("UF3::neighbors_short", ignum, max_neighs);
}
@ -969,7 +969,7 @@ PairUF3Kokkos<DeviceType>::operator()(TagPairUF3ComputeFullA<NEIGHFLAG, EVFLAG>,
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<DeviceType>::operator()(TagPairUF3ComputeFullA<NEIGHFLAG, EVFLAG>,
const F_FLOAT rij = sqrt(rsq);
this->template twobody<EVFLAG>(itype, jtype, rij, evdwl, fpair);
fpair = -fpair / rij;
fxtmpi += delx * fpair;
@ -1341,7 +1341,7 @@ void PairUF3Kokkos<DeviceType>::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

View File

@ -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;

View File

@ -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<double> &uknot_vect,
const std::vector<double> &ucoeff_vect,
const std::vector<double> &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<double> &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<double> &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

View File

@ -32,7 +32,7 @@ class uf3_pair_bspline {
std::vector<uf3_bspline_basis2> 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:

View File

@ -35,7 +35,7 @@ class uf3_triplet_bspline {
int get_starting_index_uniform(const std::vector<double>, int, double, double);
int get_starting_index_nonuniform(const std::vector<double>, int, double, double);
int (uf3_triplet_bspline::*get_starting_index)(const std::vector<double>, 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];