45
45
use parallel, only: SIESTA_worker
46
46
use files, only : label_length
48
use m_steps, only: final
50
50
use m_spin, only: nspin, spinor_dim, h_spin_dim
51
51
use m_spin, only: SpOrb, NonCol, SPpol, NoMagn
77
77
real(dp) :: polxyz(3,nspin) ! Autom., small
78
78
real(dp) :: polR(3,nspin) ! Autom., small
80
real(dp) :: Stot ! Total spin polar.
81
real(dp) :: Svec(3) ! Total spin vector
82
80
real(dp), pointer :: ebk(:,:,:) ! Band energies
84
82
integer :: j, ix, ind, ik, io, ispin
90
88
type(filesOut_t) :: filesOut ! blank output file names
92
!----------------------------------------------------------------------- BEGIN
90
!-----------------------------------------------------------------------BEGIN
94
92
if (SIESTA_worker) call timer("Analysis",1)
94
! Check that we are converged in geometry,
95
! if strictly required,
96
! before carrying out any analysis
98
quenched_MD = ( (iquench > 0) .and.
99
$ ((idyn .eq. 1) .or. (idyn .eq. 3)) )
101
if ((nmove .ne. 0) .or. quenched_MD) then
102
if (GeometryMustConverge .and. (.not. relaxd)) then
103
call message("FATAL",
104
$ "GEOM_NOT_CONV: Geometry relaxation not converged")
105
call die("ABNORMAL_TERMINATION")
96
109
! All the comments below assume that this compatibility option
98
111
! Note also that full compatibility cannot be guaranteed
157
170
! This covers CG and MD-quench (verlet, pr), instances in which
158
171
! "relaxd" is meaningful
160
quenched_MD = ( (iquench > 0) .and.
161
$ ((idyn .eq. 1) .or. (idyn .eq. 3)) )
163
173
if ((nmove .ne. 0) .or. quenched_MD ) then
165
175
if (relaxd) then ! xa = xa_last
283
293
if (IONode) print "(a)", "Writing WFSX for COOP/COHP in "
284
294
$ // trim(wfs_filename)
285
295
call wwave( no_s, h_spin_dim, spinor_dim, no_u, no_l, maxnh,
287
297
. numh, listhptr, listh, H, S, Ef, xijo, indxuo,
288
298
. nkpnt, kpoint, no_u, gamma, occtol)
367
377
& ((isolve.eq.SOLVE_MINIM).and.minim_calc_eigenvalues))
369
379
& call ioeig(eo,ef,neigwanted,nspin,nkpnt,no_u,spinor_dim,
370
& maxk,kpoint, kweight)
380
& nkpnt,kpoint, kweight)
373
383
!** This uses H,S, and xa, as it diagonalizes them again
387
397
! DMs of the SCF run for the last geometry considered.
388
398
! This can be considered a feature or a bug.
390
! Print spin polarization
391
if (nspin .ge. 2) then
393
qspin(ispin) = 0.0_dp
397
qspin(ispin) = qspin(ispin) + Dscf(ind,ispin) * S(ind)
403
! Global reduction of spin components
404
call globalize_sum(qspin(1:nspin),qtmp(1:nspin))
405
qspin(1:nspin) = qtmp(1:nspin)
407
if (nspin .eq. 2) then
409
write(6,'(/,a,f12.6)')
410
& 'siesta: Total spin polarization (Qup-Qdown) =',
411
& qspin(1) - qspin(2)
413
if (cml_p) call cmlAddProperty(xf=mainXML,
414
. value=qspin(1)-qspin(2), dictref='siesta:qspin',
415
. units='siestaUnits:spin')
416
elseif (nspin .eq. 4) then
417
call spnvec( nspin, qspin, qaux, Stot, Svec )
419
write(6,'(a,3f12.6)')
420
& 'siesta: Total spin polarization (x,y,z) = ',
421
& qspin(3)*2, qspin(4)*2, qspin(1)-qspin(2)
422
write(6,'(a,4f12.6)')
423
& 'siesta: S , {S} = ', Stot, Svec
425
call cmlAddProperty(xf=mainXML, value=Stot,
426
. dictref='siesta:stot',
427
. units='siestaUnits:spin')
428
call cmlAddProperty(xf=mainXML, value=Svec,
429
. dictref='siesta:svec',
430
. units='siestaUnits:spin')
400
call print_spin(qspin) ! qspin returned for use below
436
402
!** This uses the last computed dipole in dhscf during the scf cycle,
437
403
! which is in fact derived from the "in" DM.