From c8939d8df6dac59494e5bfa5f9d2543d2a913260 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 11 Jul 2017 09:43:54 -0400 Subject: [PATCH 1/9] clarify explanation of body style molecule in rigid fixes --- doc/src/fix_rigid.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/fix_rigid.txt b/doc/src/fix_rigid.txt index dbadd3fa63..87021b8551 100644 --- a/doc/src/fix_rigid.txt +++ b/doc/src/fix_rigid.txt @@ -212,8 +212,9 @@ pour"_fix_pour.html. For bodystyle {single} the entire fix group of atoms is treated as one rigid body. This option is only allowed for the {rigid} styles. -For bodystyle {molecule}, each set of atoms in the fix group with a -different molecule ID is treated as a rigid body. This option is +For bodystyle {molecule}, atoms are grouped into rigid bodies by their +respective molecule IDs: each set of atoms in the fix group with the +same molecule ID is treated as a different rigid body. This option is allowed for both the {rigid} and {rigid/small} styles. Note that atoms with a molecule ID = 0 will be treated as a single rigid body. For a system with atomic solvent (typically this is atoms with From ddc96213255a15932fe9d1a12b8a69fc7e1d414b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 11 Jul 2017 18:30:41 -0400 Subject: [PATCH 2/9] remove absolutely last reference to xmovie --- examples/README | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/README b/examples/README index 090ed733ac..e4312e2598 100644 --- a/examples/README +++ b/examples/README @@ -37,9 +37,8 @@ produce dump snapshots of the running simulation in any of 3 formats. If you uncomment the dump command in the input script, a text dump file will be produced, which can be animated by various visualization -programs (see http://lammps.sandia.gov/viz.html) such as VMD or -AtomEye. It can also be animated using the xmovie tool described in -the Additional Tools section of the LAMMPS documentation. +programs (see http://lammps.sandia.gov/viz.html) such as Ovito, VMD, +or AtomEye. If you uncomment the dump image command in the input script, and assuming you have built LAMMPS with a JPG library, JPG snapshot images From a9ff593763c74082df4df53d268e2ddcc172a3fb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2017 09:48:07 -0400 Subject: [PATCH 3/9] avoid segfault when calling enforce2d before langevin data has been initialized --- src/RIGID/fix_rigid.cpp | 2 +- src/RIGID/fix_rigid_small.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index d0c931a466..9d46968273 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -949,7 +949,7 @@ void FixRigid::enforce2d() angmom[ibody][1] = 0.0; omega[ibody][0] = 0.0; omega[ibody][1] = 0.0; - if (langflag) { + if (langflag && langextra) { langextra[ibody][2] = 0.0; langextra[ibody][3] = 0.0; langextra[ibody][4] = 0.0; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index b4de4f53bb..60afeecbf0 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -786,7 +786,7 @@ void FixRigidSmall::enforce2d() b->angmom[1] = 0.0; b->omega[0] = 0.0; b->omega[1] = 0.0; - if (langflag) { + if (langflag && langextra) { langextra[ibody][2] = 0.0; langextra[ibody][3] = 0.0; langextra[ibody][4] = 0.0; From 69d97fa60cf04a6364f9714baf031337fd048151 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2017 11:26:16 -0400 Subject: [PATCH 4/9] fix enforce2d has to be defined after fixes with enforce2d_flag set this check currently only applies to rigid fixes and is needed so that their respective enforce2d function is called _after_ the post force functions. this is required in combination with commit a9ff593763c74082df4df53d268e2ddcc172a3fb to allow rigid fixes use the langevin option correctly for 2d systems --- src/fix_enforce2d.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index 21a99e3c16..336fd12556 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -66,12 +66,21 @@ void FixEnforce2D::init() if (modify->fix[i]->enforce2d_flag) nfixlist++; if (nfixlist) { + int myindex = -1; delete [] flist; flist = new Fix*[nfixlist]; nfixlist = 0; for (int i = 0; i < modify->nfix; i++) { - if (modify->fix[i]->enforce2d_flag) - flist[nfixlist++] = modify->fix[i]; + if (modify->fix[i]->enforce2d_flag) { + if (myindex < 0) + flist[nfixlist++] = modify->fix[i]; + else { + char msg[256]; + sprintf(msg,"Fix enforce2d must be defined after fix %s",modify->fix[i]->style); + error->all(FLERR,msg); + } + } + if (modify->fix[i] == this) myindex = i; } } } From 734729b0a4d5772a4f4d0c17c11a16813fa730f3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2017 17:27:49 -0400 Subject: [PATCH 5/9] avoid small memory leak with USER-REAXC + USER-OMP, spotted by GCC's address sanitizer --- src/USER-REAXC/reaxc_allocate.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index 0d9c51c878..e3fc54c504 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -196,11 +196,10 @@ void DeAllocate_Workspace( control_params *control, storage *workspace ) /* reductions */ #ifdef LMP_USER_OMP - if(workspace->CdDeltaReduction) sfree( workspace->CdDeltaReduction, "cddelta_reduce" ); - if(workspace->forceReduction) sfree( workspace->forceReduction, "f_reduce" ); - if(workspace->valence_angle_atom_myoffset) sfree( workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); - - if (control->virial && workspace->my_ext_pressReduction) sfree( workspace->my_ext_pressReduction, "ext_press_reduce"); + if (workspace->CdDeltaReduction) sfree( workspace->CdDeltaReduction, "cddelta_reduce" ); + if (workspace->forceReduction) sfree( workspace->forceReduction, "f_reduce" ); + if (workspace->valence_angle_atom_myoffset) sfree( workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); + if (workspace->my_ext_pressReduction) sfree( workspace->my_ext_pressReduction, "ext_press_reduce"); #endif } @@ -307,9 +306,7 @@ int Allocate_Workspace( reax_system *system, control_params *control, "forceReduction", comm); workspace->valence_angle_atom_myoffset = (int *) scalloc(sizeof(int), total_cap, "valence_angle_atom_myoffset", comm); - - if (control->virial) - workspace->my_ext_pressReduction = (rvec *) calloc(sizeof(rvec), control->nthreads); + workspace->my_ext_pressReduction = (rvec *) calloc(sizeof(rvec), control->nthreads); #endif return SUCCESS; From 01e848387ac85e6bc013dc233c20a01e7ea127c7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2017 18:00:38 -0400 Subject: [PATCH 6/9] avoid accessing uninitialized data when exiting LAMMPS early --- src/comm_brick.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index d6cbed40af..3c972b8244 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -124,6 +124,7 @@ void CommBrick::init_buffers() maxrecv = BUFMIN; memory->create(buf_recv,maxrecv,"comm:buf_recv"); + nswap = 0; maxswap = 6; allocate_swap(maxswap); From c24fca61f37aa7abfa1c907fd51a1da7478a18a3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2017 18:14:11 -0400 Subject: [PATCH 7/9] fix possible uninitialized data access with pppm and pppm/disp --- src/KSPACE/pppm.cpp | 5 +++++ src/KSPACE/pppm_disp.cpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 05169fca1c..6add8b58b7 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -95,6 +95,11 @@ PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg), MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); + nfft_both = 0; + nxhi_in = nxlo_in = nxhi_out = nxlo_out = 0; + nyhi_in = nylo_in = nyhi_out = nylo_out = 0; + nzhi_in = nzlo_in = nzhi_out = nzlo_out = 0; + density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; density_fft = NULL; u_brick = NULL; diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index b31d42a815..43b2c8236a 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -121,6 +121,13 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg), MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); + nfft_both = nfft_both_6 = 0; + nxhi_in = nxlo_in = nxhi_out = nxlo_out = 0; + nyhi_in = nylo_in = nyhi_out = nylo_out = 0; + nzhi_in = nzlo_in = nzhi_out = nzlo_out = 0; + nxhi_in_6 = nxlo_in_6 = nxhi_out_6 = nxlo_out_6 = 0; + nyhi_in_6 = nylo_in_6 = nyhi_out_6 = nylo_out_6 = 0; + nzhi_in_6 = nzlo_in_6 = nzhi_out_6 = nzlo_out_6 = 0; csumflag = 0; B = NULL; From 0af9203fdc991af03cb77a7bbc649170d74c4088 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 12 Jul 2017 18:32:04 -0400 Subject: [PATCH 8/9] remove useless and incorrect neighbor list request in fix qeq/comb/omp --- src/USER-OMP/fix_qeq_comb_omp.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index 0c69876b86..351003b668 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -70,17 +70,6 @@ void FixQEQCombOMP::init() ngroup = group->count(igroup); if (ngroup == 0) error->all(FLERR,"Fix qeq/comb group has no atoms"); - - // determine status of neighbor flag of the omp package command - int ifix = modify->find_fix("package_omp"); - int use_omp = 0; - if (ifix >=0) { - FixOMP * fix = static_cast(lmp->modify->fix[ifix]); - if (fix->get_neighbor()) use_omp = 1; - } - - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->omp = use_omp; } /* ---------------------------------------------------------------------- */ From de8d417aeccdcee893ae50ccb6f47fd41bcf802e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 13 Jul 2017 10:55:13 -0400 Subject: [PATCH 9/9] fix off-by-one memory allocation bug --- src/USER-OMP/fix_nphug_omp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/USER-OMP/fix_nphug_omp.cpp b/src/USER-OMP/fix_nphug_omp.cpp index bc3c2cdd5c..75ff393e28 100644 --- a/src/USER-OMP/fix_nphug_omp.cpp +++ b/src/USER-OMP/fix_nphug_omp.cpp @@ -157,7 +157,7 @@ FixNPHugOMP::FixNPHugOMP(LAMMPS *lmp, int narg, char **arg) : // create a new compute potential energy compute - n = strlen(id) + 3; + n = strlen(id) + 4; id_pe = new char[n]; strcpy(id_pe,id); strcat(id_pe,"_pe");