Révision | f0be4549046b93203758692755f4d8615124fad3 (tree) |
---|---|
l'heure | 2013-06-20 11:15:14 |
Auteur | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
ZindoS::CalcCISProperties is parallelized by openMP and MPI. #31588
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/branches/mpi-cis@1369 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<stdexcept> |
24 | 24 | #include<boost/shared_ptr.hpp> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"base/Uncopyable.h" |
29 | 28 | #include"mpi/MpiProcess.h" |
30 | 29 | #include"base/PrintController.h" |
@@ -24,8 +24,7 @@ | ||
24 | 24 | #include<string> |
25 | 25 | #include<vector> |
26 | 26 | #include<boost/format.hpp> |
27 | -#include<boost/mpi/environment.hpp> | |
28 | -#include<boost/mpi/communicator.hpp> | |
27 | +#include<boost/mpi.hpp> | |
29 | 28 | #include"../base/Uncopyable.h" |
30 | 29 | #include"../mpi/MpiProcess.h" |
31 | 30 | #include"../base/PrintController.h" |
@@ -24,8 +24,7 @@ | ||
24 | 24 | #include<string> |
25 | 25 | #include<vector> |
26 | 26 | #include<boost/format.hpp> |
27 | -#include<boost/mpi/environment.hpp> | |
28 | -#include<boost/mpi/communicator.hpp> | |
27 | +#include<boost/mpi.hpp> | |
29 | 28 | #include"../base/Uncopyable.h" |
30 | 29 | #include"../mpi/MpiProcess.h" |
31 | 30 | #include"../base/PrintController.h" |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<vector> |
29 | 29 | #include<stdexcept> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"Uncopyable.h" |
34 | 33 | #include"../mpi/MpiProcess.h" |
35 | 34 | #include"PrintController.h" |
@@ -25,8 +25,7 @@ | ||
25 | 25 | #include<vector> |
26 | 26 | #include<stdexcept> |
27 | 27 | #include<boost/format.hpp> |
28 | -#include<boost/mpi/environment.hpp> | |
29 | -#include<boost/mpi/communicator.hpp> | |
28 | +#include<boost/mpi.hpp> | |
30 | 29 | #include"Uncopyable.h" |
31 | 30 | #include"../mpi/MpiProcess.h" |
32 | 31 | #include"PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<stdexcept> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include<boost/math/special_functions/factorials.hpp> |
29 | 28 | #include"Uncopyable.h" |
30 | 29 | #include"../mpi/MpiProcess.h" |
@@ -29,8 +29,7 @@ | ||
29 | 29 | #include<omp.h> |
30 | 30 | #include<boost/shared_ptr.hpp> |
31 | 31 | #include<boost/random.hpp> |
32 | -#include<boost/mpi/environment.hpp> | |
33 | -#include<boost/mpi/communicator.hpp> | |
32 | +#include<boost/mpi.hpp> | |
34 | 33 | #include"Uncopyable.h" |
35 | 34 | #include"../mpi/MpiProcess.h" |
36 | 35 | #include"PrintController.h" |
@@ -25,8 +25,7 @@ | ||
25 | 25 | #include<vector> |
26 | 26 | #include<stdexcept> |
27 | 27 | #include<boost/format.hpp> |
28 | -#include<boost/mpi/environment.hpp> | |
29 | -#include<boost/mpi/communicator.hpp> | |
28 | +#include<boost/mpi.hpp> | |
30 | 29 | #include"Uncopyable.h" |
31 | 30 | #include"../mpi/MpiProcess.h" |
32 | 31 | #include"PrintController.h" |
@@ -27,8 +27,7 @@ | ||
27 | 27 | #include<vector> |
28 | 28 | #include<stdexcept> |
29 | 29 | #include<boost/format.hpp> |
30 | -#include<boost/mpi/environment.hpp> | |
31 | -#include<boost/mpi/communicator.hpp> | |
30 | +#include<boost/mpi.hpp> | |
32 | 31 | #include"Uncopyable.h" |
33 | 32 | #include"../mpi/MpiProcess.h" |
34 | 33 | #include"PrintController.h" |
@@ -25,8 +25,7 @@ | ||
25 | 25 | #include<time.h> |
26 | 26 | #include<omp.h> |
27 | 27 | #include<boost/format.hpp> |
28 | -#include<boost/mpi/environment.hpp> | |
29 | -#include<boost/mpi/communicator.hpp> | |
28 | +#include<boost/mpi.hpp> | |
30 | 29 | #include"Uncopyable.h" |
31 | 30 | #include"../mpi/MpiProcess.h" |
32 | 31 | #include"PrintController.h" |
@@ -26,8 +26,7 @@ | ||
26 | 26 | #include<vector> |
27 | 27 | #include<stdexcept> |
28 | 28 | #include<boost/format.hpp> |
29 | -#include<boost/mpi/environment.hpp> | |
30 | -#include<boost/mpi/communicator.hpp> | |
29 | +#include<boost/mpi.hpp> | |
31 | 30 | #include"../Uncopyable.h" |
32 | 31 | #include"../../mpi/MpiProcess.h" |
33 | 32 | #include"../PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<vector> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../Uncopyable.h" |
29 | 28 | #include"../../mpi/MpiProcess.h" |
30 | 29 | #include"../PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<vector> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../Uncopyable.h" |
29 | 28 | #include"../../mpi/MpiProcess.h" |
30 | 29 | #include"../PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<vector> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../Uncopyable.h" |
29 | 28 | #include"../../mpi/MpiProcess.h" |
30 | 29 | #include"../PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<vector> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../Uncopyable.h" |
29 | 28 | #include"../../mpi/MpiProcess.h" |
30 | 29 | #include"../PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<vector> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../Uncopyable.h" |
29 | 28 | #include"../../mpi/MpiProcess.h" |
30 | 29 | #include"../PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<vector> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../Uncopyable.h" |
29 | 28 | #include"../../mpi/MpiProcess.h" |
30 | 29 | #include"../PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<vector> |
24 | 24 | #include<stdexcept> |
25 | 25 | #include<boost/format.hpp> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../Uncopyable.h" |
29 | 28 | #include"../../mpi/MpiProcess.h" |
30 | 29 | #include"../PrintController.h" |
@@ -24,8 +24,7 @@ | ||
24 | 24 | #include<vector> |
25 | 25 | #include<stdexcept> |
26 | 26 | #include<boost/format.hpp> |
27 | -#include<boost/mpi/environment.hpp> | |
28 | -#include<boost/mpi/communicator.hpp> | |
27 | +#include<boost/mpi.hpp> | |
29 | 28 | #include"../Uncopyable.h" |
30 | 29 | #include"../../mpi/MpiProcess.h" |
31 | 30 | #include"../PrintController.h" |
@@ -25,8 +25,7 @@ | ||
25 | 25 | #include<stdexcept> |
26 | 26 | #include<boost/shared_ptr.hpp> |
27 | 27 | #include<boost/format.hpp> |
28 | -#include<boost/mpi/environment.hpp> | |
29 | -#include<boost/mpi/communicator.hpp> | |
28 | +#include<boost/mpi.hpp> | |
30 | 29 | #include"../Uncopyable.h" |
31 | 30 | #include"../../mpi/MpiProcess.h" |
32 | 31 | #include"../PrintController.h" |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<stdexcept> |
29 | 29 | #include<omp.h> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"../Uncopyable.h" |
34 | 33 | #include"../../mpi/MpiProcess.h" |
35 | 34 | #include"../PrintController.h" |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<stdexcept> |
29 | 29 | #include<omp.h> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"../Uncopyable.h" |
34 | 33 | #include"../../mpi/MpiProcess.h" |
35 | 34 | #include"../PrintController.h" |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<stdexcept> |
29 | 29 | #include<omp.h> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"../Uncopyable.h" |
34 | 33 | #include"../../mpi/MpiProcess.h" |
35 | 34 | #include"../PrintController.h" |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<stdexcept> |
29 | 29 | #include<omp.h> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"../Uncopyable.h" |
34 | 33 | #include"../../mpi/MpiProcess.h" |
35 | 34 | #include"../PrintController.h" |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<stdexcept> |
29 | 29 | #include<omp.h> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"../base/Uncopyable.h" |
34 | 33 | #include"../mpi/MpiProcess.h" |
35 | 34 | #include"../base/PrintController.h" |
@@ -25,8 +25,7 @@ | ||
25 | 25 | #include<vector> |
26 | 26 | #include<stdexcept> |
27 | 27 | #include<boost/format.hpp> |
28 | -#include<boost/mpi/environment.hpp> | |
29 | -#include<boost/mpi/communicator.hpp> | |
28 | +#include<boost/mpi.hpp> | |
30 | 29 | #include"../base/Uncopyable.h" |
31 | 30 | #include"../mpi/MpiProcess.h" |
32 | 31 | #include"../base/PrintController.h" |
@@ -27,8 +27,7 @@ | ||
27 | 27 | #include<boost/shared_ptr.hpp> |
28 | 28 | #include<boost/random.hpp> |
29 | 29 | #include<boost/format.hpp> |
30 | -#include<boost/mpi/environment.hpp> | |
31 | -#include<boost/mpi/communicator.hpp> | |
30 | +#include<boost/mpi.hpp> | |
32 | 31 | #include"../base/Uncopyable.h" |
33 | 32 | #include"../mpi/MpiProcess.h" |
34 | 33 | #include"../base/PrintController.h" |
@@ -26,8 +26,7 @@ | ||
26 | 26 | #include<stdexcept> |
27 | 27 | #include<boost/shared_ptr.hpp> |
28 | 28 | #include<boost/format.hpp> |
29 | -#include<boost/mpi/environment.hpp> | |
30 | -#include<boost/mpi/communicator.hpp> | |
29 | +#include<boost/mpi.hpp> | |
31 | 30 | #include"../base/Uncopyable.h" |
32 | 31 | #include"../mpi/MpiProcess.h" |
33 | 32 | #include"../base/PrintController.h" |
@@ -26,8 +26,7 @@ | ||
26 | 26 | #include<stdexcept> |
27 | 27 | #include<omp.h> |
28 | 28 | #include<boost/format.hpp> |
29 | -#include<boost/mpi/environment.hpp> | |
30 | -#include<boost/mpi/communicator.hpp> | |
29 | +#include<boost/mpi.hpp> | |
31 | 30 | #include"../base/Uncopyable.h" |
32 | 31 | #include"../mpi/MpiProcess.h" |
33 | 32 | #include"../base/PrintController.h" |
@@ -23,8 +23,7 @@ | ||
23 | 23 | #include<math.h> |
24 | 24 | #include<string> |
25 | 25 | #include<stdexcept> |
26 | -#include<boost/mpi/environment.hpp> | |
27 | -#include<boost/mpi/communicator.hpp> | |
26 | +#include<boost/mpi.hpp> | |
28 | 27 | #include"../base/MolDSException.h" |
29 | 28 | #include"../base/Uncopyable.h" |
30 | 29 | #include"MpiProcess.h" |
@@ -27,8 +27,7 @@ | ||
27 | 27 | #include<boost/shared_ptr.hpp> |
28 | 28 | #include<boost/random.hpp> |
29 | 29 | #include<boost/format.hpp> |
30 | -#include<boost/mpi/environment.hpp> | |
31 | -#include<boost/mpi/communicator.hpp> | |
30 | +#include<boost/mpi.hpp> | |
32 | 31 | #include"../base/Uncopyable.h" |
33 | 32 | #include"../mpi/MpiProcess.h" |
34 | 33 | #include"../base/PrintController.h" |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<stdexcept> |
29 | 29 | #include<boost/shared_ptr.hpp> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"../base/Uncopyable.h" |
34 | 33 | #include"../mpi/MpiProcess.h" |
35 | 34 | #include"../base/PrintController.h" |
@@ -27,8 +27,7 @@ | ||
27 | 27 | #include<stdexcept> |
28 | 28 | #include<boost/shared_ptr.hpp> |
29 | 29 | #include<boost/format.hpp> |
30 | -#include<boost/mpi/environment.hpp> | |
31 | -#include<boost/mpi/communicator.hpp> | |
30 | +#include<boost/mpi.hpp> | |
32 | 31 | #include"../base/Uncopyable.h" |
33 | 32 | #include"../mpi/MpiProcess.h" |
34 | 33 | #include"../base/PrintController.h" |
@@ -27,8 +27,7 @@ | ||
27 | 27 | #include<stdexcept> |
28 | 28 | #include<boost/shared_ptr.hpp> |
29 | 29 | #include<boost/format.hpp> |
30 | -#include<boost/mpi/environment.hpp> | |
31 | -#include<boost/mpi/communicator.hpp> | |
30 | +#include<boost/mpi.hpp> | |
32 | 31 | #include"../base/Uncopyable.h" |
33 | 32 | #include"../mpi/MpiProcess.h" |
34 | 33 | #include"../base/PrintController.h" |
@@ -27,8 +27,7 @@ | ||
27 | 27 | #include<stdexcept> |
28 | 28 | #include<boost/shared_ptr.hpp> |
29 | 29 | #include<boost/format.hpp> |
30 | -#include<boost/mpi/environment.hpp> | |
31 | -#include<boost/mpi/communicator.hpp> | |
30 | +#include<boost/mpi.hpp> | |
32 | 31 | #include"../base/Uncopyable.h" |
33 | 32 | #include"../mpi/MpiProcess.h" |
34 | 33 | #include"../base/PrintController.h" |
@@ -24,8 +24,7 @@ | ||
24 | 24 | #include<string> |
25 | 25 | #include<vector> |
26 | 26 | #include<boost/format.hpp> |
27 | -#include<boost/mpi/environment.hpp> | |
28 | -#include<boost/mpi/communicator.hpp> | |
27 | +#include<boost/mpi.hpp> | |
29 | 28 | #include"../base/Uncopyable.h" |
30 | 29 | #include"../mpi/MpiProcess.h" |
31 | 30 | #include"../base/PrintController.h" |
@@ -24,8 +24,7 @@ | ||
24 | 24 | #include<string> |
25 | 25 | #include<vector> |
26 | 26 | #include<boost/format.hpp> |
27 | -#include<boost/mpi/environment.hpp> | |
28 | -#include<boost/mpi/communicator.hpp> | |
27 | +#include<boost/mpi.hpp> | |
29 | 28 | #include"../base/Uncopyable.h" |
30 | 29 | #include"../mpi/MpiProcess.h" |
31 | 30 | #include"../base/PrintController.h" |
@@ -24,8 +24,7 @@ | ||
24 | 24 | #include<string> |
25 | 25 | #include<vector> |
26 | 26 | #include<boost/format.hpp> |
27 | -#include<boost/mpi/environment.hpp> | |
28 | -#include<boost/mpi/communicator.hpp> | |
27 | +#include<boost/mpi.hpp> | |
29 | 28 | #include"../base/Uncopyable.h" |
30 | 29 | #include"../mpi/MpiProcess.h" |
31 | 30 | #include"../base/PrintController.h" |
@@ -27,8 +27,7 @@ | ||
27 | 27 | #include<boost/shared_ptr.hpp> |
28 | 28 | #include<boost/random.hpp> |
29 | 29 | #include<boost/format.hpp> |
30 | -#include<boost/mpi/environment.hpp> | |
31 | -#include<boost/mpi/communicator.hpp> | |
30 | +#include<boost/mpi.hpp> | |
32 | 31 | #include"../base/Uncopyable.h" |
33 | 32 | #include"../mpi/MpiProcess.h" |
34 | 33 | #include"../base/PrintController.h" |
@@ -25,8 +25,7 @@ | ||
25 | 25 | #include<string> |
26 | 26 | #include<stdexcept> |
27 | 27 | #include<boost/format.hpp> |
28 | -#include<boost/mpi/environment.hpp> | |
29 | -#include<boost/mpi/communicator.hpp> | |
28 | +#include<boost/mpi.hpp> | |
30 | 29 | #ifdef __INTEL_COMPILER |
31 | 30 | #include"mkl.h" |
32 | 31 | #else |
@@ -24,8 +24,7 @@ | ||
24 | 24 | #include<string> |
25 | 25 | #include<stdexcept> |
26 | 26 | #include<boost/format.hpp> |
27 | -#include<boost/mpi/environment.hpp> | |
28 | -#include<boost/mpi/communicator.hpp> | |
27 | +#include<boost/mpi.hpp> | |
29 | 28 | #ifdef __INTEL_COMPILER |
30 | 29 | #include"mkl.h" |
31 | 30 | #else |
@@ -28,8 +28,7 @@ | ||
28 | 28 | #include<algorithm> |
29 | 29 | #include<omp.h> |
30 | 30 | #include<boost/format.hpp> |
31 | -#include<boost/mpi/environment.hpp> | |
32 | -#include<boost/mpi/communicator.hpp> | |
31 | +#include<boost/mpi.hpp> | |
33 | 32 | #include"../base/Uncopyable.h" |
34 | 33 | #include"../mpi/MpiProcess.h" |
35 | 34 | #include"../base/PrintController.h" |
@@ -1087,131 +1086,184 @@ void ZindoS::DoCIS(){ | ||
1087 | 1086 | void ZindoS::CalcCISProperties(){ |
1088 | 1087 | //calculate dipole moments and transitiondipolemoment |
1089 | 1088 | { |
1090 | - double*** dipoleMOs = NULL; | |
1091 | - double** overlapMOs = NULL; | |
1092 | 1089 | int totalNumberAOs = this->molecule->GetTotalNumberAOs(); |
1093 | 1090 | int numberOcc = this->molecule->GetTotalNumberValenceElectrons()/2; |
1094 | 1091 | int numberActiveOcc = Parameters::GetInstance()->GetActiveOccCIS(); |
1095 | 1092 | int numberActiveVir = Parameters::GetInstance()->GetActiveVirCIS(); |
1096 | - MallocerFreer::GetInstance()->Malloc<double>(&dipoleMOs, CartesianType_end, totalNumberAOs, totalNumberAOs); | |
1097 | - MallocerFreer::GetInstance()->Malloc<double>(&overlapMOs, totalNumberAOs, totalNumberAOs); | |
1098 | - double alpha=1.0; | |
1099 | - double beta =0.0; | |
1100 | - //double ompStartTime = omp_get_wtime(); | |
1101 | - MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1102 | - alpha, | |
1103 | - this->fockMatrix, | |
1104 | - this->cartesianMatrix[XAxis], | |
1105 | - this->fockMatrix, | |
1106 | - beta, | |
1107 | - dipoleMOs[XAxis]); | |
1108 | - MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1109 | - alpha, | |
1110 | - this->fockMatrix, | |
1111 | - this->cartesianMatrix[YAxis], | |
1112 | - this->fockMatrix, | |
1113 | - beta, | |
1114 | - dipoleMOs[YAxis]); | |
1115 | - MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1116 | - alpha, | |
1117 | - this->fockMatrix, | |
1118 | - this->cartesianMatrix[ZAxis], | |
1119 | - this->fockMatrix, | |
1120 | - beta, | |
1121 | - dipoleMOs[ZAxis]); | |
1122 | - | |
1123 | - double const* centerOfDipole = this->molecule->GetXyzCOC(); | |
1124 | - // set orign of dipole | |
1125 | - MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1126 | - alpha, | |
1127 | - this->fockMatrix, | |
1128 | - this->overlapAOs, | |
1129 | - this->fockMatrix, | |
1130 | - beta, | |
1131 | - overlapMOs); | |
1132 | - MolDS_wrappers::Blas::GetInstance()->Daxpy(totalNumberAOs*totalNumberAOs, | |
1133 | - -centerOfDipole[XAxis], | |
1134 | - &overlapMOs[0][0], | |
1135 | - &dipoleMOs[XAxis][0][0]); | |
1136 | - MolDS_wrappers::Blas::GetInstance()->Daxpy(totalNumberAOs*totalNumberAOs, | |
1137 | - -centerOfDipole[YAxis], | |
1138 | - &overlapMOs[0][0], | |
1139 | - &dipoleMOs[YAxis][0][0]); | |
1140 | - MolDS_wrappers::Blas::GetInstance()->Daxpy(totalNumberAOs*totalNumberAOs, | |
1141 | - -centerOfDipole[ZAxis], | |
1142 | - &overlapMOs[0][0], | |
1143 | - &dipoleMOs[ZAxis][0][0]); | |
1144 | - | |
1145 | - | |
1146 | - // dipole moments of excited states | |
1147 | - //this->CalcElectronicDipoleMomentsExcitedStates(this->electronicTransitionDipoleMoments, | |
1148 | - // this->fockMatrix, | |
1149 | - // this->matrixCIS, | |
1150 | - // this->cartesianMatrix, | |
1151 | - // *this->molecule, | |
1152 | - // this->orbitalElectronPopulation, | |
1153 | - // this->overlapAOs); | |
1154 | - int groundState = 0; | |
1155 | - for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); k++){ | |
1156 | - int excitedState = k+1; // (k+1)-th excited state | |
1157 | - this->electronicTransitionDipoleMoments[excitedState][excitedState][XAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][XAxis]; | |
1158 | - this->electronicTransitionDipoleMoments[excitedState][excitedState][YAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][YAxis]; | |
1159 | - this->electronicTransitionDipoleMoments[excitedState][excitedState][ZAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][ZAxis]; | |
1160 | - for(int l=0; l<this->matrixCISdimension; l++){ | |
1161 | - // single excitation from I-th (occupied)MO to A-th (virtual)MO | |
1162 | - int moI = this->GetActiveOccIndex(*this->molecule, l); | |
1163 | - int moA = this->GetActiveVirIndex(*this->molecule, l); | |
1164 | - double temp = matrixCIS[k][l]*matrixCIS[k][l]; | |
1165 | - this->electronicTransitionDipoleMoments[excitedState][excitedState][XAxis] += temp*(-dipoleMOs[XAxis][moI][moI]+dipoleMOs[XAxis][moA][moA]); | |
1166 | - this->electronicTransitionDipoleMoments[excitedState][excitedState][YAxis] += temp*(-dipoleMOs[YAxis][moI][moI]+dipoleMOs[YAxis][moA][moA]); | |
1167 | - this->electronicTransitionDipoleMoments[excitedState][excitedState][ZAxis] += temp*(-dipoleMOs[ZAxis][moI][moI]+dipoleMOs[ZAxis][moA][moA]); | |
1168 | - } | |
1169 | - } | |
1170 | - | |
1171 | - // transition dipole moment | |
1172 | - //this->CalcElectronicTransitionDipoleMoments(this->electronicTransitionDipoleMoments, | |
1173 | - // this->fockMatrix, | |
1174 | - // this->matrixCIS, | |
1175 | - // this->cartesianMatrix, | |
1176 | - // *this->molecule, | |
1177 | - // this->orbitalElectronPopulation, | |
1178 | - // this->overlapAOs); | |
1179 | - for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); k++){ | |
1180 | - int excitedState = k+1; // (k+1)-th excited state | |
1181 | - this->electronicTransitionDipoleMoments[excitedState][groundState][XAxis] = 0.0; | |
1182 | - this->electronicTransitionDipoleMoments[excitedState][groundState][YAxis] = 0.0; | |
1183 | - this->electronicTransitionDipoleMoments[excitedState][groundState][ZAxis] = 0.0; | |
1184 | - for(int l=0; l<this->matrixCISdimension; l++){ | |
1185 | - // single excitation from I-th (occupied)MO to A-th (virtual)MO | |
1186 | - int moI = this->GetActiveOccIndex(*this->molecule, l); | |
1187 | - int moA = this->GetActiveVirIndex(*this->molecule, l); | |
1188 | - //double temp = matrixCIS[k][l]*matrixCIS[k][l]; | |
1189 | - double temp = this->matrixCIS[k][l]*sqrt(2.0); | |
1190 | - this->electronicTransitionDipoleMoments[excitedState][groundState][XAxis] += temp*dipoleMOs[XAxis][moA][moI]; | |
1191 | - this->electronicTransitionDipoleMoments[excitedState][groundState][YAxis] += temp*dipoleMOs[YAxis][moA][moI]; | |
1192 | - this->electronicTransitionDipoleMoments[excitedState][groundState][ZAxis] += temp*dipoleMOs[ZAxis][moA][moI]; | |
1193 | - } | |
1194 | - } | |
1195 | - if(Parameters::GetInstance()->RequiresAllTransitionDipoleMomentsCIS()){ | |
1093 | + boost::mpi::communicator* world = MolDS_mpi::MpiProcess::GetInstance()->GetCommunicator(); | |
1094 | + double*** dipoleMOs = NULL; | |
1095 | + double** overlapMOs = NULL; | |
1096 | + try{ | |
1097 | + MallocerFreer::GetInstance()->Malloc<double>(&dipoleMOs, CartesianType_end, totalNumberAOs, totalNumberAOs); | |
1098 | + MallocerFreer::GetInstance()->Malloc<double>(&overlapMOs, totalNumberAOs, totalNumberAOs); | |
1099 | + double alpha=1.0; | |
1100 | + double beta =0.0; | |
1101 | + //double ompStartTime = omp_get_wtime(); | |
1102 | + MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1103 | + alpha, | |
1104 | + this->fockMatrix, | |
1105 | + this->cartesianMatrix[XAxis], | |
1106 | + this->fockMatrix, | |
1107 | + beta, | |
1108 | + dipoleMOs[XAxis]); | |
1109 | + MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1110 | + alpha, | |
1111 | + this->fockMatrix, | |
1112 | + this->cartesianMatrix[YAxis], | |
1113 | + this->fockMatrix, | |
1114 | + beta, | |
1115 | + dipoleMOs[YAxis]); | |
1116 | + MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1117 | + alpha, | |
1118 | + this->fockMatrix, | |
1119 | + this->cartesianMatrix[ZAxis], | |
1120 | + this->fockMatrix, | |
1121 | + beta, | |
1122 | + dipoleMOs[ZAxis]); | |
1123 | + | |
1124 | + double const* centerOfDipole = this->molecule->GetXyzCOC(); | |
1125 | + // set orign of dipole | |
1126 | + MolDS_wrappers::Blas::GetInstance()->Dgemmm(false, false, true, totalNumberAOs, totalNumberAOs, totalNumberAOs, totalNumberAOs, | |
1127 | + alpha, | |
1128 | + this->fockMatrix, | |
1129 | + this->overlapAOs, | |
1130 | + this->fockMatrix, | |
1131 | + beta, | |
1132 | + overlapMOs); | |
1133 | + MolDS_wrappers::Blas::GetInstance()->Daxpy(totalNumberAOs*totalNumberAOs, | |
1134 | + -centerOfDipole[XAxis], | |
1135 | + &overlapMOs[0][0], | |
1136 | + &dipoleMOs[XAxis][0][0]); | |
1137 | + MolDS_wrappers::Blas::GetInstance()->Daxpy(totalNumberAOs*totalNumberAOs, | |
1138 | + -centerOfDipole[YAxis], | |
1139 | + &overlapMOs[0][0], | |
1140 | + &dipoleMOs[YAxis][0][0]); | |
1141 | + MolDS_wrappers::Blas::GetInstance()->Daxpy(totalNumberAOs*totalNumberAOs, | |
1142 | + -centerOfDipole[ZAxis], | |
1143 | + &overlapMOs[0][0], | |
1144 | + &dipoleMOs[ZAxis][0][0]); | |
1145 | + | |
1146 | + | |
1147 | + // dipole moments of excited states | |
1148 | + //this->CalcElectronicDipoleMomentsExcitedStates(this->electronicTransitionDipoleMoments, | |
1149 | + // this->fockMatrix, | |
1150 | + // this->matrixCIS, | |
1151 | + // this->cartesianMatrix, | |
1152 | + // *this->molecule, | |
1153 | + // this->orbitalElectronPopulation, | |
1154 | + // this->overlapAOs); | |
1155 | + int groundState = 0; | |
1196 | 1156 | for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); k++){ |
1197 | - int departureExcitedState = k+1; // (k+1)-th excited state | |
1198 | - for(int l=k+1; l<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); l++){ | |
1199 | - int destinationExcitedState = l+1; // (l+1)-th excited state | |
1200 | - this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][XAxis] = 0.0; | |
1201 | - this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][YAxis] = 0.0; | |
1202 | - this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][ZAxis] = 0.0; | |
1203 | - for(int l=0; l<this->matrixCISdimension; l++){ | |
1204 | - // single excitation from I-th (occupied)MO to A-th (virtual)MO | |
1205 | - int moI = this->GetActiveOccIndex(*this->molecule, l); | |
1206 | - int moA = this->GetActiveVirIndex(*this->molecule, l); | |
1207 | - double temp = matrixCIS[departureExcitedState-1][l]*matrixCIS[destinationExcitedState-1][l]; | |
1208 | - this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][XAxis] += temp*(-dipoleMOs[XAxis][moI][moI]+dipoleMOs[XAxis][moA][moA]); | |
1209 | - this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][YAxis] += temp*(-dipoleMOs[YAxis][moI][moI]+dipoleMOs[YAxis][moA][moA]); | |
1210 | - this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][ZAxis] += temp*(-dipoleMOs[ZAxis][moI][moI]+dipoleMOs[ZAxis][moA][moA]); | |
1157 | + int excitedState = k+1; // (k+1)-th excited state | |
1158 | + if(excitedState%world->size() != world->rank()){continue;} | |
1159 | + this->electronicTransitionDipoleMoments[excitedState][excitedState][XAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][XAxis]; | |
1160 | + this->electronicTransitionDipoleMoments[excitedState][excitedState][YAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][YAxis]; | |
1161 | + this->electronicTransitionDipoleMoments[excitedState][excitedState][ZAxis] = this->electronicTransitionDipoleMoments[groundState][groundState][ZAxis]; | |
1162 | + double tmpX=0.0, tmpY=0.0, tmpZ=0.0; | |
1163 | +#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(auto) | |
1164 | + for(int l=0; l<this->matrixCISdimension; l++){ | |
1165 | + // single excitation from I-th (occupied)MO to A-th (virtual)MO | |
1166 | + int moI = this->GetActiveOccIndex(*this->molecule, l); | |
1167 | + int moA = this->GetActiveVirIndex(*this->molecule, l); | |
1168 | + double temp = matrixCIS[k][l]*matrixCIS[k][l]; | |
1169 | + tmpX += temp*(-dipoleMOs[XAxis][moI][moI]+dipoleMOs[XAxis][moA][moA]); | |
1170 | + tmpY += temp*(-dipoleMOs[YAxis][moI][moI]+dipoleMOs[YAxis][moA][moA]); | |
1171 | + tmpZ += temp*(-dipoleMOs[ZAxis][moI][moI]+dipoleMOs[ZAxis][moA][moA]); | |
1172 | + } | |
1173 | + this->electronicTransitionDipoleMoments[excitedState][excitedState][XAxis] += tmpX; | |
1174 | + this->electronicTransitionDipoleMoments[excitedState][excitedState][YAxis] += tmpY; | |
1175 | + this->electronicTransitionDipoleMoments[excitedState][excitedState][ZAxis] += tmpZ; | |
1176 | + | |
1177 | + } | |
1178 | + | |
1179 | + // transition dipole moment | |
1180 | + //this->CalcElectronicTransitionDipoleMoments(this->electronicTransitionDipoleMoments, | |
1181 | + // this->fockMatrix, | |
1182 | + // this->matrixCIS, | |
1183 | + // this->cartesianMatrix, | |
1184 | + // *this->molecule, | |
1185 | + // this->orbitalElectronPopulation, | |
1186 | + // this->overlapAOs); | |
1187 | + for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); k++){ | |
1188 | + int excitedState = k+1; // (k+1)-th excited state | |
1189 | + if(excitedState%world->size() != world->rank()){continue;} | |
1190 | + this->electronicTransitionDipoleMoments[excitedState][groundState][XAxis] = 0.0; | |
1191 | + this->electronicTransitionDipoleMoments[excitedState][groundState][YAxis] = 0.0; | |
1192 | + this->electronicTransitionDipoleMoments[excitedState][groundState][ZAxis] = 0.0; | |
1193 | + double tmpX=0.0, tmpY=0.0, tmpZ=0.0; | |
1194 | +#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(auto) | |
1195 | + for(int l=0; l<this->matrixCISdimension; l++){ | |
1196 | + // single excitation from I-th (occupied)MO to A-th (virtual)MO | |
1197 | + int moI = this->GetActiveOccIndex(*this->molecule, l); | |
1198 | + int moA = this->GetActiveVirIndex(*this->molecule, l); | |
1199 | + //double temp = matrixCIS[k][l]*matrixCIS[k][l]; | |
1200 | + double tmp = this->matrixCIS[k][l]*sqrt(2.0); | |
1201 | + tmpX += tmp*dipoleMOs[XAxis][moA][moI]; | |
1202 | + tmpY += tmp*dipoleMOs[YAxis][moA][moI]; | |
1203 | + tmpZ += tmp*dipoleMOs[ZAxis][moA][moI]; | |
1204 | + } | |
1205 | + this->electronicTransitionDipoleMoments[excitedState][groundState][XAxis] += tmpX; | |
1206 | + this->electronicTransitionDipoleMoments[excitedState][groundState][YAxis] += tmpY; | |
1207 | + this->electronicTransitionDipoleMoments[excitedState][groundState][ZAxis] += tmpZ; | |
1208 | + } | |
1209 | + if(Parameters::GetInstance()->RequiresAllTransitionDipoleMomentsCIS()){ | |
1210 | + for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); k++){ | |
1211 | + int departureExcitedState = k+1; // (k+1)-th excited state | |
1212 | + for(int l=k+1; l<Parameters::GetInstance()->GetNumberExcitedStatesCIS(); l++){ | |
1213 | + int destinationExcitedState = l+1; // (l+1)-th excited state | |
1214 | + if(destinationExcitedState%world->size() != world->rank()){continue;} | |
1215 | + this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][XAxis] = 0.0; | |
1216 | + this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][YAxis] = 0.0; | |
1217 | + this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][ZAxis] = 0.0; | |
1218 | + double tmpX=0.0, tmpY=0.0, tmpZ=0.0; | |
1219 | +#pragma omp parallel for reduction(+:tmpX,tmpY,tmpZ) schedule(auto) | |
1220 | + for(int l=0; l<this->matrixCISdimension; l++){ | |
1221 | + // single excitation from I-th (occupied)MO to A-th (virtual)MO | |
1222 | + int moI = this->GetActiveOccIndex(*this->molecule, l); | |
1223 | + int moA = this->GetActiveVirIndex(*this->molecule, l); | |
1224 | + double tmp = matrixCIS[departureExcitedState-1][l]*matrixCIS[destinationExcitedState-1][l]; | |
1225 | + tmpX += tmp*(-dipoleMOs[XAxis][moI][moI]+dipoleMOs[XAxis][moA][moA]); | |
1226 | + tmpY += tmp*(-dipoleMOs[YAxis][moI][moI]+dipoleMOs[YAxis][moA][moA]); | |
1227 | + tmpZ += tmp*(-dipoleMOs[ZAxis][moI][moI]+dipoleMOs[ZAxis][moA][moA]); | |
1228 | + } | |
1229 | + this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][XAxis] += tmpX; | |
1230 | + this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][YAxis] += tmpY; | |
1231 | + this->electronicTransitionDipoleMoments[destinationExcitedState][departureExcitedState][ZAxis] += tmpZ; | |
1211 | 1232 | } |
1212 | 1233 | } |
1213 | 1234 | } |
1235 | + } | |
1236 | + catch(MolDSException ex){ | |
1237 | + MallocerFreer::GetInstance()->Free<double>(&dipoleMOs, CartesianType_end, totalNumberAOs, totalNumberAOs); | |
1238 | + MallocerFreer::GetInstance()->Free<double>(&overlapMOs, totalNumberAOs, totalNumberAOs); | |
1239 | + throw ex; | |
1240 | + } | |
1241 | + MallocerFreer::GetInstance()->Free<double>(&dipoleMOs, CartesianType_end, totalNumberAOs, totalNumberAOs); | |
1242 | + MallocerFreer::GetInstance()->Free<double>(&overlapMOs, totalNumberAOs, totalNumberAOs); | |
1243 | + | |
1244 | + // communication to collect all matrix data on rank 0 | |
1245 | + int numTransported = (Parameters::GetInstance()->GetNumberExcitedStatesCIS()+1)*CartesianType_end; | |
1246 | + if(world->rank() == 0){ | |
1247 | + // receive the matrix data from other ranks | |
1248 | + for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS()+1; k++){ | |
1249 | + if(k%world->size() == 0){continue;} | |
1250 | + int source = k%world->size(); | |
1251 | + int tag = k; | |
1252 | + world->recv(source, tag, &this->electronicTransitionDipoleMoments[k][0][0], numTransported); | |
1253 | + } | |
1254 | + } | |
1255 | + else{ | |
1256 | + // send the matrix data to rank-0 | |
1257 | + for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS()+1; k++){ | |
1258 | + if(k%world->size() != world->rank()){continue;} | |
1259 | + int dest = 0; | |
1260 | + int tag = k; | |
1261 | + world->send(dest, tag, &this->electronicTransitionDipoleMoments[k][0][0], numTransported); | |
1262 | + } | |
1263 | + } | |
1214 | 1264 | |
1265 | + // right upper part of the matrix is copied from left lower part. | |
1266 | + if(world->rank() == 0 && Parameters::GetInstance()->RequiresAllTransitionDipoleMomentsCIS()){ | |
1215 | 1267 | for(int k=0; k<Parameters::GetInstance()->GetNumberExcitedStatesCIS()+1; k++){ |
1216 | 1268 | for(int l=k+1; l<Parameters::GetInstance()->GetNumberExcitedStatesCIS()+1; l++){ |
1217 | 1269 | for(int axis=0; axis<CartesianType_end; axis++){ |
@@ -1221,8 +1273,13 @@ void ZindoS::CalcCISProperties(){ | ||
1221 | 1273 | } |
1222 | 1274 | } |
1223 | 1275 | } |
1224 | - MallocerFreer::GetInstance()->Free<double>(&dipoleMOs, CartesianType_end, totalNumberAOs, totalNumberAOs); | |
1225 | - MallocerFreer::GetInstance()->Free<double>(&overlapMOs, totalNumberAOs, totalNumberAOs); | |
1276 | + | |
1277 | + // broadcast all matrix data to all ranks | |
1278 | + numTransported *= (Parameters::GetInstance()->GetNumberExcitedStatesCIS()+1); | |
1279 | + int source=0; | |
1280 | + broadcast(*world, &this->electronicTransitionDipoleMoments[0][0][0], numTransported, source); | |
1281 | + | |
1282 | + | |
1226 | 1283 | }// end of "calculate dipole moments and transitiondipolemoment" |
1227 | 1284 | |
1228 | 1285 |
@@ -2355,6 +2412,10 @@ void ZindoS::CalcCISMatrix(double** matrixCIS) const{ | ||
2355 | 2412 | } |
2356 | 2413 | } |
2357 | 2414 | |
2415 | + // broadcast all matrix data to all rank | |
2416 | + int source=0; | |
2417 | + broadcast(*world, &matrixCIS[0][0], this->matrixCISdimension*this->matrixCISdimension, source); | |
2418 | + | |
2358 | 2419 | double ompEndTime = omp_get_wtime(); |
2359 | 2420 | this->OutputLog(boost::format("%s%lf%s\n%s") % this->messageOmpElapsedTimeCalcCISMarix.c_str() |
2360 | 2421 | % (ompEndTime - ompStartTime) |