-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoxDimensionsNonOrth.h
102 lines (82 loc) · 3.53 KB
/
BoxDimensionsNonOrth.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
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.31
Copyright (C) 2018 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
********************************************************************************/
#ifndef BOX_DIMENSIONS_NONORTHO_H
#define BOX_DIMENSIONS_NONORTHO_H
#include "BoxDimensions.h"
class BoxDimensionsNonOrth : public BoxDimensions
{
public:
BoxDimensionsNonOrth() : BoxDimensions()
{
cellLength.Init(BOX_TOTAL);
for (uint b = 0; b < BOX_TOTAL; b++) {
cellBasis[b] = XYZArray(3);
cellBasis_Inv[b] = XYZArray(3);
}
}
BoxDimensionsNonOrth(BoxDimensionsNonOrth const& other) : BoxDimensions(other)
{
cellLength.Init(BOX_TOTAL);
other.cellLength.CopyRange(cellLength, 0, 0, BOX_TOTAL);
for (uint b = 0; b < BOX_TOTAL; ++b) {
cellBasis_Inv[b] = XYZArray(3);
other.cellBasis_Inv[b].CopyRange(cellBasis_Inv[b], 0, 0, 3);
}
}
virtual BoxDimensionsNonOrth& operator=(BoxDimensionsNonOrth const& other);
virtual void Init(config_setup::RestartSettings const& restart,
config_setup::Volume const& confVolume,
pdb_setup::Cryst1 const& cryst, double rc, double rcSq);
virtual void SetVolume(const uint b, const double vol);
virtual uint ShiftVolume(BoxDimensionsNonOrth & newDim, XYZ & scale,
const uint b, const double delta) const;
//!Calculate and execute volume exchange based on transfer
virtual uint ExchangeVolume(BoxDimensionsNonOrth & newDim, XYZ * scale,
const double transfer) const;
//Construct cell basis based on new axis dimension
void CalcCellDimensions(const uint b);
//Vector btwn two points, accounting for PBC, on an individual axis
virtual XYZ MinImage(XYZ rawVecRef, const uint b) const;
//Unwrap one coordinate.
virtual void WrapPBC(double &x, double &y, double &z, const uint b) const;
//Unwrap one coordinate.
virtual void UnwrapPBC(double & x, double & y, double & z,
const uint b, XYZ const& ref) const;
//Transform A to unslant coordinate
XYZ TransformUnSlant(const XYZ &A, const uint b) const;
//Transform A to slant coordinate
XYZ TransformSlant(const XYZ &A, const uint b) const;
//private:
XYZArray cellBasis_Inv[BOX_TOTAL]; //inverse cell matrix for each box
XYZArray cellLength; //Length of a, b, c for each box
};
//Calculate transform
inline XYZ BoxDimensionsNonOrth::TransformUnSlant(const XYZ &A,
const uint b) const
{
XYZ temp;
temp.x = A.x * cellBasis_Inv[b].Get(0).x + A.y * cellBasis_Inv[b].Get(1).x +
A.z * cellBasis_Inv[b].Get(2).x;
temp.y = A.x * cellBasis_Inv[b].Get(0).y + A.y * cellBasis_Inv[b].Get(1).y +
A.z * cellBasis_Inv[b].Get(2).y;
temp.z = A.x * cellBasis_Inv[b].Get(0).z + A.y * cellBasis_Inv[b].Get(1).z +
A.z * cellBasis_Inv[b].Get(2).z;
return temp;
}
//Calculate transform
inline XYZ BoxDimensionsNonOrth::TransformSlant(const XYZ &A, const uint b) const
{
XYZ temp;
temp.x = A.x * cellBasis[b].Get(0).x + A.y * cellBasis[b].Get(1).x +
A.z * cellBasis[b].Get(2).x;
temp.y = A.x * cellBasis[b].Get(0).y + A.y * cellBasis[b].Get(1).y +
A.z * cellBasis[b].Get(2).y;
temp.z = A.x * cellBasis[b].Get(0).z + A.y * cellBasis[b].Get(1).z +
A.z * cellBasis[b].Get(2).z;
return temp;
}
#endif /*BOX_DIMENSIONS_NONORTHO_H*/