git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15170 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2016-06-14 22:14:34 +00:00
parent c6e7b0c8b9
commit e8ea08fa8c
3 changed files with 14 additions and 12 deletions

View File

@ -159,7 +159,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
char *ptr = strchr(suffix,'['); char *ptr = strchr(suffix,'[');
if (ptr) { if (ptr) {
if (suffix[strlen(suffix)-1] != ']') if (suffix[strlen(suffix)-1] != ']')
error->all(FLERR,"Illegal fix ave/atom command"); error->all(FLERR,"Illegal compute chunk/atom command");
argindex = atoi(ptr+1); argindex = atoi(ptr+1);
*ptr = '\0'; *ptr = '\0';
} else argindex = 0; } else argindex = 0;
@ -573,7 +573,7 @@ void ComputeChunkAtom::init()
// create/destroy fix STORE for persistent chunk IDs as needed // create/destroy fix STORE for persistent chunk IDs as needed
// need to do this if idsflag = ONCE or locks will be used by other commands // need to do this if idsflag = ONCE or locks will be used by other commands
// need to wait until init() so that fix ave/chunk command(s) are in place // need to wait until init() so that fix command(s) are in place
// they increment lockcount if they lock this compute // they increment lockcount if they lock this compute
// fixstore ID = compute-ID + COMPUTE_STORE, fix group = compute group // fixstore ID = compute-ID + COMPUTE_STORE, fix group = compute group
// fixstore initializes all values to 0.0 // fixstore initializes all values to 0.0
@ -617,7 +617,7 @@ void ComputeChunkAtom::setup()
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
only called by classes that use per-atom computes in standard way only called by classes that use per-atom computes in standard way
dump, variable, thermo output, other computes, etc dump, variable, thermo output, other computes, etc
not called by fix ave/chunk or compute chunk commands not called by fix chunk or compute chunk commands
they invoke setup_chunks() and compute_ichunk() directly they invoke setup_chunks() and compute_ichunk() directly
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -645,11 +645,11 @@ void ComputeChunkAtom::compute_peratom()
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
set lock, so that nchunk will not change from startstep to stopstep set lock, so that nchunk will not change from startstep to stopstep
called by fix ave/chunk for duration of its Nfreq epoch called by fix for duration of time it requires lock
OK if called by multiple fix ave/chunk commands OK if called by multiple fix commands
error if all callers do not have same duration error if all callers do not have same duration
last caller holds the lock, so it can also unlock last caller holds the lock, so it can also unlock
lockstop can be positive for final step of finite-size time window stopstep can be positive for final step of finite-size time window
or can be -1 for infinite-size time window or can be -1 for infinite-size time window
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -663,7 +663,7 @@ void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep)
} }
if (startstep != lockstart || stopstep != lockstop) if (startstep != lockstart || stopstep != lockstop)
error->all(FLERR,"Two fix ave commands using " error->all(FLERR,"Two fix commands using "
"same compute chunk/atom command in incompatible ways"); "same compute chunk/atom command in incompatible ways");
// set lock to last calling Fix, since it will be last to unlock() // set lock to last calling Fix, since it will be last to unlock()
@ -673,7 +673,7 @@ void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep)
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
unset lock unset lock
can only be done by fix ave/chunk command that holds the lock can only be done by fix command that holds the lock
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void ComputeChunkAtom::unlock(Fix *fixptr) void ComputeChunkAtom::unlock(Fix *fixptr)
@ -791,7 +791,7 @@ void ComputeChunkAtom::compute_ichunk()
all atoms will be assigned a chunk ID from 1 to Nchunk, or 0 all atoms will be assigned a chunk ID from 1 to Nchunk, or 0
also setup any internal state needed to quickly assign atoms to chunks also setup any internal state needed to quickly assign atoms to chunks
called from compute_peratom() and also directly from called from compute_peratom() and also directly from
fix ave/chunk and compute chunk commands fix chunk and compute chunk commands
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
int ComputeChunkAtom::setup_chunks() int ComputeChunkAtom::setup_chunks()

View File

@ -26,6 +26,9 @@ namespace LAMMPS_NS {
class ComputeCOMChunk : public Compute { class ComputeCOMChunk : public Compute {
public: public:
char *idchunk; // fields accessed by other classes
double *masstotal;
ComputeCOMChunk(class LAMMPS *, int, char **); ComputeCOMChunk(class LAMMPS *, int, char **);
~ComputeCOMChunk(); ~ComputeCOMChunk();
void init(); void init();
@ -43,10 +46,9 @@ class ComputeCOMChunk : public Compute {
private: private:
int nchunk,maxchunk; int nchunk,maxchunk;
int firstflag,massneed; int firstflag,massneed;
char *idchunk;
class ComputeChunkAtom *cchunk; class ComputeChunkAtom *cchunk;
double *massproc,*masstotal; double *massproc;
double **com,**comall; double **com,**comall;
void allocate(); void allocate();

View File

@ -23,9 +23,9 @@
#include "update.h" #include "update.h"
#include "respa.h" #include "respa.h"
#include "domain.h" #include "domain.h"
#include "error.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "error.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;