-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompute.h
130 lines (100 loc) · 5.1 KB
/
compute.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* ----------------------------------------------------------------------
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
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifndef LMP_COMPUTE_H
#define LMP_COMPUTE_H
#include "pointers.h"
namespace LAMMPS_NS {
class Compute : protected Pointers {
public:
char *id,*style;
int igroup,groupbit;
double scalar; // computed global scalar
double *vector; // computed global vector
double **array; // computed global array
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
int scalar_flag; // 0/1 if compute_scalar() function exists
int vector_flag; // 0/1 if compute_vector() function exists
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
int peratom_flag; // 0/1 if compute_peratom() function exists
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
int *extlist; // list of 0/1 int/ext for each vec component
int extarray; // 0/1 if global array is all intensive/extensive
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
int pressatomflag; // 1 if Compute calculates per-atom virial
int peflag; // 1 if Compute calculates PE (uses Force energies)
int peatomflag; // 1 if Compute calculates per-atom PE
int tempbias; // 0/1 if Compute temp includes self/extra bias
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
int *tlist; // time list of steps the Compute is called on
int invoked_flag; // non-zero if invoked or accessed this step, 0 if not
int invoked_scalar; // last timestep on which compute_scalar() was invoked
int invoked_vector; // ditto for compute_vector()
int invoked_array; // ditto for compute_array()
int invoked_peratom; // ditto for compute_peratom()
int invoked_local; // ditto for compute_local()
double dof; // degrees-of-freedom for temperature
int comm_forward; // size of forward communication (0 if none)
int comm_reverse; // size of reverse communication (0 if none)
Compute(class LAMMPS *, int, char **);
virtual ~Compute();
void modify_params(int, char **);
void reset_extra_dof();
virtual void post_create() {}
virtual void init() = 0;
virtual void init_list(int, class NeighList *) {}
virtual double compute_scalar() {return 0.0;}
virtual void compute_vector() {}
virtual void compute_array() {}
virtual void compute_peratom() {}
virtual void compute_local() {}
virtual int pack_comm(int, int *, double *, int, int *) {return 0;}
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 *) {}
virtual int dof_remove(int) {return 0;}
virtual void remove_bias(int, double *) {}
virtual void remove_bias_all() {}
virtual void restore_bias(int, double *) {}
virtual void restore_bias_all() {}
virtual void reset_extra_compute_fix(char *);
void addstep(int);
int matchstep(int);
void clearstep();
virtual void *extract(char *) {return NULL;}
virtual double memory_usage() {return 0.0;}
protected:
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
double vbias[3]; // stored velocity bias for one atom
double **vbiasall; // stored velocity bias for all atoms
int maxbias; // size of vbiasall array
int *molmap; // convert molecule ID to local index
int molecules_in_group(int &, int &);
};
}
#endif