2007-01-30 08:31:11 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
|
|
|
http://lammps.sandia.gov, Sandia National Laboratories
|
|
|
|
Steve Plimpton, sjplimp@sandia.gov
|
|
|
|
|
|
|
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
|
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
2012-06-07 06:47:51 +08:00
|
|
|
certain rights in this software. This software is distributed under
|
2007-01-30 08:31:11 +08:00
|
|
|
the GNU General Public License.
|
|
|
|
|
|
|
|
See the README file in the top-level LAMMPS directory.
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2010-01-12 09:37:48 +08:00
|
|
|
#ifndef LMP_COMPUTE_H
|
|
|
|
#define LMP_COMPUTE_H
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2011-02-23 06:09:18 +08:00
|
|
|
#include "pointers.h"
|
2007-01-30 08:31:11 +08:00
|
|
|
|
|
|
|
namespace LAMMPS_NS {
|
|
|
|
|
|
|
|
class Compute : protected Pointers {
|
|
|
|
public:
|
2012-08-28 22:21:55 +08:00
|
|
|
|
2007-01-30 08:31:11 +08:00
|
|
|
char *id,*style;
|
|
|
|
int igroup,groupbit;
|
|
|
|
|
2007-02-21 08:15:29 +08:00
|
|
|
double scalar; // computed global scalar
|
|
|
|
double *vector; // computed global vector
|
2009-12-10 05:12:49 +08:00
|
|
|
double **array; // computed global array
|
2009-12-05 05:03:54 +08:00
|
|
|
double *vector_atom; // computed per-atom vector
|
|
|
|
double **array_atom; // computed per-atom array
|
|
|
|
double *vector_local; // computed local vector
|
|
|
|
double **array_local; // computed local array
|
2007-01-30 08:31:11 +08:00
|
|
|
|
|
|
|
int scalar_flag; // 0/1 if compute_scalar() function exists
|
|
|
|
int vector_flag; // 0/1 if compute_vector() function exists
|
2009-12-05 05:03:54 +08:00
|
|
|
int array_flag; // 0/1 if compute_array() function exists
|
|
|
|
int size_vector; // length of global vector
|
|
|
|
int size_array_rows; // rows in global array
|
|
|
|
int size_array_cols; // columns in global array
|
|
|
|
|
2007-10-10 01:20:33 +08:00
|
|
|
int peratom_flag; // 0/1 if compute_peratom() function exists
|
2009-12-05 05:03:54 +08:00
|
|
|
int size_peratom_cols; // 0 = vector, N = columns in peratom array
|
|
|
|
|
|
|
|
int local_flag; // 0/1 if compute_local() function exists
|
|
|
|
int size_local_rows; // rows in local vector or array
|
|
|
|
int size_local_cols; // 0 = vector, N = columns in local array
|
|
|
|
|
|
|
|
int extscalar; // 0/1 if global scalar is intensive/extensive
|
|
|
|
int extvector; // 0/1/-1 if global vector is all int/ext/extlist
|
2008-01-03 03:24:46 +08:00
|
|
|
int *extlist; // list of 0/1 int/ext for each vec component
|
2009-12-10 05:12:49 +08:00
|
|
|
int extarray; // 0/1 if global array is all intensive/extensive
|
2007-01-30 08:31:11 +08:00
|
|
|
|
|
|
|
int tempflag; // 1 if Compute can be used as temperature
|
|
|
|
// must have both compute_scalar, compute_vector
|
|
|
|
int pressflag; // 1 if Compute can be used as pressure (uses virial)
|
|
|
|
// must have both compute_scalar, compute_vector
|
2007-12-01 05:54:30 +08:00
|
|
|
int pressatomflag; // 1 if Compute calculates per-atom virial
|
2007-11-03 04:25:11 +08:00
|
|
|
int peflag; // 1 if Compute calculates PE (uses Force energies)
|
2007-12-01 05:54:30 +08:00
|
|
|
int peatomflag; // 1 if Compute calculates per-atom PE
|
2007-11-03 04:25:11 +08:00
|
|
|
|
2008-03-21 08:14:38 +08:00
|
|
|
int tempbias; // 0/1 if Compute temp includes self/extra bias
|
2008-03-12 01:15:30 +08:00
|
|
|
|
2007-11-03 04:25:11 +08:00
|
|
|
int timeflag; // 1 if Compute stores list of timesteps it's called on
|
|
|
|
int ntime; // # of entries in time list
|
|
|
|
int maxtime; // max # of entries time list can hold
|
2011-01-11 08:41:00 +08:00
|
|
|
bigint *tlist; // list of timesteps the Compute is called on
|
2007-11-03 04:25:11 +08:00
|
|
|
|
2011-01-11 08:41:00 +08:00
|
|
|
int invoked_flag; // non-zero if invoked or accessed this step, 0 if not
|
|
|
|
bigint invoked_scalar; // last timestep on which compute_scalar() was invoked
|
|
|
|
bigint invoked_vector; // ditto for compute_vector()
|
|
|
|
bigint invoked_array; // ditto for compute_array()
|
|
|
|
bigint invoked_peratom; // ditto for compute_peratom()
|
|
|
|
bigint invoked_local; // ditto for compute_local()
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2008-01-03 03:24:46 +08:00
|
|
|
double dof; // degrees-of-freedom for temperature
|
2007-10-04 00:22:30 +08:00
|
|
|
|
2008-05-17 05:58:06 +08:00
|
|
|
int comm_forward; // size of forward communication (0 if none)
|
|
|
|
int comm_reverse; // size of reverse communication (0 if none)
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2012-08-28 22:21:55 +08:00
|
|
|
unsigned int datamask;
|
|
|
|
unsigned int datamask_ext;
|
|
|
|
|
2011-05-20 23:28:28 +08:00
|
|
|
int cudable; // 1 if compute is CUDA-enabled
|
|
|
|
|
2007-01-30 08:31:11 +08:00
|
|
|
Compute(class LAMMPS *, int, char **);
|
|
|
|
virtual ~Compute();
|
|
|
|
void modify_params(int, char **);
|
2008-05-17 05:58:06 +08:00
|
|
|
void reset_extra_dof();
|
|
|
|
|
2007-01-30 08:31:11 +08:00
|
|
|
virtual void init() = 0;
|
2007-10-04 00:22:30 +08:00
|
|
|
virtual void init_list(int, class NeighList *) {}
|
2013-02-13 07:09:54 +08:00
|
|
|
virtual void setup() {}
|
2007-01-30 08:31:11 +08:00
|
|
|
virtual double compute_scalar() {return 0.0;}
|
|
|
|
virtual void compute_vector() {}
|
2009-12-05 05:03:54 +08:00
|
|
|
virtual void compute_array() {}
|
2007-01-30 08:31:11 +08:00
|
|
|
virtual void compute_peratom() {}
|
2009-12-05 05:03:54 +08:00
|
|
|
virtual void compute_local() {}
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2007-03-16 05:49:48 +08:00
|
|
|
virtual int pack_comm(int, int *, double *, int, int *) {return 0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
virtual void unpack_comm(int, int, double *) {}
|
|
|
|
virtual int pack_reverse_comm(int, int, double *) {return 0;}
|
|
|
|
virtual void unpack_reverse_comm(int, int *, double *) {}
|
|
|
|
|
2008-03-21 08:14:38 +08:00
|
|
|
virtual int dof_remove(int) {return 0;}
|
2008-03-12 01:15:30 +08:00
|
|
|
virtual void remove_bias(int, double *) {}
|
2008-03-20 22:53:21 +08:00
|
|
|
virtual void remove_bias_all() {}
|
2008-03-20 23:32:33 +08:00
|
|
|
virtual void restore_bias(int, double *) {}
|
2008-03-20 22:53:21 +08:00
|
|
|
virtual void restore_bias_all() {}
|
2008-03-12 01:15:30 +08:00
|
|
|
|
2011-12-17 05:15:49 +08:00
|
|
|
virtual void reset_extra_compute_fix(const char *);
|
2009-07-02 04:28:37 +08:00
|
|
|
|
2011-01-11 08:41:00 +08:00
|
|
|
void addstep(bigint);
|
|
|
|
int matchstep(bigint);
|
2009-01-06 06:26:08 +08:00
|
|
|
void clearstep();
|
2007-11-03 04:25:11 +08:00
|
|
|
|
2007-10-05 01:57:04 +08:00
|
|
|
virtual double memory_usage() {return 0.0;}
|
2007-01-30 08:31:11 +08:00
|
|
|
|
2012-08-28 22:21:55 +08:00
|
|
|
virtual int unsigned data_mask() {return datamask;}
|
|
|
|
virtual int unsigned data_mask_ext() {return datamask_ext;}
|
|
|
|
|
2007-01-30 08:31:11 +08:00
|
|
|
protected:
|
2007-11-03 04:25:11 +08:00
|
|
|
int extra_dof; // extra DOF for temperature computes
|
|
|
|
int dynamic; // recount atoms for temperature computes
|
|
|
|
int thermoflag; // 1 if include fix PE for PE computes
|
2009-04-30 00:54:06 +08:00
|
|
|
|
|
|
|
double vbias[3]; // stored velocity bias for one atom
|
|
|
|
double **vbiasall; // stored velocity bias for all atoms
|
|
|
|
int maxbias; // size of vbiasall array
|
2009-12-22 01:24:04 +08:00
|
|
|
|
|
|
|
int *molmap; // convert molecule ID to local index
|
|
|
|
|
2014-01-23 01:44:32 +08:00
|
|
|
int molecules_in_group(tagint &, tagint &);
|
2011-04-06 03:10:43 +08:00
|
|
|
|
|
|
|
inline int sbmask(int j) {
|
|
|
|
return j >> SBBITS & 3;
|
|
|
|
}
|
2007-01-30 08:31:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2011-12-16 09:37:13 +08:00
|
|
|
|
|
|
|
/* ERROR/WARNING messages:
|
|
|
|
|
|
|
|
E: Illegal ... command
|
|
|
|
|
|
|
|
Self-explanatory. Check the input script syntax and compare to the
|
|
|
|
documentation for the command. You can use -echo screen as a
|
|
|
|
command-line option when running LAMMPS to see the offending line.
|
|
|
|
|
|
|
|
E: Compute ID must be alphanumeric or underscore characters
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
|
|
|
E: Could not find compute group ID
|
|
|
|
|
|
|
|
Self-explanatory.
|
|
|
|
|
|
|
|
E: Compute does not allow an extra compute or fix to be reset
|
|
|
|
|
|
|
|
This is an internal LAMMPS error. Please report it to the
|
|
|
|
developers.
|
|
|
|
|
|
|
|
W: Atom with molecule ID = 0 included in compute molecule group
|
|
|
|
|
|
|
|
The group used in a compute command that operates on moleclues
|
|
|
|
includes atoms with no molecule ID. This is probably not what you
|
|
|
|
want.
|
|
|
|
|
2014-01-29 09:37:09 +08:00
|
|
|
E: Too many molecules for compute
|
|
|
|
|
2014-01-30 06:22:56 +08:00
|
|
|
The limit is 2^31 = ~2 billion molecules.
|
2014-01-29 09:37:09 +08:00
|
|
|
|
2011-12-16 09:37:13 +08:00
|
|
|
W: One or more compute molecules has atoms not in group
|
|
|
|
|
|
|
|
The group used in a compute command that operates on moleclues does
|
|
|
|
not include all the atoms in some molecules. This is probably not
|
|
|
|
what you want.
|
|
|
|
|
|
|
|
*/
|