-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E type 2DM is successfully created from S type DM
- Loading branch information
yasuto-masuda
committed
Dec 13, 2023
1 parent
2bbbfaa
commit 56784e5
Showing
14 changed files
with
950 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
module DM4_interface | ||
|
||
implicit none | ||
|
||
interface create_permutation_list | ||
|
||
module procedure create_permutation_list_DM2, create_permutation_list_DM3, create_permutation_list_DM4 | ||
|
||
end interface create_permutation_list | ||
|
||
contains | ||
|
||
subroutine create_permutation_list_DM2(i, j, list) | ||
implicit none | ||
|
||
integer, intent(inout) :: i, j | ||
|
||
integer, intent(out) :: list(3, 2) | ||
|
||
list(:, 1) = (/i, j, 1/) | ||
|
||
list(:, 2) = (/j, i, -1/) | ||
|
||
end subroutine create_permutation_list_DM2 | ||
|
||
subroutine create_permutation_list_DM3(i, j, k, list) | ||
implicit none | ||
|
||
integer, intent(inout) :: i, j, k | ||
|
||
integer, intent(out) :: list(4, 6) | ||
|
||
list(:, 1) = (/i, j, k, 1/) | ||
|
||
list(:, 2) = (/i, k, j, -1/) | ||
|
||
list(:, 3) = (/j, i, k, -1/) | ||
|
||
list(:, 4) = (/j, k, i, 1/) | ||
|
||
list(:, 5) = (/k, i, j, 1/) | ||
|
||
list(:, 6) = (/k, j, i, -1/) | ||
|
||
end subroutine create_permutation_list_DM3 | ||
|
||
subroutine create_permutation_list_DM4(i, j, k, l, list) | ||
implicit none | ||
|
||
integer, intent(inout) :: i, j, k, l | ||
|
||
integer, intent(out) :: list(5, 24) | ||
list(:, 1) = (/i, j, k, l, 1/) | ||
list(:, 2) = (/j, i, k, l, -1/) | ||
list(:, 3) = (/k, i, j, l, 1/) | ||
list(:, 4) = (/i, k, j, l, -1/) | ||
list(:, 5) = (/j, k, i, l, 1/) | ||
list(:, 6) = (/k, j, i, l, -1/) | ||
list(:, 7) = (/k, j, l, i, 1/) | ||
list(:, 8) = (/j, k, l, i, -1/) | ||
list(:, 9) = (/l, k, j, i, 1/) | ||
list(:, 10) = (/k, l, j, i, -1/) | ||
list(:, 11) = (/j, l, k, i, 1/) | ||
list(:, 12) = (/l, j, k, i, -1/) | ||
list(:, 13) = (/l, i, k, j, 1/) | ||
list(:, 14) = (/i, l, k, j, -1/) | ||
list(:, 15) = (/k, l, i, j, 1/) | ||
list(:, 16) = (/l, k, i, j, -1/) | ||
list(:, 17) = (/i, k, l, j, 1/) | ||
list(:, 18) = (/k, i, l, j, -1/) | ||
list(:, 19) = (/j, i, l, k, 1/) | ||
list(:, 20) = (/i, j, l, k, -1/) | ||
list(:, 21) = (/l, j, i, k, 1/) | ||
list(:, 22) = (/j, l, i, k, -1/) | ||
list(:, 23) = (/i, l, j, k, 1/) | ||
list(:, 24) = (/l, i, j, k, -1/) | ||
|
||
end subroutine create_permutation_list_DM4 | ||
|
||
! +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= | ||
! +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= | ||
|
||
SUBROUTINE bAmat_interface(sc, bc) ! Assume C1 molecule, overlap matrix B in space A | ||
! | ||
! B(xyz,tuv) = Siguma_w eps(w){-<0|EzyEtxEuvEww|0> + d(tx)<0|EzyEuvEww|0>} | ||
! | ||
! + S(xyz,tuv)(eps(u)+eps(t)-eps(v)) | ||
! | ||
! +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= | ||
! +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= | ||
|
||
use four_caspt2_module | ||
use module_file_manager | ||
|
||
Implicit NONE | ||
#ifdef HAVE_MPI | ||
include 'mpif.h' | ||
#endif | ||
integer :: iu, iv | ||
integer :: jt, ju, jv, jw | ||
integer :: iw1, iw2, iostat | ||
|
||
complex*16, intent(in) :: sc(dimn, dimn) | ||
complex*16, intent(out) :: bc(dimn, dimn) | ||
integer, intent(in) ::isym | ||
integer :: counter_use_3dm_Bamat | ||
|
||
real*8 :: e | ||
complex*16 :: dm3, dm4 | ||
character(50) :: chr_isym, chr_rank, dmat4A_filename, dmat3A_B_filename | ||
|
||
integer :: DM3_unit_num = 300, DM4_unit_num = 400 | ||
bc(:, :) = 0.0d+00 | ||
|
||
! Get a 4DM file name and open it | ||
|
||
dmat4A_filename = "required_S_type_dmat4A" | ||
call open_unformatted_file(unit=DM4_unit_num, file=trim(dmat4A_filename), status="old", optional_action="read") | ||
|
||
! Do!iostatを使ってファイルのすべてを読む | ||
! read ijklmnop, S型4DM1個 | ||
|
||
! Do 複製type = 1,N | ||
! !(N個複製する必要があるとする、4次のDMならこの前の計算があっていれば24個) | ||
! !(事前に配列で、type=1はindexとしてijklmnopみたいなのを作っておく。) | ||
! !(ここから処理部) | ||
|
||
! !(dirac_orderからenergy_orderに変換) | ||
! call convert dirac_order to energy_order(intent(in)D_i..,intent(out)E_i..) | ||
|
||
! !(インデックスをxyztuv...に変換) | ||
! call convert to A_subspace_index& | ||
! (intent(in)ijklmn... intent(out)xyztuv...) | ||
|
||
! !(部分空間AorCの判定条件を満たすか確かめる) | ||
! call sym_check_ABmat(intent (out)sym_check,intent(in)xyz...) | ||
|
||
! if (sym_check==.true.)then | ||
|
||
if (rank == 0) print *, "solv_A_dmrg_bAmat_read 4DM file" | ||
do | ||
read (DM4_unit_num, iostat=iostat) i, j, k, l, m, n, o, p, dm4 | ||
if (iostat < 0) then | ||
print *, "IOSTAT < 0, End read a file. filename: ", trim(dmat4A_filename) | ||
exit | ||
else if (iostat > 0) then | ||
print *, "ERROR: error occured while reading a file. filename: ", trim(dmat4A_filename) | ||
print *, "Exit PROGRAM" | ||
stop | ||
|
||
end if | ||
|
||
!(dirac_orderからenergy_orderに変換) | ||
call convert_index_dirac_order_to_energy_order(i, j, k, l, m, n, o, p) | ||
|
||
call create_permutation_list(i, j, k, l, left_list) | ||
call create_permutation_list(m, n, o, p, right_list) | ||
|
||
do left_idx = 1, 24 !左側のS型4DMのインデックスパターンを指定するもの | ||
do right_idx = 1, 24 !右側のS型4DMのインデックスパターンを指定するもの | ||
|
||
!(インデックスをxyztuv...に変換) | ||
call convert_to_A_subspace_index(left_list(1:4, left_idx), right_list(1:4, right_idx), iz, iy, it, ix, iu, iv, iw1, iw2) | ||
|
||
!(部分空間AorCの判定条件を満たすか確かめる) | ||
call sym_check_ABmat(intent(out) sym_check, intent(in) xyz...) | ||
|
||
if (sym_check) then | ||
|
||
B_i = indsym_reverse(ix, iy, iz) | ||
B_j = indsym_reverse(it, iu, iv) | ||
|
||
if (B_i > B_j) print *, "i is larger than B_j 4dm", B_i, B_j | ||
if (B_i == 0 .or. B_j == 0 .or. B_i > B_j) cycle | ||
|
||
bc(B_i, B_j) = bc(B_i, B_j) - dm4*eps(iw2 + ninact) | ||
|
||
end if | ||
|
||
end do | ||
|
||
end do | ||
end do | ||
|
||
end SUBROUTINE bAmat_interface | ||
|
||
subroutine convert_to_A_subspace_index(left_list, right_list, iz, iy, it, ix, iu, iv, iw1, iw2) | ||
|
||
implicit NONE | ||
|
||
integer, intent(out) ::iz, iy, it, ix, iu, iv, iw1, iw2 | ||
integer, intent(in) :: left_list(4), right_list(4) | ||
|
||
iz = left_list(1) | ||
iy = left_list(2) | ||
it = left_list(3) | ||
ix = left_list(4) | ||
iu = right_list(1) | ||
iv = right_list(2) | ||
iw1 = right_list(3) | ||
iw2 = right_list(4) | ||
|
||
end subroutine convert_to_A_subspace_index | ||
|
||
end module DM4_interface | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.