From 45372937dbf81a04b49b78341e27ca254a7549fe Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 1 Dec 2023 14:52:47 -0500 Subject: [PATCH] loads of whitespace fixes --- doc/src/Howto_triclinic.rst | 2 +- doc/src/create_box.rst | 4 +-- doc/src/dump.rst | 4 +-- doc/src/read_data.rst | 4 +-- doc/src/thermo_style.rst | 2 +- src/DIELECTRIC/atom_vec_dielectric.cpp | 2 +- src/DIPOLE/atom_vec_dipole.cpp | 4 +-- src/MACHDYN/atom_vec_smd.cpp | 4 +-- src/SPIN/atom_vec_spin.cpp | 4 +-- src/atom.cpp | 22 ++++++------- src/atom_vec.cpp | 12 +++---- src/atom_vec.h | 4 +-- src/atom_vec_body.cpp | 8 ++--- src/atom_vec_body.h | 2 +- src/atom_vec_ellipsoid.cpp | 8 ++--- src/atom_vec_ellipsoid.h | 2 +- src/atom_vec_line.cpp | 4 +-- src/atom_vec_tri.cpp | 10 +++--- src/create_atoms.cpp | 18 +++++------ src/create_box.cpp | 18 +++++------ src/domain.cpp | 24 +++++++------- src/domain.h | 12 +++---- src/dump_atom.cpp | 8 ++--- src/dump_custom.cpp | 44 +++++++++++++------------- src/dump_custom.h | 14 ++++---- src/lattice.cpp | 20 ++++++------ src/lattice.h | 8 ++--- src/math_extra.cpp | 2 +- src/read_data.cpp | 32 +++++++++---------- src/read_data.h | 4 +-- src/thermo.cpp | 4 +-- src/thermo.h | 4 +-- src/write_data.cpp | 10 +++--- src/write_restart.cpp | 2 +- 34 files changed, 163 insertions(+), 163 deletions(-) diff --git a/doc/src/Howto_triclinic.rst b/doc/src/Howto_triclinic.rst index 525c3e0f1b..1461f32187 100644 --- a/doc/src/Howto_triclinic.rst +++ b/doc/src/Howto_triclinic.rst @@ -92,7 +92,7 @@ restricted triclinic parallelepiped. conform to the LAMMPS definition of a restricted triclinic box. See the discussion in the next sub-section about general triclinic simulation boxes in LAMMPS. - + Note that the :doc:`thermo_style custom ` command has keywords for outputting the various parameters that define both restricted and general triclinic simulation boxes. Thus you can check diff --git a/doc/src/create_box.rst b/doc/src/create_box.rst index 79aa839d11..f2b5875539 100644 --- a/doc/src/create_box.rst +++ b/doc/src/create_box.rst @@ -46,11 +46,11 @@ Examples create_box 1 NULL 0 5 0 5 -0.5 0.5 .. code-block:: LAMMPS - + # 3d general triclinic box using primitive cell for 3d fcc lattice lattice custom 1.0 a2 0.0 0.5 0.5 a1 0.5 0.0 0.5 a3 0.5 0.5 0.0 basis 0.0 0.0 0.0 create box 1 NULL -5 5 -10 10 0 20 - + Description """"""""""" diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 77faa5ffe7..8cba1d760b 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -719,9 +719,9 @@ Third, the output for any attribute of the *custom* style which represents a per-atom vector quantity will be converted (rotated) to be oriented consistent with the general tricinic box and its orientation relative to the standard xyz coordinate axes. - + This applies to the following *custom* style attributes: - + * vx,vy,vz = atom velocities * fx,fy,fz = forces on atoms * mux,muy,muz = orientation of dipole moment of atom diff --git a/doc/src/read_data.rst b/doc/src/read_data.rst index 897f6878b0..dd028ec23e 100644 --- a/doc/src/read_data.rst +++ b/doc/src/read_data.rst @@ -148,7 +148,7 @@ keyword must be used. triclinic box, the avec, bvec, cvec, and "abc origin" keywords must have the same values in subsequent data files. Also the *shift* keyword cannot be used in subsequent read_data commands. - + The three choices for the *add* argument affect how the atom IDs and molecule IDs of atoms in the data file are treated. If *append* is specified, atoms in the data file are added to the current system, @@ -494,7 +494,7 @@ periodic sense) back inside the box. For triclinic boxes, periodicity in x,y,z refers to the faces of the parallelepided defined by the **A**,**B**,**C** edge vectors of the simuation box. See the :doc:`boundary ` command doc page for a fuller discussion. - + Note that if the *add* option is being used to add atoms to a simulation box that already exists, this periodic remapping will be performed using simulation box bounds that are the union of the diff --git a/doc/src/thermo_style.rst b/doc/src/thermo_style.rst index 504a7d1d6d..45a1eaa2a8 100644 --- a/doc/src/thermo_style.rst +++ b/doc/src/thermo_style.rst @@ -107,7 +107,7 @@ screen and log files. The units for each column of output corresponding to the list of keywords is determined by the :doc:`units ` command for the simulation. E.g. energies will be in energy units, temperature in temperature units, pressure in pressure units. - + Style *one* prints a single line of thermodynamic info that is the equivalent of "thermo_style custom step temp epair emol etotal press". The line contains only numeric values. diff --git a/src/DIELECTRIC/atom_vec_dielectric.cpp b/src/DIELECTRIC/atom_vec_dielectric.cpp index 617ad4ebea..7412df118f 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.cpp +++ b/src/DIELECTRIC/atom_vec_dielectric.cpp @@ -235,7 +235,7 @@ void AtomVecDielectric::write_data_restore_restricted() AtomVec::write_data_restore_restricted(); if (!mu_hold) return; - + int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) memcpy(&mu[i],&mu_hold[i],3*sizeof(double)); diff --git a/src/DIPOLE/atom_vec_dipole.cpp b/src/DIPOLE/atom_vec_dipole.cpp index 38ecd63ddd..470dfc77ef 100644 --- a/src/DIPOLE/atom_vec_dipole.cpp +++ b/src/DIPOLE/atom_vec_dipole.cpp @@ -29,7 +29,7 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp) mass_type = PER_TYPE; atom->q_flag = atom->mu_flag = 1; - + mu_hold = nullptr; // strings with peratom variables to include in each AtomVec method @@ -117,7 +117,7 @@ void AtomVecDipole::write_data_restore_restricted() AtomVec::write_data_restore_restricted(); if (!mu_hold) return; - + int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) memcpy(&mu[i],&mu_hold[i],3*sizeof(double)); diff --git a/src/MACHDYN/atom_vec_smd.cpp b/src/MACHDYN/atom_vec_smd.cpp index 05c73d5b33..9d4e5dcce5 100644 --- a/src/MACHDYN/atom_vec_smd.cpp +++ b/src/MACHDYN/atom_vec_smd.cpp @@ -60,7 +60,7 @@ AtomVecSMD::AtomVecSMD(LAMMPS *lmp) : AtomVec(lmp) atom->eff_plastic_strain_rate_flag = 1; x0_hold = nullptr; - + // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter @@ -166,7 +166,7 @@ void AtomVecSMD::data_atom_post(int ilocal) // for PBC, shift, etc // this means no need for read_data_general_to_restricted() method // to rotate x0 for general triclinic - + x0[ilocal][0] = x[ilocal][0]; x0[ilocal][1] = x[ilocal][1]; x0[ilocal][2] = x[ilocal][2]; diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index 8844755cd8..f941ddc990 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -43,7 +43,7 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp) atom->sp_flag = 1; sp_hold = nullptr; - + // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter @@ -147,7 +147,7 @@ void AtomVecSpin::write_data_restore_restricted() AtomVec::write_data_restore_restricted(); if (!sp_hold) return; - + int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) memcpy(&sp[i],&sp_hold[i],3*sizeof(double)); diff --git a/src/atom.cpp b/src/atom.cpp index 33bd5d517f..a0d5b4ba08 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1052,7 +1052,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, auto location = "Atoms section of data file"; // use the first line to detect and validate the number of words/tokens per line - + next = strchr(buf,'\n'); if (!next) error->all(FLERR, "Missing data in {}", location); *next = '\0'; @@ -1069,7 +1069,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, error->all(FLERR,"Incorrect format in {}: {}", location, utils::trim(buf)); *next = '\n'; - + // set bounds for my proc // if periodic and I am lo/hi proc, adjust bounds by EPSILON // ensures all data atoms will be owned even with round-off @@ -1147,17 +1147,17 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, int nvalues = values.size(); // skip comment lines - + if ((nvalues == 0) || (utils::strmatch(values[0],"^#.*"))) { // check that line has correct # of words - + } else if ((nvalues < nwords) || ((nvalues > nwords) && (!utils::strmatch(values[nwords],"^#")))) { error->all(FLERR, "Incorrect format in {}: {}", location, utils::trim(buf)); // extract the atom coords and image flags (if they exist) - + } else { int imx = 0, imy = 0, imz = 0; if (imageflag) { @@ -1186,14 +1186,14 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, error->all(FLERR,"Read_data atom z coord is non-zero for 2d simulation"); xdata[2] = 0.0; } - + // convert atom coords from general to restricted triclinic // so can decide which proc owns the atom - + if (triclinic_general) domain->general_to_restricted_coords(xdata); // apply shift if requested by read_data command - + if (shiftflag) { xdata[0] += shift[0]; xdata[1] += shift[1]; @@ -1201,11 +1201,11 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, } // map atom into simulation box for periodic dimensions - + domain->remap(xdata,imagedata); // determine if this proc owns the atom - + if (triclinic) { domain->x2lamda(xdata,lamda); coord = lamda; @@ -1216,7 +1216,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, coord[2] >= sublo[2] && coord[2] < subhi[2]) { // atom-style specific method parses single line - + avec->data_atom(xdata,imagedata,values,typestr); typestr = utils::utf8_subst(typestr); if (id_offset) tag[nlocal-1] += id_offset; diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index d94365db43..1942d2a6d2 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -70,7 +70,7 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp) x_hold = nullptr; v_hold = omega_hold = angmom_hold = nullptr; - + threads = nullptr; } @@ -2243,7 +2243,7 @@ void AtomVec::read_data_general_to_restricted(int nlocal_previous, int nlocal) // operate on v, omega, angmom // no other read_data Velocities fields are Nx3 double arrays - + if (datatype == Atom::DOUBLE) { if (cols == 3) { double **array = *((double ***) pdata); @@ -2283,7 +2283,7 @@ void AtomVec::write_data_restricted_to_general() // operate on v, omega, angmom // no other write_data Velocities fields are Nx3 double arrays - + if (datatype == Atom::DOUBLE) { if (cols == 3) { double **array = *((double ***) pdata); @@ -2325,10 +2325,10 @@ void AtomVec::write_data_restore_restricted() memory->destroy(x_hold); x_hold = nullptr; } - + // operate on v, omega, angmom // no other write_data Velocities fields are Nx3 double arrays - + if (v_hold) { memcpy(&v[0][0],&v_hold[0][0],3*nlocal*sizeof(double)); memory->destroy(v_hold); @@ -2340,7 +2340,7 @@ void AtomVec::write_data_restore_restricted() memory->destroy(omega_hold); omega_hold = nullptr; } - + if (angmom_hold) { memcpy(&atom->angmom[0][0],&angmom_hold[0][0],3*nlocal*sizeof(double)); memory->destroy(angmom_hold); diff --git a/src/atom_vec.h b/src/atom_vec.h index 55fe7e2f7d..2342964797 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -174,8 +174,8 @@ class AtomVec : protected Pointers { double **x, **v, **f; // copies of original unrotated fields for write_data for general triclinic - - double **x_hold; + + double **x_hold; double **v_hold, **omega_hold, **angmom_hold; // standard list of peratom fields always operated on by different methods diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 108d94bbec..5ff84d6b1f 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -648,15 +648,15 @@ void AtomVecBody::write_data_bonus(FILE *fp, int n, double *buf, int /*flag*/) void AtomVecBody::read_data_general_to_restricted(int nlocal_previous, int nlocal) { int j; - + AtomVec::read_data_general_to_restricted(nlocal_previous, nlocal); // quat_g2r = quat that rotates from general to restricted triclinic // quat_new = body quat converted to restricted triclinic - + double quat_g2r[4],quat_new[4]; MathExtra::mat_to_quat(domain->rotate_g2r,quat_g2r); - + for (int i = nlocal_previous; i < nlocal; i++) { if (body[i] < 0) continue; j = body[i]; @@ -685,7 +685,7 @@ void AtomVecBody::write_data_restricted_to_general() // quat_r2g = quat that rotates from restricted to general triclinic // quat_new = ellipsoid quat converted to general triclinic - + double quat_r2g[4],quat_new[4]; MathExtra::mat_to_quat(domain->rotate_r2g,quat_r2g); diff --git a/src/atom_vec_body.h b/src/atom_vec_body.h index 5ba90a6dc1..0aa83e833f 100644 --- a/src/atom_vec_body.h +++ b/src/atom_vec_body.h @@ -69,7 +69,7 @@ class AtomVecBody : public AtomVec { void read_data_general_to_restricted(int, int); void write_data_restricted_to_general(); void write_data_restore_restricted(); - + // methods used by other classes to query/set body info double radius_body(int, int, int *, double *); diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index 9b64426224..417c3cf5fa 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -545,15 +545,15 @@ void AtomVecEllipsoid::write_data_bonus(FILE *fp, int n, double *buf, int /*flag void AtomVecEllipsoid::read_data_general_to_restricted(int nlocal_previous, int nlocal) { int j; - + AtomVec::read_data_general_to_restricted(nlocal_previous, nlocal); // quat_g2r = quat that rotates from general to restricted triclinic // quat_new = ellipsoid quat converted to restricted triclinic - + double quat_g2r[4],quat_new[4]; MathExtra::mat_to_quat(domain->rotate_g2r,quat_g2r); - + for (int i = nlocal_previous; i < nlocal; i++) { if (ellipsoid[i] < 0) continue; j = ellipsoid[i]; @@ -582,7 +582,7 @@ void AtomVecEllipsoid::write_data_restricted_to_general() // quat_r2g = quat that rotates from restricted to general triclinic // quat_new = ellipsoid quat converted to general triclinic - + double quat_r2g[4],quat_new[4]; MathExtra::mat_to_quat(domain->rotate_r2g,quat_r2g); diff --git a/src/atom_vec_ellipsoid.h b/src/atom_vec_ellipsoid.h index 23c824dbf0..03850837d8 100644 --- a/src/atom_vec_ellipsoid.h +++ b/src/atom_vec_ellipsoid.h @@ -74,7 +74,7 @@ class AtomVecEllipsoid : public AtomVec { double *rmass; double **angmom; double **quat_hold; - + int nghost_bonus, nmax_bonus; int ellipsoid_flag; double rmass_one; diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index 21a9cc880a..d6f1b56171 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -526,7 +526,7 @@ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/) j = line[i]; length = bonus[j].length; theta = bonus[j].theta; - + xc = x_bonus[i][0]; yc = x_bonus[i][1]; x1 = xc - 0.5 * cos(theta) * length; @@ -541,7 +541,7 @@ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/) // if triclinic_general: // rotate 4 buf values from restricted to general triclinic // output by write_data_bonus() as x1/y1 and x2/y2 - + if (triclinic_general) { coords[0] = buf[m-4]; coords[1] = buf[m-3]; coords[2] = 0.0; domain->restricted_to_general_coords(coords); diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 69665c6a94..e3cfab7d59 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -510,7 +510,7 @@ void AtomVecTri::data_atom_bonus(int m, const std::vector &values) // convert c1,c2,c3 from general to restricted triclniic // x is already restricted triclinic - + if (domain->triclinic_general) { domain->general_to_restricted_coords(c1); domain->general_to_restricted_coords(c2); @@ -523,11 +523,11 @@ void AtomVecTri::data_atom_bonus(int m, const std::vector &values) domain->remap_near(c1,x[m]); domain->remap_near(c2,x[m]); domain->remap_near(c3,x[m]); - + // centroid = 1/3 of sum of vertices // error if centroid is not within EPSILON of atom x // reset atom x to centroid - + double centroid[3]; centroid[0] = (c1[0] + c2[0] + c3[0]) / 3.0; centroid[1] = (c1[1] + c2[1] + c3[1]) / 3.0; @@ -729,7 +729,7 @@ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) double **x_bonus; if (triclinic_general) x_bonus = x_hold; else x_bonus = x; - + tagint *tag = atom->tag; int nlocal = atom->nlocal; @@ -760,7 +760,7 @@ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) // if triclinic_general: // rotate 9 buf values from restricted to general triclinic // output by write_data_bonus() as c1,c2,c3 - + if (triclinic_general) { domain->restricted_to_general_coords(&buf[m-9]); domain->restricted_to_general_coords(&buf[m-6]); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 59b0ad4ab6..d3c3e200bc 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -358,11 +358,11 @@ void CreateAtoms::command(int narg, char **arg) } // require non-none lattice be defined for BOX or REGION styles - + if ((style == BOX) || (style == REGION)) { if (nbasis == 0) error->all(FLERR, "Cannot create atoms with undefined lattice"); } - + // apply scaling factor for styles that use distance-dependent factors if (scaleflag) { @@ -465,7 +465,7 @@ void CreateAtoms::command(int narg, char **arg) atom->avec->clear_bonus(); // add atoms/molecules with appropriate add() method - + bigint natoms_previous = atom->natoms; int nlocal_previous = atom->nlocal; @@ -1178,7 +1178,7 @@ void CreateAtoms::add_lattice() { // add atoms on general triclinic lattice if Domain has setting for it // verify lattice was defined with triclinic/general option - + if (!domain->triclinic_general && domain->lattice->is_general_triclinic()) error->all(FLERR,"Create_atoms for non general triclinic box cannot use triclinic/general lattice"); if (domain->triclinic_general && !domain->lattice->is_general_triclinic()) @@ -1228,7 +1228,7 @@ void CreateAtoms::add_lattice() // convert 8 corner points of bounding box to lattice coordinates // compute new bounding box (xyz min/max) in lattice coords // for orthogonal or restricted triclinic, use 8 corner points of bbox lo/hi - + if (!domain->triclinic_general) { domain->lattice->bbox(1, bboxlo[0], bboxlo[1], bboxlo[2], xmin, ymin, zmin, xmax, ymax, zmax); domain->lattice->bbox(1, bboxhi[0], bboxlo[1], bboxlo[2], xmin, ymin, zmin, xmax, ymax, zmax); @@ -1274,7 +1274,7 @@ void CreateAtoms::add_lattice() domain->restricted_to_general_coords(point); domain->lattice->bbox(1, point[0], point[1], point[2], xmin, ymin, zmin, xmax, ymax, zmax); } - + // ilo:ihi,jlo:jhi,klo:khi = loop bounds for lattice overlap of my subbox // overlap = any part of a unit cell (face,edge,pt) in common with my subbox // in lattice space, subbox is a tilted box @@ -1284,7 +1284,7 @@ void CreateAtoms::add_lattice() // which can lead to missing atoms in rare cases // extra decrement of lo if min < 0, since static_cast(-1.5) = -1 // for 2d simulation, klo = khi = 0 so just one plane of atoms - + ilo = static_cast(xmin) - 1; jlo = static_cast(ymin) - 1; klo = static_cast(zmin) - 1; @@ -1297,7 +1297,7 @@ void CreateAtoms::add_lattice() if (zmin < 0.0) klo--; if (domain->dimension == 2) klo = khi = 0; - + // count lattice sites on each proc nlatt_overflow = 0; @@ -1395,7 +1395,7 @@ void CreateAtoms::loop_lattice(int action) error->all(FLERR,"Create_atoms atom z coord is non-zero for 2d simulation"); x[2] = 0.0; } - } + } // if a region was specified, test if atom is in it diff --git a/src/create_box.cpp b/src/create_box.cpp index e4ebe4c0cb..7dd6f52e9d 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -48,7 +48,7 @@ void CreateBox::command(int narg, char **arg) Region *region = nullptr; int triclinic_general = 0; - + if (strcmp(arg[1],"NULL") == 0) triclinic_general = 1; else { region = domain->get_region_by_id(arg[1]); @@ -61,13 +61,13 @@ void CreateBox::command(int narg, char **arg) // 3 options: orthogonal, restricted triclinic, general triclinic int iarg = 2; - + if (region) { - + // region is not prism // setup orthogonal box // set simulation domain from region extent - + if (strcmp(region->style, "prism") != 0) { domain->triclinic = 0; domain->boxlo[0] = region->extent_xlo; @@ -108,7 +108,7 @@ void CreateBox::command(int narg, char **arg) } else if (triclinic_general) { if (!domain->lattice->is_general_triclinic()) error->all(FLERR,"Create_box for general triclinic requires triclnic/general lattice"); - + if (iarg + 6 > narg) utils::missing_cmd_args(FLERR, "create_box general triclinic", error); double alo = utils::numeric(FLERR, arg[iarg + 0], false, lmp); @@ -118,14 +118,14 @@ void CreateBox::command(int narg, char **arg) double clo = utils::numeric(FLERR, arg[iarg + 4], false, lmp); double chi = utils::numeric(FLERR, arg[iarg + 5], false, lmp); iarg += 6; - + // use lattice2box() to generate origin and ABC vectors // origin = abc lo // ABC vectors = hi in one dim - origin - + double avec[3],bvec[3],cvec[3],origin[3]; double px,py,pz; - + px = alo; py = blo; pz = clo; domain->lattice->lattice2box(px,py,pz); origin[0] = px; @@ -157,7 +157,7 @@ void CreateBox::command(int narg, char **arg) } // define general triclinic box within Domain class - + domain->define_general_triclinic(avec,bvec,cvec,origin); } diff --git a/src/domain.cpp b/src/domain.cpp index 3e49255b57..a27b52e49b 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -293,12 +293,12 @@ void Domain::set_global_box() // update general triclinic box if defined // reset general tri ABC edge vectors from restricted tri box - + if (triclinic_general) { double aprime[3],bprime[3],cprime[3]; // A'B'C' = edge vectors of restricted triclinic box - + aprime[0] = boxhi[0] - boxlo[0]; aprime[1] = aprime[2] = 0.0; bprime[0] = xy; @@ -309,7 +309,7 @@ void Domain::set_global_box() cprime[2] = boxhi[2] - boxlo[2]; // transform restricted A'B'C' to general triclinic ABC - + MathExtra::matvec(rotate_r2g,aprime,avec); MathExtra::matvec(rotate_r2g,bprime,bvec); MathExtra::matvec(rotate_r2g,cprime,cvec); @@ -556,7 +556,7 @@ void Domain::define_general_triclinic(double *avec_caller, double *bvec_caller, { if (triclinic || triclinic_general) error->all(FLERR,"General triclinic box edge vectors are already set"); - + triclinic = triclinic_general = 1; avec[0] = avec_caller[0]; @@ -596,7 +596,7 @@ void Domain::define_general_triclinic(double *avec_caller, double *bvec_caller, xy = bprime[0]; xz = cprime[0]; yz = cprime[1]; - + // debug /* @@ -656,7 +656,7 @@ void Domain::general_to_restricted_rotation(double *a, double *b, double *c, MathExtra::norm3(rot1); double theta1 = acos(a[0]/alen); MathExtra::axisangle_to_quat(rot1,theta1,quat1); - + // rotmat1 = rotation matrix associated with quat1 double rotmat1[3][3]; @@ -674,7 +674,7 @@ void Domain::general_to_restricted_rotation(double *a, double *b, double *c, // Byz1 dot yunit = B1y = |Byz1| cos(theta2) // theta2 via acos() is positive (0 to PI) // positive is valid if B1z < 0.0 else flip sign of theta2 - + double byzvec1[3],quat2[4]; MathExtra::copy3(b1,byzvec1); byzvec1[0] = 0.0; @@ -705,7 +705,7 @@ void Domain::general_to_restricted_rotation(double *a, double *b, double *c, void Domain::general_to_restricted_coords(double *x) { double xshift[3],xnew[3]; - + xshift[0] = x[0] - boxlo[0]; xshift[1] = x[1] - boxlo[1]; xshift[2] = x[2] - boxlo[2]; @@ -722,7 +722,7 @@ void Domain::general_to_restricted_coords(double *x) void Domain::restricted_to_general_coords(double *x) { double xshift[3],xnew[3]; - + xshift[0] = x[0] - boxlo[0]; xshift[1] = x[1] - boxlo[1]; xshift[2] = x[2] - boxlo[2]; @@ -735,7 +735,7 @@ void Domain::restricted_to_general_coords(double *x) void Domain::restricted_to_general_coords(double *x, double *xnew) { double xshift[3]; - + xshift[0] = x[0] - boxlo[0]; xshift[1] = x[1] - boxlo[1]; xshift[2] = x[2] - boxlo[2]; @@ -752,7 +752,7 @@ void Domain::restricted_to_general_coords(double *x, double *xnew) void Domain::general_to_restricted_vector(double *v) { double vnew[3]; - + MathExtra::matvec(rotate_g2r,v,vnew); v[0] = vnew[0]; v[1] = vnew[1]; @@ -766,7 +766,7 @@ void Domain::general_to_restricted_vector(double *v) void Domain::restricted_to_general_vector(double *v) { double vnew[3]; - + MathExtra::matvec(rotate_r2g,v,vnew); v[0] = vnew[0]; v[1] = vnew[1]; diff --git a/src/domain.h b/src/domain.h index c54c08df3d..d0991c3768 100644 --- a/src/domain.h +++ b/src/domain.h @@ -41,7 +41,7 @@ class Domain : protected Pointers { int triclinic; // 0 = orthog box, 1 = triclinic (restricted or general) int triclinic_general; // 1 if general <-> restricted tri mapping is stored, 0 if not - + // orthogonal box double xprd, yprd, zprd; // global box dimensions @@ -96,7 +96,7 @@ class Domain : protected Pointers { double rotate_r2g[3][3]; // rotation matrix from restricted --> general tri // box flags - + int box_change; // 1 if any of next 3 flags are set, else 0 int box_change_size; // 1 if box size changes, 0 if not int box_change_shape; // 1 if box shape changes, 0 if not @@ -145,13 +145,13 @@ class Domain : protected Pointers { void general_to_restricted_rotation(double *, double *, double *, double [3][3], double *, double *, double *); - void general_to_restricted_coords(double *); + void general_to_restricted_coords(double *); void restricted_to_general_coords(double *); void restricted_to_general_coords(double *, double *); - void general_to_restricted_vector(double *); + void general_to_restricted_vector(double *); void restricted_to_general_vector(double *); - void restricted_to_general_vector(double *, double *x); - + void restricted_to_general_vector(double *, double *x); + void set_lattice(int, char **); void add_region(int, char **); void delete_region(Region *); diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index a029a68135..8d77efcea0 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -133,7 +133,7 @@ void DumpAtom::init_style() } } } - + if (image_flag == 0) convert_choice = &DumpAtom::convert_noimage; else convert_choice = &DumpAtom::convert_image; @@ -157,14 +157,14 @@ int DumpAtom::modify_param(int narg, char **arg) for (auto &item : keyword_user) item.clear(); return 2; } - + if (strcmp(arg[0],"image") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); image_flag = utils::logical(FLERR,arg[1],false,lmp); for (auto &item : keyword_user) item.clear(); return 2; } - + if (strcmp(arg[0],"triclinic/general") == 0) { triclinic_general = 1; if (triclinic_general && !domain->triclinic_general) @@ -172,7 +172,7 @@ int DumpAtom::modify_param(int narg, char **arg) "if simulation box is not general triclinic"); return 1; } - + return 0; } diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 6708a7c410..c06ee0a290 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -1347,7 +1347,7 @@ int DumpCustom::parse_fields(int narg, char **arg) if (triclinic_general) pack_choice[iarg] = &DumpCustom::pack_y_triclinic_general; else pack_choice[iarg] = &DumpCustom::pack_y; vtype[iarg] = Dump::DOUBLE; - } else if (strcmp(arg[iarg],"z") == 0) { + } else if (strcmp(arg[iarg],"z") == 0) { if (triclinic_general) pack_choice[iarg] = &DumpCustom::pack_z_triclinic_general; else pack_choice[iarg] = &DumpCustom::pack_z; vtype[iarg] = Dump::DOUBLE; @@ -1390,7 +1390,7 @@ int DumpCustom::parse_fields(int narg, char **arg) if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_zsu_triclinic; else pack_choice[iarg] = &DumpCustom::pack_zsu; vtype[iarg] = Dump::DOUBLE; - + } else if (strcmp(arg[iarg],"ix") == 0) { pack_choice[iarg] = &DumpCustom::pack_ix; vtype[iarg] = Dump::INT; @@ -1431,7 +1431,7 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Dumping an atom property that isn't allocated"); pack_choice[iarg] = &DumpCustom::pack_q; vtype[iarg] = Dump::DOUBLE; - + } else if (strcmp(arg[iarg],"mux") == 0) { if (!atom->mu_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); @@ -1466,7 +1466,7 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Dumping an atom property that isn't allocated"); pack_choice[iarg] = &DumpCustom::pack_diameter; vtype[iarg] = Dump::DOUBLE; - + } else if (strcmp(arg[iarg],"heatflow") == 0) { if (!atom->heatflow_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); @@ -1477,7 +1477,7 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Dumping an atom property that isn't allocated"); pack_choice[iarg] = &DumpCustom::pack_temperature; vtype[iarg] = Dump::DOUBLE; - + } else if (strcmp(arg[iarg],"omegax") == 0) { if (!atom->omega_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); @@ -1496,7 +1496,7 @@ int DumpCustom::parse_fields(int narg, char **arg) if (triclinic_general) pack_choice[iarg] = &DumpCustom::pack_omegaz_triclinic_general; else pack_choice[iarg] = &DumpCustom::pack_omegaz; vtype[iarg] = Dump::DOUBLE; - + } else if (strcmp(arg[iarg],"angmomx") == 0) { if (!atom->angmom_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); @@ -1515,7 +1515,7 @@ int DumpCustom::parse_fields(int narg, char **arg) if (triclinic_general) pack_choice[iarg] = &DumpCustom::pack_angmomz_triclinic_general; else pack_choice[iarg] = &DumpCustom::pack_angmomz; vtype[iarg] = Dump::DOUBLE; - + } else if (strcmp(arg[iarg],"tqx") == 0) { if (!atom->torque_flag) error->all(FLERR,"Dumping an atom property that isn't allocated"); @@ -1793,7 +1793,7 @@ int DumpCustom::modify_param(int narg, char **arg) "if simulation box is not general triclinic"); return 1; } - + if (strcmp(arg[0],"triclinic/general") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); triclinic_general = utils::logical(FLERR,arg[1],false,lmp); @@ -2387,7 +2387,7 @@ void DumpCustom::pack_x_triclinic_general(int n) { double **x = atom->x; double xtri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_coords(x[clist[i]],xtri); buf[n] = xtri[0]; @@ -2973,7 +2973,7 @@ void DumpCustom::pack_fx_triclinic_general(int n) { double **f = atom->f; double ftri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(f[clist[i]],ftri); buf[n] = ftri[0]; @@ -3075,7 +3075,7 @@ void DumpCustom::pack_mux_triclinic_general(int n) { double **mu = atom->mu; double mutri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(mu[clist[i]],mutri); buf[n] = mutri[0]; @@ -3089,7 +3089,7 @@ void DumpCustom::pack_muy_triclinic_general(int n) { double **mu = atom->mu; double mutri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(mu[clist[i]],mutri); buf[n] = mutri[1]; @@ -3103,7 +3103,7 @@ void DumpCustom::pack_muz_triclinic_general(int n) { double **mu = atom->mu; double mutri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(mu[clist[i]],mutri); buf[n] = mutri[2]; @@ -3201,7 +3201,7 @@ void DumpCustom::pack_omegax_triclinic_general(int n) { double **omega = atom->omega; double omegatri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(omega[clist[i]],omegatri); buf[n] = omegatri[0]; @@ -3215,7 +3215,7 @@ void DumpCustom::pack_omegay_triclinic_general(int n) { double **omega = atom->omega; double omegatri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(omega[clist[i]],omegatri); buf[n] = omegatri[1]; @@ -3229,7 +3229,7 @@ void DumpCustom::pack_omegaz_triclinic_general(int n) { double **omega = atom->omega; double omegatri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(omega[clist[i]],omegatri); buf[n] = omegatri[2]; @@ -3279,7 +3279,7 @@ void DumpCustom::pack_angmomx_triclinic_general(int n) { double **angmom = atom->angmom; double angmomtri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(angmom[clist[i]],angmomtri); buf[n] = angmomtri[0]; @@ -3293,7 +3293,7 @@ void DumpCustom::pack_angmomy_triclinic_general(int n) { double **angmom = atom->angmom; double angmomtri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(angmom[clist[i]],angmomtri); buf[n] = angmomtri[1]; @@ -3307,7 +3307,7 @@ void DumpCustom::pack_angmomz_triclinic_general(int n) { double **angmom = atom->angmom; double angmomtri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(angmom[clist[i]],angmomtri); buf[n] = angmomtri[2]; @@ -3357,7 +3357,7 @@ void DumpCustom::pack_tqx_triclinic_general(int n) { double **torque = atom->torque; double tqtri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(torque[clist[i]],tqtri); buf[n] = tqtri[0]; @@ -3371,7 +3371,7 @@ void DumpCustom::pack_tqy_triclinic_general(int n) { double **torque = atom->torque; double tqtri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(torque[clist[i]],tqtri); buf[n] = tqtri[1]; @@ -3385,7 +3385,7 @@ void DumpCustom::pack_tqz_triclinic_general(int n) { double **torque = atom->torque; double tqtri[3]; - + for (int i = 0; i < nchoose; i++) { domain->restricted_to_general_vector(torque[clist[i]],tqtri); buf[n] = tqtri[2]; diff --git a/src/dump_custom.h b/src/dump_custom.h index b22d03f9b5..ceb85ea3c2 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -37,7 +37,7 @@ class DumpCustom : public Dump { int nevery; // dump frequency for output char *idregion; // region ID, nullptr if no region int triclinic_general; // 1 if output box & per-atom info for general triclinic - + int nthresh; // # of defined thresholds int nthreshlast; // # of defined thresholds with value = LAST // @@ -159,7 +159,7 @@ class DumpCustom : public Dump { void pack_x_triclinic_general(int); void pack_y_triclinic_general(int); void pack_z_triclinic_general(int); - + void pack_xs(int); void pack_ys(int); void pack_zs(int); @@ -190,11 +190,11 @@ class DumpCustom : public Dump { void pack_vx(int); void pack_vy(int); - void pack_vz(int); + void pack_vz(int); void pack_vx_triclinic_general(int); void pack_vy_triclinic_general(int); void pack_vz_triclinic_general(int); - + void pack_fx(int); void pack_fy(int); void pack_fz(int); @@ -214,7 +214,7 @@ class DumpCustom : public Dump { void pack_radius(int); void pack_diameter(int); - + void pack_heatflow(int); void pack_temperature(int); @@ -224,14 +224,14 @@ class DumpCustom : public Dump { void pack_omegax_triclinic_general(int); void pack_omegay_triclinic_general(int); void pack_omegaz_triclinic_general(int); - + void pack_angmomx(int); void pack_angmomy(int); void pack_angmomz(int); void pack_angmomx_triclinic_general(int); void pack_angmomy_triclinic_general(int); void pack_angmomz_triclinic_general(int); - + void pack_tqx(int); void pack_tqy(int); void pack_tqz(int); diff --git a/src/lattice.cpp b/src/lattice.cpp index 6992828e3a..64bde35c26 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -141,7 +141,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // process optional args int triclinic_general = 0; - + int iarg = 2; while (iarg < narg) { if (strcmp(arg[iarg],"origin") == 0) { @@ -230,7 +230,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) } else if (strcmp(arg[iarg],"triclinic/general") == 0) { triclinic_general = 1; iarg++; - + } else error->all(FLERR,"Unknown lattice keyword: {}", arg[iarg]); } @@ -267,7 +267,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // additional requirements for a general triclinic lattice // a123 prime are used to compute lattice spacings - + if (triclinic_general) { if (style != CUSTOM) error->all(FLERR,"Lattice triclnic/general must be style = CUSTOM"); @@ -285,11 +285,11 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) double rotmat[3][3]; domain->general_to_restricted_rotation(a1,a2,a3,rotmat,a1_prime,a2_prime,a3_prime); } - + // reset scale for LJ units (input scale is rho*) // scale = (Nbasis/(Vprimitive * rho*)) ^ (1/dim) // use fabs() in case a1,a2,a3 are not right-handed for general triclinic - + if (strcmp(update->unit_style,"lj") == 0) { double vec[3]; MathExtra::cross3(a2,a3,vec); @@ -321,7 +321,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // reset transform used by bbox() to be based on rotated a123 prime vectors if (triclinic_general) setup_transform(a1_prime,a2_prime,a3_prime); - + bbox(0,0.0,0.0,0.0,xmin,ymin,zmin,xmax,ymax,zmax); bbox(0,1.0,0.0,0.0,xmin,ymin,zmin,xmax,ymax,zmax); bbox(0,0.0,1.0,0.0,xmin,ymin,zmin,xmax,ymax,zmax); @@ -334,13 +334,13 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // restore original general triclinic a123 transform if (triclinic_general) setup_transform(a2,a2,a3); - + xlattice = xmax - xmin; ylattice = ymax - ymin; zlattice = zmax - zmin; // user-defined lattice spacings - + } else { xlattice *= scale; ylattice *= scale; @@ -542,7 +542,7 @@ void Lattice::setup_transform(double *a, double *b, double *c) ------------------------------------------------------------------------- */ void Lattice::lattice2box(double &x, double &y, double &z) -{ +{ double x1 = primitive[0][0]*x + primitive[0][1]*y + primitive[0][2]*z; double y1 = primitive[1][0]*x + primitive[1][1]*y + primitive[1][2]*z; double z1 = primitive[2][0]*x + primitive[2][1]*y + primitive[2][2]*z; @@ -615,7 +615,7 @@ void Lattice::add_basis(double x, double y, double z) void Lattice::bbox(int flag, double x, double y, double z, double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) -{ +{ if (flag == 0) lattice2box(x,y,z); else box2lattice(x,y,z); diff --git a/src/lattice.h b/src/lattice.h index 8f545de2ab..85ffd27c0a 100644 --- a/src/lattice.h +++ b/src/lattice.h @@ -28,7 +28,7 @@ class Lattice : protected Pointers { int nbasis; // # of basis atoms in unit cell double **basis; // fractional coords of each basis atom // within unit cell (0 <= coord < 1) - + Lattice(class LAMMPS *, int, char **); ~Lattice() override; void lattice2box(double &, double &, double &); @@ -36,7 +36,7 @@ class Lattice : protected Pointers { void bbox(int, double, double, double, double &, double &, double &, double &, double &, double &); int is_general_triclinic(); - + private: int triclinic_general; // 1 if general triclinic, else 0 int oriented; // 1 if non-default orient xyz, else 0 @@ -51,10 +51,10 @@ class Lattice : protected Pointers { double rotaterow[3][3]; double rotatecol[3][3]; - double a1_prime[3]; // a123 rotated to restricted triclinic orientation + double a1_prime[3]; // a123 rotated to restricted triclinic orientation double a2_prime[3]; double a3_prime[3]; - + int orthogonal(); int right_handed_orientation(); int right_handed_primitive(); diff --git a/src/math_extra.cpp b/src/math_extra.cpp index b8c9bd98df..a36600d970 100644 --- a/src/math_extra.cpp +++ b/src/math_extra.cpp @@ -381,7 +381,7 @@ void mat_to_quat(double mat[3][3], double *q) ez[0] = mat[0][2]; ez[1] = mat[1][2]; ez[2] = mat[2][2]; - + MathExtra::exyz_to_q(ex,ey,ez,q); } diff --git a/src/read_data.cpp b/src/read_data.cpp index b34dac54eb..5642c61920 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -474,7 +474,7 @@ void ReadData::command(int narg, char **arg) int atomflag, topoflag; int bondflag, angleflag, dihedralflag, improperflag; int ellipsoidflag, lineflag, triflag, bodyflag; - + atomflag = topoflag = 0; bondflag = angleflag = dihedralflag = improperflag = 0; ellipsoidflag = lineflag = triflag = bodyflag = 0; @@ -492,14 +492,14 @@ void ReadData::command(int narg, char **arg) boxlo[0] = boxlo[1] = boxlo[2] = -0.5; boxhi[0] = boxhi[1] = boxhi[2] = 0.5; xy = xz = yz = 0.0; - + avec[0] = bvec[1] = cvec[2] = 1.0; avec[1] = avec[2] = 0.0; bvec[0] = bvec[2] = 0.0; cvec[0] = cvec[1] = 0.0; abc_origin[0] = abc_origin[1] = abc_origin[2] = 0.0; if (domain->dimension == 2) abc_origin[2] = -0.5; - + keyword[0] = '\0'; nlocal_previous = atom->nlocal; @@ -542,7 +542,7 @@ void ReadData::command(int narg, char **arg) "2d simulation with general triclinic box"); } } - + // problem setup using info from header // only done once, if firstpass and first data file // apply extra settings before grow(), even if no topology in file @@ -577,7 +577,7 @@ void ReadData::command(int narg, char **arg) if (!triclinic_general) { // orthogonal or restricted triclinic box - + domain->boxlo[0] = boxlo[0]; domain->boxhi[0] = boxhi[0]; domain->boxlo[1] = boxlo[1]; @@ -586,7 +586,7 @@ void ReadData::command(int narg, char **arg) domain->boxhi[2] = boxhi[2]; // restricted triclinic box - + if (triclinic) { domain->triclinic = 1; domain->xy = xy; @@ -597,7 +597,7 @@ void ReadData::command(int narg, char **arg) // general triclinic box // define_general_triclinic() converts // ABC edge vectors + abc_origin to restricted triclinic - + } else if (triclinic_general) { domain->define_general_triclinic(avec,bvec,cvec,abc_origin); } @@ -612,7 +612,7 @@ void ReadData::command(int narg, char **arg) // first data file must also be general triclinic // avec,bvec,vec and origin must match first data file // shift not allowed - + if (triclinic_general) { if (!domain->triclinic_general) error->all(FLERR,"Read_data subsequent file cannot switch to general triclinic"); @@ -633,14 +633,14 @@ void ReadData::command(int narg, char **arg) // restricted triclinic // tilt factors must match first data file - + } else if (triclinic) { if (!domain->triclinic || domain->triclinic_general) error->all(FLERR,"Read_data subsequent file cannot switch to restricted triclinic"); if (xy != domain->xy || xz != domain->xz || yz != domain->yz) error->all(FLERR,"Read_data subsequent file tilt factors must be same as first file"); } - + double oldboxlo[3] = {domain->boxlo[0], domain->boxlo[1], domain->boxlo[2]}; double oldboxhi[3] = {domain->boxhi[0], domain->boxhi[1], domain->boxhi[2]}; domain->boxlo[0] = MIN(domain->boxlo[0], boxlo[0] + shift[0]); @@ -652,7 +652,7 @@ void ReadData::command(int narg, char **arg) // check if box has changed // if yes, warn about non-zero image flags - + if ((oldboxlo[0] != domain->boxlo[0]) || (oldboxlo[1] != domain->boxlo[1]) || (oldboxlo[2] != domain->boxlo[2]) || (oldboxhi[0] != domain->boxhi[0]) || (oldboxhi[1] != domain->boxhi[1]) || (oldboxhi[2] != domain->boxhi[2])) { @@ -673,7 +673,7 @@ void ReadData::command(int narg, char **arg) } // setup simulation box and paritioning in Domain and Comm classes - + domain->print_box(" "); domain->set_initial_box(); domain->set_global_box(); @@ -1228,7 +1228,7 @@ void ReadData::header(int firstpass) // initialize type counts by the "extra" numbers so they get counted // in case the corresponding "types" line is missing and thus the extra // value will not be processed - + if (addflag == NONE) { atom->ntypes = extra_atom_types; atom->nbondtypes = extra_bond_types; @@ -1244,7 +1244,7 @@ void ReadData::header(int firstpass) if (eof == nullptr) error->one(FLERR, "Unexpected end of data file"); // check for units keyword in first line and print warning on mismatch - + auto units = Tokenizer(utils::strfind(line, "units = \\w+")).as_vector(); if (units.size() > 2) { if (units[2] != update->unit_style) @@ -1433,7 +1433,7 @@ void ReadData::header(int firstpass) xy = utils::numeric(FLERR, words[0], false, lmp); xz = utils::numeric(FLERR, words[1], false, lmp); yz = utils::numeric(FLERR, words[2], false, lmp); - + } else if (utils::strmatch(line, "^\\s*\\f+\\s+\\f+\\s+\\f+\\s+\\avec\\s")) { avec_flag = 1; avec[0] = utils::numeric(FLERR, words[0], false, lmp); @@ -1522,7 +1522,7 @@ void ReadData::atoms() if (eof) error->all(FLERR, "Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); - atom->data_atoms(nchunk, buffer, id_offset, mol_offset, toffset, + atom->data_atoms(nchunk, buffer, id_offset, mol_offset, toffset, shiftflag, shift, tlabelflag, lmap->lmap2lmap.atom, triclinic_general); nread += nchunk; } diff --git a/src/read_data.h b/src/read_data.h index 495c17d500..008283251c 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -64,12 +64,12 @@ class ReadData : public Command { int triclinic, triclinic_general; int xloxhi_flag, yloyhi_flag, zlozhi_flag, tilt_flag; int avec_flag, bvec_flag, cvec_flag, abc_origin_flag; - + double boxlo[3], boxhi[3]; double xy, xz, yz; double avec[3], bvec[3], cvec[3]; double abc_origin[3]; - + // optional args int addflag, offsetflag, shiftflag, coeffflag, settypeflag; diff --git a/src/thermo.cpp b/src/thermo.cpp index d791f5f856..76355849be 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -980,7 +980,7 @@ void Thermo::parse_fields(const std::string &str) addfield("Pxy", &Thermo::compute_pxy_triclinic_general, FLOAT); else addfield("Pxy", &Thermo::compute_pxy, FLOAT); index_press_vector = add_compute(id_press, VECTOR); - } else if (word == "pxz") { + } else if (word == "pxz") { if (triclinic_general) addfield("Pxz", &Thermo::compute_pxz_triclinic_general, FLOAT); else addfield("Pxz", &Thermo::compute_pxz, FLOAT); @@ -1223,7 +1223,7 @@ void Thermo::check_press_vector(const std::string &keyword) pressure->invoked_flag |= Compute::INVOKED_VECTOR; // store 3x3 matrix form of symmetric pressure tensor for use in triclinic_general() - + if (triclinic_general) { press_tensor[0][0] = pressure->vector[0]; press_tensor[1][1] = pressure->vector[1]; diff --git a/src/thermo.h b/src/thermo.h index 1829349b96..a82d462585 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -83,7 +83,7 @@ class Thermo : protected Pointers { std::string image_fname; // data used by routines that compute single values - + int ivalue; // integer value to print double dvalue; // double value to print bigint bivalue; // big integer value to print @@ -96,7 +96,7 @@ class Thermo : protected Pointers { // index = where they are in computes list // id = ID of Compute objects // Compute * = ptrs to the Compute objects - + int index_temp, index_press_scalar, index_press_vector, index_pe; class Compute *temperature, *pressure, *pe; double press_tensor[3][3]; diff --git a/src/write_data.cpp b/src/write_data.cpp index 06512a0f20..f9c9ec383f 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -74,7 +74,7 @@ void WriteData::command(int narg, char **arg) fixflag = 1; triclinic_general = 0; lmapflag = 1; - + // store current (default) setting since we may change it int domain_triclinic_general = domain->triclinic_general; @@ -227,9 +227,9 @@ void WriteData::write(const std::string &file) // reset internal per-atom data that needs rotation if (domain->triclinic_general) atom->avec->write_data_restricted_to_general(); - + // per atom info in Atoms and Velocities sections - + if (natoms) atoms(); if (natoms) velocities(); @@ -261,7 +261,7 @@ void WriteData::write(const std::string &file) // restore internal per-atom data that was rotated if (domain->triclinic_general) atom->avec->write_data_restore_restricted(); - + // close data file if (me == 0) fclose(fp); @@ -326,7 +326,7 @@ void WriteData::header() domain->boxlo[2],domain->boxhi[2]); if (domain->triclinic) fmt::print(fp,"{} {} {} xy xz yz\n",domain->xy,domain->xz,domain->yz); - + } else if (domain->triclinic_general) { fmt::print(fp,"\n{} {} {} avec\n{} {} {} bvec\n{} {} {} cvec\n", domain->avec[0],domain->avec[1],domain->avec[2], diff --git a/src/write_restart.cpp b/src/write_restart.cpp index ae5cfa5a3b..4c7835fa40 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -451,7 +451,7 @@ void WriteRestart::header() write_int(TRICLINIC_GENERAL,domain->triclinic_general); if (domain->triclinic_general) write_double_vec(ROTATE_G2R,9,&domain->rotate_g2r[0][0]); - + write_double_vec(SPECIAL_LJ,3,&force->special_lj[1]); write_double_vec(SPECIAL_COUL,3,&force->special_coul[1]);