2
czora...Scale zora eigenvalues and energy
3
subroutine dft_zora_scale(
4
& rtdb,g_dens_at,nexc, ! FA
21
#include "mafdecls.fh"
28
integer rtdb,geom,ao_bas_han ! handles
29
integer ga_create_atom_blocked
30
external ga_create_atom_blocked
31
external get_rhoS,print_EFGZ4_version,
32
& get_EPRg,print_EPRg_version,
33
& get_NMRCS_SRZORA,print_NMRCS_SRZORA_version,
34
& get_NMRHFine_ZORA,print_NMRHypFine_version,
36
& dft_zorashield_read,dft_zorashield_write
37
integer dft_zorashield_read,dft_zorashield_write
38
integer g_dens(2),g_movecs(2),g_zora_scale_sf(2)
39
integer g_s,ga_Fji,g_orb,g_dens_sf,g_zora_scr(2),
42
integer noc(2),iorb,ispin,ipol,i,nexc,noc1
43
integer nbf,nbf_ao,nat_slc
44
double precision eval_scal,ener_scal,scf_dbl
45
double precision focc(nbf*ipol) ! occupation no.
46
double precision evals(ipol*nbf) ! eigenvalues
47
double precision zora_eint,zora_denom,
48
& scale,scale_MO,scale_MO1
49
logical status,done_Fji,do_zgc_old
50
integer nospin,nogshift,nogiao,noelfgz4,efgfile,switch_focc
51
data nospin,nogshift,nogiao,noelfgZ4/1,1,1,1/
52
data switch_focc/0/ ! =0 not using occ keyword =1 using occ keyword
53
data efgfile/0/ ! =0 no NLMO analysis =1 doing NLMO analysis
54
character*255 zorafilename
55
integer dims(3),chunk(3) ! for g_Cifull(i) i=1,ipol
56
integer g_densZ4(3),ind_occ
57
logical skip_csAOev,skip_gshiftAOev,
58
& skip_hypAOev,skip_efgz4AOev
59
c ---------- nlmo definitions ----------------- START
60
integer g_munuV6,g_munu_rhoS,g_densx,
61
& g_zora_scale_munu(2),ipolmunu
63
logical dft_zoraEFGZ4_NLMOAnalysis_write
64
external dft_zoraEFGZ4_NLMOAnalysis_write
66
c ---------- nlmo definitions ----------------- END
67
status=rtdb_get(rtdb,'prop:efgfile',mt_int,1,efgfile) ! for NLMO analysis
68
status=rtdb_get(rtdb,'focc:occ-switch',mt_int,1,switch_focc) ! check-occupations-keyword
69
status=rtdb_get(rtdb,'prop:efieldgradZ4',MT_INT,1,noelfgZ4)
70
status=rtdb_get(rtdb,'prop:giao' ,MT_INT,1,nogiao)
71
status=rtdb_get(rtdb,'prop:gshift' ,MT_INT,1,nogshift)
72
status=rtdb_get(rtdb,'prop:hyperfine' ,MT_INT,1,nospin)
73
do_zgc_old=do_zora_get_correction
74
do_zora_get_correction=.true. ! -1 ! FORCE-ZORA-CALC-INTS
79
else if (ipol.eq.2) then
84
if (noelfgZ4.eq.0 .or. nospin.eq.0 .or.
85
& nogshift.eq.0 .or. nogiao.eq.0) then
86
if (ga_nodeid().eq.0) then
88
call util_print_centered(LuOut,
89
$ 'Commencing ZORA Property Calculations', 23, .true.)
94
c if (nospin.eq.0 .and. ga_nodeid().eq.0)
95
c & call print_NMRHypFine_version()
96
c if (nogiao.eq.0 .and. ga_nodeid().eq.0)
97
c & call print_NMRCS_SRZORA_version()
98
c if (nogshift.eq.0 .and. ga_nodeid().eq.0)
99
c & call print_EPRg_version()
100
c if (noelfgZ4.eq.0 .and. ga_nodeid().eq.0)
101
c & call print_EFGZ4_version()
103
if (noelfgZ4.eq.0 .or. nospin.eq.0 .or.
104
& nogshift.eq.0 .or. nogiao.eq.0) then
105
if (.not.ga_create(MT_DBL,ipol,noc1,'dft_zora_scale: g_Ci',
106
$ 0,0,g_Ci)) call errquit('dft_zora_scale: g_Ci',0,
111
if (nospin .eq.0 .or. nogiao .eq.0 .or.
112
& nogshift.eq.0 .or. noelfgZ4.eq.0) then
113
c ------- create g_Cifull for scaling MO vectors
117
if (.not. nga_create(mt_dbl,1,dims,"g_Cifull",
118
& chunk,g_Cifull(ispin)))
119
$ call errquit('dft_zora_scale: g_Cifull', 0,
121
call ga_fill(g_Cifull(ispin),1.0d0)
122
enddo ! end-loop-ispin
124
c -- execute this code for EFGSRZ4+NLMO analysis is requested -- START
125
if (noelfgZ4.eq.0 .and. efgfile.eq.1) then ! -- if-noelfgZ4.eq.0---- START
127
if (.not. ga_create(mt_dbl,nbf,nbf,
128
& 'hnd_elfcon_symm: g_munu',0,0,g_zora_scale_munu(1)))
129
$ call errquit('hnd_elfcon_symm:',0,GA_ERR)
130
call ga_copy(g_zora_scale_sf(1),g_zora_scale_munu(1))
132
if (.not. ga_create(mt_dbl,nbf,nbf,
133
& 'hnd_elfcon_symm: g_munu',0,0,g_zora_scale_munu(2)))
134
$ call errquit('hnd_elfcon_symm:',0,GA_ERR)
135
call ga_copy(g_zora_scale_sf(2),g_zora_scale_munu(2))
137
c ----- Store efgz4 data in a file ------- START
138
c Note.- lbl_nlmo defined in zora.fh
140
call util_file_name(lbl_nlmo,.false.,.false.,zorafilename)
141
c ---------> Write NMLO analysis data: 1 of 3 ----- START
142
if (.not. dft_zoraEFGZ4_NLMOAnalysis_write(
143
& zorafilename, ! in: filename
144
& nbf, ! in: nr basis functions
145
& ndir, ! in: nr of directions: 6 = xx yy zz xy xz yz
146
& nlist, ! in: list of selected atoms
147
& 1, ! in: writing order =1,2,3
148
& ipolmunu, ! in: write for ndada=1
149
& g_zora_scale_munu, ! in: write for ndada=1
150
& g_munu_rhoS, ! in: write for ndata=2
151
& g_densx, ! in: write for ndata=2
153
& call errquit('get_rhoS: dft_zoraNLMO_write failed',
155
c ---------> Write NMLO analysis data: 1 of 3 ----- END
156
if (.not. ga_destroy(g_zora_scale_munu(1))) call errquit(
157
& 'dft_zora_utils: ga_destroy failed ',0, GA_ERR)
158
if (ipolmunu.gt.1) then
159
if (.not. ga_destroy(g_zora_scale_munu(2))) call errquit(
160
& 'dft_zora_utils: ga_destroy failed ',0, GA_ERR)
162
endif ! -------- if-noelfgZ4.eq.0---- END
163
c -- execute this code for EFGSRZ4+NLMO analysis is requested -- END
164
if (.not. ma_alloc_get(mt_dbl,nbf_ao,'vec aux',l_vecs, k_vecs))
166
& 'dft_zora_utils: cannot allocate vec aux',911,MA_ERR)
167
g_orb = ga_create_atom_blocked(geom, ao_bas_han, 'orbs')
168
g_dens_sf = ga_create_atom_blocked(geom, ao_bas_han,'orbs dens')
169
do i=1,3 ! for scaled density matrix used in NMR-shieldigns,hyperfine,gshift,EFGZ4
170
g_densZ4(i)=ga_create_atom_blocked(geom,ao_bas_han,'orbs dens')
171
call ga_zero(g_densZ4(i))
174
c scale the eigenvalues and energy
178
call ga_get(g_movecs(ispin), 1, nbf, iorb, iorb,
181
call ga_put(g_orb, 1, nbf, iorb, iorb,
183
call ga_zero(g_dens_sf)
184
call ga_dgemm('n','t',nbf,nbf,noc(ispin),
185
& 1.0d00,g_orb,g_orb,
187
eval_scal = evals(iorb)
188
if (ispin.gt.1) eval_scal = evals(iorb + nbf)
189
zora_eint = ga_ddot(g_dens_sf,g_zora_scale_sf(ispin)) ! FA
190
if ((do_NonRel) .or. (not_zora_scale)) then
191
c +++++++++ Create non-scaled density matrix +++++++ START
193
ener_scal = ener_scal-eval_scal ! for skipping scaling
194
if (iorb .le. noc(ispin)) then
196
if (switch_focc.eq.1) then ! adding focc()
197
ind_occ=nbf*(ispin-1)+iorb
198
scale_MO=scf_dbl*focc(ind_occ)
200
call ga_add(1.0d0 ,g_densZ4(ispin),
201
& scale_MO,g_dens_sf,
204
c +++++++++ Create non-scaled density matrix +++++++ END
206
c +++++++++ Create scaled density matrix +++++++ START
207
zora_denom= 1.d0+zora_eint
208
eval_scal = eval_scal/zora_denom
209
ener_scal = ener_scal-eval_scal*zora_eint
210
if (iorb .le. noc(ispin)) then
211
scale=1.0d0/zora_denom
212
call ga_scale(g_dens_sf,scale)
214
if (switch_focc.eq.1) then ! adding focc()
215
ind_occ=nbf*(ispin-1)+iorb
216
scale_MO=scf_dbl*focc(ind_occ)
218
call ga_add(1.0d0 ,g_densZ4(ispin),
219
& scale_MO,g_dens_sf,
222
c +++++++++ Create scaled density matrix +++++++ END
225
evals(iorb) = eval_scal
227
evals(iorb+nbf) = eval_scal
229
c ----- execute this code ONLY when EFGZ4/NMRCSZ4/EPRgshift is requested -- START
230
if(noelfgZ4.eq.0 .or. nospin.eq.0 .or.
231
& nogshift.eq.0 .or. nogiao.eq.0) then
232
if ((ipol.eq.1 .and. iorb.le.noc(1)).or.
234
& (ispin.eq.1 .and. iorb.le.noc(1)).or.
235
& (ispin.eq.2 .and. iorb.le.noc(2)))) then
236
call ga_fill_patch(g_Ci,ispin,ispin,iorb,iorb,
241
& nogshift.eq.0 .or. nospin.eq.0) then
242
if ((ipol.eq.1 .and. iorb.le.noc(1)).or.
244
& (ispin.eq.1 .and. iorb.le.noc(1)).or.
245
& (ispin.eq.2 .and. iorb.le.noc(2)))) then
246
if (nogiao.eq.0 .or. nogshift.eq.0 .or.
247
& nospin .eq. 0) then
248
scale_MO1=1.0d0/zora_denom
249
if (switch_focc.eq.1) then ! adding focc()
250
ind_occ=nbf*(ispin-1)+iorb
251
scale_MO1=1.0d0/zora_denom*focc(ind_occ)
252
c if (ga_nodeid().eq.0) then
253
c write(*,5) 1.0d0/zora_denom,ind_occ,focc(ind_occ)
254
c5 format('In dft_zora_utils:: (scl_MO,ind_occ,focc)=(',
255
c & f15.8,',',i4,',',f15.8,')')
258
call ga_fill_patch(g_Cifull(ispin),iorb,iorb,1,1,
263
c ----- execute this code ONLY when EFGZ4/NMRCSZ4/EPRgshift is requested -- END
264
end do ! orbital loop
265
end do ! polarization loop
266
c--- Create total scaled-density matrix ---- START
267
call ga_zero(g_densZ4(3))
268
call ga_copy(g_densZ4(1),g_densZ4(3))
270
call ga_add(1.0d00,g_densZ4(1),
271
& 1.0d00,g_densZ4(2),
274
c--- Create total scaled-density matrix ---- END
275
c double the energy for closed-shell calculations
276
if (ipol.eq.1) ener_scal = 2.d0*ener_scal
277
c write(luout,*) "scaled_energy:",ener_scal
278
c ----- execute this code ONLY when NMR-CS-Z4 is requested -- START
280
if(.not.rtdb_get(rtdb,'zora:skip_csAOev',
281
& mt_log,1,skip_csAOev))
282
& skip_csAOev = .false.
283
if (nogiao.eq.0 .and. .not.(skip_csAOev)) then
284
call get_NMRCS_SRZORA(rtdb,g_dens_at,nexc,
289
done_Fji=.true. ! I do not need to calculate again
290
! if calling get_EPRg
292
c ----- execute this code ONLY when NMR-CS-Z4 is requested -- END
293
c ----- execute this code ONLY when NMR-spinspin is requested -- START
294
if(.not.rtdb_get(rtdb,'zora:skip_hypAOev',
295
& mt_log,1,skip_hypAOev))
296
& skip_hypAOev = .false.
297
if (nospin.eq.0 .and. .not.(skip_hypAOev)) then
298
call get_NMRHFine_ZORA(rtdb,g_dens_at,nexc,
303
c ----- execute this code ONLY when NMR-spinspin is requested -- END
304
c ----- execute this code ONLY when EPR-gshift is requested -- START
305
skip_gshiftAOev = .false.
306
if(.not.rtdb_get(rtdb,'zora:skip_gshiftAOev',
307
& mt_log,1,skip_gshiftAOev))
308
& skip_gshiftAOev = .false.
310
if (ga_nodeid().eq.0)
311
& write(*,22) nogshift,skip_gshiftAOev,done_Fji
312
22 format('(nogshift,skip_gshiftAOev,done_Fji)=(',
313
& i2,',',L,',',L,')')
315
if (nogshift.eq.0 .and. .not.(skip_gshiftAOev)) then
316
call get_EPRg(rtdb,g_dens_at,nexc,
322
c ----- execute this code ONLY when EPR-gshift is requested -- END
323
if ((nogiao .eq.0 .and. .not.(skip_csAOev)).or.
324
& (nogshift.eq.0 .and. .not.(skip_gshiftAOev))) then
325
if (.not.ga_destroy(ga_Fji)) call
326
& errquit('dft_zora_utils: ga_destroy failed ga_Fji',
329
c ----- execute this code ONLY when EFGZ4 is requested -- START
330
if(.not.rtdb_get(rtdb,'zora:skip_efgz4AOev',
331
& mt_log,1,skip_efgz4AOev))
332
& skip_efgz4AOev = .false.
333
if (noelfgZ4.eq.0 .and. .not.(skip_efgz4AOev)) then
334
call get_rhoS(rtdb,g_dens_at,nexc,
335
& geom,ao_bas_han,nbf,nbf_ao,
338
c ----- execute this code ONLY when EFGZ4 is requested -- END
340
if (.not.ma_free_heap(l_vecs)) call errquit
341
& ('dft_zora_utils, ma_free_heap of l_vecs failed',911,MA_ERR)
342
if (.not. ga_destroy(g_orb)) call errquit(
343
& 'zora_scale_evals: ga_destroy failed ',0, GA_ERR)
344
if (.not. ga_destroy(g_dens_sf)) call errquit(
345
& 'zora_scale_evals: ga_destroy failed ',0, GA_ERR)
347
if (.not. ga_destroy(g_densZ4(i))) call errquit(
348
& 'dft_zora_utils: ga_destroy failed ',0, GA_ERR)
351
if (.not. ga_destroy(g_densZ4(3))) call errquit(
352
& 'dft_zora_utils: ga_destroy failed ',0, GA_ERR)
355
do_zora_get_correction=do_zgc_old ! restore value
360
czora...Inquire if the zora correction file is present
362
logical function dft_zora_inquire_file(filename)
366
#include "errquit.fh"
369
#include "msgtypesf.h"
370
#include "mafdecls.fh"
377
character*(*) filename
382
c Inquire if file is present
383
inquire(file=filename,exist=found)
384
dft_zora_inquire_file = found
391
czora...Read in the zora atomic corrections from disk
393
logical function dft_zora_read(filename, nbf, nsets, nmo,
394
& mult, g_zora_sf, g_zora_scale_sf)
398
#include "errquit.fh"
401
#include "msgtypesf.h"
402
#include "mafdecls.fh"
409
integer nsets ! restricted or unrestricted
410
character*(*) filename
411
integer iset ! restricted or unrestricted
412
integer g_zora_sf(nsets)
413
integer g_zora_scale_sf(nsets)
415
integer nbf ! No. of functions in basis
417
integer mult ! multiplicity
418
integer ok, jset, i, j
419
integer l_zora, k_zora
422
parameter (unitno = 77)
423
integer inntsize,ddblsize
425
integer nsets_read ! No. of sets from file
426
integer nbf_read ! No. of functions from file
429
c Initialise to invalid MA handle
432
inntsize=MA_sizeof(MT_INT,1,MT_BYTE)
433
ddblsize=MA_sizeof(MT_DBL,1,MT_BYTE)
437
if (ga_nodeid() .eq. 0) then
439
c Print a message indicating the file being read
440
write(6,22) filename(1:inp_strlen(filename))
441
22 format(/' Read atomic ZORA corrections from ',a/)
442
call util_flush(luout)
445
open(unitno, status='old', form='unformatted', file=filename,
448
c Read in some basics to check if they are consistent with the calculation
449
read(unitno, err=1001, end=1001) nsets_read
450
read(unitno, err=1001, end=1001) nbf_read
451
read(unitno, err=1001, end=1001) mult_read
454
if ((nsets_read .ne. nsets)
455
& .or. (nbf_read .ne. nbf)
456
& .or. (mult_read .ne. mult) ) goto 1003
458
c Allocate the temporary buffer
459
if (.not. ma_push_get(mt_dbl,nbf,'dft_zora_read',l_zora,k_zora))
460
$ call errquit('dft_zora_read: ma failed', nbf, MA_ERR)
465
call sread(unitno, dbl_mb(k_zora), nbf)
466
call ga_put(g_zora_sf(iset), 1, nbf, i, i, dbl_mb(k_zora), 1)
470
c Read in g_zora_scale_sf
473
call sread(unitno, dbl_mb(k_zora), nbf)
474
call ga_put(g_zora_scale_sf(iset), 1, nbf, i, i,
480
close(unitno,err=1002)
483
c Deallocate the temporary buffer
484
if (.not. ma_pop_stack(l_zora)) call errquit
485
$ ('dft_zora_read: pop failed', l_zora, MA_ERR)
489
c Broadcast status to other nodes
490
10 call ga_brdcst(Msg_Vec_Stat+MSGINT, ok, inntsize, 0) ! Propagate status
493
c write(6,*)' g_zora_sf(1) from dft_scf'
494
c call ga_print(g_zora_sf(1))
495
c write(6,*)' g_zora_scale_sf(1) from dft_scf'
496
c call ga_print(g_zora_scale_sf(1))
498
dft_zora_read = ok .eq. 1
501
1000 write(6,*) 'dft_zora_read: failed to open',
502
$ filename(1:inp_strlen(filename))
503
call util_flush(luout)
507
1001 write(6,*) 'dft_zora_read: failed to read',
508
$ filename(1:inp_strlen(filename))
509
call util_flush(luout)
511
close(unitno,err=1002)
514
1003 write(6,*) 'dft_zora_read: file inconsistent with calculation',
515
$ filename(1:inp_strlen(filename))
516
call util_flush(luout)
518
close(unitno,err=1002)
521
1002 write(6,*) 'dft_zora_read: failed to close',
522
$ filename(1:inp_strlen(filename))
523
call util_flush(luout)
529
czora...Write out the zora atomic corrections to disk
531
logical function dft_zora_write(rtdb, basis, filename,
532
& nbf, nsets, nmo, mult, g_zora_sf, g_zora_scale_sf)
536
#include "errquit.fh"
537
#include "mafdecls.fh"
540
#include "msgtypesf.h"
552
integer rtdb ! [input] RTDB handle (-1 if not accessible)
553
integer basis ! [input] Basis handle(-1 if not accessible)
554
character*(*) filename ! [input] File to write to
555
integer nbf ! [input] No. of functions in basis
556
integer nsets ! [input] No. of sets of matrices
557
integer nmo(nsets) ! [input] No. of mos in each set
560
integer g_zora_sf(nsets)
561
integer g_zora_scale_sf(nsets)
564
parameter (unitno = 77)
568
integer l_zora, k_zora
569
integer ok, iset, i, j
570
integer geom, ma_type, nelem
572
character*32 geomsum, basissum, key
573
character*20 scftype20
574
character*128 basis_name, trans_name
575
double precision energy, enrep
578
l_zora = -1 ! An invalid MA handle
580
inntsize=MA_sizeof(MT_INT,1,MT_BYTE)
585
c Read routines should be consistent with this
587
c Write out the atomic zora corrections
589
if (ga_nodeid() .eq. 0) then
592
open(unitno, status='unknown', form='unformatted',
593
$ file=filename, err=1000)
595
c Write out the number of sets and basis functions
596
write(unitno, err=1001) nsets
597
write(unitno, err=1001) nbf
598
write(unitno, err=1001) mult
600
c Allocate the temporary buffer
601
if (.not. ma_push_get(mt_dbl,nbf,'dft_zora_write',l_zora,k_zora))
602
$ call errquit('dft_zora_write: ma failed', nbf, MA_ERR)
604
c Write out g_zora_sf
607
call ga_get(g_zora_sf(iset), 1, nbf, i, i, dbl_mb(k_zora),1)
608
call swrite(unitno, dbl_mb(k_zora), nbf)
612
c Write out g_zora_scale_sf
615
call ga_get(g_zora_scale_sf(iset), 1, nbf, i, i,
617
call swrite(unitno, dbl_mb(k_zora), nbf)
621
c Deallocate the temporary buffer
622
if (.not. ma_pop_stack(l_zora))
623
$ call errquit('dft_zora_write: ma pop failed', l_zora, MA_ERR)
626
close(unitno,err=1002)
631
c Broadcast status to other nodes
632
10 call ga_brdcst(Msg_Vec_Stat+MSGINT, ok, inntsize, 0) ! Propagate status
635
c write(6,*)' g_zora_sf(1) from dft_scf'
636
c call ga_print(g_zora_sf(1))
637
c write(6,*)' g_zora_scale_sf(1) from dft_scf'
638
c call ga_print(g_zora_scale_sf(1))
640
dft_zora_write = (ok .eq. 1)
641
if (ga_nodeid() .eq. 0) then
642
write(6,22) filename(1:inp_strlen(filename))
643
22 format(/' Wrote atomic ZORA corrections to ',a/)
644
call util_flush(luout)
649
1000 write(6,*) 'dft_zora_write: failed to open ',
650
$ filename(1:inp_strlen(filename))
651
call util_flush(luout)
655
1001 write(6,*) 'dft_zora_write: failed to write ',
656
$ filename(1:inp_strlen(filename))
657
call util_flush(luout)
659
close(unitno,err=1002)
662
1002 write(6,*) 'dft_zora_write: failed to close',
663
$ filename(1:inp_strlen(filename))
664
call util_flush(luout)
670
c Convergence check for zora calculations
672
subroutine dft_zora_scfcvg(rms, derr, etold, etnew, e_conv,
673
& d_conv, g_conv, ipol, iter, iterations,
674
& idone, rtdb, converged, diising)
676
c $Id: dft_zora_utils.F 21851 2012-01-25 00:02:19Z niri $
679
#include "errquit.fh"
681
double precision rms(2) ! [input]
682
double precision derr(2) ! [input]
683
double precision etold ! [input]
684
double precision etnew ! [input]
685
double precision e_conv ! [input]
686
double precision d_conv ! [input]
687
double precision g_conv ! [input]
688
integer ipol ! [input]
689
integer iter ! [input]
690
integer iterations ! [input]
691
integer idone ! [output]
692
integer rtdb ! [input]
693
logical converged ! [output]
694
logical diising ! [input]
696
#include "mafdecls.fh"
699
logical e_conv_logical, d_conv_logical, g_conv_logical
700
logical ENERGY, DENSITY, GRADIENT
701
double precision de, abde
705
e_conv_logical = .false.
706
d_conv_logical = .false.
707
g_conv_logical = .false.
710
DENSITY = d_conv.gt.0
711
GRADIENT = g_conv.gt.0
715
c Evaluate change in energy.
721
c Check to see if energy is converged.
724
if (abde.lt.e_conv)e_conv_logical = .true.
726
e_conv_logical = .true.
729
c Check for density matrix convergence.
732
if (dsqrt(rms(1)).le.d_conv)d_conv_logical = .true.
734
if (dsqrt(rms(2)).le.d_conv) then
735
d_conv_logical = d_conv_logical.and..true.
737
d_conv_logical = d_conv_logical.and..false.
741
d_conv_logical = .true.
744
c Check for gradient convergence.
746
if (GRADIENT.and.diising)then
747
if (derr(1).le.g_conv)g_conv_logical = .true.
749
if (derr(2).le.g_conv) then
750
g_conv_logical = g_conv_logical.and..true.
752
g_conv_logical = g_conv_logical.and..false.
756
g_conv_logical = .true.
759
c Check over-all convergence.
761
converged = e_conv_logical
762
if (converged)idone = 1
764
c Check iteration value.
768
elseif (iter.eq.iterations)then
772
c If all convergence criterion met or number of iterations has been
773
c exceeded, write "converged" to RTDB.
776
if (.not.rtdb_put(rtdb, 'dft:converged', MT_LOG, 1, converged))
777
& call errquit('dft_scfcvg: rtdb_put failed', 1, RTDB_ERR)