git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12069 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
#include "respa.h"
|
||||
#include "neighbor.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "comm.h"
|
||||
#include "force.h"
|
||||
@ -283,17 +284,11 @@ void Respa::init()
|
||||
int ifix = modify->find_fix("package_omp");
|
||||
if (ifix >= 0) external_force_clear = 1;
|
||||
|
||||
// set flags for what arrays to clear in force_clear()
|
||||
// need to clear additionals arrays if they exist
|
||||
// set flags for arrays to clear in force_clear()
|
||||
|
||||
torqueflag = 0;
|
||||
torqueflag = extraflag = 0;
|
||||
if (atom->torque_flag) torqueflag = 1;
|
||||
erforceflag = 0;
|
||||
if (atom->erforce_flag) erforceflag = 1;
|
||||
e_flag = 0;
|
||||
if (atom->e_flag) e_flag = 1;
|
||||
rho_flag = 0;
|
||||
if (atom->rho_flag) rho_flag = 1;
|
||||
if (atom->avec->forceclearflag) extraflag = 1;
|
||||
|
||||
// step[] = timestep for each level
|
||||
|
||||
@ -626,6 +621,7 @@ void Respa::recurse(int ilevel)
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
clear force on own & ghost atoms
|
||||
clear other arrays as needed
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Respa::force_clear(int newtonflag)
|
||||
@ -633,20 +629,15 @@ void Respa::force_clear(int newtonflag)
|
||||
if (external_force_clear) return;
|
||||
|
||||
// clear global force array
|
||||
// nall includes ghosts only if newton flag is set
|
||||
// if either newton flag is set, also include ghosts
|
||||
|
||||
int nall;
|
||||
if (newtonflag) nall = atom->nlocal + atom->nghost;
|
||||
else nall = atom->nlocal;
|
||||
size_t nbytes = sizeof(double) * atom->nlocal;
|
||||
if (force->newton) nbytes += sizeof(double) * atom->nghost;
|
||||
|
||||
size_t nbytes = sizeof(double) * nall;
|
||||
|
||||
if (nbytes > 0 ) {
|
||||
memset(&(atom->f[0][0]),0,3*nbytes);
|
||||
if (torqueflag) memset(&(atom->torque[0][0]),0,3*nbytes);
|
||||
if (erforceflag) memset(&(atom->erforce[0]), 0, nbytes);
|
||||
if (e_flag) memset(&(atom->de[0]), 0, nbytes);
|
||||
if (rho_flag) memset(&(atom->drho[0]), 0, nbytes);
|
||||
if (nbytes) {
|
||||
memset(&atom->f[0][0],0,3*nbytes);
|
||||
if (torqueflag) memset(&atom->torque[0][0],0,3*nbytes);
|
||||
if (extraflag) atom->avec->force_clear(0,nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user