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 * theInfo, ForceFields * the_ff); |
44 |
virtual~NPT(); |
45 |
|
46 |
virtual void integrateStep(int calcPot, int calcStress) { |
47 |
calcStress = 1; |
48 |
T::integrateStep(calcPot, calcStress); |
49 |
} |
50 |
|
51 |
virtual double getConservedQuantity(void) = 0; |
52 |
virtual string getAdditionalParameters(void) = 0; |
53 |
|
54 |
double myTauThermo() { |
55 |
return tauThermostat; |
56 |
} |
57 |
|
58 |
double myTauBaro() { |
59 |
return tauBarostat; |
60 |
} |
61 |
|
62 |
void setTauThermostat(double tt) { |
63 |
tauThermostat = tt; |
64 |
have_tau_thermostat = 1; |
65 |
} |
66 |
|
67 |
void setTauBarostat(double tb) { |
68 |
tauBarostat = tb; |
69 |
have_tau_barostat = 1; |
70 |
} |
71 |
|
72 |
void setTargetTemp(double tt) { |
73 |
targetTemp = tt; |
74 |
have_target_temp = 1; |
75 |
} |
76 |
|
77 |
void setTargetPressure(double tp) { |
78 |
targetPressure = tp; |
79 |
have_target_pressure = 1; |
80 |
} |
81 |
|
82 |
void setChiTolerance(double tol) { |
83 |
chiTolerance = tol; |
84 |
have_chi_tolerance = 1; |
85 |
} |
86 |
|
87 |
void setPosIterTolerance(double tol) { |
88 |
posIterTolerance = tol; |
89 |
have_pos_iter_tolerance = 1; |
90 |
} |
91 |
|
92 |
void setEtaTolerance(double tol) { |
93 |
etaTolerance = tol; |
94 |
have_eta_tolerance = 1; |
95 |
} |
96 |
|
97 |
protected: |
98 |
|
99 |
virtual void moveA(); |
100 |
virtual void moveB(); |
101 |
|
102 |
virtual int readyCheck(); |
103 |
|
104 |
virtual void resetIntegrator(); |
105 |
|
106 |
virtual void getVelScaleA(double sc[3], double vel[3]) = 0; |
107 |
virtual void getVelScaleB(double sc[3], int index) = 0; |
108 |
virtual void getPosScale(double pos[3], double COM[3], int index, |
109 |
double sc[3]) = 0; |
110 |
|
111 |
virtual void calcVelScale() = 0; |
112 |
|
113 |
virtual bool chiConverged(); |
114 |
virtual bool etaConverged() = 0; |
115 |
|
116 |
virtual void evolveChiA(); |
117 |
virtual void evolveEtaA() = 0; |
118 |
virtual void evolveChiB(); |
119 |
virtual void evolveEtaB() = 0; |
120 |
|
121 |
virtual void scaleSimBox() = 0; |
122 |
|
123 |
void accIntegralOfChidt(void) { |
124 |
integralOfChidt += dt * chi; |
125 |
} |
126 |
|
127 |
// chi and eta are the propagated degrees of freedom |
128 |
|
129 |
double oldChi; |
130 |
double prevChi; |
131 |
double chi; |
132 |
double NkBT; |
133 |
double fkBT; |
134 |
|
135 |
double tt2, |
136 |
tb2; |
137 |
double instaTemp, |
138 |
instaPress, |
139 |
instaVol; |
140 |
double press[3][3]; |
141 |
|
142 |
int Nparticles; |
143 |
|
144 |
double integralOfChidt; |
145 |
|
146 |
// targetTemp, targetPressure, and tauBarostat must be set. |
147 |
// One of qmass or tauThermostat must be set; |
148 |
|
149 |
double targetTemp; |
150 |
double targetPressure; |
151 |
double tauThermostat; |
152 |
double tauBarostat; |
153 |
|
154 |
short int have_tau_thermostat, |
155 |
have_tau_barostat, |
156 |
have_target_temp; |
157 |
short int have_target_pressure; |
158 |
|
159 |
double * oldPos; |
160 |
double * oldVel; |
161 |
double * oldJi; |
162 |
|
163 |
double chiTolerance; |
164 |
short int have_chi_tolerance; |
165 |
double posIterTolerance; |
166 |
short int have_pos_iter_tolerance; |
167 |
double etaTolerance; |
168 |
short int have_eta_tolerance; |
169 |
}; |
170 |
|
171 |
} //end namespace oopse |
172 |
|
173 |
#endif //INTEGRATORS_NPT_HPP |