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 |
< |
#ifndef CONSTRAINTS_ZCONSTRAINTFORCEMANAGER_HPP |
26 |
< |
#define CONSTRAINTS_ZCONSTRAINTFORCEMANAGER_HPP |
27 |
< |
#include <list> |
28 |
< |
#include <string> |
29 |
< |
#include <vector> |
30 |
< |
#include "brains/ForceManager.hpp" |
31 |
< |
#include "primitives/Molecule.hpp" |
32 |
< |
namespace oopse { |
33 |
< |
|
34 |
< |
struct ZconstraintParam { |
35 |
< |
double zTargetPos; /**< target zconstraint position */ |
36 |
< |
double kz; /**< force constant */ |
37 |
< |
double cantVel; /**< The velocity of cantilever */ |
38 |
< |
}; |
39 |
< |
|
40 |
< |
struct ZconstraintMol { |
41 |
< |
Molecule* mol; |
42 |
< |
ZconstraintParam param; |
43 |
< |
double fz; |
44 |
< |
double zpos; |
45 |
< |
double cantPos; /**< current position of cantilever */ |
46 |
< |
double endFixingTime; |
47 |
< |
}; |
48 |
< |
|
49 |
< |
class ZconstraintForceManager : public ForceManager { |
50 |
< |
public: |
51 |
< |
ZconstraintForceManager(SimInfo* info); |
52 |
< |
|
53 |
< |
virtual void calcForces(bool needPotential, bool needStress); |
54 |
< |
|
55 |
< |
double getZConsTime() { return zconsTime_; } |
56 |
< |
std::string getZConsOutput() { return zconsOutput_; } |
57 |
< |
|
58 |
< |
void update(); |
59 |
< |
|
60 |
< |
private: |
61 |
< |
|
62 |
< |
bool isZMol(Molecule* mol); |
63 |
< |
void thermalize(void); |
64 |
< |
|
65 |
< |
void zeroVelocity(); |
66 |
< |
void doZconstraintForce(); |
67 |
< |
void doHarmonic(); |
68 |
< |
bool checkZConsState(); |
69 |
< |
bool haveFixedZMols(); |
70 |
< |
bool haveMovingMols(); |
71 |
< |
void updateZPos(); |
72 |
< |
void updateCantPos(); |
73 |
< |
void calcTotalMassMovingZMols(); |
74 |
< |
double getZTargetPos(int index); |
75 |
< |
double getZFOfFixedZMols(Molecule* mol, StuntDouble* sd, double totalForce) ; |
76 |
< |
double getZFOfMovingMols(StuntDouble* sd, double totalForce) ; |
77 |
< |
double getHFOfFixedZMols(Molecule* mol, StuntDouble* sd, double totalForce); |
78 |
< |
double getHFOfUnconsMols(StuntDouble* sd, double totalForce); |
79 |
< |
|
80 |
< |
std::list<ZconstraintMol> movingZMols_; /**< moving zconstraint molecules*/ |
81 |
< |
std::list<ZconstraintMol> fixedZMols_; /**< fixed zconstraint molecules*/ |
82 |
< |
std::vector<Molecule*> unzconsMols_; /**< free molecules*/ |
83 |
< |
|
84 |
< |
double zconsTime_; |
85 |
< |
std::string zconsOutput_; |
86 |
< |
double zconsTol_; |
87 |
< |
bool usingSMD_; |
88 |
< |
double zconsFixingTime_; |
89 |
< |
double zconsGap_; |
90 |
< |
bool usingZconsGap_; |
91 |
< |
double dt_; |
92 |
< |
|
93 |
< |
const static int whichDirection = 2; |
94 |
< |
|
95 |
< |
std::map<int, ZconstraintParam> allZMolIndices_; |
96 |
< |
|
97 |
< |
Snapshot* currSnapshot_; |
98 |
< |
double currZconsTime_; |
99 |
< |
|
100 |
< |
double totMassMovingZMols_; |
101 |
< |
double totMassUnconsMols_; /**< mass of unconstraint molecules in the whole system (never change) */ |
102 |
< |
|
103 |
< |
ZConsWriter* fzOut; |
104 |
< |
const static double infiniteTime = 1e31; |
105 |
< |
}; |
106 |
< |
|
107 |
< |
} |
108 |
< |
#endif |
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 |
> |
#ifndef CONSTRAINTS_ZCONSTRAINTFORCEMANAGER_HPP |
26 |
> |
#define CONSTRAINTS_ZCONSTRAINTFORCEMANAGER_HPP |
27 |
> |
#include <list> |
28 |
> |
#include <string> |
29 |
> |
#include <vector> |
30 |
> |
#include "brains/ForceManager.hpp" |
31 |
> |
#include "constraints/ZconsStruct.hpp" |
32 |
> |
namespace oopse { |
33 |
> |
|
34 |
> |
class ZconstraintForceManager : public ForceManager { |
35 |
> |
public: |
36 |
> |
ZconstraintForceManager(SimInfo* info); |
37 |
> |
|
38 |
> |
virtual void calcForces(bool needPotential, bool needStress); |
39 |
> |
|
40 |
> |
double getZConsTime() { return zconsTime_; } |
41 |
> |
std::string getZConsOutput() { return zconsOutput_; } |
42 |
> |
|
43 |
> |
void update(); |
44 |
> |
|
45 |
> |
private: |
46 |
> |
|
47 |
> |
bool isZMol(Molecule* mol); |
48 |
> |
void thermalize(void); |
49 |
> |
|
50 |
> |
void zeroVelocity(); |
51 |
> |
void doZconstraintForce(); |
52 |
> |
void doHarmonic(); |
53 |
> |
bool checkZConsState(); |
54 |
> |
bool haveFixedZMols(); |
55 |
> |
bool haveMovingMols(); |
56 |
> |
void updateZPos(); |
57 |
> |
void updateCantPos(); |
58 |
> |
void calcTotalMassMovingZMols(); |
59 |
> |
double getZTargetPos(int index); |
60 |
> |
double getZFOfFixedZMols(Molecule* mol, StuntDouble* sd, double totalForce) ; |
61 |
> |
double getZFOfMovingMols(StuntDouble* sd, double totalForce) ; |
62 |
> |
double getHFOfFixedZMols(Molecule* mol, StuntDouble* sd, double totalForce); |
63 |
> |
double getHFOfUnconsMols(StuntDouble* sd, double totalForce); |
64 |
> |
|
65 |
> |
std::list<ZconstraintMol> movingZMols_; /**< moving zconstraint molecules*/ |
66 |
> |
std::list<ZconstraintMol> fixedZMols_; /**< fixed zconstraint molecules*/ |
67 |
> |
std::vector<Molecule*> unzconsMols_; /**< free molecules*/ |
68 |
> |
|
69 |
> |
double zconsTime_; |
70 |
> |
std::string zconsOutput_; |
71 |
> |
double zconsTol_; |
72 |
> |
bool usingSMD_; |
73 |
> |
double zconsFixingTime_; |
74 |
> |
double zconsGap_; |
75 |
> |
bool usingZconsGap_; |
76 |
> |
double dt_; |
77 |
> |
|
78 |
> |
const static int whichDirection = 2; |
79 |
> |
|
80 |
> |
std::map<int, ZconstraintParam> allZMolIndices_; |
81 |
> |
|
82 |
> |
Snapshot* currSnapshot_; |
83 |
> |
double currZconsTime_; |
84 |
> |
|
85 |
> |
double totMassMovingZMols_; |
86 |
> |
double totMassUnconsMols_; /**< mass of unconstraint molecules in the whole system (never change) */ |
87 |
> |
|
88 |
> |
ZConsWriter* fzOut; |
89 |
> |
const static double infiniteTime = 1e31; |
90 |
> |
}; |
91 |
> |
|
92 |
> |
} |
93 |
> |
#endif |