Skip to content
Snippets Groups Projects
Commit 1934962e authored by Philipp Rüssmann's avatar Philipp Rüssmann
Browse files

Fix running OPERATORS test

parent a6a99adf
No related branches found
No related tags found
No related merge requests found
...@@ -633,10 +633,11 @@ contains ...@@ -633,10 +633,11 @@ contains
!---------------------------------------------------------------------------- !----------------------------------------------------------------------------
! Calculate the left-hand side solution ! Calculate the left-hand side solution
!---------------------------------------------------------------------------- !----------------------------------------------------------------------------
if ( t_dtmatjij_at%calculate .or. (t_wavefunctions%isave_wavefun(i1,ie)>0 .and. & if ( calculate_left(i1, ie) .or. &
(t_wavefunctions%save_rllleft .or. t_wavefunctions%save_sllleft)) .or. & t_dtmatjij_at%calculate .or. &
((write_rhoq_input .and. ie==2) .and. (i1==mu0)) .or. & ! rhoqtest ((write_rhoq_input .and. ie==2) .and. (i1==mu0)) & ! rhoqtest
calc_exchange_couplings .or. write_pkkr_operators .or. calc_wronskian ) then ! MdSD: seems to make more sense to check here than below ) then ! MdSD: seems to make more sense to check here than below
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Calculate the left-hand side solution this needs to be done for the ! Calculate the left-hand side solution this needs to be done for the
! calculation of t-matrices for Jij tensor or if wavefunctions should be saved ! calculation of t-matrices for Jij tensor or if wavefunctions should be saved
...@@ -983,7 +984,7 @@ contains ...@@ -983,7 +984,7 @@ contains
sll = czero sll = czero
! Left regular and irregular wavefunctions (used here only in case of XCPL or saving of left wavefunctions) ! Left regular and irregular wavefunctions (used here only in case of XCPL or saving of left wavefunctions)
if (calc_exchange_couplings .or. (t_wavefunctions%save_rllleft .or. t_wavefunctions%save_sllleft .or. write_rhoq_input) .or. calc_wronskian) then if (calculate_left(1,1)) then
allocate (rllleft(nsra*lmmaxd,lmmaxd,irmdnew,0:nth-1), stat=i_stat) allocate (rllleft(nsra*lmmaxd,lmmaxd,irmdnew,0:nth-1), stat=i_stat)
call memocc(i_stat, product(shape(rllleft))*kind(rllleft), 'RLLLEFT', 'allocate_locals_tmat_newsolver') call memocc(i_stat, product(shape(rllleft))*kind(rllleft), 'RLLLEFT', 'allocate_locals_tmat_newsolver')
rllleft = czero rllleft = czero
...@@ -1065,7 +1066,7 @@ contains ...@@ -1065,7 +1066,7 @@ contains
deallocate (sll, stat=i_stat) deallocate (sll, stat=i_stat)
call memocc(i_stat, -product(shape(sll))*kind(sll), 'SLL', 'allocate_locals_tmat_newsolver') call memocc(i_stat, -product(shape(sll))*kind(sll), 'SLL', 'allocate_locals_tmat_newsolver')
if (calc_exchange_couplings .or. (t_wavefunctions%save_rllleft .or. t_wavefunctions%save_sllleft .or. write_rhoq_input)) then if (calculate_left(1,1)) then
deallocate (rllleft, stat=i_stat) deallocate (rllleft, stat=i_stat)
call memocc(i_stat, -product(shape(rllleft))*kind(rllleft), 'RLLLEFT', 'allocate_locals_tmat_newsolver') call memocc(i_stat, -product(shape(rllleft))*kind(rllleft), 'RLLLEFT', 'allocate_locals_tmat_newsolver')
deallocate (sllleft, stat=i_stat) deallocate (sllleft, stat=i_stat)
...@@ -1102,4 +1103,39 @@ contains ...@@ -1102,4 +1103,39 @@ contains
end subroutine allocate_locals_tmat_newsolver end subroutine allocate_locals_tmat_newsolver
!-------------------------------------------------------------------------------
!> Summary: Helper function which tells if the left wave functions are needed
!> calculation
!> Author: Philipp Ruessmann
!> Category: single-site, profiling, KKRhost
!> Deprecated: False
!>
!-------------------------------------------------------------------------------
logical function calculate_left(i1, ie)
use :: mod_save_wavefun, only: t_wavefunctions
use :: mod_runoptions, only: calc_wronskian, write_pkkr_operators, calc_exchange_couplings, write_rhoq_input
use :: mod_types, only: type_dtmatjijdij
implicit None
integer, intent(in) :: i1, ie
calculate_left = .false.
if ( calc_exchange_couplings &
.or. &
write_pkkr_operators &
.or. &
calc_wronskian &
) then
calculate_left = .true.
end if
if ( (t_wavefunctions%save_rllleft .or. t_wavefunctions%save_sllleft) ) then
if ( t_wavefunctions%isave_wavefun(i1,ie)>0 ) calculate_left = .true.
end if
return
end function calculate_left
end module mod_tmatnewsolver end module mod_tmatnewsolver
...@@ -72,9 +72,9 @@ class Test_features(): ...@@ -72,9 +72,9 @@ class Test_features():
fname = 'TBkkr_rhod.txt' fname = 'TBkkr_rhod.txt'
num, text = read_file(path+fname) num, text = read_file(path+fname)
num_ref, text_ref = read_file(path0+fname) num_ref, text_ref = read_file(path0+fname)
assert std(abs(num-num_ref))<10**-14 assert std(abs(num-num_ref))<1e-14
assert mean(abs(num-num_ref))<10**-14 assert mean(abs(num-num_ref))<1e-14
assert abs(num-num_ref).max()<5*10**-13 assert abs(num-num_ref).max()<1e-12
assert set(text)-set(text_ref)==set() assert set(text)-set(text_ref)==set()
# compare output of OPERATOR for host and for impurity wavefunctions # compare output of OPERATOR for host and for impurity wavefunctions
for filename in 'TBkkr_rhod.txt TBkkr_torq.txt TBkkr_spinflux.txt'.split(): for filename in 'TBkkr_rhod.txt TBkkr_torq.txt TBkkr_spinflux.txt'.split():
...@@ -93,10 +93,10 @@ class Test_features(): ...@@ -93,10 +93,10 @@ class Test_features():
# flatten arrays and take diff # flatten arrays and take diff
d1 = d1.reshape(-1); d2 = d2.reshape(-1); d01 = d01.reshape(-1); d02 = d02.reshape(-1) d1 = d1.reshape(-1); d2 = d2.reshape(-1); d01 = d01.reshape(-1); d02 = d02.reshape(-1)
diff1 = d01-d1; diff2 = d02-d2 diff1 = d01-d1; diff2 = d02-d2
assert mean(diff1) < 10**-15 assert mean(diff1) < 1e-14
assert abs(diff1).max() < 10**-15 assert abs(diff1).max() < 1e-12
assert mean(diff2) < 10**-15 assert mean(diff2) < 1e-14
assert abs(diff2).max() < 10**-15 assert abs(diff2).max() < 1e-12
def test_11_DTM_GMAT(self): def test_11_DTM_GMAT(self):
path = 'test_run11_mpi_1_8/' path = 'test_run11_mpi_1_8/'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment