1 |
/* |
2 |
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
3 |
* |
4 |
* Contact: oopse@oopse.org |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Lesser General Public License |
8 |
* as published by the Free Software Foundation; either version 2.1 |
9 |
* of the License, or (at your option) any later version. |
10 |
* All we ask is that proper credit is given for our work, which includes |
11 |
* - but is not limited to - adding the above copyright notice to the beginning |
12 |
* of your source code files, and to any copyright notice that you may distribute |
13 |
* with programs based on this work. |
14 |
* |
15 |
* This program is distributed in the hope that it will be useful, |
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
* GNU Lesser General Public License for more details. |
19 |
* |
20 |
* You should have received a copy of the GNU Lesser General Public License |
21 |
* along with this program; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
* |
24 |
*/ |
25 |
|
26 |
/** |
27 |
* @file NPT.hpp |
28 |
* @author tlin |
29 |
* @date 11/19/2004 |
30 |
* @time 13:25am |
31 |
* @version 1.0 |
32 |
*/ |
33 |
|
34 |
#ifndef INTEGRATORS_NPT_HPP |
35 |
#define INTEGRATORS_NPT_HPP |
36 |
|
37 |
#include "integrators/VelocityVerletIntegrator.hpp" |
38 |
|
39 |
namespace oopse { |
40 |
class NPT : public VelocityVerletIntegrator { |
41 |
public: |
42 |
|
43 |
NPT(SimInfo * info); |
44 |
virtual ~NPT(); |
45 |
|
46 |
|
47 |
int getMaxIterationNumber() { |
48 |
return maxIterNum_; |
49 |
} |
50 |
|
51 |
void setMaxIterationNumber(int maxIter) { |
52 |
maxIterNum_ = maxIter; |
53 |
} |
54 |
double getTauThermostat() { |
55 |
return tauThermostat; |
56 |
} |
57 |
|
58 |
void setTauThermostat(double tt) { |
59 |
tauThermostat = tt; |
60 |
} |
61 |
|
62 |
double getTauBarostat() { |
63 |
return tauBarostat; |
64 |
} |
65 |
void setTauBarostat(double tb) { |
66 |
tauBarostat = tb; |
67 |
} |
68 |
|
69 |
double getTargetTemp() { |
70 |
return targetTemp; |
71 |
} |
72 |
|
73 |
void setTargetTemp(double tt) { |
74 |
targetTemp = tt; |
75 |
} |
76 |
|
77 |
double getTargetPressure() { |
78 |
return targetTemp; |
79 |
} |
80 |
|
81 |
void setTargetPressure(double tp) { |
82 |
targetPressure = tp; |
83 |
} |
84 |
|
85 |
double getChiTolerance() { |
86 |
return chiTolerance; |
87 |
} |
88 |
|
89 |
void setChiTolerance(double tol) { |
90 |
chiTolerance = tol; |
91 |
} |
92 |
|
93 |
double getEtaTolerance() { |
94 |
return etaTolerance; |
95 |
} |
96 |
|
97 |
void setEtaTolerance(double tol) { |
98 |
etaTolerance = tol; |
99 |
} |
100 |
|
101 |
protected: |
102 |
|
103 |
virtual void integrateStep() { |
104 |
needStress= true; |
105 |
VelocityVerletIntegrator::integrateStep(); |
106 |
} |
107 |
|
108 |
virtual void doUpdate(); |
109 |
|
110 |
double NkBT; |
111 |
double fkBT; |
112 |
|
113 |
double tt2; |
114 |
double tb2; |
115 |
|
116 |
double instaTemp; |
117 |
double instaPress; |
118 |
double instaVol; |
119 |
|
120 |
|
121 |
// targetTemp, targetPressure, and tauBarostat must be set. |
122 |
// One of qmass or tauThermostat must be set; |
123 |
|
124 |
double targetTemp; |
125 |
double targetPressure; |
126 |
double tauThermostat; |
127 |
double tauBarostat; |
128 |
|
129 |
std::vector<Vector3d> oldPos; |
130 |
std::vector<Vector3d> oldVel; |
131 |
std::vector<Vector3d> oldJi; |
132 |
|
133 |
double etaTolerance; |
134 |
|
135 |
double chi; |
136 |
double integralOfChidt; |
137 |
Mat3x3d press; |
138 |
|
139 |
private: |
140 |
|
141 |
virtual void moveA(); |
142 |
virtual void moveB(); |
143 |
|
144 |
virtual void getVelScaleA(Vector3d& sc, const Vector3d& vel) = 0; |
145 |
|
146 |
virtual void getVelScaleB(Vector3d& sc, int index) = 0; |
147 |
|
148 |
virtual void getPosScale(const Vector3d& pos, const Vector3d& COM, |
149 |
int index, Vector3d& sc) = 0; |
150 |
|
151 |
virtual void calcVelScale() = 0; |
152 |
|
153 |
virtual bool etaConverged() = 0; |
154 |
|
155 |
virtual void evolveEtaA() = 0; |
156 |
|
157 |
virtual void evolveEtaB() = 0; |
158 |
|
159 |
virtual void scaleSimBox() = 0; |
160 |
|
161 |
virtual double calcConservedQuantity() = 0; |
162 |
|
163 |
virtual void loadEta() = 0; |
164 |
virtual void saveEta() = 0; |
165 |
|
166 |
int maxIterNum_; |
167 |
|
168 |
double chiTolerance; |
169 |
}; |
170 |
|
171 |
} //end namespace oopse |
172 |
|
173 |
#endif //INTEGRATORS_NPT_HPP |