Commit 758aca08 authored by Daniel Wortmann's avatar Daniel Wortmann

Added option to converge until maxdistance

parent 61d7442f
......@@ -705,6 +705,7 @@
REAL :: te_exc !<charge density-ex-corr.energy density integral
REAL :: e_ldau !<total energy contribution of LDA+U
REAL :: tote
REAL :: last_distance
TYPE(t_energy_hf) :: te_hfex
REAL :: te_hfex_loc(2)
REAL, ALLOCATABLE :: w_iks(:,:,:)
......
......@@ -786,7 +786,7 @@
! ----> mix input and output densities
!
CALL timestart("mixing")
CALL mix(stars,atoms,sphhar,vacuum,input,sym,cell,it,noco,oneD,hybrid)
CALL mix(stars,atoms,sphhar,vacuum,input,sym,cell,it,noco,oneD,hybrid,results)
!
CALL timestop("mixing")
WRITE (6,FMT=8130) it
......@@ -833,6 +833,7 @@
END IF
CALL writeTimesXML()
CALL check_time_for_next_iteration(it,l_cont)
l_cont=l_cont.AND.(input%mindistance<=results%last_distance)
IF ((mpi%irank.EQ.0).AND.(isCurrentXMLElement("iteration"))) THEN
CALL closeXMLElement('iteration')
END IF
......
......@@ -13,7 +13,7 @@ MODULE m_mix
! IMIX = 7 : GENERALIZED ANDERSEN METHOD
!************************************************************************
CONTAINS
SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym, cell, it, noco, oneD,hybrid)
SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym, cell, it, noco, oneD,hybrid,results)
!
#include"cpp_double.h"
USE m_cdn_io
......@@ -37,6 +37,7 @@ CONTAINS
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_atoms),INTENT(INOUT) :: atoms !n_u is modified temporarily
TYPE(t_results),INTENT(INOUT)::results
! ..
! .. Scalar Arguments ..
INTEGER :: nrhomfile=26
......@@ -288,10 +289,12 @@ CONTAINS
WRITE ( 6,FMT=8000) iter,1000*SQRT(ABS(dist(4)/cell%vol))
WRITE ( 6,FMT=8010) iter,1000*SQRT(ABS(dist(5)/cell%vol))
END IF
! dist/vol should always be >= 0 ,
! but for dist=0 numerically you might obtain dist/vol < 0
! (e.g. when calculating non-magnetic systems with jspins=2).
END IF
results%last_distance=maxval(1000*SQRT(ABS(dist/cell%vol)))
DEALLOCATE (sm,fsm)
CALL closeXMLElement('densityConvergence')
!
......
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