1 |
tim |
1911 |
/*
|
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 |
tim |
1912 |
#include "io/ZConsWriter.hpp"
|
33 |
tim |
1911 |
namespace oopse {
|
34 |
|
|
|
35 |
|
|
class ZconstraintForceManager : public ForceManager {
|
36 |
|
|
public:
|
37 |
|
|
ZconstraintForceManager(SimInfo* info);
|
38 |
tim |
1912 |
~ZconstraintForceManager();
|
39 |
tim |
1911 |
|
40 |
|
|
virtual void calcForces(bool needPotential, bool needStress);
|
41 |
|
|
|
42 |
|
|
double getZConsTime() { return zconsTime_; }
|
43 |
|
|
std::string getZConsOutput() { return zconsOutput_; }
|
44 |
|
|
|
45 |
|
|
void update();
|
46 |
tim |
1912 |
virtual void init();
|
47 |
tim |
1911 |
private:
|
48 |
|
|
|
49 |
|
|
bool isZMol(Molecule* mol);
|
50 |
|
|
void thermalize(void);
|
51 |
|
|
|
52 |
|
|
void zeroVelocity();
|
53 |
|
|
void doZconstraintForce();
|
54 |
|
|
void doHarmonic();
|
55 |
|
|
bool checkZConsState();
|
56 |
|
|
void updateZPos();
|
57 |
|
|
void updateCantPos();
|
58 |
|
|
void calcTotalMassMovingZMols();
|
59 |
tim |
1912 |
bool haveMovingZMols();
|
60 |
|
|
bool haveFixedZMols();
|
61 |
tim |
1911 |
double getZTargetPos(int index);
|
62 |
|
|
double getZFOfFixedZMols(Molecule* mol, StuntDouble* sd, double totalForce) ;
|
63 |
tim |
1912 |
double getZFOfMovingMols(Molecule* mol, double totalForce) ;
|
64 |
tim |
1911 |
double getHFOfFixedZMols(Molecule* mol, StuntDouble* sd, double totalForce);
|
65 |
tim |
1912 |
double getHFOfUnconsMols(Molecule* mol, double totalForce);
|
66 |
tim |
1911 |
|
67 |
|
|
std::list<ZconstraintMol> movingZMols_; /**< moving zconstraint molecules*/
|
68 |
|
|
std::list<ZconstraintMol> fixedZMols_; /**< fixed zconstraint molecules*/
|
69 |
|
|
std::vector<Molecule*> unzconsMols_; /**< free molecules*/
|
70 |
|
|
|
71 |
|
|
double zconsTime_;
|
72 |
|
|
std::string zconsOutput_;
|
73 |
|
|
double zconsTol_;
|
74 |
|
|
bool usingSMD_;
|
75 |
|
|
double zconsFixingTime_;
|
76 |
|
|
double zconsGap_;
|
77 |
|
|
bool usingZconsGap_;
|
78 |
|
|
double dt_;
|
79 |
|
|
|
80 |
|
|
const static int whichDirection = 2;
|
81 |
|
|
|
82 |
|
|
std::map<int, ZconstraintParam> allZMolIndices_;
|
83 |
|
|
|
84 |
|
|
Snapshot* currSnapshot_;
|
85 |
|
|
double currZconsTime_;
|
86 |
|
|
|
87 |
|
|
double totMassMovingZMols_;
|
88 |
|
|
double totMassUnconsMols_; /**< mass of unconstraint molecules in the whole system (never change) */
|
89 |
|
|
|
90 |
|
|
ZConsWriter* fzOut;
|
91 |
|
|
const static double infiniteTime = 1e31;
|
92 |
|
|
};
|
93 |
|
|
|
94 |
|
|
}
|
95 |
|
|
#endif
|