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

« back to all changes in this revision

Viewing changes to src/KSPACE/pppm_cg.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: Axel Kohlmeyer (Temple U)
16
16
------------------------------------------------------------------------- */
17
17
 
18
 
#include "lmptype.h"
19
18
#include "mpi.h"
20
19
#include "math.h"
21
20
#include "stdlib.h"
208
207
 
209
208
  if (evflag_atom) fieldforce_peratom();
210
209
 
 
210
  // update qsum and qsqsum, if atom count has changed and energy needed
 
211
 
 
212
  if ((eflag_global || eflag_atom) && atom->natoms != natoms_original) {
 
213
    qsum_qsq();
 
214
    natoms_original = atom->natoms;
 
215
  }
 
216
 
211
217
  // sum global energy across procs and add in volume-dependent term
212
 
  // reset qsum and qsqsum if atom count has changed
213
218
 
214
219
  const double qscale = qqrd2e * scale;
215
220
 
218
223
    MPI_Allreduce(&energy,&energy_all,1,MPI_DOUBLE,MPI_SUM,world);
219
224
    energy = energy_all;
220
225
 
221
 
    if (atom->natoms != natoms_original) {
222
 
      qsum_qsq(0);
223
 
      natoms_original = atom->natoms;
224
 
    }
225
 
 
226
226
    energy *= 0.5*volume;
227
227
    energy -= g_ewald*qsqsum/MY_PIS +
228
228
      MY_PI2*qsum*qsum / (g_ewald*g_ewald*volume);
282
282
 
283
283
  double **x = atom->x;
284
284
 
 
285
  if (!isfinite(boxlo[0]) || !isfinite(boxlo[1]) || !isfinite(boxlo[2]))
 
286
    error->one(FLERR,"Non-numeric box dimensions - simulation unstable");
 
287
 
285
288
  int flag = 0;
286
289
  for (int j = 0; j < num_charged; j++) {
287
290
    int i = is_charged[j];