~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to src/KSPACE/pppm_stagger.cpp

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
   Contributing author: Stan Moore (Sandia)
16
16
------------------------------------------------------------------------- */
17
17
 
18
 
#include "lmptype.h"
19
18
#include "mpi.h"
20
19
#include "string.h"
21
20
#include "stdio.h"
202
201
    stagger += 1.0/float(nstagger);
203
202
  }
204
203
 
 
204
  // update qsum and qsqsum, if atom count has changed and energy needed
 
205
 
 
206
  if ((eflag_global || eflag_atom) && atom->natoms != natoms_original) {
 
207
    qsum_qsq();
 
208
    natoms_original = atom->natoms;
 
209
  }
 
210
 
205
211
  // sum global energy across procs and add in volume-dependent term
206
 
  // reset qsum and qsqsum if atom count has changed
207
212
 
208
213
  const double qscale = qqrd2e * scale;
209
214
 
212
217
    MPI_Allreduce(&energy,&energy_all,1,MPI_DOUBLE,MPI_SUM,world);
213
218
    energy = energy_all;
214
219
 
215
 
    if (atom->natoms != natoms_original) {
216
 
      qsum_qsq(0);
217
 
      natoms_original = atom->natoms;
218
 
    }
219
 
 
220
220
    energy *= 0.5*volume/float(nstagger);
221
221
    energy -= g_ewald*qsqsum/MY_PIS +
222
222
      MY_PI2*qsum*qsum / (g_ewald*g_ewald*volume);
679
679
  double **x = atom->x;
680
680
  int nlocal = atom->nlocal;
681
681
 
 
682
  if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2]))
 
683
    error->one(FLERR,"Non-numeric box dimensions - simulation unstable");
 
684
 
682
685
  int flag = 0;
683
686
  for (int i = 0; i < nlocal; i++) {
684
687