Skip to content
Snippets Groups Projects
Commit 112784da authored by Manuel Dias's avatar Manuel Dias
Browse files

prevent broyden mixing for angles when rms is zero

parent 527a2ba1
No related branches found
No related tags found
No related merge requests found
......@@ -145,6 +145,7 @@ contains
real (kind=dp), intent(in) :: totmoment_atoms(natyp) !! length of the magentization vectors
integer, intent(in) :: iounit !! output unit where the nonco_angles output file is written
! local
real (kind=dp), parameter :: tol = 1.0e-12_dp !! MdSD: shifting problems with Broyden to the future
integer :: nfixed !! number of fixed angles
integer :: ipos !! for loop indices etc.
integer :: vlen !! length of vector
......@@ -197,6 +198,12 @@ contains
alpha = mixfac_broydenspin
if (iter<=ninit_broydenspin) alpha = 1.0_dp ! always use alpha=1 for simple mixing steps
! MdSD: there are special high-symmetry situations where the rms for the angles is zero
! MdSD: linear mixing is fine with that, but if broyden is called it will cause a NaN
! MdSD: this line delays using Broyden
if (rms < tol .and. iter == ninit_broydenspin) ninit_broydenspin = ninit_broydenspin + 1
! now do Broyden mixing
call broyden (vector, vlen, alpha, rms, iter, &
ninit_broydenspin, memlen_broydenspin, vlen)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment