1 |
|
#ifndef _INTEGRATOR_H_ |
2 |
|
#define _INTEGRATOR_H_ |
3 |
|
|
4 |
+ |
#include <string> |
5 |
+ |
#include <vector> |
6 |
|
#include "Atom.hpp" |
7 |
|
#include "Molecule.hpp" |
8 |
|
#include "SRI.hpp" |
11 |
|
#include "ForceFields.hpp" |
12 |
|
#include "Thermo.hpp" |
13 |
|
#include "ReadWrite.hpp" |
14 |
+ |
#include "ZConsWriter.hpp" |
15 |
|
|
16 |
+ |
using namespace std; |
17 |
|
const double kB = 8.31451e-7;// boltzmann constant amu*Ang^2*fs^-2/K |
18 |
|
const double eConvert = 4.184e-4; // converts kcal/mol -> amu*A^2/fs^2 |
19 |
|
const double p_convert = 1.63882576e8; //converts amu*fs^-2*Ang^-1 -> atm |
38 |
|
virtual void constrainA( void ); |
39 |
|
virtual void constrainB( void ); |
40 |
|
virtual int readyCheck( void ) { return 1; } |
41 |
+ |
|
42 |
+ |
virtual void calcForce( int calcPot, int calcStress ); |
43 |
+ |
virtual void thermalize(); |
44 |
|
|
45 |
|
void checkConstraints( void ); |
46 |
|
void rotate( int axes1, int axes2, double angle, double j[3], |
47 |
|
double A[3][3] ); |
48 |
< |
|
42 |
< |
|
48 |
> |
|
49 |
|
ForceFields* myFF; |
50 |
|
|
51 |
|
SimInfo *info; // all the info we'll ever need |
297 |
|
short int have_target_pressure; |
298 |
|
|
299 |
|
}; |
300 |
+ |
|
301 |
+ |
template<typename T> class ZConstraint : public T { |
302 |
+ |
|
303 |
+ |
public: |
304 |
+ |
|
305 |
+ |
ZConstraint( SimInfo *theInfo, ForceFields* the_ff); |
306 |
+ |
~ZConstraint(); |
307 |
+ |
|
308 |
+ |
void setZConsTime(double time) {this->zconsTime = time;} |
309 |
+ |
void getZConsTime() {return zconsTime;} |
310 |
+ |
|
311 |
+ |
void setIndexOfAllZConsMols(vector<int> index) {indexOfAllZConsMols = index;} |
312 |
+ |
void getIndexOfAllZConsMols() {return indexOfAllZConsMols;} |
313 |
+ |
|
314 |
+ |
void setZConsOutput(const char * fileName) {zconsOutput = fileName;} |
315 |
+ |
string getZConsOutput() {return zconsOutput;} |
316 |
+ |
|
317 |
+ |
virtual void integrate(); |
318 |
+ |
|
319 |
|
|
320 |
+ |
#ifdef IS_MPI |
321 |
+ |
virtual void update(); //which is called to indicate the molecules' migration |
322 |
|
#endif |
323 |
+ |
|
324 |
+ |
protected: |
325 |
+ |
|
326 |
+ |
enum ZConsState {zcsMoving, zcsFixed}; |
327 |
+ |
|
328 |
+ |
|
329 |
+ |
|
330 |
+ |
virtual void calcForce( int calcPot, int calcStress ); |
331 |
+ |
virtual void thermalize(void); |
332 |
+ |
|
333 |
+ |
void zeroOutVel(); |
334 |
+ |
void doZconstraintForce(); |
335 |
+ |
void doHarmonic(); |
336 |
+ |
bool checkZConsState(); |
337 |
+ |
|
338 |
+ |
bool haveFixedZMols(); |
339 |
+ |
bool haveMovingZMols(); |
340 |
+ |
|
341 |
+ |
double calcZSys(); |
342 |
+ |
|
343 |
+ |
int isZConstraintMol(Molecule* mol); |
344 |
+ |
|
345 |
+ |
|
346 |
+ |
double zconsTime; |
347 |
+ |
double zconsTol; |
348 |
+ |
double zForceConst; |
349 |
+ |
|
350 |
+ |
vector<Molecule*> zconsMols; |
351 |
+ |
vector<double> massOfZConsMols; |
352 |
+ |
vector<double> kz; |
353 |
+ |
vector<ZConsState> states; |
354 |
+ |
vector<double> zPos; |
355 |
+ |
|
356 |
+ |
|
357 |
+ |
vector<Molecule*> unconsMols; |
358 |
+ |
vector<double> massOfUnconsMols; |
359 |
+ |
double totalMassOfUncons; |
360 |
+ |
|
361 |
+ |
vector<ZConsParaItem>* parameters; |
362 |
+ |
|
363 |
+ |
vector<int> indexOfAllZConsMols; //index of All Z-Constraint Molecuels |
364 |
+ |
|
365 |
+ |
int* indexOfZConsMols; //index of local Z-Constraint Molecules |
366 |
+ |
double* fz; |
367 |
+ |
|
368 |
+ |
int totNumOfUnconsAtoms; |
369 |
+ |
|
370 |
+ |
int whichDirection; //constraint direction |
371 |
+ |
|
372 |
+ |
private: |
373 |
+ |
|
374 |
+ |
string zconsOutput; |
375 |
+ |
ZConsWriter* fzOut; |
376 |
+ |
|
377 |
+ |
|
378 |
+ |
}; |
379 |
+ |
|
380 |
+ |
#endif |