ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-2.0/src/integrators/NPT.hpp
Revision: 1774
Committed: Tue Nov 23 23:12:23 2004 UTC (19 years, 7 months ago) by tim
File size: 4952 byte(s)
Log Message:
refactory NPT integrator

File Contents

# User Rev Content
1 tim 1762 /*
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 tim 1774
47     int getMaxIterationNumber() {
48     return maxIterNum_;
49 tim 1762 }
50    
51 tim 1774 void setMaxIterationNumber(int maxIter) {
52     maxIterNum_ = maxIter;
53     }
54     double getTauThermostat() {
55 tim 1762 return tauThermostat;
56     }
57    
58     void setTauThermostat(double tt) {
59     tauThermostat = tt;
60     }
61    
62 tim 1774 double getTauBarostat() {
63     return tauBarostat;
64     }
65 tim 1762 void setTauBarostat(double tb) {
66     tauBarostat = tb;
67     }
68    
69 tim 1774 double getTargetTemp() {
70     return targetTemp;
71     }
72    
73 tim 1762 void setTargetTemp(double tt) {
74     targetTemp = tt;
75     }
76    
77 tim 1774 double getTargetPressure() {
78     return targetTemp;
79     }
80    
81 tim 1762 void setTargetPressure(double tp) {
82     targetPressure = tp;
83     }
84    
85 tim 1774 double getChiTolerance() {
86     return chiTolerance;
87     }
88    
89 tim 1762 void setChiTolerance(double tol) {
90     chiTolerance = tol;
91     }
92    
93 tim 1774 double getEtaTolerance() {
94     return etaTolerance;
95 tim 1762 }
96 tim 1774
97 tim 1762 void setEtaTolerance(double tol) {
98     etaTolerance = tol;
99     }
100    
101     protected:
102    
103 tim 1774 virtual void integrateStep(int calcPot, int calcStress) {
104     calcStress = 1;
105     T::integrateStep(calcPot, calcStress);
106     }
107    
108     double NkBT;
109     double fkBT;
110 tim 1762
111 tim 1774 double tt2;
112     double tb2;
113    
114     double instaTemp;
115     double instaPress;
116     double instaVol;
117     Vector3d press;
118 tim 1762
119 tim 1774 // targetTemp, targetPressure, and tauBarostat must be set.
120     // One of qmass or tauThermostat must be set;
121 tim 1762
122 tim 1774 double targetTemp;
123     double targetPressure;
124     double tauThermostat;
125     double tauBarostat;
126 tim 1762
127 tim 1774 std::vector<Vector3d> oldPos;
128     std::vector<Vector3d> oldVel;
129     std::vector<Vector3d> oldJi;
130    
131     double etaTolerance;
132    
133     private:
134    
135     virtual void moveA();
136     virtual void moveB();
137    
138     virtual void getVelScaleA(Vector3d& sc, const Vector3d& vel) = 0;
139     virtual void getVelScaleB(Vector3d& sc, int index ) = 0;
140     virtual void getVelScaleA(Vector3d& sc, const Vector3d& vel) = 0;
141     virtual void getVelScaleB(Vector3d& sc, int index) = 0;
142     virtual void getPosScale(const Vector3d& pos, const Vector3d& COM,
143     int index, Vector3d& sc) = 0;
144 tim 1762 virtual void calcVelScale() = 0;
145    
146     virtual bool chiConverged();
147     virtual bool etaConverged() = 0;
148    
149     virtual void evolveChiA();
150     virtual void evolveEtaA() = 0;
151     virtual void evolveChiB();
152     virtual void evolveEtaB() = 0;
153    
154     virtual void scaleSimBox() = 0;
155 tim 1774
156     virtual double calcConservedQuantity() = 0;
157    
158     int maxIterNum_;
159 tim 1762
160     double oldChi;
161     double prevChi;
162 tim 1774 double chi;
163     double chiTolerance;
164 tim 1762 };
165    
166     } //end namespace oopse
167    
168     #endif //INTEGRATORS_NPT_HPP