-
Notifications
You must be signed in to change notification settings - Fork 1
/
ComputeImpropers.h
114 lines (92 loc) · 3.2 KB
/
ComputeImpropers.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
/**
*** Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by
*** The Board of Trustees of the University of Illinois.
*** All rights reserved.
**/
#ifndef COMPUTEIMPROPERS_H
#define COMPUTEIMPROPERS_H
#include "ComputeHomeTuples.h"
#include "ComputeSelfTuples.h"
#include "ReductionMgr.h"
class Molecule;
class ImproperValue;
class ImproperElem {
public:
// ComputeHomeTuples interface
enum { size = 4 };
AtomID atomID[size];
int localIndex[size];
TuplePatchElem *p[size];
Real scale;
void computeForce(BigReal*, BigReal *);
static void getMoleculePointers(Molecule*, int*, int32***, Improper**);
static void getParameterPointers(Parameters*, const ImproperValue**);
static void getTupleInfo(AtomSignature* sig, int *count, TupleSignature** t) {
*count = sig->improperCnt;
*t = sig->improperSigs;
}
// pressure profile parameters
static int pressureProfileSlabs;
static int pressureProfileAtomTypes;
static BigReal pressureProfileThickness;
static BigReal pressureProfileMin;
// Internal data
const ImproperValue *value;
int hash() const {
return 0x7FFFFFFF &((atomID[0]<<24) + (atomID[1]<<16) + (atomID[2]<<8) + atomID[3]);
}
enum { improperEnergyIndex, TENSOR(virialIndex), reductionDataSize };
enum { reductionChecksumLabel = REDUCTION_IMPROPER_CHECKSUM };
static void submitReductionData(BigReal*,SubmitReduction*);
ImproperElem() { ; }
ImproperElem(AtomID atom0, const TupleSignature *sig, const ImproperValue *v){
atomID[0] = atom0;
atomID[1] = atom0 + sig->offset[0];
atomID[2] = atom0 + sig->offset[1];
atomID[3] = atom0 + sig->offset[2];
value = &v[sig->tupleParamType];
}
ImproperElem(const Improper *a, const ImproperValue *v) {
atomID[0] = a->atom1;
atomID[1] = a->atom2;
atomID[2] = a->atom3;
atomID[3] = a->atom4;
value = &v[a->improper_type];
}
ImproperElem(AtomID atom0, AtomID atom1, AtomID atom2, AtomID atom3) {
if (atom0 > atom3) { // Swap end atoms so lowest is first!
AtomID tmp = atom3; atom3 = atom0; atom0 = tmp;
tmp = atom1; atom1 = atom2; atom2 = tmp;
}
atomID[0] = atom0;
atomID[1] = atom1;
atomID[2] = atom2;
atomID[3] = atom3;
}
~ImproperElem() {};
int operator==(const ImproperElem &a) const {
return (a.atomID[0] == atomID[0] && a.atomID[1] == atomID[1] &&
a.atomID[2] == atomID[2] && a.atomID[3] == atomID[3]);
}
int operator<(const ImproperElem &a) const {
return (atomID[0] < a.atomID[0] ||
(atomID[0] == a.atomID[0] &&
(atomID[1] < a.atomID[1] ||
(atomID[1] == a.atomID[1] &&
(atomID[2] < a.atomID[2] ||
(atomID[2] == a.atomID[2] &&
atomID[3] < a.atomID[3]
))))));
}
};
class ComputeImpropers : public ComputeHomeTuples<ImproperElem,Improper,ImproperValue>
{
public:
ComputeImpropers(ComputeID c, PatchIDList &p) : ComputeHomeTuples<ImproperElem,Improper,ImproperValue>(c,p) { ; }
};
class ComputeSelfImpropers : public ComputeSelfTuples<ImproperElem,Improper,ImproperValue>
{
public:
ComputeSelfImpropers(ComputeID c, PatchID p) : ComputeSelfTuples<ImproperElem,Improper,ImproperValue>(c,p) { ; }
};
#endif