Commit a510ed3c authored by Alexander Neukirchen's avatar Alexander Neukirchen

Added a spin-scaling present in the SF paper.

parent b7d2e059
......@@ -120,7 +120,7 @@ CONTAINS
INTEGER :: iter,iterHF,i,n
INTEGER :: wannierspin
LOGICAL :: l_opti,l_cont,l_qfix,l_real
REAL :: fix
REAL :: fix, sfscale
#ifdef CPP_MPI
INCLUDE 'mpif.h'
......@@ -280,11 +280,36 @@ CONTAINS
! IF(.FALSE.)CALL rotateMagnetToSpinAxis(vacuum,sphhar,stars&
! ,sym,oneD,cell,noco,input,atoms,inDen)
!END Rot For Testing (HIGHLY EXPERIMENTAL ROUTINE)
IF (noco%l_sourceFree) THEN
sfscale=1.0
IF (xcpot%needs_grad()) THEN
sfscale=1.14
ELSE
sfscale=1.12
END IF
CALL inDen%SpinsToChargeAndMagnetisation()
inDen%mt(:,0:,:, 2:4) = sfscale*inDen%mt(:,0:,:,2:4)
inDen%pw(:, 2:3) = sfscale*inDen%pw(:, 2:3)
inDen%vacz(:,:, 2:4) = sfscale*inDen%vacz(:,:, 2:4)
inDen%vacxy(:,:,:,2:3) = sfscale*inDen%vacxy(:,:,:,2:3)
CALL inDen%ChargeAndMagnetisationToSpins()
END IF
CALL timestart("generation of potential")
CALL vgen(hybdat,field,input,xcpot,atoms,sphhar,stars,vacuum,sym,&
cell,oneD,sliceplot,mpi,results,noco,EnergyDen,inDen,vTot,vx,vCoul)
CALL timestop("generation of potential")
IF (noco%l_sourceFree) THEN
CALL inDen%SpinsToChargeAndMagnetisation()
inDen%mt(:,0:,:, 2:4) = inDen%mt(:,0:,:,2:4)/sfscale
inDen%pw(:, 2:3) = inDen%pw(:, 2:3)/sfscale
inDen%vacz(:,:, 2:4) = inDen%vacz(:,:, 2:4)/sfscale
inDen%vacxy(:,:,:,2:3) = inDen%vacxy(:,:,:,2:3)/sfscale
CALL inDen%ChargeAndMagnetisationToSpins()
END IF
IF ((sliceplot%iplot.NE.0 ).AND.(mpi%irank==0) ) THEN
CALL makeplots(stars, atoms, sphhar, vacuum, input, oneD, sym, cell, &
noco, vTot, PLOT_POT_TOT, sliceplot)
......
......@@ -105,7 +105,7 @@ CONTAINS
cell,oneD,sliceplot,mpi,noco,den,denRot,EnergyDen,vTot,vx,results)
!ToDo, check if this is needed for more potentials as well...
CALL vgen_finalize(mpi,oneD,field,cell,atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot)
CALL vgen_finalize(mpi,oneD,field,cell,atoms,stars,vacuum,sym,noco,input,xcpot,sphhar,vTot,vCoul,denRot)
!DEALLOCATE(vcoul%pw_w)
CALL bfield(input,noco,atoms,field,vTot)
......
......@@ -7,7 +7,7 @@ MODULE m_vgen_finalize
USE m_juDFT
USE m_xcBfield
CONTAINS
SUBROUTINE vgen_finalize(mpi,oneD,field,cell,atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot)
SUBROUTINE vgen_finalize(mpi,oneD,field,cell,atoms,stars,vacuum,sym,noco,input,xcpot,sphhar,vTot,vCoul,denRot)
! ***********************************************************
! FLAPW potential generator *
! ***********************************************************
......@@ -32,6 +32,7 @@ CONTAINS
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_input),INTENT(IN) :: input
CLASS(t_xcpot),INTENT(IN) :: xcpot
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_potden),INTENT(INOUT) :: vTot,vCoul,denRot
! ..
......@@ -40,7 +41,7 @@ CONTAINS
TYPE(t_potden) :: div, phi, checkdiv
TYPE(t_potden), DIMENSION(3) :: cvec, corrB, bxc
REAL :: b(3,atoms%ntype),dummy1(atoms%ntype),dummy2(atoms%ntype)
REAL :: b(3,atoms%ntype),dummy1(atoms%ntype),dummy2(atoms%ntype),sfscale
......@@ -61,8 +62,20 @@ CONTAINS
! Source-free testwise
!CALL sftest(mpi,dimension,field,stars,atoms,sphhar,vacuum,input,oneD,sym,cell,noco,1,inDen,1.0)
!CALL sftest(mpi,dimension,field,stars,atoms,sphhar,vacuum,input,oneD,sym,cell,noco,1,vTot,2.0)
sfscale=1.0
IF (xcpot%needs_grad()) THEN
sfscale=1.14
ELSE
sfscale=1.12
END IF
CALL vTot%SpinsToChargeAndMagnetisation()
vTot%mt(:,0:,:, 2:4) = sfscale*vTot%mt(:,0:,:,2:4)
vTot%pw(:, 2:3) = sfscale*vTot%pw(:, 2:3)
vTot%vacz(:,:, 2:4) = sfscale*vTot%vacz(:,:, 2:4)
vTot%vacxy(:,:,:,2:3) = sfscale*vTot%vacxy(:,:,:,2:3)
CALL vTot%ChargeAndMagnetisationToSpins()
! Once it is tested:
IF (noco%l_mtnocoPot.AND.noco%l_sourceFree) THEN ! l_sf will go here
......
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