1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2!  This module contains the following active subroutines:
3!     Total_Energy_Report, One_electron_energy_Report, Core_Electron_Report,
4!       Valence_Electron_Report, Total_FCEnergy_Report, Report_AESCF,
5!       Report_FCSCF, summary_report
6!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7
8#if defined HAVE_CONFIG_H
9#include "config.h"
10#endif
11
12MODULE report_mod
13
14  USE atomdata
15  USE gridmod
16  USE excor
17
18  IMPLICIT NONE
19
20CONTAINS
21
22
23  SUBROUTINE Total_Energy_Report(SCF,IF)
24    TYPE (SCFinfo) ,INTENT(INOUT) :: SCF
25    INTEGER, INTENT(IN) :: IF
26
27    WRITE(IF,*)
28    WRITE(IF,*) ' Total energies'
29    WRITE(IF,*) '    One-electron contribution:  ',SCF%eone
30    WRITE(IF,*) '    Kinetic energy contribution:',SCF%ekin
31    WRITE(IF,*) '    Coulomb contribution     :  ',SCF%ecoul
32    WRITE(IF,*) '    Electrostatic contribution: ',SCF%estatic
33    WRITE(IF,*) '    Exch        contribution :  ',SCF%eexc
34      SCF%etot=SCF%ekin+SCF%estatic+SCF%eexc
35    WRITE(IF,*) '    Ratio Pot/Kin            :  ',&
36&                  (SCF%estatic+SCF%eexc)/SCF%ekin
37   If (ColleSalvetti) then
38    WRITE(IF,*) '    CS correlation           :  ',SCF%oepcs
39    SCF%etot=SCF%etot+SCF%oepcs
40   endif
41
42    WRITE(IF,*) '    Total                    :  ',SCF%etot
43
44  END SUBROUTINE Total_Energy_Report
45
46!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
47  SUBROUTINE One_electron_energy_Report(Orbit,IF)
48    TYPE (Orbitinfo) ,INTENT(IN) :: Orbit
49    INTEGER, INTENT(IN) :: IF
50
51    INTEGER :: io
52
53    WRITE(IF,*)
54    WRITE(IF,*) 'Orbital energies'
55    If (diracrelativistic) then
56    WRITE(IF,"(' n   kappa   l   occupancy            energy')")
57    IF (frozencorecalculation) THEN
58       DO io=1,Orbit%norbit
59          IF (.NOT.Orbit%iscore(io)) &
60&              WRITE(IF,'(i2,1x,i2,2x,i2,4x,1p,2e15.7)') &
61&              Orbit%np(io),Orbit%kappa(io),Orbit%l(io),Orbit%occ(io),Orbit%eig(io)
62       ENDDO
63    ELSE
64       DO io=1,Orbit%norbit
65          WRITE(IF,'(i2,1x,i2,2x,i2,4x,1p,2e15.7)') &
66&              Orbit%np(io),Orbit%kappa(io),Orbit%l(io),Orbit%occ(io),Orbit%eig(io)
67       ENDDO
68    ENDIF
69
70    else
71    WRITE(IF,"(' n  l     occupancy            energy')")
72    IF (frozencorecalculation) THEN
73       DO io=1,Orbit%norbit
74          IF (.NOT.Orbit%iscore(io)) &
75&              WRITE(IF,'(i2,1x,i2,4x,1p,2e15.7)') &
76&              Orbit%np(io),Orbit%l(io),Orbit%occ(io),Orbit%eig(io)
77       ENDDO
78    ELSE
79       DO io=1,Orbit%norbit
80          WRITE(IF,'(i2,1x,i2,4x,1p,2e15.7)') &
81&              Orbit%np(io),Orbit%l(io),Orbit%occ(io),Orbit%eig(io)
82       ENDDO
83    ENDIF
84    endif
85  END SUBROUTINE One_electron_energy_Report
86
87!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
88  SUBROUTINE Core_Electron_Report(Orbit,FC,IF)
89    TYPE (Orbitinfo) ,INTENT(IN) :: Orbit
90    TYPE (FCinfo) ,INTENT(IN) :: FC
91    INTEGER, INTENT(IN) :: IF
92
93    INTEGER :: io
94
95    IF (.NOT.frozencorecalculation) RETURN
96
97    WRITE(IF,*)
98    WRITE(IF,*) ' All-Electron core states (zcore)', FC%zcore
99    WRITE(IF,"(' n  l     occupancy            energy')")
100    DO io=1,Orbit%norbit
101       IF (Orbit%iscore(io)) &
102&           WRITE(IF,'(i2,1x,i2,4x,1p,2e15.7)') &
103&           Orbit%np(io),Orbit%l(io),Orbit%occ(io),Orbit%eig(io)
104    ENDDO
105  END SUBROUTINE Core_Electron_Report
106
107!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
108  SUBROUTINE Valence_Electron_Report(Orbit,FC,IF)
109    TYPE (Orbitinfo) ,INTENT(IN) :: Orbit
110    TYPE (FCinfo) ,INTENT(IN) :: FC
111    INTEGER, INTENT(IN) :: IF
112
113    INTEGER :: io
114
115    IF (.NOT.frozencorecalculation) RETURN
116
117    WRITE(IF,*)
118    WRITE(IF,*) ' All-Electron valence states (zvale)', FC%zvale
119    WRITE(IF,*) ' Below are listed the All-Electron valence states'
120    WRITE(IF,"(' n  l     occupancy            energy')")
121    DO io=1,Orbit%norbit
122       IF (.not.Orbit%iscore(io)) &
123&           WRITE(IF,'(i2,1x,i2,4x,1p,2e15.7)') &
124&           Orbit%np(io),Orbit%l(io),Orbit%occ(io),Orbit%eig(io)
125    ENDDO
126  END SUBROUTINE Valence_Electron_Report
127
128!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
129  SUBROUTINE Total_FCEnergy_Report(SCF,IF)
130    TYPE (SCFinfo) ,INTENT(INOUT) :: SCF
131    INTEGER, INTENT(IN) :: IF
132
133    WRITE(IF,*)
134    WRITE(IF,*) ' Valence energies'
135    WRITE(IF,*) '    Kinetic energy contribution:',SCF%valekin
136    WRITE(IF,*) '    Coulomb contribution     :  ',SCF%valecoul
137    WRITE(IF,*) '    Exch        contribution :  ',SCF%valeexc
138
139     SCF%evale=SCF%valekin+SCF%valecoul+SCF%valeexc
140
141    WRITE(IF,*) '    Total valence            :  ',SCF%evale
142
143  END SUBROUTINE Total_FCEnergy_Report
144
145!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
146  !  Report SCF AE
147  !
148!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
149  SUBROUTINE Report_AESCF(Grid,AEPot,AEOrbit)
150    TYPE(GridInfo), INTENT(IN) :: Grid
151    TYPE(PotentialInfo), INTENT(IN) :: AEPot
152    TYPE(OrbitInfo), INTENT(IN) :: AEOrbit
153    INTEGER i,j,n
154
155    n=Grid%n
156    OPEN (unit=1001,file='AE_pot')
157    DO i = 1,n
158       WRITE(1001,'(1p,9e15.7)') Grid%r(i),AEPot%rv(i) ,&
159&           AEPOt%rvx(i),AEPot%rvh(i),AEPot%rvn(i),AEOrbit%den(i), &
160&           AEOrbit%tau(i),AEPot%vtau(i)
161    ENDDO
162    CLOSE(1001)
163
164    OPEN (unit=1001,file='AE_wfn')
165    DO i = 1,n
166       WRITE(1001,'(1p,50e15.7)') Grid%r(i),&
167&           (AEOrbit%wfn(i,j),j=1,AEOrbit%norbit)
168    ENDDO
169    CLOSE(1001)
170
171  END SUBROUTINE Report_AESCF
172
173!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
174  !  Report SCF FC
175  !
176!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
177  SUBROUTINE Report_FCSCF(Grid,FCPOT,FCOrbit)
178    TYPE(GridInfo), INTENT(IN) :: Grid
179    TYPE(PotentialInfo), INTENT(IN) :: FCPot
180    TYPE(OrbitInfo), INTENT(IN) :: FCOrbit
181
182    INTEGER i,j,n
183
184    n=Grid%n
185    OPEN (unit=2001,file='FC_Pot')
186    DO i = 1,n
187       WRITE(1001,'(1p,9e15.7)') Grid%r(i),FCPot%rv(i) ,&
188&           FCPot%rvx(i),FCPot%rvh(i),FCPot%rvn(i),FCOrbit%den(i), &
189&           FCOrbit%tau(i),FCPot%vtau(i)
190    ENDDO
191    CLOSE(2001)
192
193
194    OPEN (unit=2001,file='FC_wfn')
195    DO i = 1,n
196       WRITE(2001,'(1p,50e15.7)') Grid%r(i),&
197&           (FCOrbit%wfn(i,j),j=1,FCOrbit%norbit)
198    ENDDO
199    CLOSE(2001)
200
201  END SUBROUTINE Report_FCSCF
202
203  SUBROUTINE summary_report(ifen,key,Grid,Orbit,Pot,SCF)
204    INTEGER, INTENT(IN) :: ifen
205    CHARACTER(2), INTENT(IN) :: key
206    TYPE(GridInfo), INTENT(IN) :: Grid
207    TYPE(OrbitInfo), INTENT(IN) :: Orbit
208    TYPE(PotentialInfo), INTENT(IN) :: Pot
209    TYPE(SCFInfo), INTENT(IN) :: SCF
210
211
212    WRITE(ifen,*)
213    WRITE(ifen,*) 'Completed calculations for ',TRIM(POT%sym)
214    IF (TRIM(Orbit%exctype)=='EXX') THEN
215       WRITE(ifen,*) 'Exact exchange calculation'
216    ELSEIF (TRIM(Orbit%exctype)=='EXXKLI') THEN
217       WRITE(ifen,*) 'Exact exchange KLI calculation'
218    ELSEIF (TRIM(Orbit%exctype)=='EXXOCC') THEN
219       WRITE(ifen,*) 'Exact exchange OCC calculation'
220    ELSEIF (TRIM(Orbit%exctype)=='HF') THEN
221       WRITE(ifen,*) 'Hartree Fock calculation'
222    ELSE
223       CALL Report_EXC(ifen)
224    ENDIF
225
226    CALL reportgrid(Grid,ifen)
227    IF (scalarrelativistic) THEN
228       IF(.NOT.finitenucleus) THEN
229          WRITE(ifen,*) 'Scalar relativistic calculation -- point nucleus'
230       ELSE
231          WRITE(ifen,*) &
232&              'Scalar relativistic calculation -- finite (Gaussian) nucleus'
233       ENDIF
234    ELSEIF (diracrelativistic) then
235       WRITE(ifen,*) 'Dirac-relativistic calculation'
236    ELSE
237       WRITE(ifen,*) 'Non-relativistic calculation'
238    ENDIF
239
240    IF (key=='AE'.OR.key=='NC') &
241&        WRITE(ifen,*) '  AEatom converged in',SCF%iter,' iterations'
242    IF (key=='FC'.OR.key=='SC') &
243&        WRITE(ifen,*) '  FCatom converged in',SCF%iter,' iterations'
244    WRITE(ifen,'(a,i3)') '     for nz = ',Pot%nz
245    WRITE(ifen,*) '    delta  = ', SCF%delta
246    CALL One_electron_energy_Report(Orbit,ifen)
247    WRITE(ifen,*)
248    WRITE(ifen,*) ' Total energy'
249    WRITE(ifen,*) '    Total                    :  ',SCF%etot
250    IF (key=='FC'.OR.key=='SC') THEN
251       WRITE(ifen,*) '    Valence                  :  ',SCF%evale
252    ENDIF
253
254  END SUBROUTINE summary_report
255
256END MODULE report_mod
257
258