From c3b76e9f27c25cc3e2c81dbe376376d071c53879 Mon Sep 17 00:00:00 2001 From: Nicolas Essing <n.essing@fz-juelich.de> Date: Tue, 26 Oct 2021 13:03:37 +0200 Subject: [PATCH] Fixing a but I introduced for collinear calculations. As some calculations use the muffin tin index (of the new mesh), this was calculated in calculateDensities in ProcessKKRresults_mod, so before checking if a nonco calculation is done. However, in a collinear calculation, the pointer to the new mesh is not associated, which gave an error in that case. --- source/KKRnano/source/ProcessKKRresults_mod.F90 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/KKRnano/source/ProcessKKRresults_mod.F90 b/source/KKRnano/source/ProcessKKRresults_mod.F90 index ac3e854de..1db41ee5e 100644 --- a/source/KKRnano/source/ProcessKKRresults_mod.F90 +++ b/source/KKRnano/source/ProcessKKRresults_mod.F90 @@ -454,6 +454,7 @@ module ProcessKKRresults_mod double precision :: CHRGSEMICORE !< total semicore charge over all atoms double precision :: fsemicore_in integer :: ila, r1fu + integer :: imt ! muffin tin index integer :: num_local_atoms double complex, allocatable :: prefactors(:) ! for Morgan charge test only @@ -506,6 +507,16 @@ module ProcessKKRresults_mod energies => getEnergies(calc, ila) ldau_data => getLDAUData(calc, ila) atom_id = calc%atom_ids(ila) ! get global atom_id from local index + + if (dims%korbit == 1) then + imt = get_muffin_tin_index(atomdata%chebmesh_ptr) + else + ! At the moment, the muffin tin index is used in RHOVAL_wrapper only for + ! noncollinear magnetic fields, so only for korbit==1. Thus, the value + ! assigned here is not used. However, if that changes at some point, + ! I think this value is what you'd expect + imt = calc%mesh_a(ila)%imt + end if !------------------------------------------------------------------------------ ! has to be done after Lloyd @@ -523,7 +534,7 @@ module ProcessKKRresults_mod calc%noco_data%angle_fix_mode(atom_id), calc%noco_data%moment_x(atom_id), & calc%noco_data%moment_y(atom_id), calc%noco_data%moment_z(atom_id), & densities%muorb, densities%iemxd, params, calc%bfields(ila), & - get_muffin_tin_index(atomdata%chebmesh_ptr), iter) + imt, iter) ! LDAU if (ldau_data%LDAU .and. ldau_data%NLDAU >= 1) then -- GitLab