From 1ee85e59c3f25bb9fb70c8c703417cbac6b818bc Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Fri, 1 Jun 2018 14:50:41 -0400 Subject: [PATCH 01/29] Removed obsolete changes to fix_nve-manifold_rattle --- src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index 543d49278d..4dcc3f9704 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -513,6 +513,7 @@ void FixNVEManifoldRattle::rattle_manifold_x(double *x, double *v, const double c_inv = 1.0 / c; + while ( 1 ) { v[0] = vt[0] - l*no_dt[0]; v[1] = vt[1] - l*no_dt[1]; @@ -650,10 +651,10 @@ void FixNVEManifoldRattle::rattle_manifold_v(double *v, double *f, }while( (res > tolerance) && (iters < max_iter) ); if( iters >= max_iter && res >= tolerance ){ - char msg[2048]; - sprintf(msg,"Failed to constrain atom %d (x = (%f, %f, %f)! res = %e, iters = %d\n", - tagi, x[0], x[1], x[2], res, iters); - error->all(FLERR,msg); + char msg[2048]; + sprintf(msg,"Failed to constrain atom %d (x = (%f, %f, %f)! res = %e, iters = %d\n", + tagi, x[0], x[1], x[2], res, iters); + error->all(FLERR,msg); } stats.v_iters += iters; From 962946ee45df30722b1288afde0f7be334049842 Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Fri, 1 Jun 2018 14:52:34 -0400 Subject: [PATCH 02/29] Ported fix enforce2d to Kokkos. --- doc/src/fix_enforce2d.txt | 1 + src/KOKKOS/fix_enforce2d_kokkos.cpp | 102 ++++++++++++++++++++++++++++ src/KOKKOS/fix_enforce2d_kokkos.h | 92 +++++++++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 src/KOKKOS/fix_enforce2d_kokkos.cpp create mode 100644 src/KOKKOS/fix_enforce2d_kokkos.h diff --git a/doc/src/fix_enforce2d.txt b/doc/src/fix_enforce2d.txt index 5d04e96677..01840254b6 100644 --- a/doc/src/fix_enforce2d.txt +++ b/doc/src/fix_enforce2d.txt @@ -7,6 +7,7 @@ :line fix enforce2d command :h3 +fix enforce2d/kk command :h3 [Syntax:] diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp new file mode 100644 index 0000000000..b5fb964ea8 --- /dev/null +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -0,0 +1,102 @@ +/* -*- 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 authors: Stefan Paquay (Brandeis University) +------------------------------------------------------------------------- */ + +#include "atom_masks.h" +#include "atom_kokkos.h" +#include "fix_enforce2d_kokkos.h" + +using namespace LAMMPS_NS; + + +template +FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char **arg) : + FixEnforce2D(lmp, narg, arg) +{ + kokkosable = 1; + atomKK = (AtomKokkos *) atom; + execution_space = ExecutionSpaceFromDevice::space; + + datamask_read = X_MASK | V_MASK | F_MASK | MASK_MASK; + datamask_modify = X_MASK | V_MASK | F_MASK; +} + + +template +void FixEnforce2DKokkos::setup(int vflag) +{ + post_force(vflag); +} + + +template +void FixEnforce2DKokkos::post_force(int vflag) +{ + atomKK->sync(execution_space,datamask_read); + atomKK->modified(execution_space,datamask_modify); + + x = atomKK->k_x.view(); + v = atomKK->k_v.view(); + f = atomKK->k_f.view(); + + mask = atomKK->k_mask.view(); + + int nlocal = atomKK->nlocal; + if (igroup == atomKK->firstgroup) nlocal = atomKK->nfirst; + + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + + // Probably sync here again? + atomKK->sync(execution_space,datamask_read); + atomKK->modified(execution_space,datamask_modify); + + for (int m = 0; m < nfixlist; m++) + flist[m]->enforce2d(); + + +} + + +template +void FixEnforce2DKokkos::post_force_item( int i ) const +{ + + if (mask[i] & groupbit){ + v(i,2) = 0; + x(i,2) = 0; + f(i,2) = 0; + + // Add for omega, angmom, torque... + } + +} + + +template +void FixEnforce2DKokkos::cleanup_copy() +{ + id = style = NULL; + vatom = NULL; +} + + +namespace LAMMPS_NS { +template class FixEnforce2DKokkos; +#ifdef KOKKOS_HAVE_CUDA +template class FixEnforce2DKokkos; +#endif +} diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h new file mode 100644 index 0000000000..11cb213210 --- /dev/null +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -0,0 +1,92 @@ +/* -*- 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 FIX_CLASS + +FixStyle(enforce2d/kk,FixEnforce2DKokkos) +FixStyle(enforce2d/kk/device,FixEnforce2DKokkos) +FixStyle(enforce2d/kk/host,FixEnforce2DKokkos) + +#else + +#ifndef LMP_FIX_ENFORCE2D_KOKKOS_H +#define LMP_FIX_ENFORCE2D_KOKKOS_H + +#include "fix_enforce2d.h" +#include "kokkos_type.h" + +namespace LAMMPS_NS { + +template +class FixEnforce2DKokkos : public FixEnforce2D { + public: + FixEnforce2DKokkos(class LAMMPS *, int, char **); + // ~FixEnforce2DKokkos() {} + // void init(); + void cleanup_copy(); + void setup(int); + void post_force(int); + + KOKKOS_INLINE_FUNCTION + void post_force_item(int) const; + + // void min_setup(int); Kokkos does not support minimization (yet) + // void min_post_force(int); Kokkos does not support minimization (yet) + // void post_force_respa(int, int, int); No RRESPA support yet. + + private: + + typename ArrayTypes::t_x_array x; + typename ArrayTypes::t_v_array v; + typename ArrayTypes::t_f_array f; + + typename ArrayTypes::t_int_1d mask; +}; + + +template +struct FixEnforce2DKokkosPostForceFunctor { + typedef DeviceType device_type; + FixEnforce2DKokkos c; + + FixEnforce2DKokkosPostForceFunctor(FixEnforce2DKokkos* c_ptr): + c(*c_ptr) {c.cleanup_copy();}; + KOKKOS_INLINE_FUNCTION + void operator()(const int i) const { + c.post_force_item(i); + } +}; + + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Cannot use fix enforce2d with 3d simulation + +Self-explanatory. + +E: Fix enforce2d must be defined after fix %s + +UNDOCUMENTED + +*/ From 031077b4fa2c62d59da6720b68c7dd633eb87377 Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Fri, 1 Jun 2018 17:19:53 -0400 Subject: [PATCH 03/29] Made enforce2d also set rotations to in-plane. --- src/KOKKOS/fix_enforce2d_kokkos.cpp | 104 ++++++++++++++++++++++++---- src/KOKKOS/fix_enforce2d_kokkos.h | 15 ++-- 2 files changed, 102 insertions(+), 17 deletions(-) diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index b5fb964ea8..88291ead6e 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -12,13 +12,16 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: Stefan Paquay (Brandeis University) + Contributing authors: Stefan Paquay & Matthew Peterson (Brandeis University) ------------------------------------------------------------------------- */ #include "atom_masks.h" #include "atom_kokkos.h" +#include "comm.h" +#include "error.h" #include "fix_enforce2d_kokkos.h" + using namespace LAMMPS_NS; @@ -30,14 +33,21 @@ FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char * atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; - datamask_read = X_MASK | V_MASK | F_MASK | MASK_MASK; - datamask_modify = X_MASK | V_MASK | F_MASK; + datamask_read = X_MASK | V_MASK | F_MASK | OMEGA_MASK | MASK_MASK; + /* TORQUE_MASK | ANGMOM_MASK | */ // MASK_MASK; + + datamask_modify = X_MASK | V_MASK | F_MASK | OMEGA_MASK; // | + /* TORQUE_MASK | ANGMOM_MASK */ ; } template void FixEnforce2DKokkos::setup(int vflag) { + if( comm->me == 0 ){ + fprintf(screen, "omega, angmom and torque flags are %d, %d, %d\n", + atomKK->omega_flag, atomKK->angmom_flag, atomKK->torque_flag ); + } post_force(vflag); } @@ -52,13 +62,71 @@ void FixEnforce2DKokkos::post_force(int vflag) v = atomKK->k_v.view(); f = atomKK->k_f.view(); + if( atomKK->omega_flag ) + omega = atomKK->k_omega.view(); + + if( atomKK->angmom_flag ) + angmom = atomKK->k_angmom.view(); + + if( atomKK->torque_flag ) + torque = atomKK->k_torque.view(); + + mask = atomKK->k_mask.view(); int nlocal = atomKK->nlocal; if (igroup == atomKK->firstgroup) nlocal = atomKK->nfirst; - FixEnforce2DKokkosPostForceFunctor functor(this); - Kokkos::parallel_for(nlocal,functor); + int flag_mask = 0; + if( atomKK->omega_flag ) flag_mask |= 1; + if( atomKK->angmom_flag ) flag_mask |= 2; + if( atomKK->torque_flag ) flag_mask |= 4; + + switch( flag_mask ){ + case 0:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + case 1:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + case 2:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + case 3:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + case 4:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + case 5:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + case 6:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + case 7:{ + FixEnforce2DKokkosPostForceFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + break; + } + default: + error->all(FLERR, "flag_mask outside of what it should be"); + } + // Probably sync here again? atomKK->sync(execution_space,datamask_read); @@ -66,23 +134,33 @@ void FixEnforce2DKokkos::post_force(int vflag) for (int m = 0; m < nfixlist; m++) flist[m]->enforce2d(); - - } template +template void FixEnforce2DKokkos::post_force_item( int i ) const { - if (mask[i] & groupbit){ - v(i,2) = 0; - x(i,2) = 0; - f(i,2) = 0; + // x(i,2) = 0; // Enforce2d does not set x[2] to zero either... :/ + v(i,2) = 0.0; + f(i,2) = 0.0; - // Add for omega, angmom, torque... + if(omega_flag){ + omega(i,0) = 0.0; + omega(i,1) = 0.0; + } + + if(angmom_flag){ + angmom(i,0) = 0.0; + angmom(i,1) = 0.0; + } + + if(torque_flag){ + torque(i,0) = 0.0; + torque(i,1) = 0.0; + } } - } diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h index 11cb213210..4130797f2c 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.h +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -37,8 +37,9 @@ class FixEnforce2DKokkos : public FixEnforce2D { void setup(int); void post_force(int); + template KOKKOS_INLINE_FUNCTION - void post_force_item(int) const; + void post_force_item(const int i) const; // void min_setup(int); Kokkos does not support minimization (yet) // void min_post_force(int); Kokkos does not support minimization (yet) @@ -50,20 +51,26 @@ class FixEnforce2DKokkos : public FixEnforce2D { typename ArrayTypes::t_v_array v; typename ArrayTypes::t_f_array f; + typename ArrayTypes::t_v_array omega; + typename ArrayTypes::t_v_array angmom; + typename ArrayTypes::t_f_array torque; + typename ArrayTypes::t_int_1d mask; }; -template -struct FixEnforce2DKokkosPostForceFunctor { +template +struct FixEnforce2DKokkosPostForceFunctor { typedef DeviceType device_type; FixEnforce2DKokkos c; FixEnforce2DKokkosPostForceFunctor(FixEnforce2DKokkos* c_ptr): c(*c_ptr) {c.cleanup_copy();}; + KOKKOS_INLINE_FUNCTION void operator()(const int i) const { - c.post_force_item(i); + // c.template? Really C++? + c.template post_force_item (i); } }; From 0e9691831321c8d2c4f03614b3076eaa34f48f2f Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Fri, 1 Jun 2018 17:22:25 -0400 Subject: [PATCH 04/29] Made enforce2d_kokkos actually set data masks. --- src/KOKKOS/fix_enforce2d_kokkos.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index 88291ead6e..e9a42e5c31 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -33,11 +33,11 @@ FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char * atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; - datamask_read = X_MASK | V_MASK | F_MASK | OMEGA_MASK | MASK_MASK; - /* TORQUE_MASK | ANGMOM_MASK | */ // MASK_MASK; + datamask_read = X_MASK | V_MASK | F_MASK | OMEGA_MASK | MASK_MASK + | TORQUE_MASK | ANGMOM_MASK; // | */ // MASK_MASK; - datamask_modify = X_MASK | V_MASK | F_MASK | OMEGA_MASK; // | - /* TORQUE_MASK | ANGMOM_MASK */ ; + datamask_modify = X_MASK | V_MASK | F_MASK | OMEGA_MASK + | TORQUE_MASK | ANGMOM_MASK; } From 824a21a661fe679fadaf3ef7f43e954a9e35e7a6 Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Mon, 4 Jun 2018 12:28:06 -0400 Subject: [PATCH 05/29] Removed debug printing from setup. --- src/KOKKOS/fix_enforce2d_kokkos.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index e9a42e5c31..8ba68a0c0c 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -44,10 +44,6 @@ FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char * template void FixEnforce2DKokkos::setup(int vflag) { - if( comm->me == 0 ){ - fprintf(screen, "omega, angmom and torque flags are %d, %d, %d\n", - atomKK->omega_flag, atomKK->angmom_flag, atomKK->torque_flag ); - } post_force(vflag); } From 4bf9a93c11c9f2baf4290dea63b6db6e7ad199cb Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Wed, 6 Jun 2018 10:47:07 -0400 Subject: [PATCH 06/29] Removed x dependency from enforce2d_kokkos. --- src/KOKKOS/fix_enforce2d_kokkos.cpp | 9 ++++++--- src/KOKKOS/fix_enforce2d_kokkos.h | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index 8ba68a0c0c..da33455978 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -33,10 +33,10 @@ FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char * atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; - datamask_read = X_MASK | V_MASK | F_MASK | OMEGA_MASK | MASK_MASK + datamask_read = V_MASK | F_MASK | OMEGA_MASK | MASK_MASK | TORQUE_MASK | ANGMOM_MASK; // | */ // MASK_MASK; - datamask_modify = X_MASK | V_MASK | F_MASK | OMEGA_MASK + datamask_modify = V_MASK | F_MASK | OMEGA_MASK | TORQUE_MASK | ANGMOM_MASK; } @@ -44,6 +44,10 @@ FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char * template void FixEnforce2DKokkos::setup(int vflag) { + if( comm->me == 0 ){ + fprintf(screen, "omega, angmom and torque flags are %d, %d, %d\n", + atomKK->omega_flag, atomKK->angmom_flag, atomKK->torque_flag ); + } post_force(vflag); } @@ -54,7 +58,6 @@ void FixEnforce2DKokkos::post_force(int vflag) atomKK->sync(execution_space,datamask_read); atomKK->modified(execution_space,datamask_modify); - x = atomKK->k_x.view(); v = atomKK->k_v.view(); f = atomKK->k_f.view(); diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h index 4130797f2c..d8a13d281f 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.h +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -46,8 +46,6 @@ class FixEnforce2DKokkos : public FixEnforce2D { // void post_force_respa(int, int, int); No RRESPA support yet. private: - - typename ArrayTypes::t_x_array x; typename ArrayTypes::t_v_array v; typename ArrayTypes::t_f_array f; From e08ccd0a7c62b71fa8cb8f3cd4f54b83ca2ed7de Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Fri, 29 Jun 2018 11:58:27 -0400 Subject: [PATCH 07/29] Forgot to include change in fix_enforce2d to access fixlist in kokkos port. --- src/fix_enforce2d.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_enforce2d.h b/src/fix_enforce2d.h index cdead78f6a..a3f79309dc 100644 --- a/src/fix_enforce2d.h +++ b/src/fix_enforce2d.h @@ -36,7 +36,7 @@ class FixEnforce2D : public Fix { void post_force_respa(int, int, int); void min_post_force(int); - private: + protected: int nfixlist; class Fix **flist; }; From 24405217d04153ba8eaf9d204d595e0a428cb6f7 Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Thu, 5 Jul 2018 11:20:27 -0400 Subject: [PATCH 08/29] Updated Install.sh in KOKKOS. --- src/KOKKOS/Install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh index c6fab2a1b1..08c7468a49 100755 --- a/src/KOKKOS/Install.sh +++ b/src/KOKKOS/Install.sh @@ -93,6 +93,8 @@ action domain_kokkos.cpp action domain_kokkos.h action fix_deform_kokkos.cpp action fix_deform_kokkos.h +action fix_enforce2d_kokkos.cpp +action fix_enforce2d_kokkos.h action fix_eos_table_rx_kokkos.cpp fix_eos_table_rx.cpp action fix_eos_table_rx_kokkos.h fix_eos_table_rx.h action fix_langevin_kokkos.cpp From db75232957d5964f07df7dc6d1f774ca089fc3b8 Mon Sep 17 00:00:00 2001 From: Stefan Paquay Date: Fri, 6 Jul 2018 11:31:48 -0400 Subject: [PATCH 09/29] Removed debug print and comment. --- src/KOKKOS/fix_enforce2d_kokkos.cpp | 4 ---- src/KOKKOS/fix_enforce2d_kokkos.h | 1 - 2 files changed, 5 deletions(-) diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index da33455978..f2c313b2fe 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -44,10 +44,6 @@ FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char * template void FixEnforce2DKokkos::setup(int vflag) { - if( comm->me == 0 ){ - fprintf(screen, "omega, angmom and torque flags are %d, %d, %d\n", - atomKK->omega_flag, atomKK->angmom_flag, atomKK->torque_flag ); - } post_force(vflag); } diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h index d8a13d281f..ae8183acf1 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.h +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -67,7 +67,6 @@ struct FixEnforce2DKokkosPostForceFunctor { KOKKOS_INLINE_FUNCTION void operator()(const int i) const { - // c.template? Really C++? c.template post_force_item (i); } }; From 0c1dcfb617e9b0f4aeb3a38919d14b20ab09b357 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Fri, 6 Jul 2018 17:06:37 -0600 Subject: [PATCH 10/29] Favor copymode instead of cleanup_copy --- src/KOKKOS/fix_enforce2d_kokkos.cpp | 11 ++--------- src/KOKKOS/fix_enforce2d_kokkos.h | 3 +-- src/fix_enforce2d.cpp | 2 ++ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index f2c313b2fe..33aa39e2f6 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -77,6 +77,7 @@ void FixEnforce2DKokkos::post_force(int vflag) if( atomKK->angmom_flag ) flag_mask |= 2; if( atomKK->torque_flag ) flag_mask |= 4; + copymode = 1; switch( flag_mask ){ case 0:{ FixEnforce2DKokkosPostForceFunctor functor(this); @@ -121,7 +122,7 @@ void FixEnforce2DKokkos::post_force(int vflag) default: error->all(FLERR, "flag_mask outside of what it should be"); } - + copymode = 0; // Probably sync here again? atomKK->sync(execution_space,datamask_read); @@ -159,14 +160,6 @@ void FixEnforce2DKokkos::post_force_item( int i ) const } -template -void FixEnforce2DKokkos::cleanup_copy() -{ - id = style = NULL; - vatom = NULL; -} - - namespace LAMMPS_NS { template class FixEnforce2DKokkos; #ifdef KOKKOS_HAVE_CUDA diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h index ae8183acf1..1ed3cf3ef8 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.h +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -33,7 +33,6 @@ class FixEnforce2DKokkos : public FixEnforce2D { FixEnforce2DKokkos(class LAMMPS *, int, char **); // ~FixEnforce2DKokkos() {} // void init(); - void cleanup_copy(); void setup(int); void post_force(int); @@ -63,7 +62,7 @@ struct FixEnforce2DKokkosPostForceFunctor { FixEnforce2DKokkos c; FixEnforce2DKokkosPostForceFunctor(FixEnforce2DKokkos* c_ptr): - c(*c_ptr) {c.cleanup_copy();}; + c(*c_ptr) {}; KOKKOS_INLINE_FUNCTION void operator()(const int i) const { diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index 4ffd2ca7ac..791a52c50c 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -38,6 +38,8 @@ FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) : FixEnforce2D::~FixEnforce2D() { + if (copymode) return; + delete [] flist; } From ad4f61a5ce6abdf69c5cff22dec3d563ead95c35 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 10 Jul 2018 09:07:54 -0400 Subject: [PATCH 11/29] update fatbin makefile for libgpu.a to latest additions --- lib/gpu/Nvidia.makefile_multi | 46 +++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/gpu/Nvidia.makefile_multi b/lib/gpu/Nvidia.makefile_multi index 5fb35cce3c..94cfd4af6b 100644 --- a/lib/gpu/Nvidia.makefile_multi +++ b/lib/gpu/Nvidia.makefile_multi @@ -79,7 +79,10 @@ OBJS = $(OBJ_DIR)/lal_atom.o $(OBJ_DIR)/lal_ans.o \ $(OBJ_DIR)/lal_lj_cubic.o $(OBJ_DIR)/lal_lj_cubic_ext.o \ $(OBJ_DIR)/lal_ufm.o $(OBJ_DIR)/lal_ufm_ext.o \ $(OBJ_DIR)/lal_dipole_long_lj.o $(OBJ_DIR)/lal_dipole_long_lj_ext.o \ - $(OBJ_DIR)/lal_lj_expand_coul_long.o $(OBJ_DIR)/lal_lj_expand_coul_long_ext.o + $(OBJ_DIR)/lal_lj_expand_coul_long.o $(OBJ_DIR)/lal_lj_expand_coul_long_ext.o \ + $(OBJ_DIR)/lal_coul_long_cs.o $(OBJ_DIR)/lal_coul_long_cs_ext.o \ + $(OBJ_DIR)/lal_born_coul_long_cs.o $(OBJ_DIR)/lal_born_coul_long_cs_ext.o \ + $(OBJ_DIR)/lal_born_coul_wolf_cs.o $(OBJ_DIR)/lal_born_coul_wolf_cs_ext.o CBNS = $(OBJ_DIR)/device.cubin $(OBJ_DIR)/device_cubin.h \ $(OBJ_DIR)/atom.cubin $(OBJ_DIR)/atom_cubin.h \ @@ -137,7 +140,10 @@ CBNS = $(OBJ_DIR)/device.cubin $(OBJ_DIR)/device_cubin.h \ $(OBJ_DIR)/lj_cubic.cubin $(OBJ_DIR)/lj_cubic_cubin.h \ $(OBJ_DIR)/ufm.cubin $(OBJ_DIR)/ufm_cubin.h \ $(OBJ_DIR)/dipole_long_lj.cubin $(OBJ_DIR)/dipole_long_lj_cubin.h \ - $(OBJ_DIR)/lj_expand_coul_long.cubin $(OBJ_DIR)/lj_expand_coul_long_cubin.h + $(OBJ_DIR)/lj_expand_coul_long.cubin $(OBJ_DIR)/lj_expand_coul_long_cubin.h \ + $(OBJ_DIR)/coul_long_cs.cubin $(OBJ_DIR)/coul_long_cs_cubin.h \ + $(OBJ_DIR)/born_coul_long_cs.cubin $(OBJ_DIR)/born_coul_long_cs_cubin.h \ + $(OBJ_DIR)/born_coul_wolf_cs.cubin $(OBJ_DIR)/born_coul_wolf_cs_cubin.h all: $(OBJ_DIR) $(GPU_LIB) $(EXECS) @@ -837,6 +843,42 @@ $(OBJ_DIR)/lal_lj_expand_coul_long.o: $(ALL_H) lal_lj_expand_coul_long.h lal_lj_ $(OBJ_DIR)/lal_lj_expand_coul_long_ext.o: $(ALL_H) lal_lj_expand_coul_long.h lal_lj_expand_coul_long_ext.cpp lal_base_charge.h $(CUDR) -o $@ -c lal_lj_expand_coul_long_ext.cpp -I$(OBJ_DIR) +$(OBJ_DIR)/coul_long_cs.cubin: lal_coul_long_cs.cu lal_precision.h lal_preprocessor.h + $(CUDA) --fatbin -DNV_KERNEL -o $@ lal_coul_long_cs.cu + +$(OBJ_DIR)/coul_long_cs_cubin.h: $(OBJ_DIR)/coul_long_cs.cubin $(OBJ_DIR)/coul_long_cs.cubin + $(BIN2C) -c -n coul_long_cs $(OBJ_DIR)/coul_long_cs.cubin > $(OBJ_DIR)/coul_long_cs_cubin.h + +$(OBJ_DIR)/lal_coul_long_cs.o: $(ALL_H) lal_coul_long_cs.h lal_coul_long_cs.cpp $(OBJ_DIR)/coul_long_cs_cubin.h $(OBJ_DIR)/lal_base_charge.o $(OBJ_DIR)/lal_coul_long.o + $(CUDR) -o $@ -c lal_coul_long_cs.cpp -I$(OBJ_DIR) + +$(OBJ_DIR)/lal_coul_long_cs_ext.o: $(ALL_H) lal_coul_long_cs.h lal_coul_long_cs_ext.cpp lal_coul_long.h + $(CUDR) -o $@ -c lal_coul_long_cs_ext.cpp -I$(OBJ_DIR) + +$(OBJ_DIR)/born_coul_long_cs.cubin: lal_born_coul_long_cs.cu lal_precision.h lal_preprocessor.h + $(CUDA) --fatbin -DNV_KERNEL -o $@ lal_born_coul_long_cs.cu + +$(OBJ_DIR)/born_coul_long_cs_cubin.h: $(OBJ_DIR)/born_coul_long_cs.cubin $(OBJ_DIR)/born_coul_long_cs.cubin + $(BIN2C) -c -n born_coul_long_cs $(OBJ_DIR)/born_coul_long_cs.cubin > $(OBJ_DIR)/born_coul_long_cs_cubin.h + +$(OBJ_DIR)/lal_born_coul_long_cs.o: $(ALL_H) lal_born_coul_long_cs.h lal_born_coul_long_cs.cpp $(OBJ_DIR)/born_coul_long_cs_cubin.h $(OBJ_DIR)/lal_base_charge.o $(OBJ_DIR)/lal_born_coul_long.o + $(CUDR) -o $@ -c lal_born_coul_long_cs.cpp -I$(OBJ_DIR) + +$(OBJ_DIR)/lal_born_coul_long_cs_ext.o: $(ALL_H) lal_born_coul_long_cs.h lal_born_coul_long_cs_ext.cpp lal_born_coul_long.h + $(CUDR) -o $@ -c lal_born_coul_long_cs_ext.cpp -I$(OBJ_DIR) + +$(OBJ_DIR)/born_coul_wolf_cs.cubin: lal_born_coul_wolf_cs.cu lal_precision.h lal_preprocessor.h + $(CUDA) --fatbin -DNV_KERNEL -o $@ lal_born_coul_wolf_cs.cu + +$(OBJ_DIR)/born_coul_wolf_cs_cubin.h: $(OBJ_DIR)/born_coul_wolf_cs.cubin $(OBJ_DIR)/born_coul_wolf_cs.cubin + $(BIN2C) -c -n born_coul_wolf_cs $(OBJ_DIR)/born_coul_wolf_cs.cubin > $(OBJ_DIR)/born_coul_wolf_cs_cubin.h + +$(OBJ_DIR)/lal_born_coul_wolf_cs.o: $(ALL_H) lal_born_coul_wolf_cs.h lal_born_coul_wolf_cs.cpp $(OBJ_DIR)/born_coul_wolf_cs_cubin.h $(OBJ_DIR)/lal_base_charge.o $(OBJ_DIR)/lal_born_coul_wolf.o + $(CUDR) -o $@ -c lal_born_coul_wolf_cs.cpp -I$(OBJ_DIR) + +$(OBJ_DIR)/lal_born_coul_wolf_cs_ext.o: $(ALL_H) lal_born_coul_wolf_cs.h lal_born_coul_wolf_cs_ext.cpp lal_born_coul_wolf.h + $(CUDR) -o $@ -c lal_born_coul_wolf_cs_ext.cpp -I$(OBJ_DIR) + $(BIN_DIR)/nvc_get_devices: ./geryon/ucl_get_devices.cpp $(NVD_H) $(CUDR) -o $@ ./geryon/ucl_get_devices.cpp -DUCL_CUDADR $(CUDA_LIB) -lcuda From 199c96f985bae537e7b43dc49b7a41570cf8b905 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 10 Jul 2018 09:22:41 -0400 Subject: [PATCH 12/29] update and clarify the choice of atom ids for angle style dipole (which is not really an angle potential) --- doc/src/angle_dipole.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/src/angle_dipole.txt b/doc/src/angle_dipole.txt index d91f260d51..34cc8c153c 100644 --- a/doc/src/angle_dipole.txt +++ b/doc/src/angle_dipole.txt @@ -96,16 +96,17 @@ USER-MISC package. See the "Making LAMMPS"_Section_start.html#start_2_3 section for more info on packages. NOTE: In the "Angles" section of the data file, the atom ID 'j' -corresponding to the dipole to restrain must come before the atom ID -of the reference atom 'i'. A third atom ID 'k' must also be provided, -although 'k' is just a 'dummy' atom which can be any atom; it may be -useful to choose a convention (e.g., 'k'='i') and adhere to it. For -example, if ID=1 for the dipolar atom to restrain, and ID=2 for the -reference atom, the corresponding line in the "Angles" section of the -data file would read: X X 1 2 2 +defining the direction of the dipole vector to restrain must come +before the atom ID of the reference atom 'i'. A third atom ID 'k' must +also be provided to comply with the requirement of a valid angle +definition. This atom ID k should be chosen to be that of an atom +bonded to atom 'i' to avoid errors with "lost angle atoms" when running +in parallel. Since the LAMMPS code checks for valid angle definitions, +cannot use the same atom ID of either 'i' or 'j' (this was allowed +and recommended with older LAMMPS versions). The "newton" command for intramolecular interactions must be "on" -(which is the default). +(which is the default except when using some accelerator packages). This angle style should not be used with SHAKE. From 9d5dc561ca45967c445f472bca92e253bca3d33d Mon Sep 17 00:00:00 2001 From: julient31 Date: Mon, 9 Jul 2018 10:24:55 -0600 Subject: [PATCH 13/29] Commit1 JT 070918 - created README in examples/SPIN - modified doc/src/set.txt to define 'spin' and 'spin/random' keywords --- doc/src/set.txt | 17 +++++++++++++++++ examples/SPIN/README | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 examples/SPIN/README diff --git a/doc/src/set.txt b/doc/src/set.txt index 4757d1c575..d05660dc42 100644 --- a/doc/src/set.txt +++ b/doc/src/set.txt @@ -17,6 +17,7 @@ ID = atom ID range or type range or mol ID range or group ID or region ID :l one or more keyword/value pairs may be appended :l keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \ {charge} or {dipole} or {dipole/random} or {quat} or \ + {spin} or {spin/random} or {quat} or \ {quat/random} or {diameter} or {shape} or \ {length} or {tri} or {theta} or {theta/random} or \ {angmom} or {omega} or \ @@ -43,6 +44,13 @@ keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \ {dipole/random} value = seed Dlen seed = random # seed (positive integer) for dipole moment orientations Dlen = magnitude of dipole moment (dipole units) + {spin} values = g x y z + g = magnitude of magnetic spin vector (in Bohr magneton's unit) + x,y,z = orientation of magnetic spin vector + any of x,y,z can be an atom-style variable (see below) + {spin/random} value = seed Dlen + seed = random # seed (positive integer) for magnetic spin orientations + Dlen = magnitude of magnetic spin vector (in Bohr magneton's unit) {quat} values = a b c theta a,b,c = unit vector to rotate particle around via right-hand rule theta = rotation angle (degrees) @@ -232,6 +240,15 @@ the orientation of a particular atom is the same, regardless of how many processors are being used. This keyword does not allow use of an atom-style variable. +Keyword {spin} uses the specified g value to set the magnitude of the +magnetic spin vectors, and the x,y,z values as components of a vector +to set as the orientation of the magnetic spin vectors of the selected +atoms. + +Keyword {spin/random} randomizes the orientation of the magnetic spin +vectors for the selected atoms and sets the magnitude of each to the +specified {Dlen} value. + Keyword {quat} uses the specified values to create a quaternion (4-vector) that represents the orientation of the selected atoms. The particles must define a quaternion for their orientation diff --git a/examples/SPIN/README b/examples/SPIN/README new file mode 100644 index 0000000000..5ad252e7f2 --- /dev/null +++ b/examples/SPIN/README @@ -0,0 +1,20 @@ +This directory contains examples and applications of the SPIN package +===================================================================== + +- the iron, cobalt_hcp, cobalt_fcc and nickel directories provide +examples of spin-lattice calculations. + +- the bfo repository provides an example of spin dynamics calculation +performed on a fixed lattice, and applied to the multiferroic +material bismuth-oxide. + +- the read_restart directory provides examples allowing to write or +read data files, and restart magneto-mechanical simulations. + +- vizualization of the dump files can be achieved using Ovito or +VMD. See the vmd repository for help vizualizing results with VMD. + +** Note, the aim of this repository is mainly to provide users with +examples. Better values and tuning of the magnetic and mechanical +interactions can be achieved for more accurate materials +simulations. ** From ade9b7bfc39ede248fc1d81b7ab93a7019e10daf Mon Sep 17 00:00:00 2001 From: julient31 Date: Mon, 9 Jul 2018 18:07:10 -0600 Subject: [PATCH 14/29] Commit2 JT 070918 - modified the citeme reference (replaced by the JCP one) - same modification in doc and src/SPIN --- doc/src/fix_langevin_spin.txt | 4 ++-- doc/src/fix_nve_spin.txt | 2 +- doc/src/pair_spin_dmi.txt | 2 +- doc/src/pair_spin_exchange.txt | 2 +- doc/src/pair_spin_magelec.txt | 2 +- doc/src/pair_spin_neel.txt | 2 +- src/SPIN/atom_vec_spin.cpp | 6 +++--- src/SPIN/compute_spin.cpp | 6 +++--- src/SPIN/fix_langevin_spin.cpp | 6 +++--- src/SPIN/fix_nve_spin.cpp | 11 ++++++----- src/SPIN/fix_precession_spin.cpp | 6 +++--- src/SPIN/pair_spin.cpp | 6 +++--- src/SPIN/pair_spin_dmi.cpp | 6 +++--- src/SPIN/pair_spin_exchange.cpp | 6 +++--- src/SPIN/pair_spin_magelec.cpp | 12 ++++++------ src/SPIN/pair_spin_neel.cpp | 6 +++--- 16 files changed, 43 insertions(+), 42 deletions(-) diff --git a/doc/src/fix_langevin_spin.txt b/doc/src/fix_langevin_spin.txt index 51f085ebdc..b089cd7f58 100644 --- a/doc/src/fix_langevin_spin.txt +++ b/doc/src/fix_langevin_spin.txt @@ -98,5 +98,5 @@ integration fix (e.g. {fix nve/spin}). [(Mayergoyz)] I.D. Mayergoyz, G. Bertotti, C. Serpico (2009). Elsevier (2009) :link(Tranchida2) -[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson, -arXiv preprint arXiv:1801.10233, (2018). +[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson, +Journal of Computational Physics, (2018). diff --git a/doc/src/fix_nve_spin.txt b/doc/src/fix_nve_spin.txt index 6ccebcebf6..f4b38c270b 100644 --- a/doc/src/fix_nve_spin.txt +++ b/doc/src/fix_nve_spin.txt @@ -73,4 +73,4 @@ instead of "array" is also valid. :link(Tranchida1) [(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson, -arXiv preprint arXiv:1801.10233, (2018). +Journal of Computational Physics, (2018). diff --git a/doc/src/pair_spin_dmi.txt b/doc/src/pair_spin_dmi.txt index 9fe53df18a..24877906f3 100644 --- a/doc/src/pair_spin_dmi.txt +++ b/doc/src/pair_spin_dmi.txt @@ -63,4 +63,4 @@ See the "Making LAMMPS"_Section_start.html#start_3 section for more info. :link(Tranchida5) [(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson, -arXiv preprint arXiv:1801.10233, (2018). +Journal of Computational Physics, (2018). diff --git a/doc/src/pair_spin_exchange.txt b/doc/src/pair_spin_exchange.txt index 97b6d0b34f..ad3357cb5e 100644 --- a/doc/src/pair_spin_exchange.txt +++ b/doc/src/pair_spin_exchange.txt @@ -79,4 +79,4 @@ See the "Making LAMMPS"_Section_start.html#start_3 section for more info. :link(Tranchida3) [(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson, -arXiv preprint arXiv:1801.10233, (2018). +Journal of Computational Physics, (2018). diff --git a/doc/src/pair_spin_magelec.txt b/doc/src/pair_spin_magelec.txt index 0185a5abb2..8ba24c46af 100644 --- a/doc/src/pair_spin_magelec.txt +++ b/doc/src/pair_spin_magelec.txt @@ -70,4 +70,4 @@ See the "Making LAMMPS"_Section_start.html#start_3 section for more info. :link(Tranchida4) [(Tranchida)] Tranchida, Plimpton, Thibaudeau, and Thompson, -arXiv preprint arXiv:1801.10233, (2018). +Journal of Computational Physics, (2018). diff --git a/doc/src/pair_spin_neel.txt b/doc/src/pair_spin_neel.txt index f7c9608a93..8551f8d636 100644 --- a/doc/src/pair_spin_neel.txt +++ b/doc/src/pair_spin_neel.txt @@ -78,4 +78,4 @@ See the "Making LAMMPS"_Section_start.html#start_3 section for more info. :link(Tranchida6) [(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson, -arXiv preprint arXiv:1801.10233, (2018). +Journal of Computational Physics, (2018). diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index 4871fe0c40..51903e5480 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -18,9 +18,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index 54818a9b70..1d87f4e722 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 97b33197ce..402b934723 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index d91636af58..353f2cbd83 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include @@ -59,8 +59,9 @@ static const char cite_fix_nve_spin[] = "title={Massively parallel symplectic algorithm for coupled magnetic spin " "dynamics and molecular dynamics},\n" "author={Tranchida, J and Plimpton, SJ and Thibaudeau, P and Thompson, AP},\n" - "journal={arXiv preprint arXiv:1801.10233},\n" - "year={2018}\n" + "journal={Journal of Computational Physics},\n" + "year={2018},\n" + "publisher={Elsevier}\n" "}\n\n"; enum{NONE}; diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index eedf0becb7..447139e0ee 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index acb7ffe548..d29f31b70a 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index 07ae684939..0129dec005 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 7b05d7337e..5aa5a267b9 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index e9e7c1fb3f..79cdc919e8 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include @@ -436,9 +436,9 @@ void PairSpinMagelec::compute_magelec_mech(int i, int j, double fi[3], double sp meiy *= ME_mech[itype][jtype]; meiz *= ME_mech[itype][jtype]; - fi[0] = meiy*vz - meiz*vy; - fi[1] = meiz*vx - meix*vz; - fi[2] = meix*vy - meiy*vx; + fi[0] += meiy*vz - meiz*vy; + fi[1] += meiz*vx - meix*vz; + fi[2] += meix*vy - meiy*vx; } diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index d74db638bd..a8d9fe8ffa 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -16,9 +16,9 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics - and molecular dynamics. arXiv preprint arXiv:1801.10233. + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics + and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ #include From 792b182cb041dce9c72a7c46ccb473c0c0165a72 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 10 Jul 2018 09:46:08 -0400 Subject: [PATCH 15/29] whitespace cleanup --- src/SPIN/atom_vec_spin.cpp | 6 +++--- src/SPIN/compute_spin.cpp | 4 ++-- src/SPIN/fix_langevin_spin.cpp | 4 ++-- src/SPIN/fix_nve_spin.cpp | 4 ++-- src/SPIN/fix_precession_spin.cpp | 4 ++-- src/SPIN/pair_spin.cpp | 4 ++-- src/SPIN/pair_spin_dmi.cpp | 4 ++-- src/SPIN/pair_spin_exchange.cpp | 4 ++-- src/SPIN/pair_spin_magelec.cpp | 4 ++-- src/SPIN/pair_spin_neel.cpp | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index 51903e5480..276bc34e64 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -18,8 +18,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp) size_data_atom = 9; size_data_vel = 4; xcol_data = 4; - + atom->sp_flag = 1; } diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index 1d87f4e722..b508d0624f 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 402b934723..3650651457 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 353f2cbd83..415c2352d4 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index 447139e0ee..bcdd62413d 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index d29f31b70a..b6cf07e60c 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index 0129dec005..4ea6cfd0cc 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 5aa5a267b9..cb2d7424cf 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index 79cdc919e8..77bf42159a 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index a8d9fe8ffa..05999170eb 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -16,8 +16,8 @@ Aidan Thompson (SNL) Please cite the related publication: - Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). - Massively parallel symplectic algorithm for coupled magnetic spin dynamics + Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018). + Massively parallel symplectic algorithm for coupled magnetic spin dynamics and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ From 1ed25d195be0d32caa75f99172dcda48afab95ed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 10 Jul 2018 09:48:49 -0400 Subject: [PATCH 16/29] convert c-style includes for c-library calls to c++-style --- src/SPIN/atom_vec_spin.cpp | 6 +++--- src/SPIN/compute_spin.cpp | 2 +- src/SPIN/fix_langevin_spin.cpp | 6 +++--- src/SPIN/fix_nve_spin.cpp | 6 +++--- src/SPIN/fix_precession_spin.cpp | 8 ++++---- src/SPIN/pair_spin.cpp | 6 +++--- src/SPIN/pair_spin_dmi.cpp | 6 +++--- src/SPIN/pair_spin_exchange.cpp | 6 +++--- src/SPIN/pair_spin_magelec.cpp | 6 +++--- src/SPIN/pair_spin_neel.cpp | 6 +++--- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index 276bc34e64..8b47eff624 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -23,9 +23,9 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include "atom.h" #include "atom_vec_spin.h" #include "comm.h" diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index b508d0624f..b67f62d53d 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -22,7 +22,7 @@ ------------------------------------------------------------------------- */ #include -#include +#include #include "atom.h" #include "compute_spin.h" #include "domain.h" diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 3650651457..cb34465482 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -22,9 +22,9 @@ ------------------------------------------------------------------------- */ #include -#include -#include -#include +#include +#include +#include #include "atom.h" #include "atom_vec_ellipsoid.h" diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 415c2352d4..b75f03212a 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -21,9 +21,9 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include "atom.h" #include "atom_vec.h" diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index bcdd62413d..b908478952 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -21,10 +21,10 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include -#include +#include +#include +#include +#include #include "atom.h" #include "domain.h" diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index b6cf07e60c..398206b26e 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -21,9 +21,9 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include "atom.h" #include "comm.h" diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index 4ea6cfd0cc..b792969c5d 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -21,9 +21,9 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include "atom.h" #include "comm.h" diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index cb2d7424cf..1b7b36b6db 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -21,9 +21,9 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include "atom.h" #include "comm.h" diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index 77bf42159a..315b691d17 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -21,9 +21,9 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include "atom.h" #include "comm.h" diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index 05999170eb..0daafad756 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -21,9 +21,9 @@ and molecular dynamics. Journal of Computational Physics. ------------------------------------------------------------------------- */ -#include -#include -#include +#include +#include +#include #include "atom.h" #include "comm.h" From 1f1447c3ac3f919d6c4c34d03e2a0df99b39fdad Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 11 Jul 2018 07:22:47 -0400 Subject: [PATCH 17/29] need to update exclusions with the new atom IDs in case of molecular systems --- src/reset_ids.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/reset_ids.cpp b/src/reset_ids.cpp index 8a33cd535b..fd898bd3ab 100644 --- a/src/reset_ids.cpp +++ b/src/reset_ids.cpp @@ -16,6 +16,7 @@ #include "atom_vec.h" #include "domain.h" #include "comm.h" +#include "special.h" #include "memory.h" #include "error.h" @@ -44,7 +45,7 @@ void ResetIDs::command(int narg, char **arg) } // create an atom map if one doesn't exist already - + int mapflag = 0; if (atom->map_style == 0) { mapflag = 1; @@ -93,7 +94,7 @@ void ResetIDs::command(int narg, char **arg) // forward_comm_array acquires new IDs for ghost atoms double **newIDs; - memory->create(newIDs,nall,1,"reset_ids:newIDs"); + memory->create(newIDs,nall,1,"reset_ids:newIDs"); for (int i = 0; i < nlocal; i++) { newIDs[i][0] = tag[i]; @@ -105,7 +106,7 @@ void ResetIDs::command(int narg, char **arg) // loop over bonds, angles, etc and reset IDs in stored topology arrays // only necessary for molecular = 1, not molecular = 2 // badcount = atom IDs that could not be found - + int badcount = 0; if (atom->molecular == 1) { @@ -232,8 +233,15 @@ void ResetIDs::command(int narg, char **arg) atom->map_init(); atom->map_set(); + // need to update exclusions with new atom IDs + + if (atom->molecular == 1) { + Special special(lmp); + special.build(); + } + // delete temporary atom map - + if (mapflag) { atom->map_delete(); atom->map_style = 0; From acdc240cdd3e056c3d105b27582387351bc76aca Mon Sep 17 00:00:00 2001 From: "Steven J. Plimpton" Date: Wed, 11 Jul 2018 08:42:28 -0600 Subject: [PATCH 18/29] better rRESPA doc page, also a new Makefile.theta --- doc/src/run_style.txt | 61 ++++++++++---- src/MAKE/MACHINES/Makefile.theta | 133 +++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+), 16 deletions(-) create mode 100644 src/MAKE/MACHINES/Makefile.theta diff --git a/doc/src/run_style.txt b/doc/src/run_style.txt index ba836a07dd..3240344a45 100644 --- a/doc/src/run_style.txt +++ b/doc/src/run_style.txt @@ -138,13 +138,19 @@ iterations of level 1 for a single iteration of level 2, N2 is the iterations of level 2 per iteration of level 3, etc. N-1 looping parameters must be specified. -The "timestep"_timestep.html command sets the timestep for the -outermost rRESPA level. Thus if the example command above for a -4-level rRESPA had an outer timestep of 4.0 fmsec, the inner timestep -would be 8x smaller or 0.5 fmsec. All other LAMMPS commands that -specify number of timesteps (e.g. "neigh_modify"_neigh_modify.html -parameters, "dump"_dump.html every N timesteps, etc) refer to the -outermost timesteps. +Thus with a 4-level respa setting of "2 2 2" for the 3 loop factors, +you could choose to have bond interactions computed 8x per large +timestep, angle interactions computed 4x, pair interactions computed +2x, and long-range interactions once per large timestep. + +The "timestep"_timestep.html command sets the large timestep for the +outermost rRESPA level. Thus if the 3 loop factors are "2 2 2" for +4-level rRESPA, and the outer timestep is set to 4.0 fmsec, then the +inner timestep would be 8x smaller or 0.5 fmsec. All other LAMMPS +commands that specify number of timesteps (e.g. "thermo"_thermo.html +for thermo output every N steps, "neigh_modify +delay/every"_neigh_modify.html parameters, "dump"_dump.html every N +steps, etc) refer to the outermost timesteps. The rRESPA keywords enable you to specify at what level of the hierarchy various forces will be computed. If not specified, the @@ -238,12 +244,24 @@ roughly a 1.5 fold speedup over the {verlet} style with SHAKE and a For non-biomolecular simulations, the {respa} style can be advantageous if there is a clear separation of time scales - fast and -slow modes in the simulation. Even a LJ system can benefit from -rRESPA if the interactions are divided by the inner, middle and outer -keywords. A 2-fold or more speedup can be obtained while maintaining -good energy conservation. In real units, for a pure LJ fluid at -liquid density, with a sigma of 3.0 angstroms, and epsilon of 0.1 -Kcal/mol, the following settings seem to work well: +slow modes in the simulation. For example, a system of slowly-moving +charged polymer chains could be setup as follows: + +timestep 4.0 +run_style respa 2 8 :pre + +This is two-level rRESPA with an 8x difference between the short and +long timesteps. The bonds, angles, dihedrals will be computed every +0.5 fs (assuming real units), while the pair and kspace interactions +will be computed once every 4 fs. These are the default settings for +each kind of interaction, so no additional keywords are necessary. + +Even a LJ system can benefit from rRESPA if the interactions are +divided by the inner, middle and outer keywords. A 2-fold or more +speedup can be obtained while maintaining good energy conservation. +In real units, for a pure LJ fluid at liquid density, with a sigma of +3.0 angstroms, and epsilon of 0.1 Kcal/mol, the following settings +seem to work well: timestep 36.0 run_style respa 3 3 4 inner 1 3.0 4.0 middle 2 6.0 7.0 outer 3 :pre @@ -271,9 +289,9 @@ more instructions on how to use the accelerated styles effectively. [Restrictions:] The {verlet/split} style can only be used if LAMMPS was built with the -REPLICA package. Correspondingly the {respa/omp} style is available only -if the USER-OMP package was included. See the "Making LAMMPS"_Section_start.html#start_3 -section for more info on packages. +REPLICA package. Correspondingly the {respa/omp} style is available +only if the USER-OMP package was included. See the "Making +LAMMPS"_Section_start.html#start_3 section for more info on packages. Whenever using rRESPA, the user should experiment with trade-offs in speed and accuracy for their system, and verify that they are @@ -287,6 +305,17 @@ conserving energy to adequate precision. run_style verlet :pre +For run_style respa, the default assignment of interactions +to rRESPA levels is as follows: + +bond forces = level 1 (innermost loop) +angle forces = same level as bond forces +dihedral forces = same level as angle forces +improper forces = same level as dihedral forces +pair forces = leven N (outermost level) +kspace forces = same level as pair forces +inner, middle, outer forces = no default :ul + :line :link(Tuckerman3) diff --git a/src/MAKE/MACHINES/Makefile.theta b/src/MAKE/MACHINES/Makefile.theta new file mode 100644 index 0000000000..cad5a03b42 --- /dev/null +++ b/src/MAKE/MACHINES/Makefile.theta @@ -0,0 +1,133 @@ +# knl = Flags for Knights Landing Xeon Phi Processor,Intel Compiler/MPI,MKL FFT +# module load perftools-base perftools +# make theta -j 8 +# pat_build -g mpi -u ./lmp_theta + +SHELL = /bin/sh + +# --------------------------------------------------------------------- +# compiler/linker settings +# specify flags and libraries needed for your compiler + +CC = CC -mkl +#OPTFLAGS = -O0 +OPTFLAGS = -xMIC-AVX512 -O3 -fp-model fast=2 -no-prec-div -qoverride-limits +CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -qno-offload \ + -fno-alias -ansi-alias -restrict $(OPTFLAGS) +#CCFLAGS += -DLMP_INTEL_NO_TBB +#CCFLAGS += -DLAMMPS_BIGBIG +#CCFLAGS += -D_USE_PAPI +#CCFLAGS += -D_USE_CRAYPAT_API +SHFLAGS = -fPIC +DEPFLAGS = -M + +LINK = $(CC) +LINKFLAGS = -g -qopenmp $(OPTFLAGS) +LINKFLAGS += -dynamic +LIB = +#LIB += -L${TBBROOT}/lib/intel64/gcc4.7 -ltbbmalloc +LIB += -ltbbmalloc +#LIB += /soft/debuggers/forge-7.0-2017-02-16/lib/64/libdmallocthcxx.a -zmuldefs +SIZE = size + +ARCHIVE = ar +ARFLAGS = -rc +SHLIBFLAGS = -shared + +# --------------------------------------------------------------------- +# LAMMPS-specific settings, all OPTIONAL +# specify settings for LAMMPS features you will use +# if you change any -D setting, do full re-compile after "make clean" + +# LAMMPS ifdef settings +# see possible settings in Section 2.2 (step 4) of manual + +LMP_INC = -DLAMMPS_GZIP #-DLAMMPS_JPEG + +# MPI library +# see discussion in Section 2.2 (step 5) of manual +# MPI wrapper compiler/linker can provide this info +# can point to dummy MPI library in src/STUBS as in Makefile.serial +# use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts +# INC = path for mpi.h, MPI compiler settings +# PATH = path for MPI library +# LIB = name of MPI library + +MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 +MPI_PATH = +MPI_LIB = + +# FFT library +# see discussion in Section 2.2 (step 6) of manaul +# can be left blank to use provided KISS FFT library +# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings +# PATH = path for FFT library +# LIB = name of FFT library + +FFT_INC = -DFFT_MKL -DFFT_SINGLE +FFT_PATH = +FFT_LIB = -L$(MKLROOT)/lib/intel64/ -Wl,--start-group -lmkl_intel_ilp64 \ + -lmkl_intel_thread -lmkl_core -Wl,--end-group + +# JPEG and/or PNG library +# see discussion in Section 2.2 (step 7) of manual +# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with LMP_INC +# INC = path(s) for jpeglib.h and/or png.h +# PATH = path(s) for JPEG library and/or PNG library +# LIB = name(s) of JPEG library and/or PNG library + +JPG_INC = +JPG_PATH = +JPG_LIB = + +# --------------------------------------------------------------------- +# build rules and dependencies +# do not edit this section + +include Makefile.package.settings +include Makefile.package + +EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC) +EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH) +EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) + +# Path to src files + +vpath %.cpp .. +vpath %.h .. + +# Link target + +$(EXE): $(OBJ) + $(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE) + $(SIZE) $(EXE) + +# Library targets + +lib: $(OBJ) + $(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ) + +shlib: $(OBJ) + $(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE) \ + $(OBJ) $(EXTRA_LIB) $(LIB) + +# Compilation rules + +%.o:%.cpp + $(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $< + +%.d:%.cpp + $(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@ + +%.o:%.cu + $(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c $< + +# Individual dependencies + +depend : fastdep.exe $(SRC) + @./fastdep.exe $(EXTRA_INC) -- $^ > .depend || exit 1 + +fastdep.exe: ../DEPEND/fastdep.c + icc -O -o $@ $< + +sinclude .depend From 5d133214258d317ec80b8599eb24e007823732bf Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Wed, 11 Jul 2018 12:15:50 -0600 Subject: [PATCH 19/29] Standardize suffix paragraph in fix_enforce2d.txt --- doc/src/fix_enforce2d.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/src/fix_enforce2d.txt b/doc/src/fix_enforce2d.txt index 01840254b6..4bbf41d25d 100644 --- a/doc/src/fix_enforce2d.txt +++ b/doc/src/fix_enforce2d.txt @@ -28,12 +28,13 @@ not move from their initial z coordinate. :line -Styles with a 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. +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 From 71f699123374944f5620b2fb2b1b18104e7b7346 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Wed, 11 Jul 2018 12:39:04 -0600 Subject: [PATCH 20/29] Small tweaks to fix_enforce2d_kokkos --- src/KOKKOS/fix_enforce2d_kokkos.cpp | 14 +++++++------- src/KOKKOS/fix_enforce2d_kokkos.h | 15 ++------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/KOKKOS/fix_enforce2d_kokkos.cpp b/src/KOKKOS/fix_enforce2d_kokkos.cpp index 33aa39e2f6..26075b269c 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.cpp +++ b/src/KOKKOS/fix_enforce2d_kokkos.cpp @@ -34,7 +34,7 @@ FixEnforce2DKokkos::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char * execution_space = ExecutionSpaceFromDevice::space; datamask_read = V_MASK | F_MASK | OMEGA_MASK | MASK_MASK - | TORQUE_MASK | ANGMOM_MASK; // | */ // MASK_MASK; + | TORQUE_MASK | ANGMOM_MASK; datamask_modify = V_MASK | F_MASK | OMEGA_MASK | TORQUE_MASK | ANGMOM_MASK; @@ -52,7 +52,6 @@ template void FixEnforce2DKokkos::post_force(int vflag) { atomKK->sync(execution_space,datamask_read); - atomKK->modified(execution_space,datamask_modify); v = atomKK->k_v.view(); f = atomKK->k_f.view(); @@ -120,16 +119,18 @@ void FixEnforce2DKokkos::post_force(int vflag) break; } default: - error->all(FLERR, "flag_mask outside of what it should be"); + error->all(FLERR, "Flag in fix_enforce2d_kokkos outside of what it should be"); } copymode = 0; - // Probably sync here again? - atomKK->sync(execution_space,datamask_read); atomKK->modified(execution_space,datamask_modify); - for (int m = 0; m < nfixlist; m++) + for (int m = 0; m < nfixlist; m++) { + atomKK->sync(flist[m]->execution_space,flist[m]->datamask_read); flist[m]->enforce2d(); + atomKK->modified(flist[m]->execution_space,flist[m]->datamask_modify); + } + } @@ -138,7 +139,6 @@ template void FixEnforce2DKokkos::post_force_item( int i ) const { if (mask[i] & groupbit){ - // x(i,2) = 0; // Enforce2d does not set x[2] to zero either... :/ v(i,2) = 0.0; f(i,2) = 0.0; diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h index 1ed3cf3ef8..520a58de04 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.h +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -32,7 +32,6 @@ class FixEnforce2DKokkos : public FixEnforce2D { public: FixEnforce2DKokkos(class LAMMPS *, int, char **); // ~FixEnforce2DKokkos() {} - // void init(); void setup(int); void post_force(int); @@ -78,18 +77,8 @@ struct FixEnforce2DKokkosPostForceFunctor { /* ERROR/WARNING messages: -E: Illegal ... command +E: Flag in fix_enforce2d_kokkos outside of what it should be -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Cannot use fix enforce2d with 3d simulation - -Self-explanatory. - -E: Fix enforce2d must be defined after fix %s - -UNDOCUMENTED +LAMMPS developer-only error. */ From b31f0245d0abeea2cc851a07bf11e280abe65730 Mon Sep 17 00:00:00 2001 From: "Steven J. Plimpton" Date: Wed, 11 Jul 2018 15:55:16 -0600 Subject: [PATCH 21/29] 2 small bug fixes to load balancing --- doc/src/run_style.txt | 16 +++++++++++----- src/balance.cpp | 6 +++++- src/fix_balance.cpp | 13 ++++++++++--- src/fix_store.cpp | 2 -- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/doc/src/run_style.txt b/doc/src/run_style.txt index 3240344a45..7717ede86f 100644 --- a/doc/src/run_style.txt +++ b/doc/src/run_style.txt @@ -173,11 +173,17 @@ have their force go ramped to 0.0 so the overlap with the next regime compute forces for all pairs from 5.0 outward, with those from 5.0 to 6.0 having their value ramped in an inverse manner. -Only some pair potentials support the use of the {inner} and {middle} -and {outer} keywords. If not, only the {pair} keyword can be used -with that pair style, meaning all pairwise forces are computed at the -same rRESPA level. See the doc pages for individual pair styles for -details.i +Note that you can use {inner} and {outer} without using {middle} to +split the pairwise computations into two portions instead of three. +Unless you are using a very long pairwise cutoff, a 2-way split is +often faster than a 3-way split, since it avoids too much duplicate +computation of pairwise interactions near the intermediate cutoffs. + +Also note that only a few pair potentials support the use of the +{inner} and {middle} and {outer} keywords. If not, only the {pair} +keyword can be used with that pair style, meaning all pairwise forces +are computed at the same rRESPA level. See the doc pages for +individual pair styles for details. Another option for using pair potentials with rRESPA is with the {hybrid} keyword, which requires the use of the "pair_style hybrid or diff --git a/src/balance.cpp b/src/balance.cpp index 86deb55b47..7dd13e8766 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -350,13 +350,13 @@ void Balance::command(int narg, char **arg) domain->set_local_box(); // move particles to new processors via irregular() + // set disable = 0, so weights migrate with atoms for imbfinal calculation if (domain->triclinic) domain->x2lamda(atom->nlocal); Irregular *irregular = new Irregular(lmp); if (wtflag) fixstore->disable = 0; if (style == BISECTION) irregular->migrate_atoms(1,1,rcb->sendproc); else irregular->migrate_atoms(1); - if (wtflag) fixstore->disable = 1; delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -377,9 +377,11 @@ void Balance::command(int narg, char **arg) } // imbfinal = final imbalance + // set disable = 1, so weights no longer migrate with atoms double maxfinal; double imbfinal = imbalance_factor(maxfinal); + if (wtflag) fixstore->disable = 1; // stats output @@ -540,6 +542,8 @@ void Balance::weight_storage(char *prefix) fixstore = (FixStore *) modify->fix[modify->nfix-1]; } else fixstore = (FixStore *) modify->fix[ifix]; + // do not carry weights with atoms during normal atom migration + fixstore->disable = 1; if (prefix) delete [] fixargs[0]; diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index b2f545c73f..e748e0ae31 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -114,6 +114,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : if (nevery) force_reneighbor = 1; lastbalance = -1; + next_reneighbor = -1; // compute initial outputs @@ -248,6 +249,10 @@ void FixBalance::pre_neighbor() if (!pending) return; imbfinal = balance->imbalance_factor(maxloadperproc); pending = 0; + + // set disable = 1, so weights no longer migrate with atoms + + if (wtflag) balance->fixstore->disable = 1; } /* ---------------------------------------------------------------------- @@ -275,21 +280,23 @@ void FixBalance::rebalance() // reset proc sub-domains // check and warn if any proc's subbox is smaller than neigh skin - // since may lead to lost atoms in exchange() + // since may lead to lost atoms in comm->exchange() if (domain->triclinic) domain->set_lamda_box(); domain->set_local_box(); domain->subbox_too_small_check(neighbor->skin); // move atoms to new processors via irregular() - // only needed if migrate_check() says an atom moves to far + // for non-RCB only needed if migrate_check() says an atom moves too far // else allow caller's comm->exchange() to do it + // set disable = 0, so weights migrate with atoms + // important to delay disable = 1 until after pre_neighbor imbfinal calc + // b/c atoms may migrate again in comm->exchange() if (domain->triclinic) domain->x2lamda(atom->nlocal); if (wtflag) balance->fixstore->disable = 0; if (lbstyle == BISECTION) irregular->migrate_atoms(0,1,sendproc); else if (irregular->migrate_check()) irregular->migrate_atoms(); - if (wtflag) balance->fixstore->disable = 1; if (domain->triclinic) domain->lamda2x(atom->nlocal); // invoke KSpace setup_grid() to adjust to new proc sub-domains diff --git a/src/fix_store.cpp b/src/fix_store.cpp index 3b1f3dca77..350e120972 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -154,8 +154,6 @@ void FixStore::reset_global(int nrow_caller, int ncol_caller) if (vecflag) memory->create(vstore,nrow,"fix/store:vstore"); else memory->create(astore,nrow,ncol,"fix/store:astore"); memory->create(rbuf,nrow*ncol+2,"fix/store:rbuf"); - - // printf("AAA HOW GET HERE\n"); } /* ---------------------------------------------------------------------- From 4ac47ba0372385431cadf37d68b890dbcdc1bf6e Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Thu, 12 Jul 2018 07:27:11 -0600 Subject: [PATCH 22/29] cmake/README.md: fix GPU_ARCH options --- cmake/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/README.md b/cmake/README.md index 5419063f6d..bafd440a64 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -1421,11 +1421,11 @@ target API. CUDA SM architecture targeted by GPU package
-
sm20 (Fermi)
-
sm30 (Kepler)
-
sm50 (Maxwell)
-
sm60 (Pascal)
-
sm70 (Volta)
+
sm_20 (Fermi)
+
sm_30 (Kepler)
+
sm_50 (Maxwell)
+
sm_60 (Pascal)
+
sm_70 (Volta)
From 85511a4db8297dbc43c0d3eb6b69c47d48767a4c Mon Sep 17 00:00:00 2001 From: HaoZeke Date: Fri, 13 Jul 2018 00:44:03 +0530 Subject: [PATCH 23/29] docs: Fix sneaky unicode character Fixes the `pdf` target of the `Makefile`. --- doc/src/Developer/developer.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Developer/developer.tex b/doc/src/Developer/developer.tex index 9d9a93a53d..8852f44168 100644 --- a/doc/src/Developer/developer.tex +++ b/doc/src/Developer/developer.tex @@ -476,7 +476,7 @@ is the name of the class. This code allows LAMMPS to find your fix when it parses input script. In addition, your fix header must be included in the file "style\_fix.h". In case if you use LAMMPS make, this file is generated automatically - all files starting with prefix -fix\_ are included, so call your header the same way. Otherwise, donŐt +fix\_ are included, so call your header the same way. Otherwise, don't forget to add your include into "style\_fix.h". Let's write a simple fix which will print average velocity at the end From 16381a52b14aeeb47cc6eb0e2897019bc9c4a4df Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Thu, 12 Jul 2018 20:22:38 -0600 Subject: [PATCH 24/29] Fix crash in ReaxFF on GPUs --- src/KOKKOS/pair_reaxc_kokkos.cpp | 9 +++++---- src/KOKKOS/pair_reaxc_kokkos.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index bb9f8ab417..e2e2e6f6de 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -343,6 +343,7 @@ void PairReaxCKokkos::init_md() swa = control->nonb_low; swb = control->nonb_cut; + enobondsflag = control->enobondsflag; if (fabs(swa) > 0.01 ) error->warning(FLERR,"Warning: non-zero lower Taper-radius cutoff"); @@ -2272,12 +2273,12 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2 0 || control->enobondsflag) + if (numbonds > 0 || enobondsflag) e_lp = p_lp2 * d_Delta_lp[i] * inv_expvd2; const F_FLOAT dElp = p_lp2 * inv_expvd2 + 75.0 * p_lp2 * d_Delta_lp[i] * expvd2 * inv_expvd2*inv_expvd2; const F_FLOAT CElp = dElp * d_dDelta_lp[i]; - if (numbonds > 0 || control->enobondsflag) + if (numbonds > 0 || enobondsflag) a_CdDelta[i] += CElp; if (eflag) ev.ereax[0] += e_lp; @@ -2314,7 +2315,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2 0 || control->enobondsflag) + if (numbonds > 0 || enobondsflag) e_un = -p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8; if (eflag) ev.ereax[2] += e_un; @@ -2334,7 +2335,7 @@ void PairReaxCKokkos::operator()(PairReaxComputeMulti2 0 || control->enobondsflag) + if (numbonds > 0 || enobondsflag) a_CdDelta[i] += CEunder3; const int j_start = d_bo_first[i]; diff --git a/src/KOKKOS/pair_reaxc_kokkos.h b/src/KOKKOS/pair_reaxc_kokkos.h index 5175e274a8..5c96d44618 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.h +++ b/src/KOKKOS/pair_reaxc_kokkos.h @@ -427,7 +427,7 @@ class PairReaxCKokkos : public PairReaxC { friend void pair_virial_fdotr_compute(PairReaxCKokkos*); - int bocnt,hbcnt; + int bocnt,hbcnt,enobondsflag; typedef LR_lookup_table_kk LR_lookup_table_kk_DT; From d4f8940ff2367f81b0ae806ec3cd057cc69c6614 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Fri, 13 Jul 2018 07:40:06 -0600 Subject: [PATCH 25/29] Update command doc page for Kokkos enforce2d --- doc/src/Section_commands.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index 3dabdbeaa1..cc9757a88e 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -571,7 +571,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "dt/reset"_fix_dt_reset.html, "efield"_fix_efield.html, "ehex"_fix_ehex.html, -"enforce2d"_fix_enforce2d.html, +"enforce2d (k)"_fix_enforce2d.html, "evaporate"_fix_evaporate.html, "external"_fix_external.html, "freeze"_fix_freeze.html, From d00eaef070f6d8500831f5893ec2de6dfa5041b9 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Jul 2018 23:05:44 -0400 Subject: [PATCH 26/29] Allow 'set' command to change atom velocities --- python/lammps.py | 11 +++++++++++ src/set.cpp | 26 +++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/python/lammps.py b/python/lammps.py index e7d703e12a..2f4ffb642e 100644 --- a/python/lammps.py +++ b/python/lammps.py @@ -708,6 +708,12 @@ class Atom(object): self.lmp.eval("vy[%d]" % self.index), self.lmp.eval("vz[%d]" % self.index)) + @velocity.setter + def velocity(self, value): + self.lmp.set("atom", self.index, "vx", value[0]) + self.lmp.set("atom", self.index, "vy", value[1]) + self.lmp.set("atom", self.index, "vz", value[2]) + @property def force(self): return (self.lmp.eval("fx[%d]" % self.index), @@ -738,6 +744,11 @@ class Atom2D(Atom): return (self.lmp.eval("vx[%d]" % self.index), self.lmp.eval("vy[%d]" % self.index)) + @velocity.setter + def velocity(self, value): + self.lmp.set("atom", self.index, "vx", value[0]) + self.lmp.set("atom", self.index, "vy", value[1]) + @property def force(self): return (self.lmp.eval("fx[%d]" % self.index), diff --git a/src/set.cpp b/src/set.cpp index 0294f93e5d..7eca4e9a9c 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -48,7 +48,7 @@ enum{TYPE,TYPE_FRACTION,MOLECULE,X,Y,Z,CHARGE,MASS,SHAPE,LENGTH,TRI, THETA,THETA_RANDOM,ANGMOM,OMEGA, DIAMETER,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER, MESO_E,MESO_CV,MESO_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY, - SMD_CONTACT_RADIUS,DPDTHETA,INAME,DNAME}; + SMD_CONTACT_RADIUS,DPDTHETA,INAME,DNAME,VX,VY,VZ}; #define BIG INT_MAX @@ -141,6 +141,27 @@ void Set::command(int narg, char **arg) set(Z); iarg += 2; + } else if (strcmp(arg[iarg],"vx") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); + else dvalue = force->numeric(FLERR,arg[iarg+1]); + set(VX); + iarg += 2; + + } else if (strcmp(arg[iarg],"vy") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); + else dvalue = force->numeric(FLERR,arg[iarg+1]); + set(VY); + iarg += 2; + + } else if (strcmp(arg[iarg],"vz") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); + else dvalue = force->numeric(FLERR,arg[iarg+1]); + set(VZ); + iarg += 2; + } else if (strcmp(arg[iarg],"charge") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); @@ -732,6 +753,9 @@ void Set::set(int keyword) else if (keyword == X) atom->x[i][0] = dvalue; else if (keyword == Y) atom->x[i][1] = dvalue; else if (keyword == Z) atom->x[i][2] = dvalue; + else if (keyword == VX) atom->v[i][0] = dvalue; + else if (keyword == VY) atom->v[i][1] = dvalue; + else if (keyword == VZ) atom->v[i][2] = dvalue; else if (keyword == CHARGE) atom->q[i] = dvalue; else if (keyword == MASS) { if (dvalue <= 0.0) error->one(FLERR,"Invalid mass in set command"); From aa3d3213c914144d0873c572363522f108ce1cb6 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 13 Jul 2018 23:06:42 -0400 Subject: [PATCH 27/29] Update set command documentation --- doc/src/set.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/src/set.txt b/doc/src/set.txt index d05660dc42..d2235d5c32 100644 --- a/doc/src/set.txt +++ b/doc/src/set.txt @@ -36,6 +36,8 @@ keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \ value can be an atom-style variable (see below) {x},{y},{z} value = atom coordinate (distance units) value can be an atom-style variable (see below) + {vx},{vy},{vz} value = atom velocity (velocity units) + value can be an atom-style variable (see below) {charge} value = atomic charge (charge units) value can be an atom-style variable (see below) {dipole} values = x y z @@ -127,6 +129,7 @@ set type 3 charge 0.5 set type 1*3 charge 0.5 set atom * charge v_atomfile set atom 100*200 x 0.5 y 1.0 +set atom 100 vx 0.0 vy 0.0 vz -1.0 set atom 1492 type 3 :pre [Description:] @@ -225,7 +228,8 @@ IDs. Keywords {x}, {y}, {z}, and {charge} set the coordinates or charge of all selected atoms. For {charge}, the "atom style"_atom_style.html -being used must support the use of atomic charge. +being used must support the use of atomic charge. Keywords {vx}, {vy}, +and {vz} set the velocities of all selected atoms. Keyword {dipole} uses the specified x,y,z values as components of a vector to set as the orientation of the dipole moment vectors of the From 783839e98593bdcb568bf651529b0d1b6f5226db Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Jul 2018 15:21:52 -0400 Subject: [PATCH 28/29] add support for restarting extra/XXX/per/atom settings in binary restarts --- src/read_restart.cpp | 15 ++++++++++++++- src/write_restart.cpp | 10 +++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 1164de6faa..7d8e6ca395 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -62,7 +62,9 @@ enum{VERSION,SMALLINT,TAGINT,BIGINT, MULTIPROC,MPIIO,PROCSPERFILE,PERPROC, IMAGEINT,BOUNDMIN,TIMESTEP, ATOM_ID,ATOM_MAP_STYLE,ATOM_MAP_USER,ATOM_SORTFREQ,ATOM_SORTBIN, - COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR}; + COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR, + EXTRA_BOND_PER_ATOM,EXTRA_ANGLE_PER_ATOM,EXTRA_DIHEDRAL_PER_ATOM, + EXTRA_IMPROPER_PER_ATOM,EXTRA_SPECIAL_PER_ATOM}; #define LB_FACTOR 1.1 @@ -914,6 +916,17 @@ void ReadRestart::header(int incompatible) } else if (flag == COMM_VEL) { comm->ghost_velocity = read_int(); + } else if (flag == EXTRA_BOND_PER_ATOM) { + atom->extra_bond_per_atom = read_int(); + } else if (flag == EXTRA_ANGLE_PER_ATOM) { + atom->extra_angle_per_atom = read_int(); + } else if (flag == EXTRA_DIHEDRAL_PER_ATOM) { + atom->extra_dihedral_per_atom = read_int(); + } else if (flag == EXTRA_IMPROPER_PER_ATOM) { + atom->extra_improper_per_atom = read_int(); + } else if (flag == EXTRA_SPECIAL_PER_ATOM) { + force->special_extra = read_int(); + } else error->all(FLERR,"Invalid flag in header section of restart file"); flag = read_int(); diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 69b731870d..1bfbb382a8 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -61,7 +61,9 @@ enum{VERSION,SMALLINT,TAGINT,BIGINT, MULTIPROC,MPIIO,PROCSPERFILE,PERPROC, IMAGEINT,BOUNDMIN,TIMESTEP, ATOM_ID,ATOM_MAP_STYLE,ATOM_MAP_USER,ATOM_SORTFREQ,ATOM_SORTBIN, - COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR}; + COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR, + EXTRA_BOND_PER_ATOM,EXTRA_ANGLE_PER_ATOM,EXTRA_DIHEDRAL_PER_ATOM, + EXTRA_IMPROPER_PER_ATOM,EXTRA_SPECIAL_PER_ATOM}; /* ---------------------------------------------------------------------- */ @@ -527,6 +529,12 @@ void WriteRestart::header() write_double(COMM_CUTOFF,comm->cutghostuser); write_int(COMM_VEL,comm->ghost_velocity); + write_int(EXTRA_BOND_PER_ATOM,atom->extra_bond_per_atom); + write_int(EXTRA_ANGLE_PER_ATOM,atom->extra_angle_per_atom); + write_int(EXTRA_DIHEDRAL_PER_ATOM,atom->extra_dihedral_per_atom); + write_int(EXTRA_IMPROPER_PER_ATOM,atom->extra_improper_per_atom); + write_int(EXTRA_SPECIAL_PER_ATOM,force->special_extra); + // -1 flag signals end of header int flag = -1; From fa73fab5df878b29a3e121cc1655e73e718e3c05 Mon Sep 17 00:00:00 2001 From: "Steven J. Plimpton" Date: Mon, 16 Jul 2018 18:12:15 -0600 Subject: [PATCH 29/29] patch 16Jul18 --- doc/src/Manual.txt | 4 ++-- src/version.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/Manual.txt b/doc/src/Manual.txt index e34ec8d5ba..e69797d9ec 100644 --- a/doc/src/Manual.txt +++ b/doc/src/Manual.txt @@ -1,7 +1,7 @@ LAMMPS Users Manual - + @@ -19,7 +19,7 @@ :line LAMMPS Documentation :c,h1 -29 Jun 2018 version :c,h2 +16 Jul 2018 version :c,h2 Version info: :h3 diff --git a/src/version.h b/src/version.h index 2833430def..90a21631d9 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "29 Jun 2018" +#define LAMMPS_VERSION "16 Jul 2018"