Commit f5a883ec authored by Uliana Alekseeva's avatar Uliana Alekseeva

l_par variable added to qfix

parent 76a53c93
......@@ -67,7 +67,7 @@ CONTAINS
END DO
END DO
CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,&
den,noco%l_noco,mpi%isize==1,force_fix=.TRUE.,fix=fix,fix_pw_only=.true.)
den,noco%l_noco,mpi%isize==1,.FALSE.,force_fix=.TRUE.,fix=fix,fix_pw_only=.true.)
END SUBROUTINE fix_by_gaussian
FUNCTION gaussian_r(r,alpha)
......
......@@ -9,10 +9,13 @@ MODULE m_qfix
! qfix=1 (qfix=f in inp.xml) means we fix only in INT (only done in firstcall)
! qfix=2 (qfix=t in inp.xml) means we fix total charge
! qfix file no longer supported!
! If l_par=.TRUE., MPI parallelization in the cdntot will be used.
! Be carefull not to set it to .TRUE. if you are calling only from one MPI
! rank.
CONTAINS
SUBROUTINE qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,&
den,l_noco,l_printData,force_fix,fix,fix_pw_only)
den,l_noco,l_printData,l_par,force_fix,fix,fix_pw_only)
USE m_types
USE m_constants
......@@ -32,7 +35,7 @@ CONTAINS
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_potden),INTENT(INOUT) :: den
LOGICAL,INTENT(IN) :: l_noco,l_printData,force_fix
LOGICAL,INTENT(IN) :: l_noco,l_printData,force_fix,l_par
REAL, INTENT (OUT) :: fix
LOGICAL,INTENT(IN),OPTIONAL :: fix_pw_only
! .. Local Scalars ..
......
......@@ -1006,10 +1006,10 @@ CONTAINS
CASE (0,1) !just qfix the density
IF (mpi%irank==0) WRITE(oUnit,*) "Using qfix to adjust density"
IF (mpi%irank==0) CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,&
den,noco%l_noco,mpi%isize==1,force_fix=.TRUE.,fix=fix)
den,noco%l_noco,mpi%isize==1,.FALSE.,force_fix=.TRUE.,fix=fix)
CASE(2,3)
IF (mpi%irank==0) CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,&
den,noco%l_noco,mpi%isize==1,force_fix=.TRUE.,fix=fix,fix_pw_only=.TRUE.)
den,noco%l_noco,mpi%isize==1,.FALSE.,force_fix=.TRUE.,fix=fix,fix_pw_only=.TRUE.)
CASE(4,5)
IF (mpi%irank==0) CALL fix_by_gaussian(shifts,atoms,stars,mpi,sym,vacuum,sphhar,input,oned,cell,noco,den)
CASE default
......
......@@ -225,7 +225,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
IF (mpi%irank == 0) THEN
CALL openXMLElementNoAttributes('allElectronCharges')
CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,outDen,noco%l_noco,.TRUE.,.true.,fix)
CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,outDen,noco%l_noco,.TRUE.,.TRUE.,.true.,fix)
CALL closeXMLElement('allElectronCharges')
IF (input%jspins == 2) THEN
......
......@@ -152,7 +152,7 @@ CONTAINS
CALL readDensity(stars,fi%noco,fi%vacuum,fi%atoms,fi%cell,sphhar,fi%input,fi%sym,fi%oneD,archiveType,CDN_INPUT_DEN_const,&
0,results%ef,l_qfix,inDen)
CALL timestart("Qfix")
CALL qfix(mpi,stars,fi%atoms,fi%sym,fi%vacuum, sphhar,fi%input,fi%cell,fi%oneD,inDen,fi%noco%l_noco,.FALSE.,.false.,fix)
CALL qfix(mpi,stars,fi%atoms,fi%sym,fi%vacuum, sphhar,fi%input,fi%cell,fi%oneD,inDen,fi%noco%l_noco,.FALSE.,.TRUE.,.false.,fix)
CALL timestop("Qfix")
IF(fi%noco%l_alignMT.AND.mpi%irank==0) THEN
CALL rotateMagnetToSpinAxis(fi%vacuum,sphhar,stars,fi%sym,fi%oneD,fi%cell,fi%noco,nococonv,fi%input,fi%atoms,inDen,.TRUE.)
......
......@@ -184,7 +184,7 @@ contains
endif
!fix charge of the new density
IF (mpi%irank==0) CALL qfix(mpi,stars,atoms,sym,vacuum, sphhar,input,cell,oneD,inDen,noco%l_noco,.FALSE.,.FALSE., fix)
IF (mpi%irank==0) CALL qfix(mpi,stars,atoms,sym,vacuum, sphhar,input,cell,oneD,inDen,noco%l_noco,.FALSE.,.FALSE.,.FALSE., fix)
......@@ -218,4 +218,4 @@ contains
CALL timestop("Charge Density Mixing")
END SUBROUTINE mix_charge
END MODULE m_mix
\ No newline at end of file
END MODULE m_mix
......@@ -86,7 +86,7 @@ CONTAINS
IF( input%jspins == 2 ) CALL resDen%ChargeAndMagnetisationToSpins()
! fix the preconditioned density
CALL outDen%addPotDen( resDen, inDen )
CALL qfix(mpi,stars, atoms, sym, vacuum, sphhar, input, cell, oneD, outDen, noco%l_noco, .FALSE., .TRUE., fix )
CALL qfix(mpi,stars, atoms, sym, vacuum, sphhar, input, cell, oneD, outDen, noco%l_noco, .FALSE.,.FALSE., .TRUE., fix )
CALL resDen%subPotDen( outDen, inDen )
END IF MPI0_c
CALL precon_v%from_density(resden)
......
......@@ -202,7 +202,7 @@ SUBROUTINE stden(mpi,sphhar,stars,atoms,sym,vacuum,&
IF (mpi%irank == 0) THEN
! Check the normalization of total density
CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,den,.FALSE.,.FALSE.,.true.,fix)
CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,den,.FALSE.,.FALSE.,.FALSE.,.true.,fix)
z=SUM(atoms%neq(:)*atoms%zatom(:))
IF (ABS(fix*z-z)>0.5) THEN
CALL judft_warn("Starting density not charge neutral",hint= &
......
......@@ -450,7 +450,7 @@ SUBROUTINE rdmft(eig_id,mpi,fi,enpara,stars,&
CALL cdncore(mpi,fi%oned,fi%input,fi%vacuum,fi%noco,nococonv,fi%sym,&
stars,fi%cell,sphhar,fi%atoms,vTot,overallDen,moments,results)
IF (mpi%irank.EQ.0) THEN
CALL qfix(mpi,stars,fi%atoms,fi%sym,fi%vacuum,sphhar,fi%input,fi%cell,fi%oned,overallDen,fi%noco%l_noco,.TRUE.,.true.,fix)
CALL qfix(mpi,stars,fi%atoms,fi%sym,fi%vacuum,sphhar,fi%input,fi%cell,fi%oned,overallDen,fi%noco%l_noco,.TRUE.,.FALSE.,.true.,fix)
END IF
#ifdef CPP_MPI
CALL mpi_bc_potden(mpi,stars,sphhar,fi%atoms,fi%input,fi%vacuum,fi%oned,fi%noco,overallDen)
......
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