• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision49ce430526dbc569844bbb6c6f1c0d8a405d7a4d (tree)
l'heure2011-09-29 23:19:16
AuteurMikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Message de Log

Input-parse-module for MD is added.

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/MolDS/trunk@159 1136aad2-a195-0410-b898-f5ea1d11b9d8

Change Summary

Modification

--- a/src/base/InputParser.h
+++ b/src/base/InputParser.h
@@ -51,6 +51,11 @@ private:
5151 string messageCisNormTolerance;
5252 string messageCisMaxIterations;
5353 string messageCisMaxDimensions;
54+ string messageMdConditions;
55+ string messageMdTotalSteps;
56+ string messageMdElecState;
57+ string messageMdTimeWidth;
58+ string messageFs;
5459 string stringYES;
5560 string stringNO;
5661 string stringSpace;
@@ -99,11 +104,18 @@ private:
99104 string stringCISMaxIter;
100105 string stringCISMaxDimensions;
101106 string stringCISNormTolerance;
107+ string stringMD;
108+ string stringMDEnd;
109+ string stringMDTotalSteps;
110+ string stringMDElecState;
111+ string stringMDTimeWidth;
102112 void CalcMolecularBasics(Molecule* molecule);
103113 void CalcCisCondition(Molecule* molecule);
114+ void CheckMdConditions();
104115 void OutputMolecularBasics(Molecule* molecule);
105116 void OutputScfConditions();
106117 void OutputCisConditions();
118+ void OutputMdConditions();
107119 void OutputInputTerms(vector<string> inputTerms);
108120 bool IsCommentOut(string str);
109121 vector<string> GetInputTerms();
@@ -133,6 +145,11 @@ InputParser::InputParser(){
133145 this->messageCisNormTolerance = "\t\tNorm tolerance for the residual of the Davidson: ";
134146 this->messageCisMaxIterations = "\t\tMax iterations for the Davidson: ";
135147 this->messageCisMaxDimensions = "\t\tMax dimensions for the Davidson: ";
148+ this->messageMdConditions = "\tMD conditions:\n";
149+ this->messageMdTotalSteps = "\t\tTotal steps: ";
150+ this->messageMdElecState = "\t\tElectronic eigen state: ";
151+ this->messageMdTimeWidth = "\t\tTime width(dt): ";
152+ this->messageFs = "[fs]";
136153 this->stringYES = "yes";
137154 this->stringNO = "no";
138155 this->stringSpace = " ";
@@ -181,6 +198,11 @@ InputParser::InputParser(){
181198 this->stringCISMaxIter = "max_iter";
182199 this->stringCISMaxDimensions = "max_dim";
183200 this->stringCISNormTolerance = "norm_tol";
201+ this->stringMD = "md";
202+ this->stringMDEnd = "md_end";
203+ this->stringMDTotalSteps = "total_steps";
204+ this->stringMDElecState = "electronic_state";
205+ this->stringMDTimeWidth = "dt";
184206 }
185207
186208 InputParser::~InputParser(){
@@ -462,6 +484,34 @@ void InputParser::Parse(Molecule* molecule){
462484 i = j;
463485 }
464486
487+ // MD condition
488+ if(inputTerms[i].compare(this->stringMD) == 0){
489+ Parameters::GetInstance()->SetRequiresMD(true);
490+ int j=i+1;
491+ while(inputTerms[j].compare(this->stringMDEnd) != 0){
492+ // number of total steps
493+ if(inputTerms[j].compare(this->stringMDTotalSteps) == 0){
494+ int totalSteps = atoi(inputTerms[j+1].c_str());
495+ Parameters::GetInstance()->SetTotalStepsMD(totalSteps);
496+ j++;
497+ }
498+ // index of electronic eigen state on whichi MD runs.
499+ if(inputTerms[j].compare(this->stringMDElecState) == 0){
500+ int elecStateIndex = atoi(inputTerms[j+1].c_str());
501+ Parameters::GetInstance()->SetElectronicStateIndexMD(elecStateIndex);
502+ j++;
503+ }
504+ // time width for MD.
505+ if(inputTerms[j].compare(this->stringMDTimeWidth) == 0){
506+ double dt = atof(inputTerms[j+1].c_str()) * Parameters::GetInstance()->GetFs2AU();
507+ Parameters::GetInstance()->SetTimeWidthMD(dt);
508+ j++;
509+ }
510+ j++;
511+ }
512+ i = j;
513+ }
514+
465515 // theory
466516 if(inputTerms[i].compare(this->stringTheory) == 0){
467517 int j=i+1;
@@ -514,6 +564,7 @@ void InputParser::Parse(Molecule* molecule){
514564 if(Parameters::GetInstance()->GetCurrentTheory() == ZINDOS){
515565 this->CalcCisCondition(molecule);
516566 }
567+ this->CheckMdConditions();
517568
518569 // output conditions
519570 this->OutputMolecularBasics(molecule);
@@ -521,6 +572,9 @@ void InputParser::Parse(Molecule* molecule){
521572 if(Parameters::GetInstance()->GetCurrentTheory() == ZINDOS){
522573 this->OutputCisConditions();
523574 }
575+ if(Parameters::GetInstance()->RequiresMD()){
576+ this->OutputMdConditions();
577+ }
524578
525579 // output inputs
526580 this->OutputInputTerms(inputTerms);
@@ -570,6 +624,13 @@ void InputParser::CalcCisCondition(Molecule* molecule){
570624
571625 }
572626
627+void InputParser::CheckMdConditions(){
628+ if(Parameters::GetInstance()->GetCurrentTheory() == ZINDOS){
629+ int groundStateIndex = 0;
630+ Parameters::GetInstance()->SetElectronicStateIndexMD(groundStateIndex);
631+ }
632+}
633+
573634 void InputParser::OutputMolecularBasics(Molecule* molecule){
574635
575636 molecule->OutputTotalNumberAtomsAOsValenceelectrons();
@@ -612,6 +673,16 @@ void InputParser::OutputCisConditions(){
612673 cout << "\n";
613674 }
614675
676+void InputParser::OutputMdConditions(){
677+ cout << this->messageMdConditions;
678+
679+ printf("%s%d\n",this->messageMdElecState.c_str(),Parameters::GetInstance()->GetElectronicStateIndexMD());
680+ printf("%s%d\n",this->messageMdTotalSteps.c_str(),Parameters::GetInstance()->GetTotalStepsMD());
681+ printf("%s%lf%s\n",this->messageMdTimeWidth.c_str(),Parameters::GetInstance()->GetTimeWidthMD()/Parameters::GetInstance()->GetFs2AU(),this->messageFs.c_str());
682+
683+ cout << "\n";
684+}
685+
615686 void InputParser::OutputInputTerms(vector<string> inputTerms){
616687
617688 // output input terms
--- a/src/base/Parameters.h
+++ b/src/base/Parameters.h
@@ -34,6 +34,7 @@ public:
3434 double GetKayser2AU();
3535 double GetGMolin2AU();
3636 double GetDegree2Radian();
37+ double GetFs2AU();
3738 double GetBondingAdjustParameterK();
3839 TheoryType GetCurrentTheory();
3940 void SetCurrentTheory(TheoryType theory);
@@ -67,6 +68,14 @@ public:
6768 void SetMaxDimensionsCIS(int maxDimensionsCIS);
6869 double GetNormToleranceCIS();
6970 void SetNormToleranceCIS(double normToleranceCIS);
71+ bool RequiresMD();
72+ void SetRequiresMD(bool requiresMD);
73+ int GetElectronicStateIndexMD();
74+ void SetElectronicStateIndexMD(int electronicStateIndex);
75+ int GetTotalStepsMD();
76+ void SetTotalStepsMD(int totalSteps);
77+ double GetTimeWidthMD();
78+ void SetTimeWidthMD(double timeWidth);
7079 private:
7180 static Parameters* parameters;
7281 Parameters();
@@ -87,6 +96,7 @@ private:
8796 double kayser2AU;
8897 double gMolin2AU;
8998 double degree2Radian;
99+ double fs2AU;
90100 double bondingAdjustParameterK; //see (3.79) in J. A. Pople book
91101 TheoryType currentTheory;
92102 double translatingDifference[3];
@@ -104,6 +114,10 @@ private:
104114 double normToleranceCIS;
105115 bool requiresCIS;
106116 bool isDavidsonCIS;
117+ bool requiresMD;
118+ int electronicStateIndexMD;
119+ int totalStepsMD;
120+ double timeWidthMD;
107121 };
108122 Parameters* Parameters::parameters = NULL;
109123
@@ -141,6 +155,7 @@ void Parameters::SetDefaultValues(){
141155 this->eV2AU = 0.03674903;
142156 this->angstrom2AU = 1.0/0.5291772;
143157 this->kayser2AU = 4.556336*pow(10.0,-6.0);
158+ this->fs2AU = 1.0/(2.418884326505*pow(10.0,-2.0));
144159 this->thresholdSCF = pow(10.0, -8.0);
145160 this->maxIterationsSCF = 100;
146161 this->dampingThreshSCF = 1.0;
@@ -171,6 +186,9 @@ void Parameters::SetDefaultValues(){
171186 this->maxIterationsCIS = 100;
172187 this->maxDimensionsCIS = 100;
173188 this->normToleranceCIS = pow(10.0, -6.0);
189+ this->electronicStateIndexMD = 0;
190+ this->totalStepsMD = 10;
191+ this->timeWidthMD = 0.1*this->fs2AU;
174192 }
175193
176194 double Parameters::GetThresholdSCF(){
@@ -249,6 +267,10 @@ double Parameters::GetDegree2Radian(){
249267 return this->degree2Radian;
250268 }
251269
270+double Parameters::GetFs2AU(){
271+ return this->fs2AU;
272+}
273+
252274 double Parameters::GetBondingAdjustParameterK(){
253275 return this->bondingAdjustParameterK;
254276 }
@@ -402,6 +424,38 @@ void Parameters::SetNormToleranceCIS(double normToleranceCIS){
402424 this->normToleranceCIS = normToleranceCIS;
403425 }
404426
427+bool Parameters::RequiresMD(){
428+ return this->requiresMD;
429+}
430+
431+void Parameters::SetRequiresMD(bool requiresMD){
432+ this->requiresMD = requiresMD;
433+}
434+
435+int Parameters::GetElectronicStateIndexMD(){
436+ return this->electronicStateIndexMD;
437+}
438+
439+void Parameters::SetElectronicStateIndexMD(int electronicStateIndex){
440+ this->electronicStateIndexMD = electronicStateIndex;
441+}
442+
443+int Parameters::GetTotalStepsMD(){
444+ return this->totalStepsMD;
445+}
446+
447+void Parameters::SetTotalStepsMD(int totalSteps){
448+ this->totalStepsMD = totalSteps;
449+}
450+
451+double Parameters::GetTimeWidthMD(){
452+ return this->timeWidthMD;
453+}
454+
455+void Parameters::SetTimeWidthMD(double timeWidth){
456+ this->timeWidthMD = timeWidth;
457+}
458+
405459 }
406460 #endif
407461
--- a/src/input.in
+++ b/src/input.in
@@ -1,8 +1,8 @@
11 // example of the input file
22 THEORY
33 //cndo/2
4- //indo
5- zindo/s
4+ indo
5+ //zindo/s
66 //none
77 //principal_axes
88 //translate
@@ -19,18 +19,21 @@ SCF
1919 diis_end_error 0.00000002
2020 SCF_END
2121
22-CIS
23- davidson yes
24- active_occ 100
25- active_vir 100
26- nstates 11
27- max_iter 200
28- max_dim 100
29- norm_tol 0.000001
30-CIS_END
31-
32-
33-
22+//CIS
23+// davidson yes
24+// active_occ 100
25+// active_vir 100
26+// nstates 11
27+// max_iter 200
28+// max_dim 100
29+// norm_tol 0.000001
30+//CIS_END
31+
32+MD
33+// total_steps 20
34+// electronic_state 2
35+// dt 0.2
36+MD_END
3437
3538 //INERTIA
3639 // origin 1.0 2.0 30.0
@@ -50,7 +53,6 @@ CIS_END
5053 //difference 100.0 200.0 300.0
5154 //TRANSLATE_END
5255
53-
5456 // NH3
5557 //GEOMETRY
5658 // N 0.950135 0.471698 0.000000
@@ -92,7 +94,6 @@ CIS_END
9294 // H -0.422611 0.820144 0.000000
9395 //GEOMETRY_END
9496
95-
9697 // c2
9798 //GEOMETRY
9899 // C 0.168464 0.0 0.000000
@@ -188,8 +189,6 @@ GEOMETRY_END
188189 // Li 1.994960 0.485175 0.000000
189190 //GEOMETRY_END
190191
191-
192-
193192 // Li2
194193 //GEOMETRY
195194 // Li 0.0 0.0 1.230000
@@ -201,7 +200,6 @@ GEOMETRY_END
201200 // Li -1.570081 0.094340 0.0
202201 // Li -4.030081 0.094340 0.0
203202 //GEOMETRY_END
204-//
205203
206204 //GEOMETRY
207205 // C -3.402965 0.646900 0.000000
--- a/src/zindo/ZindoS.h
+++ b/src/zindo/ZindoS.h
@@ -22,7 +22,7 @@ public:
2222 ZindoS();
2323 ~ZindoS();
2424 void DoesCIS();
25- virtual void CalcForce(int electronicEigenIndex);
25+ virtual void CalcForce(int electronicStateIndex);
2626 protected:
2727 virtual void CalcGammaAB(double** gammaAB, Molecule* molecule);
2828 virtual void SetMessages();
@@ -1424,9 +1424,9 @@ void ZindoS::CalcCISMatrix(double** matrixCIS, int numberOcc, int numberVir){
14241424 cout << this->messageDoneCalcCISMatrix;
14251425 }
14261426
1427-// eigenIndex is index of the electroinc eigen state.
1428-// "eigenIndex = 0" means electronic ground state.
1429-void ZindoS::CalcForce(int electronicEigenIndex){
1427+// electronicStateIndex is index of the electroinc eigen state.
1428+// "electronicStateIndex = 0" means electronic ground state.
1429+void ZindoS::CalcForce(int electronicStateIndex){
14301430
14311431 // malloc or initialize Force matrix
14321432 if(this->matrixForce == NULL){