diff --git a/doc/src/Eqs/pair_lj_sf.jpg b/doc/src/Eqs/pair_lj_sf.jpg deleted file mode 100644 index a702240003..0000000000 Binary files a/doc/src/Eqs/pair_lj_sf.jpg and /dev/null differ diff --git a/doc/src/Eqs/pair_lj_sf.tex b/doc/src/Eqs/pair_lj_sf.tex deleted file mode 100644 index e78e2ca75f..0000000000 --- a/doc/src/Eqs/pair_lj_sf.tex +++ /dev/null @@ -1,11 +0,0 @@ -\documentclass[12pt]{article} - -\begin{document} - -\begin{eqnarray*} - F & = & F_{\mathrm{LJ}}(r) - F_{\mathrm{LJ}}(r_{\mathrm{c}}) \qquad r < r_{\mathrm{c}} \\ - E & = & E_{\mathrm{LJ}}(r) - E_{\mathrm{LJ}}(r_{\mathrm{c}}) + (r - r_{\mathrm{c}}) F_{\mathrm{LJ}}(r_{\mathrm{c}}) \qquad r < r_{\mathrm{c}} \\ - \mathrm{with} \qquad E_{\mathrm{LJ}}(r) & = & 4 \epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^6 \right] \qquad \mathrm{and} \qquad F_{\mathrm{LJ}}(r) = - E^\prime_{\mathrm{LJ}}(r) -\end{eqnarray*} - -\end{document} diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index 71f10d240f..8aa5bdec2e 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -1039,7 +1039,6 @@ package"_Section_start.html#start_3. "lj/sdk (gko)"_pair_sdk.html, "lj/sdk/coul/long (go)"_pair_sdk.html, "lj/sdk/coul/msm (o)"_pair_sdk.html, -"lj/sf (o)"_pair_lj_sf.html, "meam/spline (o)"_pair_meam_spline.html, "meam/sw/spline"_pair_meam_sw_spline.html, "mgpt"_pair_mgpt.html, diff --git a/doc/src/Section_packages.txt b/doc/src/Section_packages.txt index 710b960e94..14b2c0baa3 100644 --- a/doc/src/Section_packages.txt +++ b/doc/src/Section_packages.txt @@ -2027,8 +2027,8 @@ algorithm to formulate single-particle constraint functions g(xi,yi,zi) = 0 and their derivative (i.e. the normal of the manifold) n = grad(g). -[Author:] Stefan Paquay (Eindhoven University of Technology (TU/e), The -Netherlands) +[Author:] Stefan Paquay (until 2017: Eindhoven University of Technology (TU/e), The +Netherlands; since 2017: Brandeis University, Waltham, MA, USA) [Install or un-install:] diff --git a/doc/src/fix_adapt.txt b/doc/src/fix_adapt.txt index d7c32bef3d..19d1009b8a 100644 --- a/doc/src/fix_adapt.txt +++ b/doc/src/fix_adapt.txt @@ -47,7 +47,7 @@ keyword = {scale} or {reset} :l fix 1 all adapt 1 pair soft a 1 1 v_prefactor fix 1 all adapt 1 pair soft a 2* 3 v_prefactor fix 1 all adapt 1 pair lj/cut epsilon * * v_scale1 coul/cut scale 3 3 v_scale2 scale yes reset yes -fix 1 all adapt 10 atom diameter v_size +fix 1 all adapt 10 atom diameter v_size :pre variable ramp_up equal "ramp(0.01,0.5)" fix stretch all adapt 1 bond harmonic r0 1 v_ramp_up :pre diff --git a/doc/src/fix_deform.txt b/doc/src/fix_deform.txt index 8c3a9fa499..d3254eece6 100644 --- a/doc/src/fix_deform.txt +++ b/doc/src/fix_deform.txt @@ -565,8 +565,10 @@ more instructions on how to use the accelerated styles effectively. [Restart, fix_modify, output, run start/stop, minimize info:] -No information about this fix is written to "binary restart -files"_restart.html. None of the "fix_modify"_fix_modify.html options +This fix will restore the initial box settings from "binary restart +files"_restart.html, which allows the fix to be properly continue +deformation, when using the start/stop options of the "run"_run.html +command. None of the "fix_modify"_fix_modify.html options are relevant to this fix. No global or per-atom quantities are stored by this fix for access by various "output commands"_Section_howto.html#howto_15. diff --git a/doc/src/lammps.book b/doc/src/lammps.book index 79ff5b4a75..d901ef3f77 100644 --- a/doc/src/lammps.book +++ b/doc/src/lammps.book @@ -447,7 +447,6 @@ pair_lj96.html pair_lj_cubic.html pair_lj_expand.html pair_lj_long.html -pair_lj_sf.html pair_lj_smooth.html pair_lj_smooth_linear.html pair_lj_soft.html diff --git a/doc/src/pair_lj_sf.txt b/doc/src/pair_lj_sf.txt deleted file mode 100644 index 65e28b6f51..0000000000 --- a/doc/src/pair_lj_sf.txt +++ /dev/null @@ -1,114 +0,0 @@ -"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c - -:link(lws,http://lammps.sandia.gov) -:link(ld,Manual.html) -:link(lc,Section_commands.html#comm) - -:line - -pair_style lj/sf command :h3 -pair_style lj/sf/omp command :h3 - -[Syntax:] - -pair_style lj/sf cutoff :pre - -cutoff = global cutoff for Lennard-Jones interactions (distance units) :ul - -[Examples:] - -pair_style lj/sf 2.5 -pair_coeff * * 1.0 1.0 -pair_coeff 1 1 1.0 1.0 3.0 :pre - -[Description:] - -Style {lj/sf} computes a truncated and force-shifted LJ interaction -(Shifted Force Lennard-Jones), so that both the potential and the -force go continuously to zero at the cutoff "(Toxvaerd)"_#Toxvaerd: - -:c,image(Eqs/pair_lj_sf.jpg) - -The following coefficients must be defined for each pair of atoms -types via the "pair_coeff"_pair_coeff.html command as in the examples -above, or in the data file or restart files read by the -"read_data"_read_data.html or "read_restart"_read_restart.html -commands, or by mixing as described below: - -epsilon (energy units) -sigma (distance units) -cutoff (distance units) :ul - -The last coefficient is optional. If not specified, the global -LJ cutoff specified in the pair_style command is used. - -:line - -Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are -functionally the same as the corresponding style without the suffix. -They have been optimized to run faster, depending on your available -hardware, as discussed in "Section 5"_Section_accelerate.html -of the manual. The accelerated styles take the same arguments and -should produce the same results, except for round-off and precision -issues. - -These accelerated styles are part of the GPU, USER-INTEL, KOKKOS, -USER-OMP and OPT packages, respectively. They are only enabled if -LAMMPS was built with those packages. See the "Making -LAMMPS"_Section_start.html#start_3 section for more info. - -You can specify the accelerated styles explicitly in your input script -by including their suffix, or you can use the "-suffix command-line -switch"_Section_start.html#start_7 when you invoke LAMMPS, or you can -use the "suffix"_suffix.html command in your input script. - -See "Section 5"_Section_accelerate.html of the manual for -more instructions on how to use the accelerated styles effectively. - -:line - -[Mixing, shift, table, tail correction, restart, rRESPA info]: - -For atom type pairs I,J and I != J, the epsilon and sigma -coefficients and cutoff distance for this pair style can be mixed. -Rin is a cutoff value and is mixed like the cutoff. The -default mix value is {geometric}. See the "pair_modify" command for -details. - -The "pair_modify"_pair_modify.html shift option is not relevant for -this pair style, since the pair interaction goes to 0.0 at the cutoff. - -The "pair_modify"_pair_modify.html table option is not relevant -for this pair style. - -This pair style does not support the "pair_modify"_pair_modify.html -tail option for adding long-range tail corrections to energy and -pressure, since the energy of the pair interaction is smoothed to 0.0 -at the cutoff. - -This pair style writes its information to "binary restart -files"_restart.html, so pair_style and pair_coeff commands do not need -to be specified in an input script that reads a restart file. - -This pair style can only be used via the {pair} keyword of the -"run_style respa"_run_style.html command. It does not support the -{inner}, {middle}, {outer} keywords. - -:line - -[Restrictions:] - -This pair style is part of the USER-MISC package. It is only enabled -if LAMMPS was built with that package. See the "Making -LAMMPS"_Section_start.html#start_3 section for more info. - -[Related commands:] - -"pair_coeff"_pair_coeff.html - -[Default:] none - -:line - -:link(Toxvaerd) -[(Toxvaerd)] Toxvaerd, Dyre, J Chem Phys, 134, 081102 (2011). diff --git a/doc/src/pair_lj_smooth_linear.txt b/doc/src/pair_lj_smooth_linear.txt index 8b9b9aa5fa..5721b02eb3 100644 --- a/doc/src/pair_lj_smooth_linear.txt +++ b/doc/src/pair_lj_smooth_linear.txt @@ -11,26 +11,26 @@ pair_style lj/smooth/linear/omp command :h3 [Syntax:] -pair_style lj/smooth/linear Rc :pre +pair_style lj/smooth/linear cutoff :pre -Rc = cutoff for lj/smooth/linear interactions (distance units) :ul +cutoff = global cutoff for Lennard-Jones interactions (distance units) :ul [Examples:] -pair_style lj/smooth/linear 5.456108274435118 -pair_coeff * * 0.7242785984051078 2.598146797350056 -pair_coeff 1 1 20.0 1.3 9.0 :pre +pair_style lj/smooth/linear 2.5 +pair_coeff * * 1.0 1.0 +pair_coeff 1 1 0.3 3.0 9.0 :pre [Description:] -Style {lj/smooth/linear} computes a LJ interaction that combines the -standard 12/6 Lennard-Jones function and subtracts a linear term that -includes the cutoff distance Rc, as in this formula: +Style {lj/smooth/linear} computes a truncated and force-shifted LJ +interaction (aka Shifted Force Lennard-Jones) that combines the +standard 12/6 Lennard-Jones function and subtracts a linear term based +on the cutoff distance, so that both, the potential and the force, go +continuously to zero at the cutoff Rc "(Toxvaerd)"_#Toxvaerd: :c,image(Eqs/pair_lj_smooth_linear.jpg) -At the cutoff Rc, the energy and force (its 1st derivative) will be 0.0. - The following coefficients must be defined for each pair of atoms types via the "pair_coeff"_pair_coeff.html command as in the examples above, or in the data file or restart files read by the @@ -41,8 +41,8 @@ epsilon (energy units) sigma (distance units) cutoff (distance units) :ul -The last coefficient is optional. If not specified, the global value -for Rc is used. +The last coefficient is optional. If not specified, the global +LJ cutoff specified in the pair_style command is used. :line @@ -76,10 +76,11 @@ and cutoff distance can be mixed. The default mix value is geometric. See the "pair_modify" command for details. This pair style does not support the "pair_modify"_pair_modify.html -shift option for the energy of the pair interaction. +shift option for the energy of the pair interaction, since it goes +to 0.0 at the cutoff by construction. -The "pair_modify"_pair_modify.html table option is not relevant for -this pair style. +The "pair_modify"_pair_modify.html table option is not relevant +for this pair style. This pair style does not support the "pair_modify"_pair_modify.html tail option for adding long-range tail corrections to energy and diff --git a/doc/src/pairs.txt b/doc/src/pairs.txt index 538e2a7268..2c1b20f4d3 100644 --- a/doc/src/pairs.txt +++ b/doc/src/pairs.txt @@ -49,7 +49,6 @@ Pair Styles :h1 pair_lj_cubic pair_lj_expand pair_lj_long - pair_lj_sf pair_lj_smooth pair_lj_smooth_linear pair_lj_soft diff --git a/doc/src/set.txt b/doc/src/set.txt index 6b59bf1332..14460c9741 100644 --- a/doc/src/set.txt +++ b/doc/src/set.txt @@ -80,6 +80,7 @@ keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \ value can be an atom-style variable (see below) {image} nx ny nz nx,ny,nz = which periodic image of the simulation box the atom is in + any of nx,ny,nz can be an atom-style variable (see below) {bond} value = bond type for all bonds between selected atoms {angle} value = angle type for all angles between selected atoms {dihedral} value = dihedral type for all dihedrals between selected atoms @@ -363,9 +364,8 @@ A value of -1 means subtract 1 box length to get the true value. LAMMPS updates these flags as atoms cross periodic boundaries during the simulation. The flags can be output with atom snapshots via the "dump"_dump.html command. If a value of NULL is specified for any of -nx,ny,nz, then the current image value for that dimension is -unchanged. For non-periodic dimensions only a value of 0 can be -specified. This keyword does not allow use of atom-style variables. +nx,ny,nz, then the current image value for that dimension is unchanged. +For non-periodic dimensions only a value of 0 can be specified. This command can be useful after a system has been equilibrated and atoms have diffused one or more box lengths in various directions. This command can then reset the image values for atoms so that they diff --git a/doc/src/special_bonds.txt b/doc/src/special_bonds.txt index 6924b321a0..6a661015bd 100644 --- a/doc/src/special_bonds.txt +++ b/doc/src/special_bonds.txt @@ -65,7 +65,13 @@ sense to define permanent bonds between atoms that interact via these potentials, though such bonds may exist elsewhere in your system, e.g. when using the "pair_style hybrid"_pair_hybrid.html command. Thus LAMMPS ignores special_bonds settings when manybody potentials -are calculated. +are calculated. Please note, that the existence of explicit bonds +for atoms that are described by a manybody potential will alter the +neigborlist and thus can render the computation of those interactions +invalid, since those pairs are not only used to determine direct +pairwise interactions but also neighbors of neighbors and more. +The recommended course of action is to remove such bonds, or - if +that is not possible - use a special bonds setting of 1.0 1.0 1.0. NOTE: Unlike some commands in LAMMPS, you cannot use this command multiple times in an incremental fashion: e.g. to first set the LJ diff --git a/lib/meam/meam_dens_final.F b/lib/meam/meam_dens_final.F index 92195dcaf4..cdc47067e2 100644 --- a/lib/meam/meam_dens_final.F +++ b/lib/meam/meam_dens_final.F @@ -98,13 +98,14 @@ c Complete the calculation of density call G_gam(Gamma(i),ibar_meam(elti), $ gsmooth_factor,G,errorflag) if (errorflag.ne.0) return + call get_shpfcn(shp,lattce_meam(elti,elti)) if (ibar_meam(elti).le.0) then Gbar = 1.d0 + dGbar = 0.d0 else - call get_shpfcn(shp,lattce_meam(elti,elti)) if (mix_ref_t.eq.1) then - gam = (t_ave(1,i)*shpi(1)+t_ave(2,i)*shpi(2) - $ +t_ave(3,i)*shpi(3))/(Z*Z) + gam = (t_ave(1,i)*shp(1)+t_ave(2,i)*shp(2) + $ +t_ave(3,i)*shp(3))/(Z*Z) else gam = (t1_meam(elti)*shp(1)+t2_meam(elti)*shp(2) $ +t3_meam(elti)*shp(3))/(Z*Z) @@ -119,9 +120,8 @@ c Complete the calculation of density Gbar = 1.d0 dGbar = 0.d0 else - call get_shpfcn(shpi,lattce_meam(elti,elti)) - gam = (t_ave(1,i)*shpi(1)+t_ave(2,i)*shpi(2) - $ +t_ave(3,i)*shpi(3))/(Z*Z) + gam = (t_ave(1,i)*shp(1)+t_ave(2,i)*shp(2) + $ +t_ave(3,i)*shp(3))/(Z*Z) call dG_gam(gam,ibar_meam(elti),gsmooth_factor, $ Gbar,dGbar) endif diff --git a/src/.gitignore b/src/.gitignore index d6c535ebe9..3bdf64a4cb 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -740,8 +740,6 @@ /pair_lj_sdk_coul_long.h /pair_lj_sdk_coul_msm.cpp /pair_lj_sdk_coul_msm.h -/pair_lj_sf.cpp -/pair_lj_sf.h /pair_lj_sf_dipole_sf.cpp /pair_lj_sf_dipole_sf.h /pair_lubricateU.cpp diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 3614a82cfe..b7b550369d 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -287,12 +287,12 @@ int NeighborKokkosExecute::exclusion(const int &i,const int &j, if (nex_mol) { for (m = 0; m < nex_mol; m++) - if (ex_mol_intra[m]) { // intra-chain: exclude i-j pair if on same molecule + if (ex_mol_intra[m]) { // intra-chain: exclude i-j pair if on same molecule if (mask[i] & ex_mol_bit[m] && mask[j] & ex_mol_bit[m] && - molecule[i] == molecule[j]) return 1; - } else // exclude i-j pair if on different molecules - if (mask[i] & ex_mol_bit[m] && mask[j] & ex_mol_bit[m] && - molecule[i] != molecule[j]) return 1; + molecule[i] == molecule[j]) return 1; + } else // exclude i-j pair if on different molecules + if (mask[i] & ex_mol_bit[m] && mask[j] & ex_mol_bit[m] && + molecule[i] != molecule[j]) return 1; } return 0; diff --git a/src/KOKKOS/npair_kokkos.h b/src/KOKKOS/npair_kokkos.h index 52cdfe0d53..8e81c57618 100644 --- a/src/KOKKOS/npair_kokkos.h +++ b/src/KOKKOS/npair_kokkos.h @@ -385,7 +385,7 @@ struct NPairKokkosBuildFunctor { } #ifdef KOKKOS_HAVE_CUDA __device__ inline - + void operator() (typename Kokkos::TeamPolicy::member_type dev) const { c.template build_ItemCuda(dev); } diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index e0a269b88c..fbe6b6bb62 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -501,7 +501,7 @@ void FixGCMC::init() if (ifix < 0) error->all(FLERR,"Fix gcmc rigid fix does not exist"); fixrigid = modify->fix[ifix]; int tmp; - if (onemols != (Molecule **) fixrigid->extract("onemol",tmp)) + if (&onemols[imol] != (Molecule **) fixrigid->extract("onemol",tmp)) error->all(FLERR, "Fix gcmc and fix rigid/small not using " "same molecule template ID"); @@ -516,7 +516,7 @@ void FixGCMC::init() if (ifix < 0) error->all(FLERR,"Fix gcmc shake fix does not exist"); fixshake = modify->fix[ifix]; int tmp; - if (onemols != (Molecule **) fixshake->extract("onemol",tmp)) + if (&onemols[imol] != (Molecule **) fixshake->extract("onemol",tmp)) error->all(FLERR,"Fix gcmc and fix shake not using " "same molecule template ID"); } @@ -1397,12 +1397,13 @@ void FixGCMC::attempt_molecule_insertion() // FixRigidSmall::set_molecule stores rigid body attributes // FixShake::set_molecule stores shake info for molecule - - if (rigidflag) - fixrigid->set_molecule(nlocalprev,maxtag_all,imol,com_coord,vnew,quat); - else if (shakeflag) - fixshake->set_molecule(nlocalprev,maxtag_all,imol,com_coord,vnew,quat); + for (int submol = 0; submol < nmol; ++submol) { + if (rigidflag) + fixrigid->set_molecule(nlocalprev,maxtag_all,submol,com_coord,vnew,quat); + else if (shakeflag) + fixshake->set_molecule(nlocalprev,maxtag_all,submol,com_coord,vnew,quat); + } atom->natoms += natoms_per_molecule; if (atom->natoms < 0) error->all(FLERR,"Too many total atoms"); @@ -2058,11 +2059,12 @@ void FixGCMC::attempt_molecule_insertion_full() // FixRigidSmall::set_molecule stores rigid body attributes // FixShake::set_molecule stores shake info for molecule - if (rigidflag) - fixrigid->set_molecule(nlocalprev,maxtag_all,imol,com_coord,vnew,quat); - else if (shakeflag) - fixshake->set_molecule(nlocalprev,maxtag_all,imol,com_coord,vnew,quat); - + for (int submol = 0; submol < nmol; ++submol) { + if (rigidflag) + fixrigid->set_molecule(nlocalprev,maxtag_all,submol,com_coord,vnew,quat); + else if (shakeflag) + fixshake->set_molecule(nlocalprev,maxtag_all,submol,com_coord,vnew,quat); + } atom->natoms += natoms_per_molecule; if (atom->natoms < 0) error->all(FLERR,"Too many total atoms"); diff --git a/src/Purge.list b/src/Purge.list index 3bdfed3ed0..340b210b20 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -16,6 +16,11 @@ style_region.h style_neigh_bin.h style_neigh_pair.h style_neigh_stencil.h +# deleted on 6 June 2017 +pair_lj_sf.cpp +pair_lj_sf.h +pair_lj_sf_omp.cpp +pair_lj_sf_omp.h # deleted on 4 May 2017 dump_custom_vtk.cpp dump_custom_vtk.h diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 83022cbcba..d0c931a466 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -50,7 +50,7 @@ enum{ISO,ANISO,TRICLINIC}; #define EPSILON 1.0e-7 #define SINERTIA 0.4 // moment of inertia prefactor for sphere -#define EINERTIA 0.4 // moment of inertia prefactor for ellipsoid +#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid #define LINERTIA (1.0/12.0) // moment of inertia prefactor for line segment /* ---------------------------------------------------------------------- */ diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index f40b52e162..db56e54c23 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -54,7 +54,7 @@ FixRigidSmall *FixRigidSmall::frsptr; #define BIG 1.0e20 #define SINERTIA 0.4 // moment of inertia prefactor for sphere -#define EINERTIA 0.4 // moment of inertia prefactor for ellipsoid +#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid #define LINERTIA (1.0/12.0) // moment of inertia prefactor for line segment #define DELTA_BODY 10000 @@ -1047,7 +1047,7 @@ int FixRigidSmall::dof(int tgroup) j = atom2body[i]; counts[j][2]++; if (mask[i] & tgroupbit) { - if (extended && eflags[i]) counts[j][1]++; + if (extended && (eflags[i] & ~(POINT | DIPOLE))) counts[j][1]++; else counts[j][0]++; } } diff --git a/src/USER-INTEL/nbin_intel.cpp b/src/USER-INTEL/nbin_intel.cpp index 194b9a5f97..c3335b2c26 100644 --- a/src/USER-INTEL/nbin_intel.cpp +++ b/src/USER-INTEL/nbin_intel.cpp @@ -55,7 +55,7 @@ NBinIntel::~NBinIntel() { nocopy(binhead,bins,_atombin,_binpacked:alloc_if(0) free_if(1)) } #endif -} +} /* ---------------------------------------------------------------------- setup for bin_atoms() @@ -71,7 +71,7 @@ void NBinIntel::bin_atoms_setup(int nall) if (_offload_alloc) { const int * binhead = this->binhead; #pragma offload_transfer target(mic:_cop) \ - nocopy(binhead:alloc_if(0) free_if(1)) + nocopy(binhead:alloc_if(0) free_if(1)) } #endif @@ -99,7 +99,7 @@ void NBinIntel::bin_atoms_setup(int nall) const int * _atombin = this->_atombin; const int * _binpacked = this->_binpacked; #pragma offload_transfer target(mic:_cop) \ - nocopy(bins,_atombin,_binpacked:alloc_if(0) free_if(1)) + nocopy(bins,_atombin,_binpacked:alloc_if(0) free_if(1)) } #endif memory->destroy(bins); @@ -157,10 +157,10 @@ void NBinIntel::bin_atoms(IntelBuffers * buffers) { const flt_t dx = (INTEL_BIGP - bboxhi[0]); const flt_t dy = (INTEL_BIGP - bboxhi[1]); const flt_t dz = (INTEL_BIGP - bboxhi[2]); - if (dx * dx + dy * dy + dz * dz < - static_cast(neighbor->cutneighmaxsq)) + if (dx * dx + dy * dy + dz * dz < + static_cast(neighbor->cutneighmaxsq)) error->one(FLERR, - "Intel package expects no atoms within cutoff of {1e15,1e15,1e15}."); + "Intel package expects no atoms within cutoff of {1e15,1e15,1e15}."); } // ---------- Grow and cast/pack buffers ------------- @@ -181,7 +181,7 @@ void NBinIntel::bin_atoms(IntelBuffers * buffers) { { int ifrom, ito, tid; IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, - sizeof(ATOM_T)); + sizeof(ATOM_T)); buffers->thr_pack(ifrom, ito, 0); } _fix->stop_watch(TIME_PACK); diff --git a/src/USER-INTEL/npair_full_bin_intel.cpp b/src/USER-INTEL/npair_full_bin_intel.cpp index 1ec93bf113..7e0d2abdcb 100644 --- a/src/USER-INTEL/npair_full_bin_intel.cpp +++ b/src/USER-INTEL/npair_full_bin_intel.cpp @@ -70,12 +70,12 @@ fbi(NeighList *list, IntelBuffers *buffers) { #endif buffers->grow_list(list, atom->nlocal, comm->nthreads, off_end, - _fix->nbor_pack_width()); + _fix->nbor_pack_width()); int need_ic = 0; if (atom->molecular) dminimum_image_check(need_ic, neighbor->cutneighmax, neighbor->cutneighmax, - neighbor->cutneighmax); + neighbor->cutneighmax); #ifdef _LMP_INTEL_OFFLOAD if (need_ic) { @@ -167,7 +167,7 @@ fbi(const int offload, NeighList *list, IntelBuffers *buffers, overflow = _fix->get_off_overflow_flag(); _fix->stop_watch(TIME_HOST_NEIGHBOR); _fix->start_watch(TIME_OFFLOAD_LATENCY); - } else + } else #endif { tnum = comm->nthreads; @@ -255,8 +255,8 @@ fbi(const int offload, NeighList *list, IntelBuffers *buffers, ito += astart; int e_ito = ito; if (ito == num) { - int imod = ito % pack_width; - if (imod) e_ito += pack_width - imod; + int imod = ito % pack_width; + if (imod) e_ito += pack_width - imod; } const int list_size = (e_ito + tid * 2 + 2) * maxnbors; int which; @@ -276,91 +276,91 @@ fbi(const int offload, NeighList *list, IntelBuffers *buffers, const int ioffset = ntypes * itype; const int ibin = atombin[i]; - int raw_count = pack_offset; + int raw_count = pack_offset; // loop over all atoms in surrounding bins in stencil including self // skip i = j - if (exclude) { - for (int k = 0; k < nstencilp; k++) { - const int bstart = binhead[ibin + binstart[k]]; - const int bend = binhead[ibin + binend[k]]; + if (exclude) { + for (int k = 0; k < nstencilp; k++) { + const int bstart = binhead[ibin + binstart[k]]; + const int bend = binhead[ibin + binend[k]]; #ifndef _LMP_INTEL_OFFLOAD - #ifdef INTEL_VMASK + #ifdef INTEL_VMASK #pragma simd - #endif #endif - for (int jj = bstart; jj < bend; jj++) { - int j = binpacked[jj]; + #endif + for (int jj = bstart; jj < bend; jj++) { + int j = binpacked[jj]; + + if (i == j) j=e_nall; - if (i == j) j=e_nall; - #ifdef _LMP_INTEL_OFFLOAD - if (offload_noghost) { + if (offload_noghost) { if (j < nlocal) { if (i < offload_end) continue; } else if (offload) continue; } - #endif + #endif #ifndef _LMP_INTEL_OFFLOAD - const int jtype = x[j].w; - if (exclusion(i,j,itype,jtype,mask,molecule)) continue; - #endif + const int jtype = x[j].w; + if (exclusion(i,j,itype,jtype,mask,molecule)) continue; + #endif - neighptr[raw_count++] = j; + neighptr[raw_count++] = j; } } - } else { - for (int k = 0; k < nstencilp; k++) { - const int bstart = binhead[ibin + binstart[k]]; - const int bend = binhead[ibin + binend[k]]; + } else { + for (int k = 0; k < nstencilp; k++) { + const int bstart = binhead[ibin + binstart[k]]; + const int bend = binhead[ibin + binend[k]]; #ifndef _LMP_INTEL_OFFLOAD - #ifdef INTEL_VMASK + #ifdef INTEL_VMASK #pragma simd #endif #endif - for (int jj = bstart; jj < bend; jj++) { - int j = binpacked[jj]; + for (int jj = bstart; jj < bend; jj++) { + int j = binpacked[jj]; + + if (i == j) j=e_nall; - if (i == j) j=e_nall; - #ifdef _LMP_INTEL_OFFLOAD - if (offload_noghost) { + if (offload_noghost) { if (j < nlocal) { if (i < offload_end) continue; } else if (offload) continue; } - #endif + #endif - neighptr[raw_count++] = j; + neighptr[raw_count++] = j; } } - } + } - if (raw_count > obound) *overflow = 1; + if (raw_count > obound) *overflow = 1; #if defined(LMP_SIMD_COMPILER) - #ifdef _LMP_INTEL_OFFLOAD - int vlmin = lmin, vlmax = lmax, vgmin = gmin, vgmax = gmax; - #if __INTEL_COMPILER+0 > 1499 - #pragma vector aligned + #ifdef _LMP_INTEL_OFFLOAD + int vlmin = lmin, vlmax = lmax, vgmin = gmin, vgmax = gmax; + #if __INTEL_COMPILER+0 > 1499 + #pragma vector aligned #pragma simd reduction(max:vlmax,vgmax) reduction(min:vlmin, vgmin) - #endif - #else - #pragma vector aligned + #endif + #else + #pragma vector aligned #pragma simd - #endif - #endif - for (int u = pack_offset; u < raw_count; u++) { + #endif + #endif + for (int u = pack_offset; u < raw_count; u++) { int j = neighptr[u]; const flt_t delx = xtmp - x[j].x; const flt_t dely = ytmp - x[j].y; const flt_t delz = ztmp - x[j].z; const int jtype = x[j].w; const flt_t rsq = delx * delx + dely * dely + delz * delz; - if (rsq > cutneighsq[ioffset + jtype]) - neighptr[u] = e_nall; - else { + if (rsq > cutneighsq[ioffset + jtype]) + neighptr[u] = e_nall; + else { if (need_ic) { int no_special; ominimum_image_check(no_special, delx, dely, delz); @@ -376,73 +376,73 @@ fbi(const int offload, NeighList *list, IntelBuffers *buffers, if (j > vgmax) vgmax = j; } #endif - } - } + } + } #ifdef _LMP_INTEL_OFFLOAD - lmin = MIN(lmin,vlmin); - gmin = MIN(gmin,vgmin); - lmax = MAX(lmax,vlmax); - gmax = MAX(gmax,vgmax); + lmin = MIN(lmin,vlmin); + gmin = MIN(gmin,vgmin); + lmax = MAX(lmax,vlmax); + gmax = MAX(gmax,vgmax); #endif int n = lane, n2 = pack_offset; - for (int u = pack_offset; u < raw_count; u++) { - const int j = neighptr[u]; - int pj = j; - if (pj < e_nall) { - if (need_ic) - if (pj < 0) pj = -pj - 1; - - const int jtag = tag[pj]; - int flist = 0; - if (itag > jtag) { - if ((itag+jtag) % 2 == 0) flist = 1; - } else if (itag < jtag) { - if ((itag+jtag) % 2 == 1) flist = 1; - } else { + for (int u = pack_offset; u < raw_count; u++) { + const int j = neighptr[u]; + int pj = j; + if (pj < e_nall) { + if (need_ic) + if (pj < 0) pj = -pj - 1; + + const int jtag = tag[pj]; + int flist = 0; + if (itag > jtag) { + if ((itag+jtag) % 2 == 0) flist = 1; + } else if (itag < jtag) { + if ((itag+jtag) % 2 == 1) flist = 1; + } else { if (x[pj].z < ztmp) flist = 1; - else if (x[pj].z == ztmp && x[pj].y < ytmp) flist = 1; - else if (x[pj].z == ztmp && x[pj].y == ytmp && x[pj].x < xtmp) - flist = 1; - } - if (flist) { - neighptr[n2++] = j; - } else { - neighptr[n] = j; - n += pack_width; - } + else if (x[pj].z == ztmp && x[pj].y < ytmp) flist = 1; + else if (x[pj].z == ztmp && x[pj].y == ytmp && x[pj].x < xtmp) + flist = 1; + } + if (flist) { + neighptr[n2++] = j; + } else { + neighptr[n] = j; + n += pack_width; + } } } - int ns = (n - lane) / pack_width; - atombin[i] = ns; - for (int u = pack_offset; u < n2; u++) { - neighptr[n] = neighptr[u]; - n += pack_width; - } + int ns = (n - lane) / pack_width; + atombin[i] = ns; + for (int u = pack_offset; u < n2; u++) { + neighptr[n] = neighptr[u]; + n += pack_width; + } ilist[i] = i; cnumneigh[i] = ct + lane; - ns += n2 - pack_offset; + ns += n2 - pack_offset; numneigh[i] = ns; - if (ns > max_chunk) max_chunk = ns; - lane++; - if (lane == pack_width) { - ct += max_chunk * pack_width; - const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); - const int edge = (ct % alignb); - if (edge) ct += alignb - edge; - neighptr = firstneigh + ct; - max_chunk = 0; - pack_offset = maxnbors * pack_width; - lane = 0; - if (ct + obound > list_size) { - if (i < ito - 1) { - *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; - } + if (ns > max_chunk) max_chunk = ns; + lane++; + if (lane == pack_width) { + ct += max_chunk * pack_width; + const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); + const int edge = (ct % alignb); + if (edge) ct += alignb - edge; + neighptr = firstneigh + ct; + max_chunk = 0; + pack_offset = maxnbors * pack_width; + lane = 0; + if (ct + obound > list_size) { + if (i < ito - 1) { + *overflow = 1; + ct = (ifrom + tid * 2) * maxnbors; + } } - } + } } if (*overflow == 1) @@ -482,13 +482,13 @@ fbi(const int offload, NeighList *list, IntelBuffers *buffers, int * _noalias jlist = firstneigh + cnumneigh[i]; const int jnum = numneigh[i]; - const int trip = jnum * pack_width; + const int trip = jnum * pack_width; for (int jj = 0; jj < trip; jj+=pack_width) { const int j = jlist[jj]; - if (need_ic && j < 0) { - which = 0; - jlist[jj] = -j - 1; - } else + if (need_ic && j < 0) { + which = 0; + jlist[jj] = -j - 1; + } else ofind_special(which, special, nspecial, i, tag[j]); #ifdef _LMP_INTEL_OFFLOAD if (j >= nlocal) { @@ -511,9 +511,9 @@ fbi(const int offload, NeighList *list, IntelBuffers *buffers, int jj = 0; for (jj = 0; jj < jnum; jj++) { if (jlist[jj] >= nlocal) { - if (jlist[jj] == e_nall) jlist[jj] = nall_offset; - else jlist[jj] -= ghost_offset; - } + if (jlist[jj] == e_nall) jlist[jj] = nall_offset; + else jlist[jj] -= ghost_offset; + } } } } diff --git a/src/USER-INTEL/npair_full_bin_intel.h b/src/USER-INTEL/npair_full_bin_intel.h index 608bd0f5dd..f1be71abbc 100644 --- a/src/USER-INTEL/npair_full_bin_intel.h +++ b/src/USER-INTEL/npair_full_bin_intel.h @@ -15,7 +15,7 @@ NPairStyle(full/bin/intel, NPairFullBinIntel, - NP_FULL | NP_BIN | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | + NP_FULL | NP_BIN | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_INTEL) #else @@ -38,7 +38,7 @@ class NPairFullBinIntel : public NPairIntel { void fbi(NeighList *, IntelBuffers *); template void fbi(const int, NeighList *, IntelBuffers *, const int, - const int, const int offload_end = 0); + const int, const int offload_end = 0); }; } diff --git a/src/USER-INTEL/npair_half_bin_newtoff_intel.cpp b/src/USER-INTEL/npair_half_bin_newtoff_intel.cpp index 1fcc3f0759..9a40e2a07c 100644 --- a/src/USER-INTEL/npair_half_bin_newtoff_intel.cpp +++ b/src/USER-INTEL/npair_half_bin_newtoff_intel.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalfBinNewtoffIntel::NPairHalfBinNewtoffIntel(LAMMPS *lmp) : +NPairHalfBinNewtoffIntel::NPairHalfBinNewtoffIntel(LAMMPS *lmp) : NPairIntel(lmp) {} /* ---------------------------------------------------------------------- @@ -75,7 +75,7 @@ hbnni(NeighList *list, IntelBuffers *buffers) { int need_ic = 0; if (atom->molecular) dminimum_image_check(need_ic, neighbor->cutneighmax, neighbor->cutneighmax, - neighbor->cutneighmax); + neighbor->cutneighmax); #ifdef _LMP_INTEL_OFFLOAD if (need_ic) { @@ -159,7 +159,7 @@ hbnni(const int offload, NeighList *list, IntelBuffers *buffers, overflow = _fix->get_off_overflow_flag(); _fix->stop_watch(TIME_HOST_NEIGHBOR); _fix->start_watch(TIME_OFFLOAD_LATENCY); - } else + } else #endif { tnum = comm->nthreads; @@ -294,13 +294,13 @@ hbnni(const int offload, NeighList *list, IntelBuffers *buffers, ominimum_image_check(no_special, delx, dely, delz); if (no_special) neighptr[n++] = -j - 1; - else + else neighptr[n++] = j; } else neighptr[n++] = j; #ifdef _LMP_INTEL_OFFLOAD - if (j < lmin) lmin = j; - if (j > lmax) lmax = j; + if (j < lmin) lmin = j; + if (j > lmax) lmax = j; #endif } else { if (need_ic) { @@ -308,16 +308,16 @@ hbnni(const int offload, NeighList *list, IntelBuffers *buffers, ominimum_image_check(no_special, delx, dely, delz); if (no_special) neighptr[n2++] = -j - 1; - else + else neighptr[n2++] = j; } else neighptr[n2++] = j; - #ifdef _LMP_INTEL_OFFLOAD - if (j < gmin) gmin = j; - if (j > gmax) gmax = j; + #ifdef _LMP_INTEL_OFFLOAD + if (j < gmin) gmin = j; + if (j > gmax) gmax = j; #endif - } - } + } + } } } ilist[i] = i; @@ -341,13 +341,13 @@ hbnni(const int offload, NeighList *list, IntelBuffers *buffers, neighptr += n; if (ct + n + maxnbors > list_size) { *overflow = 1; - ct = (ifrom + tid) * maxnbors; + ct = (ifrom + tid) * maxnbors; } } if (*overflow == 1) - for (int i = ifrom; i < ito; i++) - numneigh[i] = 0; + for (int i = ifrom; i < ito; i++) + numneigh[i] = 0; #ifdef _LMP_INTEL_OFFLOAD if (separate_buffers) { @@ -370,7 +370,7 @@ hbnni(const int offload, NeighList *list, IntelBuffers *buffers, if (offload) { ghost_offset = overflow[LMP_GHOST_MIN] - overflow[LMP_LOCAL_MAX] - 1; nall_offset = overflow[LMP_LOCAL_MAX] + 1 + nghost; - } else { + } else { ghost_offset = overflow[LMP_GHOST_MIN] - nlocal; nall_offset = nlocal + nghost; } @@ -383,38 +383,38 @@ hbnni(const int offload, NeighList *list, IntelBuffers *buffers, const int jnum = numneigh[i]; for (int jj = 0; jj < jnum; jj++) { const int j = jlist[jj]; - if (need_ic && j < 0) { - which = 0; - jlist[jj] = -j - 1; - } else + if (need_ic && j < 0) { + which = 0; + jlist[jj] = -j - 1; + } else ofind_special(which, special, nspecial, i, tag[j]); #ifdef _LMP_INTEL_OFFLOAD - if (j >= nlocal) { - if (j == nall) - jlist[jj] = nall_offset; - else if (which) - jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); - else jlist[jj]-=ghost_offset; + if (j >= nlocal) { + if (j == nall) + jlist[jj] = nall_offset; + else if (which) + jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); + else jlist[jj]-=ghost_offset; } else #endif - if (which) jlist[jj] = j ^ (which << SBBITS); + if (which) jlist[jj] = j ^ (which << SBBITS); } } } #ifdef _LMP_INTEL_OFFLOAD else if (separate_buffers) { - for (int i = ifrom; i < ito; ++i) { + for (int i = ifrom; i < ito; ++i) { int * _noalias jlist = firstneigh + cnumneigh[i]; const int jnum = numneigh[i]; - int jj = 0; - for (jj = 0; jj < jnum; jj++) - if (jlist[jj] >= nlocal) break; - while (jj < jnum) { - if (jlist[jj] == nall) jlist[jj] = nall_offset; - else jlist[jj] -= ghost_offset; - jj++; - } - } + int jj = 0; + for (jj = 0; jj < jnum; jj++) + if (jlist[jj] >= nlocal) break; + while (jj < jnum) { + if (jlist[jj] == nall) jlist[jj] = nall_offset; + else jlist[jj] -= ghost_offset; + jj++; + } + } } #endif } // end omp @@ -438,9 +438,9 @@ hbnni(const int offload, NeighList *list, IntelBuffers *buffers, _fix->start_watch(TIME_PACK); _fix->set_neighbor_host_sizes(); buffers->pack_sep_from_single(_fix->host_min_local(), - _fix->host_used_local(), - _fix->host_min_ghost(), - _fix->host_used_ghost()); + _fix->host_used_local(), + _fix->host_min_ghost(), + _fix->host_used_ghost()); _fix->stop_watch(TIME_PACK); } } diff --git a/src/USER-INTEL/npair_half_bin_newtoff_intel.h b/src/USER-INTEL/npair_half_bin_newtoff_intel.h index ccb4560909..49482f8b3e 100644 --- a/src/USER-INTEL/npair_half_bin_newtoff_intel.h +++ b/src/USER-INTEL/npair_half_bin_newtoff_intel.h @@ -38,7 +38,7 @@ class NPairHalfBinNewtoffIntel : public NPairIntel { void hbnni(NeighList *, IntelBuffers *); template void hbnni(const int, NeighList *, IntelBuffers *, const int, - const int); + const int); }; } diff --git a/src/USER-INTEL/npair_half_bin_newton_intel.cpp b/src/USER-INTEL/npair_half_bin_newton_intel.cpp index 5584f962e9..6313ab944f 100644 --- a/src/USER-INTEL/npair_half_bin_newton_intel.cpp +++ b/src/USER-INTEL/npair_half_bin_newton_intel.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalfBinNewtonIntel::NPairHalfBinNewtonIntel(LAMMPS *lmp) : +NPairHalfBinNewtonIntel::NPairHalfBinNewtonIntel(LAMMPS *lmp) : NPairIntel(lmp) {} /* ---------------------------------------------------------------------- @@ -75,7 +75,7 @@ hbni(NeighList *list, IntelBuffers *buffers) { int need_ic = 0; if (atom->molecular) dminimum_image_check(need_ic, neighbor->cutneighmax, neighbor->cutneighmax, - neighbor->cutneighmax); + neighbor->cutneighmax); #ifdef _LMP_INTEL_OFFLOAD if (need_ic) { @@ -96,7 +96,7 @@ hbni(NeighList *list, IntelBuffers *buffers) { } } #else - if (need_ic) + if (need_ic) hbni(0, list, buffers, host_start, nlocal); else hbni(0, list, buffers, host_start, nlocal); @@ -119,7 +119,7 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, if (offload) { if (INTEL_MIC_NBOR_PAD > 1) pad = INTEL_MIC_NBOR_PAD * sizeof(float) / sizeof(flt_t); - } else + } else #endif if (INTEL_NBOR_PAD > 1) pad = INTEL_NBOR_PAD * sizeof(float) / sizeof(flt_t); @@ -172,7 +172,7 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, overflow = _fix->get_off_overflow_flag(); _fix->stop_watch(TIME_HOST_NEIGHBOR); _fix->start_watch(TIME_OFFLOAD_LATENCY); - } else + } else #endif { tnum = comm->nthreads; @@ -235,8 +235,8 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, int end = stencil[k] + 1; for (int kk = k + 1; kk < nstencil; kk++) { if (stencil[kk-1]+1 == stencil[kk]) { - end++; - k++; + end++; + k++; } else break; } binend[nstencilp] = end; @@ -262,8 +262,8 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, ito += astart; int e_ito = ito; if (ito == num) { - int imod = ito % swidth; - if (imod) e_ito += swidth - imod; + int imod = ito % swidth; + if (imod) e_ito += swidth - imod; } const int list_size = (e_ito + tid * 2 + 2) * maxnbors; #else @@ -294,118 +294,118 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, // if j is owned atom, store it, since j is beyond i in linked list // if j is ghost, only store if j coords are "above/to the right" of i - int raw_count = pack_offset; + int raw_count = pack_offset; for (int j = bins[i]; j >= 0; j = bins[j]) { if (j >= nlocal) { - #ifdef _LMP_INTEL_OFFLOAD + #ifdef _LMP_INTEL_OFFLOAD if (offload_noghost && offload) continue; - #endif + #endif if (x[j].z < ztmp) continue; if (x[j].z == ztmp) { if (x[j].y < ytmp) continue; if (x[j].y == ytmp && x[j].x < xtmp) continue; } - } + } #ifdef _LMP_INTEL_OFFLOAD else if (offload_noghost && i < offload_end) continue; - #endif + #endif #ifndef _LMP_INTEL_OFFLOAD if (exclude) { - const int jtype = x[j].w; - if (exclusion(i,j,itype,jtype,mask,molecule)) continue; - } - #endif + const int jtype = x[j].w; + if (exclusion(i,j,itype,jtype,mask,molecule)) continue; + } + #endif - neighptr[raw_count++] = j; - } + neighptr[raw_count++] = j; + } // loop over all atoms in other bins in stencil, store every pair const int ibin = atombin[i]; - if (exclude) { - for (int k = 0; k < nstencilp; k++) { - const int bstart = binhead[ibin + binstart[k]]; - const int bend = binhead[ibin + binend[k]]; - #ifndef _LMP_INTEL_OFFLOAD - #ifdef INTEL_VMASK - #pragma simd - #endif - #endif - for (int jj = bstart; jj < bend; jj++) { - const int j = binpacked[jj]; - + if (exclude) { + for (int k = 0; k < nstencilp; k++) { + const int bstart = binhead[ibin + binstart[k]]; + const int bend = binhead[ibin + binend[k]]; + #ifndef _LMP_INTEL_OFFLOAD + #ifdef INTEL_VMASK + #pragma simd + #endif + #endif + for (int jj = bstart; jj < bend; jj++) { + const int j = binpacked[jj]; + #ifdef _LMP_INTEL_OFFLOAD if (offload_noghost) { if (j < nlocal) { if (i < offload_end) continue; } else if (offload) continue; } - #endif + #endif #ifndef _LMP_INTEL_OFFLOAD - const int jtype = x[j].w; - if (exclusion(i,j,itype,jtype,mask,molecule)) continue; - #endif + const int jtype = x[j].w; + if (exclusion(i,j,itype,jtype,mask,molecule)) continue; + #endif + + neighptr[raw_count++] = j; + } + } + } else { + for (int k = 0; k < nstencilp; k++) { + const int bstart = binhead[ibin + binstart[k]]; + const int bend = binhead[ibin + binend[k]]; + #ifndef _LMP_INTEL_OFFLOAD + #ifdef INTEL_VMASK + #pragma simd + #endif + #endif + for (int jj = bstart; jj < bend; jj++) { + const int j = binpacked[jj]; - neighptr[raw_count++] = j; - } - } - } else { - for (int k = 0; k < nstencilp; k++) { - const int bstart = binhead[ibin + binstart[k]]; - const int bend = binhead[ibin + binend[k]]; - #ifndef _LMP_INTEL_OFFLOAD - #ifdef INTEL_VMASK - #pragma simd - #endif - #endif - for (int jj = bstart; jj < bend; jj++) { - const int j = binpacked[jj]; - #ifdef _LMP_INTEL_OFFLOAD if (offload_noghost) { if (j < nlocal) { if (i < offload_end) continue; } else if (offload) continue; } - #endif + #endif - neighptr[raw_count++] = j; - } - } - } + neighptr[raw_count++] = j; + } + } + } - if (raw_count > obound) *overflow = 1; + if (raw_count > obound) *overflow = 1; #if defined(LMP_SIMD_COMPILER) - #ifdef _LMP_INTEL_OFFLOAD - int vlmin = lmin, vlmax = lmax, vgmin = gmin, vgmax = gmax; - #if __INTEL_COMPILER+0 > 1499 - #pragma vector aligned + #ifdef _LMP_INTEL_OFFLOAD + int vlmin = lmin, vlmax = lmax, vgmin = gmin, vgmax = gmax; + #if __INTEL_COMPILER+0 > 1499 + #pragma vector aligned #pragma simd reduction(max:vlmax,vgmax) reduction(min:vlmin, vgmin) - #endif - #else - #pragma vector aligned + #endif + #else + #pragma vector aligned #pragma simd - #endif - #endif - for (int u = pack_offset; u < raw_count; u++) { + #endif + #endif + for (int u = pack_offset; u < raw_count; u++) { int j = neighptr[u]; const flt_t delx = xtmp - x[j].x; const flt_t dely = ytmp - x[j].y; const flt_t delz = ztmp - x[j].z; - const int jtype = x[j].w; + const int jtype = x[j].w; const flt_t rsq = delx * delx + dely * dely + delz * delz; - if (rsq > cutneighsq[ioffset + jtype]) - neighptr[u] = e_nall; - else { - if (need_ic) { - int no_special; - ominimum_image_check(no_special, delx, dely, delz); - if (no_special) - neighptr[u] = -j - 1; - } + if (rsq > cutneighsq[ioffset + jtype]) + neighptr[u] = e_nall; + else { + if (need_ic) { + int no_special; + ominimum_image_check(no_special, delx, dely, delz); + if (no_special) + neighptr[u] = -j - 1; + } #ifdef _LMP_INTEL_OFFLOAD if (j < nlocal) { if (j < vlmin) vlmin = j; @@ -415,40 +415,40 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, if (j > vgmax) vgmax = j; } #endif - } - } + } + } #ifdef _LMP_INTEL_OFFLOAD - lmin = MIN(lmin,vlmin); - gmin = MIN(gmin,vgmin); - lmax = MAX(lmax,vlmax); - gmax = MAX(gmax,vgmax); + lmin = MIN(lmin,vlmin); + gmin = MIN(gmin,vgmin); + lmax = MAX(lmax,vlmax); + gmax = MAX(gmax,vgmax); #endif int n = lane, n2 = pack_offset; - for (int u = pack_offset; u < raw_count; u++) { - const int j = neighptr[u]; - int pj = j; - if (pj < e_nall) { - if (need_ic) - if (pj < 0) pj = -pj - 1; + for (int u = pack_offset; u < raw_count; u++) { + const int j = neighptr[u]; + int pj = j; + if (pj < e_nall) { + if (need_ic) + if (pj < 0) pj = -pj - 1; - if (pj < nlocal) { - neighptr[n] = j; - n += swidth; - } else - neighptr[n2++] = j; - } - } - int ns = (n - lane) / swidth; - for (int u = pack_offset; u < n2; u++) { - neighptr[n] = neighptr[u]; - n += swidth; - } + if (pj < nlocal) { + neighptr[n] = j; + n += swidth; + } else + neighptr[n2++] = j; + } + } + int ns = (n - lane) / swidth; + for (int u = pack_offset; u < n2; u++) { + neighptr[n] = neighptr[u]; + n += swidth; + } ilist[i] = i; cnumneigh[i] = ct + lane; - ns += n2 - pack_offset; - #ifndef OUTER_CHUNK + ns += n2 - pack_offset; + #ifndef OUTER_CHUNK int edge = (ns % pad_width); if (edge) { const int pad_end = ns + (pad_width - edge); @@ -458,41 +458,41 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, for ( ; ns < pad_end; ns++) neighptr[ns] = e_nall; } - #endif + #endif numneigh[i] = ns; - #ifdef OUTER_CHUNK - if (ns > max_chunk) max_chunk = ns; - lane++; - if (lane == swidth) { - ct += max_chunk * swidth; - const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); - int edge = (ct % alignb); - if (edge) ct += alignb - edge; - neighptr = firstneigh + ct; - max_chunk = 0; - pack_offset = maxnbors * swidth; - lane = 0; - if (ct + obound > list_size) { + #ifdef OUTER_CHUNK + if (ns > max_chunk) max_chunk = ns; + lane++; + if (lane == swidth) { + ct += max_chunk * swidth; + const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); + int edge = (ct % alignb); + if (edge) ct += alignb - edge; + neighptr = firstneigh + ct; + max_chunk = 0; + pack_offset = maxnbors * swidth; + lane = 0; + if (ct + obound > list_size) { if (i < ito - 1) { - *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + *overflow = 1; + ct = (ifrom + tid * 2) * maxnbors; } - } - } - #else - ct += ns; - const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); - edge = (ct % alignb); - if (edge) ct += alignb - edge; - neighptr = firstneigh + ct; - if (ct + obound > list_size) { - if (i < ito - 1) { - *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; - } - } - #endif + } + } + #else + ct += ns; + const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); + edge = (ct % alignb); + if (edge) ct += alignb - edge; + neighptr = firstneigh + ct; + if (ct + obound > list_size) { + if (i < ito - 1) { + *overflow = 1; + ct = (ifrom + tid * 2) * maxnbors; + } + } + #endif } if (*overflow == 1) @@ -505,25 +505,25 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, #pragma omp critical #endif { - if (lmin < overflow[LMP_LOCAL_MIN]) overflow[LMP_LOCAL_MIN] = lmin; - if (lmax > overflow[LMP_LOCAL_MAX]) overflow[LMP_LOCAL_MAX] = lmax; - if (gmin < overflow[LMP_GHOST_MIN]) overflow[LMP_GHOST_MIN] = gmin; - if (gmax > overflow[LMP_GHOST_MAX]) overflow[LMP_GHOST_MAX] = gmax; + if (lmin < overflow[LMP_LOCAL_MIN]) overflow[LMP_LOCAL_MIN] = lmin; + if (lmax > overflow[LMP_LOCAL_MAX]) overflow[LMP_LOCAL_MAX] = lmax; + if (gmin < overflow[LMP_GHOST_MIN]) overflow[LMP_GHOST_MIN] = gmin; + if (gmax > overflow[LMP_GHOST_MAX]) overflow[LMP_GHOST_MAX] = gmax; } - #pragma omp barrier + #pragma omp barrier } int ghost_offset = 0, nall_offset = e_nall; if (separate_buffers) { - int nghost = overflow[LMP_GHOST_MAX] + 1 - overflow[LMP_GHOST_MIN]; - if (nghost < 0) nghost = 0; - if (offload) { - ghost_offset = overflow[LMP_GHOST_MIN] - overflow[LMP_LOCAL_MAX] - 1; - nall_offset = overflow[LMP_LOCAL_MAX] + 1 + nghost; - } else { - ghost_offset = overflow[LMP_GHOST_MIN] - nlocal; - nall_offset = nlocal + nghost; - } + int nghost = overflow[LMP_GHOST_MAX] + 1 - overflow[LMP_GHOST_MIN]; + if (nghost < 0) nghost = 0; + if (offload) { + ghost_offset = overflow[LMP_GHOST_MIN] - overflow[LMP_LOCAL_MAX] - 1; + nall_offset = overflow[LMP_LOCAL_MAX] + 1 + nghost; + } else { + ghost_offset = overflow[LMP_GHOST_MIN] - nlocal; + nall_offset = nlocal + nghost; + } } #endif @@ -531,49 +531,49 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, for (int i = ifrom; i < ito; ++i) { int * _noalias jlist = firstneigh + cnumneigh[i]; const int jnum = numneigh[i]; - #ifndef OUTER_CHUNK + #ifndef OUTER_CHUNK #if defined(LMP_SIMD_COMPILER) - #pragma vector aligned + #pragma vector aligned #pragma simd - #endif + #endif for (int jj = 0; jj < jnum; jj++) { - #else - const int trip = jnum * swidth; + #else + const int trip = jnum * swidth; for (int jj = 0; jj < trip; jj+= swidth) { - #endif + #endif const int j = jlist[jj]; - if (need_ic && j < 0) { - which = 0; - jlist[jj] = -j - 1; + if (need_ic && j < 0) { + which = 0; + jlist[jj] = -j - 1; } else ofind_special(which, special, nspecial, i, tag[j]); - #ifdef _LMP_INTEL_OFFLOAD - if (j >= nlocal) { - if (j == e_nall) - jlist[jj] = nall_offset; - else if (which) - jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); - else jlist[jj]-=ghost_offset; + #ifdef _LMP_INTEL_OFFLOAD + if (j >= nlocal) { + if (j == e_nall) + jlist[jj] = nall_offset; + else if (which) + jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); + else jlist[jj]-=ghost_offset; } else - #endif + #endif if (which) jlist[jj] = j ^ (which << SBBITS); } } } #ifdef _LMP_INTEL_OFFLOAD else if (separate_buffers) { - for (int i = ifrom; i < ito; ++i) { + for (int i = ifrom; i < ito; ++i) { int * _noalias jlist = firstneigh + cnumneigh[i]; const int jnum = numneigh[i]; - int jj = 0; - for (jj = 0; jj < jnum; jj++) - if (jlist[jj] >= nlocal) break; - while (jj < jnum) { - if (jlist[jj] == e_nall) jlist[jj] = nall_offset; - else jlist[jj] -= ghost_offset; - jj++; - } - } + int jj = 0; + for (jj = 0; jj < jnum; jj++) + if (jlist[jj] >= nlocal) break; + while (jj < jnum) { + if (jlist[jj] == e_nall) jlist[jj] = nall_offset; + else jlist[jj] -= ghost_offset; + jj++; + } + } } #endif } // end omp @@ -597,9 +597,9 @@ hbni(const int offload, NeighList *list, IntelBuffers *buffers, _fix->start_watch(TIME_PACK); _fix->set_neighbor_host_sizes(); buffers->pack_sep_from_single(_fix->host_min_local(), - _fix->host_used_local(), - _fix->host_min_ghost(), - _fix->host_used_ghost()); + _fix->host_used_local(), + _fix->host_min_ghost(), + _fix->host_used_ghost()); _fix->stop_watch(TIME_PACK); } } diff --git a/src/USER-INTEL/npair_half_bin_newton_intel.h b/src/USER-INTEL/npair_half_bin_newton_intel.h index 4e496986b4..9b5d0780a1 100644 --- a/src/USER-INTEL/npair_half_bin_newton_intel.h +++ b/src/USER-INTEL/npair_half_bin_newton_intel.h @@ -37,8 +37,8 @@ class NPairHalfBinNewtonIntel : public NPairIntel { template void hbni(NeighList *, IntelBuffers *); template - void hbni(const int, NeighList *, IntelBuffers *, const int, - const int, const int offload_end = 0); + void hbni(const int, NeighList *, IntelBuffers *, const int, + const int, const int offload_end = 0); }; } diff --git a/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp b/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp index 3b6d68d4de..5f191e0797 100644 --- a/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp +++ b/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalfBinNewtonTriIntel::NPairHalfBinNewtonTriIntel(LAMMPS *lmp) : +NPairHalfBinNewtonTriIntel::NPairHalfBinNewtonTriIntel(LAMMPS *lmp) : NPairIntel(lmp) {} /* ---------------------------------------------------------------------- @@ -75,7 +75,7 @@ hbnti(NeighList *list, IntelBuffers *buffers) { int need_ic = 0; if (atom->molecular) dminimum_image_check(need_ic, neighbor->cutneighmax, neighbor->cutneighmax, - neighbor->cutneighmax); + neighbor->cutneighmax); #ifdef _LMP_INTEL_OFFLOAD if (need_ic) { @@ -171,7 +171,7 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, overflow = _fix->get_off_overflow_flag(); _fix->stop_watch(TIME_HOST_NEIGHBOR); _fix->start_watch(TIME_OFFLOAD_LATENCY); - } else + } else #endif { tnum = comm->nthreads; @@ -279,20 +279,20 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, const int ibin = atombin[i]; - int raw_count = maxnbors; + int raw_count = maxnbors; for (int k = 0; k < nstencilp; k++) { const int bstart = binhead[ibin + binstart[k]]; const int bend = binhead[ibin + binend[k]]; for (int jj = bstart; jj < bend; jj++) { const int j = binpacked[jj]; - #ifdef _LMP_INTEL_OFFLOAD - if (offload_noghost) { + #ifdef _LMP_INTEL_OFFLOAD + if (offload_noghost) { if (j < nlocal) { if (i < offload_end) continue; } else if (offload) continue; } - #endif + #endif if (x[j].z < ztmp) continue; if (x[j].z == ztmp) { @@ -305,45 +305,45 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, #ifndef _LMP_INTEL_OFFLOAD if (exclude) { - const int jtype = x[j].w; - if (exclusion(i,j,itype,jtype,mask,molecule)) continue; - } - #endif + const int jtype = x[j].w; + if (exclusion(i,j,itype,jtype,mask,molecule)) continue; + } + #endif - neighptr[raw_count++] = j; - } - } - if (raw_count > obound) - *overflow = 1; + neighptr[raw_count++] = j; + } + } + if (raw_count > obound) + *overflow = 1; #if defined(LMP_SIMD_COMPILER) - #ifdef _LMP_INTEL_OFFLOAD - int vlmin = lmin, vlmax = lmax, vgmin = gmin, vgmax = gmax; - #if __INTEL_COMPILER+0 > 1499 - #pragma vector aligned + #ifdef _LMP_INTEL_OFFLOAD + int vlmin = lmin, vlmax = lmax, vgmin = gmin, vgmax = gmax; + #if __INTEL_COMPILER+0 > 1499 + #pragma vector aligned #pragma simd reduction(max:vlmax,vgmax) reduction(min:vlmin, vgmin) - #endif - #else - #pragma vector aligned + #endif + #else + #pragma vector aligned #pragma simd - #endif - #endif - for (int u = maxnbors; u < raw_count; u++) { + #endif + #endif + for (int u = maxnbors; u < raw_count; u++) { int j = neighptr[u]; const flt_t delx = xtmp - x[j].x; const flt_t dely = ytmp - x[j].y; const flt_t delz = ztmp - x[j].z; - const int jtype = x[j].w; + const int jtype = x[j].w; const flt_t rsq = delx * delx + dely * dely + delz * delz; - if (rsq > cutneighsq[ioffset + jtype]) - neighptr[u] = e_nall; - else { + if (rsq > cutneighsq[ioffset + jtype]) + neighptr[u] = e_nall; + else { if (need_ic) { - int no_special; - ominimum_image_check(no_special, delx, dely, delz); - if (no_special) - neighptr[u] = -j - 1; - } + int no_special; + ominimum_image_check(no_special, delx, dely, delz); + if (no_special) + neighptr[u] = -j - 1; + } #ifdef _LMP_INTEL_OFFLOAD if (j < nlocal) { @@ -358,26 +358,26 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, } int n = 0, n2 = maxnbors; - for (int u = maxnbors; u < raw_count; u++) { - const int j = neighptr[u]; - int pj = j; - if (pj < e_nall) { - if (need_ic) - if (pj < 0) pj = -pj - 1; + for (int u = maxnbors; u < raw_count; u++) { + const int j = neighptr[u]; + int pj = j; + if (pj < e_nall) { + if (need_ic) + if (pj < 0) pj = -pj - 1; - if (pj < nlocal) - neighptr[n++] = j; - else - neighptr[n2++] = j; - } - } - int ns = n; - for (int u = maxnbors; u < n2; u++) - neighptr[n++] = neighptr[u]; + if (pj < nlocal) + neighptr[n++] = j; + else + neighptr[n2++] = j; + } + } + int ns = n; + for (int u = maxnbors; u < n2; u++) + neighptr[n++] = neighptr[u]; ilist[i] = i; cnumneigh[i] = ct; - ns += n2 - maxnbors; + ns += n2 - maxnbors; int edge = (ns % pad_width); if (edge) { @@ -390,17 +390,17 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, } numneigh[i] = ns; - ct += ns; - const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); - edge = (ct % alignb); - if (edge) ct += alignb - edge; - neighptr = firstneigh + ct; - if (ct + obound > list_size) { - if (i < ito - 1) { - *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; - } - } + ct += ns; + const int alignb = (INTEL_DATA_ALIGN / sizeof(int)); + edge = (ct % alignb); + if (edge) ct += alignb - edge; + neighptr = firstneigh + ct; + if (ct + obound > list_size) { + if (i < ito - 1) { + *overflow = 1; + ct = (ifrom + tid * 2) * maxnbors; + } + } } if (*overflow == 1) @@ -428,7 +428,7 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, if (offload) { ghost_offset = overflow[LMP_GHOST_MIN] - overflow[LMP_LOCAL_MAX] - 1; nall_offset = overflow[LMP_LOCAL_MAX] + 1 + nghost; - } else { + } else { ghost_offset = overflow[LMP_GHOST_MIN] - nlocal; nall_offset = nlocal + nghost; } @@ -440,43 +440,43 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, int * _noalias jlist = firstneigh + cnumneigh[i]; const int jnum = numneigh[i]; #if defined(LMP_SIMD_COMPILER) - #pragma vector aligned + #pragma vector aligned #pragma simd - #endif + #endif for (int jj = 0; jj < jnum; jj++) { const int j = jlist[jj]; - if (need_ic && j < 0) { - which = 0; - jlist[jj] = -j - 1; - } else + if (need_ic && j < 0) { + which = 0; + jlist[jj] = -j - 1; + } else ofind_special(which, special, nspecial, i, tag[j]); #ifdef _LMP_INTEL_OFFLOAD - if (j >= nlocal) { - if (j == e_nall) - jlist[jj] = nall_offset; - else if (which) - jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); - else jlist[jj]-=ghost_offset; + if (j >= nlocal) { + if (j == e_nall) + jlist[jj] = nall_offset; + else if (which) + jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); + else jlist[jj]-=ghost_offset; } else #endif - if (which) jlist[jj] = j ^ (which << SBBITS); + if (which) jlist[jj] = j ^ (which << SBBITS); } } } #ifdef _LMP_INTEL_OFFLOAD else if (separate_buffers) { - for (int i = ifrom; i < ito; ++i) { + for (int i = ifrom; i < ito; ++i) { int * _noalias jlist = firstneigh + cnumneigh[i]; const int jnum = numneigh[i]; - int jj = 0; - for (jj = 0; jj < jnum; jj++) - if (jlist[jj] >= nlocal) break; - while (jj < jnum) { - if (jlist[jj] == e_nall) jlist[jj] = nall_offset; - else jlist[jj] -= ghost_offset; - jj++; - } - } + int jj = 0; + for (jj = 0; jj < jnum; jj++) + if (jlist[jj] >= nlocal) break; + while (jj < jnum) { + if (jlist[jj] == e_nall) jlist[jj] = nall_offset; + else jlist[jj] -= ghost_offset; + jj++; + } + } } #endif } // end omp @@ -500,9 +500,9 @@ hbnti(const int offload, NeighList *list, IntelBuffers *buffers, _fix->start_watch(TIME_PACK); _fix->set_neighbor_host_sizes(); buffers->pack_sep_from_single(_fix->host_min_local(), - _fix->host_used_local(), - _fix->host_min_ghost(), - _fix->host_used_ghost()); + _fix->host_used_local(), + _fix->host_min_ghost(), + _fix->host_used_ghost()); _fix->stop_watch(TIME_PACK); } } diff --git a/src/USER-INTEL/npair_half_bin_newton_tri_intel.h b/src/USER-INTEL/npair_half_bin_newton_tri_intel.h index d1b9ee9cd1..d144c2fc52 100644 --- a/src/USER-INTEL/npair_half_bin_newton_tri_intel.h +++ b/src/USER-INTEL/npair_half_bin_newton_tri_intel.h @@ -38,7 +38,7 @@ class NPairHalfBinNewtonTriIntel : public NPairIntel { void hbnti(NeighList *, IntelBuffers *); template void hbnti(const int, NeighList *, IntelBuffers *, const int, - const int, const int offload_end = 0); + const int, const int offload_end = 0); }; } diff --git a/src/USER-INTEL/npair_intel.cpp b/src/USER-INTEL/npair_intel.cpp index bffb31b710..c92ed88774 100644 --- a/src/USER-INTEL/npair_intel.cpp +++ b/src/USER-INTEL/npair_intel.cpp @@ -62,6 +62,6 @@ void NPairIntel::grow_stencil() const int maxstencil = ns->get_maxstencil(); #pragma offload_transfer target(mic:_cop) \ in(stencil:length(maxstencil) alloc_if(1) free_if(0)) - } + } } #endif diff --git a/src/USER-MANIFOLD/README b/src/USER-MANIFOLD/README index f55a9bb8e3..eb83cfc5ab 100644 --- a/src/USER-MANIFOLD/README +++ b/src/USER-MANIFOLD/README @@ -7,10 +7,14 @@ box). It achieves this using the RATTLE constraint algorithm applied to single-particle constraint functions g(xi,yi,zi) = 0 and their derivative (i.e. the normal of the manifold) n = grad(g). -Stefan Paquay, s.paquay@tue.nl -Applied Physics/Theory of Polymers and Soft Matter, +Stefan Paquay, stefanpaquay@gmail.com + +until 2017: Applied Physics/Theory of Polymers and Soft Matter, Eindhoven University of Technology (TU/e), The Netherlands +since 2017: Brandeis University, Waltham, MA, USA. + + Thanks to Remy Kusters at TU/e for testing. This software is distributed under the GNU General Public License. diff --git a/src/USER-MISC/README b/src/USER-MISC/README index f501c81c17..93d771efbc 100644 --- a/src/USER-MISC/README +++ b/src/USER-MISC/README @@ -64,7 +64,6 @@ pair_style gauss/cut, Axel Kohlmeyer, akohlmey at gmail.com, 1 Dec 11 pair_style lennard/mdf, Paolo Raiteri, p.raiteri at curtin.edu.au, 2 Dec 15 pair_style list, Axel Kohlmeyer (Temple U), akohlmey at gmail.com, 1 Jun 13 pair_style lj/mdf, Paolo Raiteri, p.raiteri at curtin.edu.au, 2 Dec 15 -pair_style lj/sf, Laurent Joly (U Lyon), ljoly.ulyon at gmail.com, 8 Aug 11 pair_style kolmogorov/crespi/z, Jaap Kroes (Radboud U), jaapkroes at gmail dot com, 28 Feb 17 pair_style meam/spline, Alexander Stukowski (LLNL), alex at stukowski.com, 1 Feb 12 pair_style meam/sw/spline, Robert Rudd (LLNL), robert.rudd at llnl.gov, 1 Oct 12 diff --git a/src/USER-MISC/pair_cdeam.cpp b/src/USER-MISC/pair_cdeam.cpp index 91ef598de8..b5607012ce 100644 --- a/src/USER-MISC/pair_cdeam.cpp +++ b/src/USER-MISC/pair_cdeam.cpp @@ -456,11 +456,11 @@ void PairCDEAM::read_h_coeff(char *filename) { if(comm->me == 0) { // Open potential file - FILE *fp; + FILE *fptr; char line[MAXLINE]; char nextline[MAXLINE]; - fp = force->open_potential(filename); - if (fp == NULL) { + fptr = force->open_potential(filename); + if (fptr == NULL) { char str[128]; sprintf(str,"Cannot open EAM potential file %s", filename); error->one(FLERR,str); @@ -468,7 +468,7 @@ void PairCDEAM::read_h_coeff(char *filename) // h coefficients are stored at the end of the file. // Skip to last line of file. - while(fgets(nextline, MAXLINE, fp) != NULL) { + while(fgets(nextline, MAXLINE, fptr) != NULL) { strcpy(line, nextline); } char* ptr = strtok(line, " \t\n\r\f"); @@ -483,7 +483,7 @@ void PairCDEAM::read_h_coeff(char *filename) error->one(FLERR,"Failed to read h(x) function coefficients from EAM file."); // Close the potential file. - fclose(fp); + fclose(fptr); } MPI_Bcast(&nhcoeff, 1, MPI_INT, 0, world); diff --git a/src/USER-MISC/pair_lj_sf.cpp b/src/USER-MISC/pair_lj_sf.cpp deleted file mode 100644 index a34119f880..0000000000 --- a/src/USER-MISC/pair_lj_sf.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, 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 author: Laurent Joly (U Lyon), ljoly.ulyon@gmail.com -------------------------------------------------------------------------- */ - -#include -#include -#include -#include "pair_lj_sf.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" - -using namespace LAMMPS_NS; - -/* ---------------------------------------------------------------------- */ - -PairLJShiftedForce::PairLJShiftedForce(LAMMPS *lmp) : Pair(lmp) -{ - respa_enable = 0; -} - -/* ---------------------------------------------------------------------- */ - -PairLJShiftedForce::~PairLJShiftedForce() -{ - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); - - memory->destroy(cut); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(foffset); - memory->destroy(offset); - } -} - -/* ---------------------------------------------------------------------- */ - -void PairLJShiftedForce::compute(int eflag, int vflag) -{ - int i,j,ii,jj,inum,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; - double rsq,r2inv,r6inv,forcelj,factor_lj; - double r,t; - int *ilist,*jlist,*numneigh,**firstneigh; - - evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; - - double **x = atom->x; - double **f = atom->f; - int *type = atom->type; - int nlocal = atom->nlocal; - double *special_lj = force->special_lj; - 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++) { - i = ilist[ii]; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - itype = type[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - factor_lj = special_lj[sbmask(j)]; - 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]) { - r2inv = 1.0/rsq; - r6inv = r2inv*r2inv*r2inv; - r = sqrt(rsq); - t = r/cut[itype][jtype]; - forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]) - - t*foffset[itype][jtype]; - fpair = factor_lj*forcelj*r2inv; - - f[i][0] += delx*fpair; - f[i][1] += dely*fpair; - f[i][2] += delz*fpair; - if (newton_pair || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; - } - - if (eflag) { - evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) + - (t-1.0)*foffset[itype][jtype] - offset[itype][jtype]; - evdwl *= factor_lj; - } - - if (evflag) ev_tally(i,j,nlocal,newton_pair, - evdwl,0.0,fpair,delx,dely,delz); - } - } - } - - if (vflag_fdotr) virial_fdotr_compute(); -} - -/* ---------------------------------------------------------------------- - allocate all arrays -------------------------------------------------------------------------- */ - -void PairLJShiftedForce::allocate() -{ - allocated = 1; - int n = atom->ntypes; - - memory->create(setflag,n+1,n+1,"pair:setflag"); - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - memory->create(cutsq,n+1,n+1,"pair:cutsq"); - - memory->create(cut,n+1,n+1,"pair:cut"); - memory->create(epsilon,n+1,n+1,"pair:epsilon"); - memory->create(sigma,n+1,n+1,"pair:sigma"); - memory->create(lj1,n+1,n+1,"pair:lj1"); - memory->create(lj2,n+1,n+1,"pair:lj2"); - memory->create(lj3,n+1,n+1,"pair:lj3"); - memory->create(lj4,n+1,n+1,"pair:lj4"); - memory->create(foffset,n+1,n+1,"pair:foffset"); - memory->create(offset,n+1,n+1,"pair:offset"); -} - -/* ---------------------------------------------------------------------- - global settings -------------------------------------------------------------------------- */ - -void PairLJShiftedForce::settings(int narg, char **arg) -{ - if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - - cut_global = force->numeric(FLERR,arg[0]); - - if (cut_global <= 0.0) - error->all(FLERR,"Illegal pair_style command"); - - // reset cutoffs that have been explicitly set - - if (allocated) { - int i,j; - for (i = 1; i <= atom->ntypes; i++) - for (j = i; j <= atom->ntypes; j++) - if (setflag[i][j]) cut[i][j] = cut_global; - } -} - -/* ---------------------------------------------------------------------- - set coeffs for one or more type pairs -------------------------------------------------------------------------- */ - -void PairLJShiftedForce::coeff(int narg, char **arg) -{ - if (narg < 4 || narg > 5) - error->all(FLERR,"Incorrect args for pair coefficients"); - if (!allocated) allocate(); - - int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); - - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - - double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); - - if (cut_one <= 0.0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - int count = 0; - for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo,i); j <= jhi; j++) { - epsilon[i][j] = epsilon_one; - sigma[i][j] = sigma_one; - cut[i][j] = cut_one; - setflag[i][j] = 1; - count++; - } - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); -} - -/* ---------------------------------------------------------------------- - init for one type pair i,j and corresponding j,i -------------------------------------------------------------------------- */ - -double PairLJShiftedForce::init_one(int i, int j) -{ - if (setflag[i][j] == 0) { - epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j], - sigma[i][i],sigma[j][j]); - sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]); - cut[i][j] = mix_distance(cut[i][i],cut[j][j]); - } - - lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j],12.0); - lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0); - lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0); - lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0); - - double ratio = sigma[i][j] / cut[i][j]; - foffset[i][j] = 4.0 * epsilon[i][j] * (12.0 * pow(ratio,12.0) - - 6.0 * pow(ratio,6.0)); - offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0)); - - cut[j][i] = cut[i][j]; - lj1[j][i] = lj1[i][j]; - lj2[j][i] = lj2[i][j]; - lj3[j][i] = lj3[i][j]; - lj4[j][i] = lj4[i][j]; - foffset[j][i] = foffset[i][j]; - offset[j][i] = offset[i][j]; - - return cut[i][j]; -} - -/* ---------------------------------------------------------------------- - proc 0 writes to restart file -------------------------------------------------------------------------- */ - -void PairLJShiftedForce::write_restart(FILE *fp) -{ - write_restart_settings(fp); - - int i,j; - for (i = 1; i <= atom->ntypes; i++) - for (j = i; j <= atom->ntypes; j++) { - fwrite(&setflag[i][j],sizeof(int),1,fp); - if (setflag[i][j]) { - fwrite(&epsilon[i][j],sizeof(double),1,fp); - fwrite(&sigma[i][j],sizeof(double),1,fp); - fwrite(&cut[i][j],sizeof(double),1,fp); - } - } -} - -/* ---------------------------------------------------------------------- - proc 0 reads from restart file, bcasts -------------------------------------------------------------------------- */ - -void PairLJShiftedForce::read_restart(FILE *fp) -{ - read_restart_settings(fp); - allocate(); - - int i,j; - int me = comm->me; - for (i = 1; i <= atom->ntypes; i++) - for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); - MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); - if (setflag[i][j]) { - if (me == 0) { - fread(&epsilon[i][j],sizeof(double),1,fp); - fread(&sigma[i][j],sizeof(double),1,fp); - fread(&cut[i][j],sizeof(double),1,fp); - } - MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); - } - } -} - -/* ---------------------------------------------------------------------- - proc 0 writes to restart file -------------------------------------------------------------------------- */ - -void PairLJShiftedForce::write_restart_settings(FILE *fp) -{ - fwrite(&cut_global,sizeof(double),1,fp); - fwrite(&offset_flag,sizeof(int),1,fp); - fwrite(&mix_flag,sizeof(int),1,fp); -} - -/* ---------------------------------------------------------------------- - proc 0 reads from restart file, bcasts -------------------------------------------------------------------------- */ - -void PairLJShiftedForce::read_restart_settings(FILE *fp) -{ - int me = comm->me; - if (me == 0) { - fread(&cut_global,sizeof(double),1,fp); - fread(&offset_flag,sizeof(int),1,fp); - fread(&mix_flag,sizeof(int),1,fp); - } - MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); - MPI_Bcast(&offset_flag,1,MPI_INT,0,world); - MPI_Bcast(&mix_flag,1,MPI_INT,0,world); -} - -/* ---------------------------------------------------------------------- */ - -double PairLJShiftedForce::single(int i, int j, int itype, int jtype, double rsq, - double factor_coul, double factor_lj, - double &fforce) -{ - double r2inv,r6inv,forcelj,philj,r,t; - - r2inv = 1.0/rsq; - r6inv = r2inv*r2inv*r2inv; - r = sqrt(rsq); - t = r/cut[itype][jtype]; - forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]) - - t*foffset[itype][jtype]; - fforce = factor_lj*forcelj*r2inv; - - philj = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) + - (t-1.0)*foffset[itype][jtype] - offset[itype][jtype]; - return factor_lj*philj; -} diff --git a/src/USER-MISC/pair_lj_sf.h b/src/USER-MISC/pair_lj_sf.h deleted file mode 100644 index 1a4106b782..0000000000 --- a/src/USER-MISC/pair_lj_sf.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, 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. -------------------------------------------------------------------------- */ - -#ifdef PAIR_CLASS - -PairStyle(lj/sf,PairLJShiftedForce) - -#else - -#ifndef LMP_PAIR_LJ_SF_H -#define LMP_PAIR_LJ_SF_H - -#include "pair.h" - -namespace LAMMPS_NS { - -class PairLJShiftedForce : public Pair { - public: - PairLJShiftedForce(class LAMMPS *); - virtual ~PairLJShiftedForce(); - virtual void compute(int, int); - void settings(int, char **); - void coeff(int, char **); - double init_one(int, int); - void write_restart(FILE *); - void read_restart(FILE *); - void write_restart_settings(FILE *); - void read_restart_settings(FILE *); - double single(int, int, int, int, double, double, double, double &); - - protected: - double cut_global; - double **cut; - double **epsilon,**sigma; - double **lj1,**lj2,**lj3,**lj4,**foffset,**offset; - - void allocate(); -}; - -} - -#endif -#endif diff --git a/src/USER-OMP/fix_rigid_omp.cpp b/src/USER-OMP/fix_rigid_omp.cpp index d5bacc0320..f3ef1d2985 100644 --- a/src/USER-OMP/fix_rigid_omp.cpp +++ b/src/USER-OMP/fix_rigid_omp.cpp @@ -39,7 +39,7 @@ using namespace MathConst; enum{SINGLE,MOLECULE,GROUP}; // same as in FixRigid -#define EINERTIA 0.4 // moment of inertia prefactor for ellipsoid +#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid typedef struct { double x,y,z; } dbl3_t; diff --git a/src/USER-OMP/fix_rigid_small_omp.cpp b/src/USER-OMP/fix_rigid_small_omp.cpp index a260899aef..e3939a829d 100644 --- a/src/USER-OMP/fix_rigid_small_omp.cpp +++ b/src/USER-OMP/fix_rigid_small_omp.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -#define EINERTIA 0.4 // moment of inertia prefactor for ellipsoid +#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid enum{FULL_BODY,INITIAL,FINAL,FORCE_TORQUE,VCM_ANGMOM,XCM_MASS,ITENSOR,DOF}; diff --git a/src/USER-OMP/pair_lj_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_omp.cpp deleted file mode 100644 index bd9d5220b8..0000000000 --- a/src/USER-OMP/pair_lj_sf_omp.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - This software is distributed under the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- - Contributing author: Axel Kohlmeyer (Temple U) -------------------------------------------------------------------------- */ - -#include -#include "pair_lj_sf_omp.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" - -#include "suffix.h" -using namespace LAMMPS_NS; - -/* ---------------------------------------------------------------------- */ - -PairLJShiftedForceOMP::PairLJShiftedForceOMP(LAMMPS *lmp) : - PairLJShiftedForce(lmp), ThrOMP(lmp, THR_PAIR) -{ - suffix_flag |= Suffix::OMP; - respa_enable = 0; -} - -/* ---------------------------------------------------------------------- */ - -void PairLJShiftedForceOMP::compute(int eflag, int vflag) -{ - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; - - const int nall = atom->nlocal + atom->nghost; - const int nthreads = comm->nthreads; - const int inum = list->inum; - -#if defined(_OPENMP) -#pragma omp parallel default(none) shared(eflag,vflag) -#endif - { - int ifrom, ito, tid; - - loop_setup_thr(ifrom, ito, tid, inum, nthreads); - ThrData *thr = fix->get_thr(tid); - thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, thr); - - if (evflag) { - if (eflag) { - if (force->newton_pair) eval<1,1,1>(ifrom, ito, thr); - else eval<1,1,0>(ifrom, ito, thr); - } else { - if (force->newton_pair) eval<1,0,1>(ifrom, ito, thr); - else eval<1,0,0>(ifrom, ito, thr); - } - } else { - if (force->newton_pair) eval<0,0,1>(ifrom, ito, thr); - else eval<0,0,0>(ifrom, ito, thr); - } - - thr->timer(Timer::PAIR); - reduce_thr(this, eflag, vflag, thr); - } // end of omp parallel region -} - -template -void PairLJShiftedForceOMP::eval(int iifrom, int iito, ThrData * const thr) -{ - int i,j,ii,jj,jnum,itype,jtype; - double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; - double t,rsq,r2inv,r6inv,forcelj,factor_lj; - int *ilist,*jlist,*numneigh,**firstneigh; - - evdwl = 0.0; - - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; - const int * _noalias const type = atom->type; - const int nlocal = atom->nlocal; - const double * _noalias const special_lj = force->special_lj; - double fxtmp,fytmp,fztmp; - - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; - - // loop over neighbors of my atoms - - for (ii = iifrom; ii < iito; ++ii) { - - i = ilist[ii]; - xtmp = x[i].x; - ytmp = x[i].y; - ztmp = x[i].z; - itype = type[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - fxtmp=fytmp=fztmp=0.0; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - factor_lj = special_lj[sbmask(j)]; - j &= NEIGHMASK; - - delx = xtmp - x[j].x; - dely = ytmp - x[j].y; - delz = ztmp - x[j].z; - rsq = delx*delx + dely*dely + delz*delz; - jtype = type[j]; - - if (rsq < cutsq[itype][jtype]) { - r2inv = 1.0/rsq; - r6inv = r2inv*r2inv*r2inv; - t = sqrt(rsq)/cut[itype][jtype]; - - forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]) - - t*foffset[itype][jtype]; - - fpair = factor_lj*forcelj*r2inv; - - fxtmp += delx*fpair; - fytmp += dely*fpair; - fztmp += delz*fpair; - if (NEWTON_PAIR || j < nlocal) { - f[j].x -= delx*fpair; - f[j].y -= dely*fpair; - f[j].z -= delz*fpair; - } - - if (EFLAG) { - evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) + - (t-1.0)*foffset[itype][jtype] - offset[itype][jtype]; - evdwl *= factor_lj; - } - - if (EVFLAG) ev_tally_thr(this,i,j,nlocal,NEWTON_PAIR, - evdwl,0.0,fpair,delx,dely,delz,thr); - } - } - f[i].x += fxtmp; - f[i].y += fytmp; - f[i].z += fztmp; - } -} - -/* ---------------------------------------------------------------------- */ - -double PairLJShiftedForceOMP::memory_usage() -{ - double bytes = memory_usage_thr(); - bytes += PairLJShiftedForce::memory_usage(); - - return bytes; -} diff --git a/src/USER-OMP/pair_lj_sf_omp.h b/src/USER-OMP/pair_lj_sf_omp.h deleted file mode 100644 index 92db973b3d..0000000000 --- a/src/USER-OMP/pair_lj_sf_omp.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, 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 author: Axel Kohlmeyer (Temple U) -------------------------------------------------------------------------- */ - -#ifdef PAIR_CLASS - -PairStyle(lj/sf/omp,PairLJShiftedForceOMP) - -#else - -#ifndef LMP_PAIR_LJ_SF_OMP_H -#define LMP_PAIR_LJ_SF_OMP_H - -#include "pair_lj_sf.h" -#include "thr_omp.h" - -namespace LAMMPS_NS { - -class PairLJShiftedForceOMP : public PairLJShiftedForce, public ThrOMP { - - public: - PairLJShiftedForceOMP(class LAMMPS *); - - virtual void compute(int, int); - virtual double memory_usage(); - - private: - template - void eval(int ifrom, int ito, ThrData * const thr); -}; - -} - -#endif -#endif diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.h b/src/USER-OMP/pair_lj_smooth_linear_omp.h index 940c0ea707..874e42eb9f 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.h +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.h @@ -18,6 +18,7 @@ #ifdef PAIR_CLASS PairStyle(lj/smooth/linear/omp,PairLJSmoothLinearOMP) +PairStyle(lj/sf/omp,PairLJSmoothLinearOMP) #else diff --git a/src/compute.h b/src/compute.h index 8fd3880aa7..f04ffebd61 100644 --- a/src/compute.h +++ b/src/compute.h @@ -153,7 +153,7 @@ class Compute : protected Pointers { double **vbiasall; // stored velocity bias for all atoms int maxbias; // size of vbiasall array - inline int sbmask(int j) { + inline int sbmask(int j) const { return j >> SBBITS & 3; } diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 43f13ecc32..90e2830e39 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -102,23 +102,22 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg if (qlist[iw] > qmax) qmax = qlist[iw]; } iarg += nqlist; - if (strcmp(arg[iarg],"components") == 0) { - qlcompflag = 1; - if (iarg+2 > narg) - error->all(FLERR,"Illegal compute orientorder/atom command"); - qlcomp = force->numeric(FLERR,arg[iarg+1]); - if (qlcomp <= 0) - error->all(FLERR,"Illegal compute orientorder/atom command"); - iqlcomp = -1; - for (int iw = 0; iw < nqlist; iw++) - if (qlcomp == qlist[iw]) { - iqlcomp = iw; - break; - } - if (iqlcomp < 0) - error->all(FLERR,"Illegal compute orientorder/atom command"); - iarg += 2; - } + } else if (strcmp(arg[iarg],"components") == 0) { + qlcompflag = 1; + if (iarg+2 > narg) + error->all(FLERR,"Illegal compute orientorder/atom command"); + qlcomp = force->numeric(FLERR,arg[iarg+1]); + if (qlcomp <= 0) + error->all(FLERR,"Illegal compute orientorder/atom command"); + iqlcomp = -1; + for (int iw = 0; iw < nqlist; iw++) + if (qlcomp == qlist[iw]) { + iqlcomp = iw; + break; + } + if (iqlcomp < 0) + error->all(FLERR,"Illegal compute orientorder/atom command"); + iarg += 2; } else if (strcmp(arg[iarg],"cutoff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command"); diff --git a/src/create_bonds.h b/src/create_bonds.h index 2936506b3f..24b1596e37 100644 --- a/src/create_bonds.h +++ b/src/create_bonds.h @@ -30,7 +30,7 @@ class CreateBonds : protected Pointers { void command(int, char **); private: - inline int sbmask(int j) { + inline int sbmask(int j) const { return j >> SBBITS & 3; } }; diff --git a/src/delete_atoms.h b/src/delete_atoms.h index 62ba47d715..72cf44285f 100644 --- a/src/delete_atoms.h +++ b/src/delete_atoms.h @@ -45,7 +45,7 @@ class DeleteAtoms : protected Pointers { void recount_topology(); void options(int, char **); - inline int sbmask(int j) { + inline int sbmask(int j) const { return j >> SBBITS & 3; } diff --git a/src/domain.cpp b/src/domain.cpp index 8ead12cd4e..427f7785e8 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -60,6 +60,7 @@ enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files Domain::Domain(LAMMPS *lmp) : Pointers(lmp) { box_exist = 0; + box_change = 0; dimension = 3; nonperiodic = 0; @@ -1697,6 +1698,7 @@ int Domain::ownatom(int id, double *x, imageint *image, int shrinkexceed) void Domain::set_lattice(int narg, char **arg) { if (lattice) delete lattice; + lattice = NULL; lattice = new Lattice(lmp,narg,arg); } diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 171a90ba3a..705f1970af 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -enum{NONE,FINAL,DELTA,SCALE,VEL,ERATE,TRATE,VOLUME,WIGGLE,VARIABLE}; +enum{NONE=0,FINAL,DELTA,SCALE,VEL,ERATE,TRATE,VOLUME,WIGGLE,VARIABLE}; enum{ONE_FROM_ONE,ONE_FROM_TWO,TWO_FROM_ONE}; // same as domain.cpp, fix_nvt_sllod.cpp, compute_temp_deform.cpp @@ -52,6 +52,7 @@ rfix(NULL), irregular(NULL), set(NULL) if (narg < 4) error->all(FLERR,"Illegal fix deform command"); no_change_box = 1; + restart_global = 1; nevery = force->inumeric(FLERR,arg[3]); if (nevery <= 0) error->all(FLERR,"Illegal fix deform command"); @@ -59,12 +60,7 @@ rfix(NULL), irregular(NULL), set(NULL) // set defaults set = new Set[6]; - set[0].style = set[1].style = set[2].style = - set[3].style = set[4].style = set[5].style = NONE; - set[0].hstr = set[1].hstr = set[2].hstr = - set[3].hstr = set[4].hstr = set[5].hstr = NULL; - set[0].hratestr = set[1].hratestr = set[2].hratestr = - set[3].hratestr = set[4].hratestr = set[5].hratestr = NULL; + memset(set,0,6*sizeof(Set)); // parse arguments @@ -343,11 +339,9 @@ rfix(NULL), irregular(NULL), set(NULL) set[i].hi_initial = domain->boxhi[i]; set[i].vol_initial = domain->xprd * domain->yprd * domain->zprd; } - for (int i = 3; i < 6; i++) { - if (i == 5) set[i].tilt_initial = domain->xy; - else if (i == 4) set[i].tilt_initial = domain->xz; - else if (i == 3) set[i].tilt_initial = domain->yz; - } + set[3].tilt_initial = domain->yz; + set[4].tilt_initial = domain->xz; + set[5].tilt_initial = domain->xy; // reneighboring only forced if flips can occur due to shape changes @@ -955,6 +949,43 @@ void FixDeform::end_of_step() if (kspace_flag) force->kspace->setup(); } +/* ---------------------------------------------------------------------- + write Set data to restart file +------------------------------------------------------------------------- */ + +void FixDeform::write_restart(FILE *fp) +{ + if (comm->me == 0) { + int size = 6*sizeof(Set); + fwrite(&size,sizeof(int),1,fp); + fwrite(set,sizeof(Set),6,fp); + } +} + +/* ---------------------------------------------------------------------- + use selected state info from restart file to restart the Fix +------------------------------------------------------------------------- */ + +void FixDeform::restart(char *buf) +{ + int samestyle = 1; + Set *set_restart = (Set *) buf; + for (int i=0; i<6; ++i) { + // restore data from initial state + set[i].lo_initial = set_restart[i].lo_initial; + set[i].hi_initial = set_restart[i].hi_initial; + set[i].vol_initial = set_restart[i].vol_initial; + set[i].tilt_initial = set_restart[i].tilt_initial; + // check if style settings are consitent (should do the whole set?) + if (set[i].style != set_restart[i].style) + samestyle = 0; + if (set[i].substyle != set_restart[i].substyle) + samestyle = 0; + } + if (!samestyle) + error->all(FLERR,"Fix deform settings not consistent with restart"); +} + /* ---------------------------------------------------------------------- */ void FixDeform::options(int narg, char **arg) diff --git a/src/fix_deform.h b/src/fix_deform.h index cdda1b8547..4d440eb3c7 100644 --- a/src/fix_deform.h +++ b/src/fix_deform.h @@ -35,6 +35,8 @@ class FixDeform : public Fix { void init(); virtual void pre_exchange(); virtual void end_of_step(); + virtual void write_restart(FILE *); + virtual void restart(char *buf); double memory_usage(); protected: diff --git a/src/fix_lineforce.cpp b/src/fix_lineforce.cpp index f82ed957f7..1e78bf3ec3 100644 --- a/src/fix_lineforce.cpp +++ b/src/fix_lineforce.cpp @@ -29,6 +29,8 @@ using namespace FixConst; FixLineForce::FixLineForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { + dynamic_group_allow = 1; + if (narg != 6) error->all(FLERR,"Illegal fix lineforce command"); xdir = force->numeric(FLERR,arg[3]); ydir = force->numeric(FLERR,arg[4]); diff --git a/src/fix_planeforce.cpp b/src/fix_planeforce.cpp index 872bd98716..5e999c888c 100644 --- a/src/fix_planeforce.cpp +++ b/src/fix_planeforce.cpp @@ -29,6 +29,8 @@ using namespace FixConst; FixPlaneForce::FixPlaneForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { + dynamic_group_allow = 1; + if (narg != 6) error->all(FLERR,"Illegal fix planeforce command"); xdir = force->numeric(FLERR,arg[3]); ydir = force->numeric(FLERR,arg[4]); diff --git a/src/npair.cpp b/src/npair.cpp index 3451cd6eae..9fbb4d219d 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -123,7 +123,7 @@ void NPair::copy_bin_info() mbinxlo = nb->mbinxlo; mbinylo = nb->mbinylo; mbinzlo = nb->mbinzlo; - + bininvx = nb->bininvx; bininvy = nb->bininvy; bininvz = nb->bininvz; @@ -183,15 +183,15 @@ int NPair::exclusion(int i, int j, int itype, int jtype, if (nex_mol) { for (m = 0; m < nex_mol; m++) - // intra-chain: exclude i-j pair if in same molecule - // inter-chain: exclude i-j pair if in different molecules + // intra-chain: exclude i-j pair if in same molecule + // inter-chain: exclude i-j pair if in different molecules if (ex_mol_intra[m]) { if (mask[i] & ex_mol_bit[m] && mask[j] & ex_mol_bit[m] && - molecule[i] == molecule[j]) return 1; + molecule[i] == molecule[j]) return 1; } else { - if (mask[i] & ex_mol_bit[m] && mask[j] & ex_mol_bit[m] && - molecule[i] != molecule[j]) return 1; + if (mask[i] & ex_mol_bit[m] && mask[j] & ex_mol_bit[m] && + molecule[i] != molecule[j]) return 1; } } diff --git a/src/npair.h b/src/npair.h index 4e5e3f5dfd..6941b86164 100644 --- a/src/npair.h +++ b/src/npair.h @@ -79,7 +79,7 @@ class NPair : protected Pointers { double bininvx,bininvy,bininvz; int *atom2bin,*bins; int *binhead; - + // data from NStencil class int nstencil; diff --git a/src/npair_full_bin.h b/src/npair_full_bin.h index 432fb3cbf8..56c338e360 100644 --- a/src/npair_full_bin.h +++ b/src/npair_full_bin.h @@ -15,7 +15,7 @@ NPairStyle(full/bin, NPairFullBin, - NP_FULL | NP_BIN | NP_MOLONLY | + NP_FULL | NP_BIN | NP_MOLONLY | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/npair_full_bin_atomonly.h b/src/npair_full_bin_atomonly.h index f8c33d9558..0845d1ecef 100644 --- a/src/npair_full_bin_atomonly.h +++ b/src/npair_full_bin_atomonly.h @@ -16,7 +16,7 @@ NPairStyle(full/bin/atomonly, NPairFullBinAtomonly, NP_FULL | NP_BIN | NP_ATOMONLY | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/npair_full_bin_ghost.h b/src/npair_full_bin_ghost.h index a09aab8512..c5a86e68af 100644 --- a/src/npair_full_bin_ghost.h +++ b/src/npair_full_bin_ghost.h @@ -15,7 +15,7 @@ NPairStyle(full/bin/ghost, NPairFullBinGhost, - NP_FULL | NP_BIN | NP_GHOST | NP_NEWTON | NP_NEWTOFF | + NP_FULL | NP_BIN | NP_GHOST | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/npair_full_nsq_ghost.h b/src/npair_full_nsq_ghost.h index 3e259ed098..58cd73c392 100644 --- a/src/npair_full_nsq_ghost.h +++ b/src/npair_full_nsq_ghost.h @@ -15,7 +15,7 @@ NPairStyle(full/nsq/ghost, NPairFullNsqGhost, - NP_FULL | NP_NSQ | NP_GHOST | NP_NEWTON | NP_NEWTOFF | + NP_FULL | NP_NSQ | NP_GHOST | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/npair_half_bin_atomonly_newton.cpp b/src/npair_half_bin_atomonly_newton.cpp index 6bbef0700a..6da44b4a5c 100644 --- a/src/npair_half_bin_atomonly_newton.cpp +++ b/src/npair_half_bin_atomonly_newton.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalfBinAtomonlyNewton::NPairHalfBinAtomonlyNewton(LAMMPS *lmp) : +NPairHalfBinAtomonlyNewton::NPairHalfBinAtomonlyNewton(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/npair_half_respa_bin_newton_tri.cpp b/src/npair_half_respa_bin_newton_tri.cpp index 38621224c4..4ec6685e1d 100644 --- a/src/npair_half_respa_bin_newton_tri.cpp +++ b/src/npair_half_respa_bin_newton_tri.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalfRespaBinNewtonTri::NPairHalfRespaBinNewtonTri(LAMMPS *lmp) : +NPairHalfRespaBinNewtonTri::NPairHalfRespaBinNewtonTri(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/npair_half_size_bin_newton.cpp b/src/npair_half_size_bin_newton.cpp index a8be3ce691..4f4ecccb16 100644 --- a/src/npair_half_size_bin_newton.cpp +++ b/src/npair_half_size_bin_newton.cpp @@ -190,7 +190,7 @@ void NPairHalfSizeBinNewton::build(NeighList *list) nn += dnum; } } - + n++; } } diff --git a/src/npair_half_size_bin_newton_tri.cpp b/src/npair_half_size_bin_newton_tri.cpp index 1107f73026..559eb09a7a 100644 --- a/src/npair_half_size_bin_newton_tri.cpp +++ b/src/npair_half_size_bin_newton_tri.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalfSizeBinNewtonTri::NPairHalfSizeBinNewtonTri(LAMMPS *lmp) : +NPairHalfSizeBinNewtonTri::NPairHalfSizeBinNewtonTri(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/npair_skip_respa.h b/src/npair_skip_respa.h index 62077f85df..deff301909 100644 --- a/src/npair_skip_respa.h +++ b/src/npair_skip_respa.h @@ -15,8 +15,8 @@ NPairStyle(skip/half/respa, NPairSkipRespa, - NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | - NP_NSQ | NP_BIN | NP_MULTI | + NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/npair_skip_size.cpp b/src/npair_skip_size.cpp index 98e757e5c7..e8d19dedca 100644 --- a/src/npair_skip_size.cpp +++ b/src/npair_skip_size.cpp @@ -32,7 +32,7 @@ NPairSkipSize::NPairSkipSize(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build skip list for subset of types from parent list iskip and ijskip flag which atom types and type pairs to skip - if list requests it, preserve shear history via fix shear/history + if list requests it, preserve shear history via fix shear/history ------------------------------------------------------------------------- */ void NPairSkipSize::build(NeighList *list) diff --git a/src/npair_skip_size.h b/src/npair_skip_size.h index 9573396641..b462c9dc97 100644 --- a/src/npair_skip_size.h +++ b/src/npair_skip_size.h @@ -15,7 +15,7 @@ NPairStyle(skip/half/size, NPairSkipSize, - NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | + NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/npair_skip_size_off2on.cpp b/src/npair_skip_size_off2on.cpp index 996e9939df..da9dd57047 100644 --- a/src/npair_skip_size_off2on.cpp +++ b/src/npair_skip_size_off2on.cpp @@ -33,7 +33,7 @@ NPairSkipSizeOff2on::NPairSkipSizeOff2on(LAMMPS *lmp) : NPair(lmp) {} build skip list for subset of types from parent list iskip and ijskip flag which atom types and type pairs to skip parent non-skip list used newton off, this skip list is newton on - if list requests it, preserve shear history via fix shear/history + if list requests it, preserve shear history via fix shear/history ------------------------------------------------------------------------- */ void NPairSkipSizeOff2on::build(NeighList *list) diff --git a/src/npair_skip_size_off2on.h b/src/npair_skip_size_off2on.h index 4b4e9a9c29..dab32f04ff 100644 --- a/src/npair_skip_size_off2on.h +++ b/src/npair_skip_size_off2on.h @@ -15,8 +15,8 @@ NPairStyle(skip/size/off2on, NPairSkipSizeOff2on, - NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | - NP_NSQ | NP_BIN | NP_MULTI | + NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | + NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/npair_skip_size_off2on_oneside.cpp b/src/npair_skip_size_off2on_oneside.cpp index a4c1625590..7377feec5b 100644 --- a/src/npair_skip_size_off2on_oneside.cpp +++ b/src/npair_skip_size_off2on_oneside.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) : +NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- @@ -35,7 +35,7 @@ NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) : iskip and ijskip flag which atom types and type pairs to skip parent non-skip list used newton off and was not onesided, this skip list is newton on and onesided - if list requests it, preserve shear history via fix shear/history + if list requests it, preserve shear history via fix shear/history ------------------------------------------------------------------------- */ void NPairSkipSizeOff2onOneside::build(NeighList *list) diff --git a/src/npair_skip_size_off2on_oneside.h b/src/npair_skip_size_off2on_oneside.h index 9f3c06e7bc..73448ca279 100644 --- a/src/npair_skip_size_off2on_oneside.h +++ b/src/npair_skip_size_off2on_oneside.h @@ -15,8 +15,8 @@ NPairStyle(skip/size/off2on/oneside, NPairSkipSizeOff2onOneside, - NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | - NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | + NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | + NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) #else diff --git a/src/nstencil_full_bin_2d.cpp b/src/nstencil_full_bin_2d.cpp index 1f2b666dfb..0986c40dd4 100644 --- a/src/nstencil_full_bin_2d.cpp +++ b/src/nstencil_full_bin_2d.cpp @@ -28,7 +28,7 @@ NStencilFullBin2d::NStencilFullBin2d(LAMMPS *lmp) : NStencil(lmp) {} void NStencilFullBin2d::create() { int i,j; - + nstencil = 0; for (j = -sy; j <= sy; j++) diff --git a/src/nstencil_full_bin_2d.h b/src/nstencil_full_bin_2d.h index 18f848f275..d85063596f 100644 --- a/src/nstencil_full_bin_2d.h +++ b/src/nstencil_full_bin_2d.h @@ -15,7 +15,7 @@ NStencilStyle(full/bin/2d, NStencilFullBin2d, - NS_FULL | NS_BIN | NS_2D | + NS_FULL | NS_BIN | NS_2D | NS_NEWTON | NS_NEWTOFF | NS_ORTHO | NS_TRI) #else diff --git a/src/nstencil_full_bin_3d.h b/src/nstencil_full_bin_3d.h index d9acc9c535..facddd8ead 100644 --- a/src/nstencil_full_bin_3d.h +++ b/src/nstencil_full_bin_3d.h @@ -15,7 +15,7 @@ NStencilStyle(full/bin/3d, NStencilFullBin3d, - NS_FULL | NS_BIN | NS_3D | + NS_FULL | NS_BIN | NS_3D | NS_NEWTON | NS_NEWTOFF | NS_ORTHO | NS_TRI) #else diff --git a/src/nstencil_full_ghost_bin_2d.h b/src/nstencil_full_ghost_bin_2d.h index af47913e7f..531c7d2eb1 100644 --- a/src/nstencil_full_ghost_bin_2d.h +++ b/src/nstencil_full_ghost_bin_2d.h @@ -15,7 +15,7 @@ NStencilStyle(full/ghost/bin/2d, NStencilFullGhostBin2d, - NS_FULL | NS_GHOST | NS_BIN | NS_2D | + NS_FULL | NS_GHOST | NS_BIN | NS_2D | NS_NEWTON | NS_NEWTOFF | NS_ORTHO | NS_TRI) #else diff --git a/src/nstencil_full_ghost_bin_3d.h b/src/nstencil_full_ghost_bin_3d.h index beca6573de..ed4ca6c4d6 100644 --- a/src/nstencil_full_ghost_bin_3d.h +++ b/src/nstencil_full_ghost_bin_3d.h @@ -15,7 +15,7 @@ NStencilStyle(full/ghost/bin/3d, NStencilFullGhostBin3d, - NS_FULL | NS_GHOST | NS_BIN | NS_3D | + NS_FULL | NS_GHOST | NS_BIN | NS_3D | NS_NEWTON | NS_NEWTOFF | NS_ORTHO | NS_TRI) #else diff --git a/src/nstencil_full_multi_2d.h b/src/nstencil_full_multi_2d.h index 8154144eda..f78eecc55f 100644 --- a/src/nstencil_full_multi_2d.h +++ b/src/nstencil_full_multi_2d.h @@ -15,7 +15,7 @@ NStencilStyle(full/multi/2d, NStencilFullMulti2d, - NS_FULL | NS_MULTI | NS_2D | + NS_FULL | NS_MULTI | NS_2D | NS_NEWTON | NS_NEWTOFF | NS_ORTHO | NS_TRI) #else diff --git a/src/nstencil_half_bin_2d_newtoff.cpp b/src/nstencil_half_bin_2d_newtoff.cpp index be5bc81dbf..e51db6fe7a 100644 --- a/src/nstencil_half_bin_2d_newtoff.cpp +++ b/src/nstencil_half_bin_2d_newtoff.cpp @@ -19,7 +19,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin2dNewtoff::NStencilHalfBin2dNewtoff(LAMMPS *lmp) : +NStencilHalfBin2dNewtoff::NStencilHalfBin2dNewtoff(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/nstencil_half_bin_2d_newton_tri.cpp b/src/nstencil_half_bin_2d_newton_tri.cpp index 3a645a7434..4f89b1c326 100644 --- a/src/nstencil_half_bin_2d_newton_tri.cpp +++ b/src/nstencil_half_bin_2d_newton_tri.cpp @@ -19,7 +19,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin2dNewtonTri::NStencilHalfBin2dNewtonTri(LAMMPS *lmp) : +NStencilHalfBin2dNewtonTri::NStencilHalfBin2dNewtonTri(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/nstencil_half_bin_3d_newtoff.cpp b/src/nstencil_half_bin_3d_newtoff.cpp index 44678b05df..433de400c2 100644 --- a/src/nstencil_half_bin_3d_newtoff.cpp +++ b/src/nstencil_half_bin_3d_newtoff.cpp @@ -19,7 +19,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin3dNewtoff::NStencilHalfBin3dNewtoff(LAMMPS *lmp) : +NStencilHalfBin3dNewtoff::NStencilHalfBin3dNewtoff(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/nstencil_half_bin_3d_newton_tri.cpp b/src/nstencil_half_bin_3d_newton_tri.cpp index 9e8c41f97a..691ce0bb80 100644 --- a/src/nstencil_half_bin_3d_newton_tri.cpp +++ b/src/nstencil_half_bin_3d_newton_tri.cpp @@ -19,7 +19,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NStencilHalfBin3dNewtonTri::NStencilHalfBin3dNewtonTri(LAMMPS *lmp) : +NStencilHalfBin3dNewtonTri::NStencilHalfBin3dNewtonTri(LAMMPS *lmp) : NStencil(lmp) {} /* ---------------------------------------------------------------------- diff --git a/src/nstencil_half_ghost_bin_2d_newtoff.h b/src/nstencil_half_ghost_bin_2d_newtoff.h index 3b70f0042a..3286810c1c 100644 --- a/src/nstencil_half_ghost_bin_2d_newtoff.h +++ b/src/nstencil_half_ghost_bin_2d_newtoff.h @@ -15,7 +15,7 @@ NStencilStyle(half/ghost/bin/2d/newtoff, NStencilHalfGhostBin2dNewtoff, - NS_HALF | NS_GHOST | NS_BIN | NS_2D | + NS_HALF | NS_GHOST | NS_BIN | NS_2D | NS_NEWTOFF | NS_ORTHO | NS_TRI) #else diff --git a/src/pair.h b/src/pair.h index dd859e5f2a..b57004d965 100644 --- a/src/pair.h +++ b/src/pair.h @@ -245,7 +245,7 @@ class Pair : protected Pointers { ubuf(int arg) : i(arg) {} }; - inline int sbmask(int j) { + inline int sbmask(int j) const { return j >> SBBITS & 3; } }; diff --git a/src/pair_lj_smooth_linear.h b/src/pair_lj_smooth_linear.h index 0e3376b789..c18c442a18 100644 --- a/src/pair_lj_smooth_linear.h +++ b/src/pair_lj_smooth_linear.h @@ -14,6 +14,7 @@ #ifdef PAIR_CLASS PairStyle(lj/smooth/linear,PairLJSmoothLinear) +PairStyle(lj/sf,PairLJSmoothLinear) #else diff --git a/src/set.cpp b/src/set.cpp index 629f325d35..59625b7e6c 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -327,15 +327,18 @@ void Set::command(int narg, char **arg) ximageflag = yimageflag = zimageflag = 0; if (strcmp(arg[iarg+1],"NULL") != 0) { ximageflag = 1; - ximage = force->inumeric(FLERR,arg[iarg+1]); + if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); + else ximage = force->inumeric(FLERR,arg[iarg+1]); } if (strcmp(arg[iarg+2],"NULL") != 0) { yimageflag = 1; - yimage = force->inumeric(FLERR,arg[iarg+2]); + if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); + else yimage = force->inumeric(FLERR,arg[iarg+2]); } if (strcmp(arg[iarg+3],"NULL") != 0) { zimageflag = 1; - zimage = force->inumeric(FLERR,arg[iarg+3]); + if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); + else zimage = force->inumeric(FLERR,arg[iarg+3]); } if (ximageflag && ximage && !domain->xperiodic) error->all(FLERR, @@ -811,6 +814,9 @@ void Set::set(int keyword) int xbox = (atom->image[i] & IMGMASK) - IMGMAX; int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX; int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX; + if (varflag1) ximage = static_cast(xvalue); + if (varflag2) yimage = static_cast(yvalue); + if (varflag3) zimage = static_cast(zvalue); if (ximageflag) xbox = ximage; if (yimageflag) ybox = yimage; if (zimageflag) zbox = zimage; diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 77e2cb05d9..ad6c756558 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -185,7 +185,7 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller, if (strcmp(arg[iarg],"fileper") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal write_restart command"); if (!multiproc) - error->all(FLERR,"Cannot use write_restart fileper " + error->all(FLERR,"Cannot use write_restart fileper " "without % in restart file name"); int nper = force->inumeric(FLERR,arg[iarg+1]); if (nper <= 0) error->all(FLERR,"Illegal write_restart command"); @@ -203,7 +203,7 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller, } else if (strcmp(arg[iarg],"nfile") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal write_restart command"); if (!multiproc) - error->all(FLERR,"Cannot use write_restart nfile " + error->all(FLERR,"Cannot use write_restart nfile " "without % in restart file name"); int nfile = force->inumeric(FLERR,arg[iarg+1]); if (nfile <= 0) error->all(FLERR,"Illegal write_restart command");