Commit f4d1c6f1 authored by Gregor Michalicek's avatar Gregor Michalicek

Integrate m_perp call into magMoms subroutine

parent a91ad88e
......@@ -8,20 +8,24 @@ MODULE m_magMoms
CONTAINS
SUBROUTINE magMoms(dimension,input,atoms,chmom)
SUBROUTINE magMoms(dimension,input,atoms,noco,vTot,chmom,qa21)
USE m_types
USE m_xmlOutput
USE m_m_perp
IMPLICIT NONE
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_input), INTENT(IN) :: input
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_noco), INTENT(INOUT) :: noco
TYPE(t_potden),INTENT(IN) :: vTot
REAL, INTENT(INOUT) :: chmom(atoms%ntype,dimension%jspd)
COMPLEX, INTENT(IN) :: qa21(atoms%ntype)
INTEGER :: iType, j
INTEGER :: iType, j, iRepAtom
REAL :: smom
CHARACTER(LEN=20) :: attributes(4)
......@@ -29,6 +33,7 @@ SUBROUTINE magMoms(dimension,input,atoms,chmom)
WRITE (16,FMT=8020)
CALL openXMLElement('magneticMomentsInMTSpheres',(/'units'/),(/'muBohr'/))
iRepAtom = 1
DO iType = 1, atoms%ntype
smom = chmom(iType,1) - chmom(iType,input%jspins)
WRITE (6,FMT=8030) iType,smom, (chmom(iType,j),j=1,input%jspins)
......@@ -41,6 +46,14 @@ SUBROUTINE magMoms(dimension,input,atoms,chmom)
CALL writeXMLElementFormPoly('magneticMoment',(/'atomType ','moment ','spinUpCharge ',&
'spinDownCharge'/),&
attributes,reshape((/8,6,12,14,6,15,15,15/),(/4,2/)))
IF (noco%l_mperp) THEN
!calculate the perpendicular part of the local moment
!and relax the angle of the local moment or calculate
!the constraint B-field.
CALL m_perp(atoms,iType,iRepAtom,noco,vTot%mt(:,0,:,:),chmom,qa21)
END IF
iRepAtom= iRepAtom + atoms%neq(iType)
END DO
CALL closeXMLElement('magneticMomentsInMTSpheres')
......
......@@ -32,7 +32,6 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
USE m_rwnoco
USE m_cored
USE m_coredr
USE m_m_perp
USE m_types
USE m_xmlOutput
USE m_magMoms
......@@ -328,18 +327,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
noco_new = noco
CALL magMoms(dimension,input,atoms,chmom)
IF (noco%l_mperp) THEN
iatom = 1
DO n = 1,atoms%ntype
!calculate the perpendicular part of the local moment
!and relax the angle of the local moment or calculate
!the constraint B-field.
CALL m_perp(atoms,n,iatom,noco_new,vTot%mt(:,0,:,:),chmom,qa21)
iatom= iatom + atoms%neq(n)
END DO
END IF
CALL magMoms(dimension,input,atoms,noco_new,vTot,chmom,qa21)
!save the new nocoinp file if the dierctions of the local
!moments are relaxed or a constraint B-field is calculated.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment