(git:a145afa)
Loading...
Searching...
No Matches
atom_output.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Routines that print various information about an atomic kind.
10! **************************************************************************************************
12 USE atom_types, ONLY: &
14 ecp_pseudo, gth_pseudo, gto_basis, lmat, no_pseudo, num_basis, sgp_pseudo, sto_basis, &
15 upf_pseudo
16 USE atom_utils, ONLY: get_maxl_occ,&
19 USE cp_files, ONLY: close_file,&
21 USE input_constants, ONLY: &
30 USE kinds, ONLY: default_string_length,&
31 dp
32 USE mathconstants, ONLY: dfac,&
33 pi,&
34 rootpi
35 USE periodic_table, ONLY: ptable
36 USE physcon, ONLY: evolt
40 USE xmgrace, ONLY: xm_graph_data,&
45#include "./base/base_uses.f90"
46
47 IMPLICIT NONE
48
49 PRIVATE
50
51 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'atom_output'
52
57
58CONTAINS
59
60! **************************************************************************************************
61!> \brief Print an information string related to the atomic kind.
62!> \param zval atomic number
63!> \param info information string
64!> \param iw output file unit
65!> \par History
66!> * 09.2008 created [Juerg Hutter]
67! **************************************************************************************************
68 SUBROUTINE atom_print_info(zval, info, iw)
69 INTEGER, INTENT(IN) :: zval
70 CHARACTER(len=*), INTENT(IN) :: info
71 INTEGER, INTENT(IN) :: iw
72
73 WRITE (iw, '(/," ",A,T40,A," [",A,"]",T62,"Atomic number:",T78,I3,/)') &
74 adjustl(trim(info)), trim(ptable(zval)%name), trim(ptable(zval)%symbol), zval
75
76 END SUBROUTINE atom_print_info
77
78! **************************************************************************************************
79!> \brief Print information about electronic state.
80!> \param state electronic state
81!> \param iw output file unit
82!> \par History
83!> * 02.2010 unrestricted KS and HF methods [Juerg Hutter]
84!> * 11.2009 print multiplicity [Juerg Hutter]
85!> * 08.2008 created [Juerg Hutter]
86! **************************************************************************************************
87 SUBROUTINE atom_print_state(state, iw)
88 TYPE(atom_state) :: state
89 INTEGER, INTENT(IN) :: iw
90
91 CHARACTER(LEN=1), DIMENSION(0:7), PARAMETER :: &
92 label = ["S", "P", "D", "F", "G", "H", "I", "K"]
93
94 INTEGER :: j, l, mc, mlc, mlo, mm(0:lmat), mo
95
96 cpassert(lmat <= 7)
97 WRITE (iw, '(/,T2,A)') "Electronic structure"
98 WRITE (iw, '(T5,A,T71,F10.2)') "Total number of core electrons", sum(state%core)
99 WRITE (iw, '(T5,A,T71,F10.2)') "Total number of valence electrons", sum(state%occ)
100 WRITE (iw, '(T5,A,T71,F10.2)') "Total number of electrons", sum(state%occ + state%core)
101 SELECT CASE (state%multiplicity)
102 CASE (-1)
103 WRITE (iw, '(T5,A,T68,A)') "Multiplicity", "not specified"
104 CASE (-2)
105 WRITE (iw, '(T5,A,T72,A)') "Multiplicity", "high spin"
106 CASE (-3)
107 WRITE (iw, '(T5,A,T73,A)') "Multiplicity", "low spin"
108 CASE (1)
109 WRITE (iw, '(T5,A,T74,A)') "Multiplicity", "singlet"
110 CASE (2)
111 WRITE (iw, '(T5,A,T74,A)') "Multiplicity", "doublet"
112 CASE (3)
113 WRITE (iw, '(T5,A,T74,A)') "Multiplicity", "triplet"
114 CASE (4)
115 WRITE (iw, '(T5,A,T74,A)') "Multiplicity", "quartet"
116 CASE (5)
117 WRITE (iw, '(T5,A,T74,A)') "Multiplicity", "quintet"
118 CASE (6)
119 WRITE (iw, '(T5,A,T75,A)') "Multiplicity", "sextet"
120 CASE (7)
121 WRITE (iw, '(T5,A,T75,A)') "Multiplicity", "septet"
122 CASE DEFAULT
123 END SELECT
124
125 mlo = get_maxl_occ(state%occ)
126 mlc = get_maxl_occ(state%core)
127 mm = get_maxn_occ(state%core)
128
129 IF (state%multiplicity == -1) THEN
130 DO l = 0, max(mlo, mlc)
131 mo = state%maxn_occ(l)
132 IF (sum(state%core(l, :)) == 0) THEN
133 WRITE (iw, '(A5,T10,10F6.2)') label(l), (state%occ(l, j), j=1, mo)
134 ELSE
135 mc = mm(l)
136 cpassert(sum(state%occ(l, 1:mc)) == 0)
137 WRITE (iw, advance="no", fmt='(A5,T9,A1,10F6.2)') label(l), "[", (state%core(l, j), j=1, mc)
138 WRITE (iw, fmt='(A1,F5.2,10F6.2)') "]", (state%occ(l, j), j=mc + 1, mc + mo)
139 END IF
140 END DO
141 ELSE
142 WRITE (iw, '(T5,A)') "Alpha Electrons"
143 DO l = 0, max(mlo, mlc)
144 mo = state%maxn_occ(l)
145 IF (sum(state%core(l, :)) == 0) THEN
146 WRITE (iw, '(A5,T10,10F6.2)') label(l), (state%occa(l, j), j=1, mo)
147 ELSE
148 mc = mm(l)
149 WRITE (iw, advance="no", fmt='(A5,T9,A1,10F6.2)') label(l), "[", (0.5_dp*state%core(l, j), j=1, mc)
150 WRITE (iw, fmt='(A1,F5.2,10F6.2)') "]", (state%occa(l, j), j=1, mo)
151 END IF
152 END DO
153 WRITE (iw, '(T5,A)') "Beta Electrons"
154 DO l = 0, max(mlo, mlc)
155 mo = state%maxn_occ(l)
156 IF (sum(state%core(l, :)) == 0) THEN
157 WRITE (iw, '(A5,T10,10F6.2)') label(l), (state%occb(l, j), j=1, mo)
158 ELSE
159 mc = mm(l)
160 WRITE (iw, advance="no", fmt='(A5,T9,A1,10F6.2)') label(l), "[", (0.5_dp*state%core(l, j), j=1, mc)
161 WRITE (iw, fmt='(A1,F5.2,10F6.2)') "]", (state%occb(l, j), j=1, mo)
162 END IF
163 END DO
164 END IF
165 WRITE (iw, *)
166
167 END SUBROUTINE atom_print_state
168
169! **************************************************************************************************
170!> \brief Print energy components.
171!> \param atom information about the atomic kind
172!> \param iw output file unit
173!> \par History
174!> * 05.2010 print virial coefficient [Juerg Hutter]
175!> * 02.2010 unrestricted KS and HF methods [Juerg Hutter]
176!> * 09.2008 print orbital energies [Juerg Hutter]
177!> * 08.2008 created [Juerg Hutter]
178! **************************************************************************************************
179 SUBROUTINE atom_print_energies(atom, iw)
180 TYPE(atom_type) :: atom
181 INTEGER, INTENT(IN) :: iw
182
183 INTEGER :: i, l, n
184 REAL(kind=dp) :: drho
185
186 WRITE (iw, '(/,A,T36,A,T61,F20.12)') " Energy components [Hartree]", &
187 " Total Energy ::", atom%energy%etot
188 WRITE (iw, '(T36,A,T61,F20.12)') " Band Energy ::", atom%energy%eband
189 WRITE (iw, '(T36,A,T61,F20.12)') " Kinetic Energy ::", atom%energy%ekin
190 WRITE (iw, '(T36,A,T61,F20.12)') "Potential Energy ::", atom%energy%epot
191 IF (atom%energy%ekin /= 0.0_dp) THEN
192 WRITE (iw, '(T36,A,T61,F20.12)') " Virial (-V/T) ::", -atom%energy%epot/atom%energy%ekin
193 END IF
194 WRITE (iw, '(T36,A,T61,F20.12)') " Core Energy ::", atom%energy%ecore
195 IF (atom%energy%exc /= 0._dp) THEN
196 WRITE (iw, '(T36,A,T61,F20.12)') " XC Energy ::", atom%energy%exc
197 END IF
198 WRITE (iw, '(T36,A,T61,F20.12)') " Coulomb Energy ::", atom%energy%ecoulomb
199 IF (atom%energy%eexchange /= 0._dp) THEN
200 WRITE (iw, '(T34,A,T61,F20.12)') "HF Exchange Energy ::", atom%energy%eexchange
201 END IF
202 IF (atom%potential%ppot_type /= no_pseudo) THEN
203 WRITE (iw, '(T20,A,T61,F20.12)') " Total Pseudopotential Energy ::", atom%energy%epseudo
204 WRITE (iw, '(T20,A,T61,F20.12)') " Local Pseudopotential Energy ::", atom%energy%eploc
205 IF (atom%energy%elsd /= 0._dp) THEN
206 WRITE (iw, '(T20,A,T61,F20.12)') " Local Spin-potential Energy ::", atom%energy%elsd
207 END IF
208 WRITE (iw, '(T20,A,T61,F20.12)') " Nonlocal Pseudopotential Energy ::", atom%energy%epnl
209 END IF
210 IF (atom%potential%confinement) THEN
211 WRITE (iw, '(T36,A,T61,F20.12)') " Confinement ::", atom%energy%econfinement
212 END IF
213
214 IF (atom%state%multiplicity == -1) THEN
215 WRITE (iw, '(/,A,T20,A,T30,A,T36,A,T49,A,T71,A,/)') " Orbital energies", &
216 "State", "L", "Occupation", "Energy[a.u.]", "Energy[eV]"
217 DO l = 0, atom%state%maxl_calc
218 n = atom%state%maxn_calc(l)
219 DO i = 1, n
220 WRITE (iw, '(T23,I2,T30,I1,T36,F10.3,T46,F15.6,T66,F15.6)') &
221 i, l, atom%state%occupation(l, i), atom%orbitals%ener(i, l), atom%orbitals%ener(i, l)*evolt
222 END DO
223 IF (n > 0) WRITE (iw, *)
224 END DO
225 ELSE
226 WRITE (iw, '(/,A,T20,A,T30,A,T36,A,T42,A,T55,A,T71,A,/)') " Orbital energies", &
227 "State", "Spin", "L", "Occupation", "Energy[a.u.]", "Energy[eV]"
228 DO l = 0, atom%state%maxl_calc
229 n = atom%state%maxn_calc(l)
230 DO i = 1, n
231 WRITE (iw, '(T23,I2,T29,A,T36,I1,T42,F10.3,T52,F15.6,T68,F13.6)') &
232 i, "alpha", l, atom%state%occa(l, i), atom%orbitals%enera(i, l), atom%orbitals%enera(i, l)*evolt
233 END DO
234 DO i = 1, n
235 WRITE (iw, '(T23,I2,T29,A,T36,I1,T42,F10.3,T52,F15.6,T68,F13.6)') &
236 i, " beta", l, atom%state%occb(l, i), atom%orbitals%enerb(i, l), atom%orbitals%enerb(i, l)*evolt
237 END DO
238 IF (n > 0) WRITE (iw, *)
239 END DO
240 END IF
241
242 CALL get_rho0(atom, drho)
243 WRITE (iw, '(/,A,T66,F15.6)') " Total Electron Density at R=0: ", drho
244
245 END SUBROUTINE atom_print_energies
246
247! **************************************************************************************************
248!> \brief Printing of the atomic iterations when ZMP is active.
249!> \param iter current iteration number
250!> \param deps convergence
251!> \param atom intormation about the atomic kind
252!> \param iw output file unit
253!> \author D. Varsano [daniele.varsano@nano.cnr.it]
254! **************************************************************************************************
255 SUBROUTINE atom_print_zmp_iteration(iter, deps, atom, iw)
256 INTEGER, INTENT(IN) :: iter
257 REAL(dp), INTENT(IN) :: deps
258 TYPE(atom_type), INTENT(IN) :: atom
259 INTEGER, INTENT(IN) :: iw
260
261 IF (iter == 1) THEN
262 WRITE (iw, '(/," ",79("*"),/,T33,"Integral",T48,"Integral",/,T3,A,T16,A,T33,A,T46,A,T69,A/," ",79("*"))') &
263 "Iteration", "Convergence", "rho diff.", "rho*v_xc[au]", "Energy[au]"
264 END IF
265 WRITE (iw, '(T3,I9,T15,G13.6,T30,G13.6,T46,G13.6,T61,F20.12)') iter, deps, atom%rho_diff_integral, &
266 atom%energy%exc, atom%energy%etot
267
268 END SUBROUTINE atom_print_zmp_iteration
269
270! **************************************************************************************************
271!> \brief Print convergence information.
272!> \param iter current iteration number
273!> \param deps convergency
274!> \param etot total energy
275!> \param iw output file unit
276!> \par History
277!> * 08.2008 created [Juerg Hutter]
278! **************************************************************************************************
279 SUBROUTINE atom_print_iteration(iter, deps, etot, iw)
280 INTEGER, INTENT(IN) :: iter
281 REAL(dp), INTENT(IN) :: deps, etot
282 INTEGER, INTENT(IN) :: iw
283
284 IF (iter == 1) THEN
285 WRITE (iw, '(/," ",79("*"),/,T19,A,T38,A,T70,A,/," ",79("*"))') &
286 "Iteration", "Convergence", "Energy [au]"
287 END IF
288 WRITE (iw, '(T20,i8,T34,G14.6,T61,F20.12)') iter, deps, etot
289
290 END SUBROUTINE atom_print_iteration
291
292! **************************************************************************************************
293!> \brief Print atomic basis set.
294!> \param atom_basis atomic basis set
295!> \param iw output file unit
296!> \param title header to print on top of the basis set
297!> \par History
298!> * 09.2008 created [Juerg Hutter]
299! **************************************************************************************************
300 SUBROUTINE atom_print_basis(atom_basis, iw, title)
302 INTEGER, INTENT(IN) :: iw
303 CHARACTER(len=*) :: title
304
305 INTEGER :: i, j, l
306
307 WRITE (iw, '(/,A)') trim(title)
308 SELECT CASE (atom_basis%basis_type)
309 CASE (gto_basis)
310 IF (atom_basis%geometrical) THEN
311 WRITE (iw, '(/," ",21("*"),A,22("*"))') " Geometrical Gaussian Type Orbitals "
312 WRITE (iw, '(A,F15.8,T41,A,F15.8)') " Initial exponent: ", atom_basis%aval, &
313 " Proportionality factor: ", atom_basis%cval
314 ELSE
315 WRITE (iw, '(/," ",21("*"),A,21("*"))') " Uncontracted Gaussian Type Orbitals "
316 END IF
317 DO l = 0, lmat
318 IF (atom_basis%nbas(l) > 0) THEN
319 SELECT CASE (l)
320 CASE DEFAULT
321 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
322 "X Exponents: ", (i, atom_basis%am(i, l), i=1, atom_basis%nbas(l))
323 CASE (0)
324 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
325 "s Exponents: ", (i, atom_basis%am(i, 0), i=1, atom_basis%nbas(0))
326 CASE (1)
327 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
328 "p Exponents: ", (i, atom_basis%am(i, 1), i=1, atom_basis%nbas(1))
329 CASE (2)
330 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
331 "d Exponents: ", (i, atom_basis%am(i, 2), i=1, atom_basis%nbas(2))
332 CASE (3)
333 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
334 "f Exponents: ", (i, atom_basis%am(i, 3), i=1, atom_basis%nbas(3))
335 END SELECT
336 END IF
337 END DO
338 WRITE (iw, '(" ",79("*"))')
339 CASE (cgto_basis)
340 WRITE (iw, '(/," ",22("*"),A,22("*"))') " Contracted Gaussian Type Orbitals "
341 DO l = 0, lmat
342 IF (atom_basis%nbas(l) > 0) THEN
343 IF (l == 0) WRITE (iw, '(A)') " s Functions"
344 IF (l == 1) WRITE (iw, '(A)') " p Functions"
345 IF (l == 2) WRITE (iw, '(A)') " d Functions"
346 IF (l == 3) WRITE (iw, '(A)') " f Functions"
347 IF (l >= 3) WRITE (iw, '(A)') " x Functions"
348 DO i = 1, atom_basis%nprim(l)
349 WRITE (iw, '(F15.6,5(T21,6F10.6,/))') &
350 atom_basis%am(i, l), (atom_basis%cm(i, j, l), j=1, atom_basis%nbas(l))
351 END DO
352 END IF
353 END DO
354 WRITE (iw, '(" ",79("*"))')
355 CASE (sto_basis)
356 WRITE (iw, '(/," ",28("*"),A,29("*"))') " Slater Type Orbitals "
357 DO l = 0, lmat
358 DO i = 1, atom_basis%nbas(l)
359 SELECT CASE (l)
360 CASE DEFAULT
361 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, l), "X Exponent :", atom_basis%as(i, l)
362 CASE (0)
363 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 0), "S Exponent :", atom_basis%as(i, 0)
364 CASE (1)
365 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 1), "P Exponent :", atom_basis%as(i, 1)
366 CASE (2)
367 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 2), "D Exponent :", atom_basis%as(i, 2)
368 CASE (3)
369 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 3), "F Exponent :", atom_basis%as(i, 3)
370 END SELECT
371 END DO
372 END DO
373 WRITE (iw, '(" ",79("*"))')
374 CASE (num_basis)
375 cpabort("Numerical basis not yet implemented for atom_print_basis")
376 CASE DEFAULT
377 cpabort("Unknown basis type for atom_print_basis")
378 END SELECT
379
380 END SUBROUTINE atom_print_basis
381
382! **************************************************************************************************
383!> \brief Print the optimized atomic basis set into a file.
384!> \param atom_basis atomic basis set
385!> \param wfn ...
386!> \par History
387!> * 11.2016 revised output format [Matthias Krack]
388!> * 11.2011 Slater basis functions [Juerg Hutter]
389!> * 03.2011 created [Juerg Hutter]
390!> \note The basis set is stored as the file 'OPT_BASIS' inside the current working directory.
391!> It may be a good idea, however, to specify the name of this file via some input section.
392! **************************************************************************************************
393 SUBROUTINE atom_print_basis_file(atom_basis, wfn)
395 REAL(kind=dp), DIMENSION(:, :, 0:), OPTIONAL :: wfn
396
397 INTEGER :: i, im, iw, l
398 REAL(kind=dp) :: expzet, prefac, zeta
399
400 CALL open_file(file_name="OPT_BASIS", file_status="UNKNOWN", file_action="WRITE", unit_number=iw)
401 SELECT CASE (atom_basis%basis_type)
402 CASE (gto_basis)
403 IF (atom_basis%geometrical) THEN
404 WRITE (iw, '(/," ",21("*"),A,22("*"))') " Geometrical Gaussian Type Orbitals "
405 WRITE (iw, '(A,F15.8,T41,A,F15.8)') " Initial exponent: ", atom_basis%aval, &
406 " Proportionality factor: ", atom_basis%cval
407 ELSE
408 WRITE (iw, '(T3,A)') "BASIS_TYPE GAUSSIAN"
409 END IF
410 DO l = 0, lmat
411 IF (atom_basis%nbas(l) > 0) THEN
412 SELECT CASE (l)
413 CASE DEFAULT
414 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
415 "X_EXPONENTS ", (atom_basis%am(i, l), i=1, atom_basis%nbas(l))
416 CASE (0)
417 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
418 "S_EXPONENTS ", (atom_basis%am(i, 0), i=1, atom_basis%nbas(0))
419 CASE (1)
420 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
421 "P_EXPONENTS ", (atom_basis%am(i, 1), i=1, atom_basis%nbas(1))
422 CASE (2)
423 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
424 "D_EXPONENTS ", (atom_basis%am(i, 2), i=1, atom_basis%nbas(2))
425 CASE (3)
426 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
427 "F_EXPONENTS ", (atom_basis%am(i, 3), i=1, atom_basis%nbas(3))
428 END SELECT
429 END IF
430 END DO
431 CASE (cgto_basis)
432 CALL cp_abort(__location__, &
433 "Contracted Gaussian-type basis not yet implemented "// &
434 "for atom_print_basis_file")
435 CASE (sto_basis)
436 WRITE (iw, '(T3,A)') "BASIS_TYPE SLATER"
437 DO l = 0, lmat
438 IF (atom_basis%nbas(l) > 0) THEN
439 SELECT CASE (l)
440 CASE DEFAULT
441 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
442 "X_EXPONENTS ", (atom_basis%as(i, l), i=1, atom_basis%nbas(l))
443 WRITE (iw, '(T3,A,60I3)') &
444 "X_QUANTUM_NUMBERS ", (atom_basis%ns(i, l), i=1, atom_basis%nbas(l))
445 CASE (0)
446 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
447 "S_EXPONENTS ", (atom_basis%as(i, 0), i=1, atom_basis%nbas(0))
448 WRITE (iw, '(T3,A,60I3)') &
449 "S_QUANTUM_NUMBERS ", (atom_basis%ns(i, 0), i=1, atom_basis%nbas(0))
450 CASE (1)
451 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
452 "P_EXPONENTS ", (atom_basis%as(i, 1), i=1, atom_basis%nbas(1))
453 WRITE (iw, '(T3,A,60I3)') &
454 "P_QUANTUM_NUMBERS ", (atom_basis%ns(i, 1), i=1, atom_basis%nbas(1))
455 CASE (2)
456 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
457 "D_EXPONENTS ", (atom_basis%as(i, 2), i=1, atom_basis%nbas(2))
458 WRITE (iw, '(T3,A,60I3)') &
459 "D_QUANTUM_NUMBERS ", (atom_basis%ns(i, 2), i=1, atom_basis%nbas(2))
460 CASE (3)
461 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
462 "F_EXPONENTS ", (atom_basis%as(i, 3), i=1, atom_basis%nbas(3))
463 WRITE (iw, '(T3,A,60I3)') &
464 "F_QUANTUM_NUMBERS ", (atom_basis%ns(i, 3), i=1, atom_basis%nbas(3))
465 END SELECT
466 END IF
467 END DO
468 CASE (num_basis)
469 cpabort("Numerical basis not yet implemented for atom_print_basis_file")
470 CASE DEFAULT
471 cpabort("Unknown basis type for atom_print_basis_file")
472 END SELECT
473
474 IF (PRESENT(wfn)) THEN
475 SELECT CASE (atom_basis%basis_type)
476 CASE DEFAULT
477 CASE (gto_basis)
478 IF (.NOT. atom_basis%geometrical) THEN
479 WRITE (iw, '(/,T3,A)') "ORBITAL COEFFICENTS (Quickstep normalization)"
480 im = min(6, SIZE(wfn, 2))
481 DO l = 0, lmat
482 IF (atom_basis%nbas(l) > 0) THEN
483 WRITE (iw, '(T3,A,I3)') "L Quantum Number:", l
484 ! Quickstep normalization
485 expzet = 0.25_dp*real(2*l + 3, dp)
486 prefac = sqrt(rootpi/2._dp**(l + 2)*dfac(2*l + 1))
487 DO i = 1, atom_basis%nbas(l)
488 zeta = (2._dp*atom_basis%am(i, l))**expzet
489 WRITE (iw, '(T5,F14.8,2x,6F12.8)') atom_basis%am(i, l), wfn(i, 1:im, l)*prefac/zeta
490 END DO
491 END IF
492 END DO
493 END IF
494 END SELECT
495 END IF
496
497 CALL close_file(unit_number=iw)
498
499 END SUBROUTINE atom_print_basis_file
500
501! **************************************************************************************************
502!> \brief Print information about the electronic structure method in use.
503!> \param atom information about the atomic kind
504!> \param iw output file unit
505!> \par History
506!> * 09.2015 direct use of the LibXC Fortran interface [Andreas Gloess]
507!> * 10.2012 LibXC interface [Fabien Tran]
508!> * 02.2010 unrestricted KS and HF methods [Juerg Hutter]
509!> * 04.2009 print geometrical Gaussian type orbitals [Juerg Hutter]
510!> * 09.2008 new subroutine's prototype; print relativistic methods [Juerg Hutter]
511!> * 09.2008 created [Juerg Hutter]
512! **************************************************************************************************
513 SUBROUTINE atom_print_method(atom, iw)
514 TYPE(atom_type) :: atom
515 INTEGER, INTENT(IN) :: iw
516
517 CHARACTER(len=160) :: shortform
518 CHARACTER(len=:), ALLOCATABLE :: reference
519 INTEGER :: ifun, il, meth, myfun, reltyp
520 LOGICAL :: lsd
521 TYPE(section_vals_type), POINTER :: xc_fun, xc_fun_section, xc_section
522
523 NULLIFY (xc_fun, xc_fun_section, xc_section)
524
525 meth = atom%method_type
526
527 xc_section => atom%xc_section
528 xc_fun_section => section_vals_get_subs_vals(xc_section, "XC_FUNCTIONAL")
529 SELECT CASE (meth)
530 CASE DEFAULT
531 cpabort("Unknown method for atom_print_method")
532 CASE (do_rks_atom)
533 CALL section_vals_val_get(xc_fun_section, "_SECTION_PARAMETERS_", i_val=myfun)
534 CASE (do_uks_atom)
535 CALL section_vals_val_get(xc_fun_section, "_SECTION_PARAMETERS_", i_val=myfun)
536 CASE (do_rhf_atom)
537 myfun = xc_none
538 CASE (do_uhf_atom)
539 myfun = xc_none
540 CASE (do_rohf_atom)
541 myfun = xc_none
542 END SELECT
543
544 SELECT CASE (meth)
545 CASE DEFAULT
546 cpabort("Unknown method for atom_print_method")
547 CASE (do_rks_atom)
548 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Restricted Kohn-Sham Calculation')")
549 CASE (do_uks_atom)
550 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Unrestricted Kohn-Sham Calculation')")
551 CASE (do_rhf_atom)
552 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Restricted Hartree-Fock Calculation')")
553 CASE (do_uhf_atom)
554 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Unrestricted Hartree-Fock Calculation')")
555 CASE (do_rohf_atom)
556 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Restricted Open-Shell Kohn-Sham Calculation')")
557 END SELECT
558
559 ! zmp
560 IF (atom%do_zmp) THEN
561 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Method on atomic radial density')")
562 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Lambda : ',F5.1)") atom%lambda
563 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Reading external density : ',A20)") atom%ext_file
564 IF (atom%dm) THEN
565 IF (iw > 0) WRITE (iw, fmt="(' ZMP | The file is in the form of a density matrix')")
566 ELSE
567 IF (iw > 0) WRITE (iw, fmt="(' ZMP | The file is in the form of a linear density')")
568 END IF
569 IF (atom%doread) THEN
570 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Restarting calculation from ',A20,' file if present')") atom%zmp_restart_file
571 END IF
572 ELSE IF (atom%read_vxc) THEN
573 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Calculating density from external V_xc')")
574 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Reading external v_xc file : ',A20)") atom%ext_vxc_file
575 END IF
576
577 IF (atom%pp_calc) THEN
578 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Nonrelativistic Calculation')")
579 ELSE
580 reltyp = atom%relativistic
581
582 SELECT CASE (reltyp)
583 CASE DEFAULT
584 cpabort("Unknown relativistic type for atom_print_method")
585 CASE (do_nonrel_atom)
586 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Nonrelativistic Calculation')")
587 CASE (do_zoramp_atom)
588 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using ZORA(MP)')")
589 CASE (do_sczoramp_atom)
590 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using scaled ZORA(MP)')")
591 CASE (do_dkh0_atom)
592 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 0th order')")
593 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using kietic energy scaling')")
594 CASE (do_dkh1_atom)
595 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 1st order')")
596 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Foldy-Wouthuysen transformation')")
597 CASE (do_dkh2_atom)
598 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 2nd order')")
599 CASE (do_dkh3_atom)
600 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 3rd order')")
601 END SELECT
602 END IF
603
604 lsd = (meth == do_uks_atom)
605
606 IF (myfun /= xc_none) THEN
607 CALL xc_functionals_expand(xc_fun_section, xc_section)
608 IF (iw > 0) THEN
609 ifun = 0
610 DO
611 ifun = ifun + 1
612 xc_fun => section_vals_get_subs_vals2(xc_fun_section, i_section=ifun)
613 IF (.NOT. ASSOCIATED(xc_fun)) EXIT
614 IF (libxc_check_existence_in_libxc(xc_fun)) THEN
615 ALLOCATE (CHARACTER(LEN=libxc_get_reference_length(xc_fun, lsd)) :: reference)
616 ELSE
617 ALLOCATE (CHARACTER(LEN=20*default_string_length) :: reference)
618 END IF
619 CALL xc_functional_get_info(xc_fun, lsd=lsd, reference=reference, shortform=shortform)
620 WRITE (iw, fmt="(' FUNCTIONAL| ',a,':')") &
621 trim(xc_fun%section%name)
622 DO il = 1, len_trim(reference), 67
623 WRITE (iw, fmt="(' FUNCTIONAL| ',a67)") reference(il:)
624 END DO
625 DEALLOCATE (reference)
626 END DO
627 END IF
628 ELSE
629 IF (iw > 0) WRITE (iw, fmt="(' FUNCTIONAL| NO EXCHANGE-CORRELATION FUNCTIONAL USED.')")
630 END IF
631
632 END SUBROUTINE atom_print_method
633
634! **************************************************************************************************
635!> \brief Print information about the pseudo-potential.
636!> \param potential pseudo-potential
637!> \param iw output file unit
638!> \par History
639!> * 05.2017 SGP pseudo-potentials [Juerg Hutter]
640!> * 02.2016 pseudo-potential in Quantum Espresso UPF format [Juerg Hutter]
641!> * 01.2016 new confinement potential form [Juerg Hutter]
642!> * 03.2010 extension of GTH pseudo-potential definition [Juerg Hutter]
643!> * 05.2009 GTH pseudo-potential [Juerg Hutter]
644!> * 09.2008 created [Juerg Hutter]
645! **************************************************************************************************
646 SUBROUTINE atom_print_potential(potential, iw)
647 TYPE(atom_potential_type) :: potential
648 INTEGER, INTENT(IN) :: iw
649
650 CHARACTER(len=60) :: pline
651 INTEGER :: i, j, k, l
652
653 SELECT CASE (potential%ppot_type)
654 CASE (no_pseudo)
655 WRITE (iw, '(/," ",28("*"),A,27("*"))') " All Electron Potential "
656 CASE (gth_pseudo)
657 WRITE (iw, '(/," ",29("*"),A,29("*"))') " GTH Pseudopotential "
658 WRITE (iw, '(T10,A,T76,F5.1)') " Core Charge ", potential%gth_pot%zion
659 WRITE (iw, '(T10,A,T66,F15.6)') " Rc ", potential%gth_pot%rc
660 WRITE (pline, '(5F12.6)') (potential%gth_pot%cl(i), i=1, potential%gth_pot%ncl)
661 WRITE (iw, '(T10,A,T21,A60)') " C1 C2 ... ", adjustr(pline)
662 IF (potential%gth_pot%lpotextended) THEN
663 DO k = 1, potential%gth_pot%nexp_lpot
664 WRITE (iw, '(T10,A,F10.6,T38,A,4F10.6)') " LPot: rc=", potential%gth_pot%alpha_lpot(k), &
665 "CX=", (potential%gth_pot%cval_lpot(i, k), i=1, potential%gth_pot%nct_lpot(k))
666 END DO
667 END IF
668 IF (potential%gth_pot%nlcc) THEN
669 DO k = 1, potential%gth_pot%nexp_nlcc
670 WRITE (iw, '(T10,A,F10.6,T38,A,4F10.6)') " LSDPot: rc=", potential%gth_pot%alpha_nlcc(k), &
671 "CX=", (potential%gth_pot%cval_nlcc(i, k)*4.0_dp*pi, i=1, potential%gth_pot%nct_nlcc(k))
672 END DO
673 END IF
674 IF (potential%gth_pot%lsdpot) THEN
675 DO k = 1, potential%gth_pot%nexp_lsd
676 WRITE (iw, '(T10,A,F10.6,T38,A,4F10.6)') " LSDPot: rc=", potential%gth_pot%alpha_lsd(k), &
677 "CX=", (potential%gth_pot%cval_lsd(i, k), i=1, potential%gth_pot%nct_lsd(k))
678 END DO
679 END IF
680 DO l = 0, lmat
681 IF (potential%gth_pot%nl(l) > 0) THEN
682 WRITE (iw, '(T10,A,T76,I5)') " Angular momentum ", l
683 WRITE (iw, '(T10,A,T66,F15.6)') " Rcnl ", potential%gth_pot%rcnl(l)
684 WRITE (iw, '(T10,A,T76,I5)') " Nl ", potential%gth_pot%nl(l)
685 WRITE (pline, '(5F12.6)') (potential%gth_pot%hnl(1, j, l), j=1, potential%gth_pot%nl(l))
686 WRITE (iw, '(T10,A,T21,A60)') " Hnl ", adjustr(pline)
687 DO i = 2, potential%gth_pot%nl(l)
688 WRITE (pline, '(T21,5F12.6)') (potential%gth_pot%hnl(i, j, l), j=i, potential%gth_pot%nl(l))
689 WRITE (iw, '(T21,A60)') adjustr(pline)
690 END DO
691 END IF
692 END DO
693 IF (potential%gth_pot%soc) THEN
694 WRITE (iw, '(T10,A)') " Spin-orbit coupling parameters "
695 DO l = 1, lmat
696 IF (potential%gth_pot%nl(l) > 0) THEN
697 WRITE (iw, '(T10,A,T76,I5)') " Angular momentum ", l
698 WRITE (iw, '(T10,A,T66,F15.6)') " Rcnl ", potential%gth_pot%rcnl(l)
699 WRITE (iw, '(T10,A,T76,I5)') " Nl ", potential%gth_pot%nl(l)
700 WRITE (pline, '(5F12.6)') (potential%gth_pot%knl(1, j, l), j=1, potential%gth_pot%nl(l))
701 WRITE (iw, '(T10,A,T21,A60)') " Hnl ", adjustr(pline)
702 DO i = 2, potential%gth_pot%nl(l)
703 WRITE (pline, '(T21,5F12.6)') (potential%gth_pot%knl(i, j, l), j=i, potential%gth_pot%nl(l))
704 WRITE (iw, '(T21,A60)') adjustr(pline)
705 END DO
706 END IF
707 END DO
708 END IF
709 CASE (upf_pseudo)
710 WRITE (iw, '(/," ",29("*"),A,29("*"))') " UPF Pseudopotential "
711 DO k = 1, potential%upf_pot%maxinfo
712 WRITE (iw, '(A80)') potential%upf_pot%info(k)
713 END DO
714 CASE (sgp_pseudo)
715 WRITE (iw, '(/," ",29("*"),A,29("*"))') " SGP Pseudopotential "
716 WRITE (iw, '(T10,A,T76,F5.1)') " Core Charge ", potential%sgp_pot%zion
717 CASE (ecp_pseudo)
718 WRITE (iw, '(/," ",26("*"),A,27("*"))') " Effective Core Potential "
719 WRITE (iw, '(T10,A,T76,F5.1)') " Core Charge ", potential%ecp_pot%zion
720 DO k = 1, potential%ecp_pot%nloc
721 IF (k == 1) THEN
722 WRITE (iw, '(T10,A,T40,I3,T49,2F16.8)') " Local Potential ", potential%ecp_pot%nrloc(k), &
723 potential%ecp_pot%bloc(k), potential%ecp_pot%aloc(k)
724 ELSE
725 WRITE (iw, '(T40,I3,T49,2F16.8)') potential%ecp_pot%nrloc(k), &
726 potential%ecp_pot%bloc(k), potential%ecp_pot%aloc(k)
727 END IF
728 END DO
729 DO l = 0, potential%ecp_pot%lmax
730 WRITE (iw, '(T10,A,I3)') " ECP l-value ", l
731 DO k = 1, potential%ecp_pot%npot(l)
732 WRITE (iw, '(T40,I3,T49,2F16.8)') potential%ecp_pot%nrpot(k, l), &
733 potential%ecp_pot%bpot(k, l), potential%ecp_pot%apot(k, l)
734 END DO
735 END DO
736 CASE DEFAULT
737 cpabort("Unknown pseudopotential type for atom_print_potential")
738 END SELECT
739 IF (potential%confinement) THEN
740 IF (potential%conf_type == poly_conf) THEN
741 WRITE (iw, '(/,T10,A,T51,F12.6," * (R /",F6.2,")**",F6.2)') &
742 " Confinement Potential ", potential%acon, potential%rcon, potential%scon
743 ELSE IF (potential%conf_type == barrier_conf) THEN
744 WRITE (iw, '(/,T10,A)') " Confinement Potential s*F[(r-ron)/w] "
745 WRITE (iw, '(T57,A,F12.6,A)') "s =", potential%acon, " Ha"
746 WRITE (iw, '(T57,A,F12.6,A)') "w =", potential%rcon, " Bohr"
747 WRITE (iw, '(T57,A,F12.6,A)') "ron =", potential%scon, " Bohr"
748 ELSE
749 cpabort("Unknown potential confinement type")
750 END IF
751 ELSE
752 WRITE (iw, '(/,T10,A)') " No Confinement Potential is applied "
753 END IF
754 WRITE (iw, '(" ",79("*"))')
755
756 END SUBROUTINE atom_print_potential
757
758! **************************************************************************************************
759!> \brief Print GTH pseudo-potential parameters.
760!> \param gthpot pseudo-potential
761!> \param iunit output file unit
762!> \param fopt ...
763!> \par History
764!> * 09.2012 created [Juerg Hutter]
765!> \note The pseudo-potential is written into the 'iunit' file unit or as the file 'GTH-PARAMETER'
766!> inside the current working directory if the I/O unit is not given explicitly.
767! **************************************************************************************************
768 SUBROUTINE atom_write_pseudo_param(gthpot, iunit, fopt)
769 TYPE(atom_gthpot_type), INTENT(INOUT) :: gthpot
770 INTEGER, INTENT(IN), OPTIONAL :: iunit
771 REAL(kind=dp), INTENT(IN), OPTIONAL :: fopt
772
773 INTEGER :: i, iw, j, k, n
774
775 IF (PRESENT(iunit)) THEN
776 iw = iunit
777 ELSE
778 CALL open_file(file_name="GTH-PARAMETER", file_status="UNKNOWN", file_action="WRITE", unit_number=iw)
779 END IF
780 IF (PRESENT(fopt)) THEN
781 WRITE (iw, '(A,F30.8)') "# "//trim(adjustl(gthpot%symbol)), fopt
782 ELSE
783 WRITE (iw, '(A)') trim(adjustl(gthpot%symbol))//" "//trim(adjustl(gthpot%pname))
784 END IF
785 WRITE (iw, '(4I5)') gthpot%econf(0:3)
786 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%rc, gthpot%ncl, (gthpot%cl(i), i=1, gthpot%ncl)
787 IF (gthpot%lpotextended) THEN
788 WRITE (iw, '(A,I5)') " LPOT", gthpot%nexp_lpot
789 DO i = 1, gthpot%nexp_lpot
790 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%alpha_lpot(i), gthpot%nct_lpot(i), &
791 (gthpot%cval_lpot(j, i), j=1, gthpot%nct_lpot(i))
792 END DO
793 END IF
794 IF (gthpot%lsdpot) THEN
795 WRITE (iw, '(A,I5)') " LSD ", gthpot%nexp_lsd
796 DO i = 1, gthpot%nexp_lsd
797 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%alpha_lsd(i), gthpot%nct_lsd(i), &
798 (gthpot%cval_lsd(j, i), j=1, gthpot%nct_lsd(i))
799 END DO
800 END IF
801 IF (gthpot%nlcc) THEN
802 WRITE (iw, '(A,I5)') " NLCC ", gthpot%nexp_nlcc
803 DO i = 1, gthpot%nexp_nlcc
804 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%alpha_nlcc(i), gthpot%nct_nlcc(i), &
805 (gthpot%cval_nlcc(j, i)*4.0_dp*pi, j=1, gthpot%nct_nlcc(i))
806 END DO
807 END IF
808 n = 0
809 DO i = lmat, 0, -1
810 IF (gthpot%nl(i) > 0) THEN
811 n = i + 1
812 EXIT
813 END IF
814 END DO
815 WRITE (iw, '(I8)') n
816 DO i = 0, n - 1
817 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%rcnl(i), gthpot%nl(i), (gthpot%hnl(1, k, i), k=1, gthpot%nl(i))
818 SELECT CASE (gthpot%nl(i))
819 CASE (2)
820 WRITE (iw, '(T49,F20.14)') gthpot%hnl(2, 2, i)
821 CASE (3)
822 WRITE (iw, '(T49,2F20.14)') gthpot%hnl(2, 2, i), gthpot%hnl(2, 3, i)
823 WRITE (iw, '(T69,F20.14)') gthpot%hnl(3, 3, i)
824 CASE DEFAULT
825 DO j = 2, gthpot%nl(i)
826 WRITE (iw, '(T29,5F20.14)') (gthpot%hnl(j, k, i), k=j, gthpot%nl(i))
827 END DO
828 END SELECT
829 END DO
830 IF (gthpot%soc) THEN
831 DO i = 1, n - 1
832 WRITE (iw, '(T29,5F20.14)') (gthpot%hnl(1, k, i), k=1, gthpot%nl(i))
833 SELECT CASE (gthpot%nl(i))
834 CASE (2)
835 WRITE (iw, '(T49,F20.14)') gthpot%knl(2, 2, i)
836 CASE (3)
837 WRITE (iw, '(T49,2F20.14)') gthpot%knl(2, 2, i), gthpot%knl(2, 3, i)
838 WRITE (iw, '(T69,F20.14)') gthpot%knl(3, 3, i)
839 CASE DEFAULT
840 DO j = 2, gthpot%nl(i)
841 WRITE (iw, '(T29,5F20.14)') (gthpot%knl(j, k, i), k=j, gthpot%nl(i))
842 END DO
843 END SELECT
844 END DO
845 END IF
846 IF (.NOT. PRESENT(iunit)) CALL close_file(unit_number=iw)
847
848 END SUBROUTINE atom_write_pseudo_param
849
850! **************************************************************************************************
851!> \brief Print atomic orbitals.
852!> \param atom information about the atomic kind
853!> \param iw output file unit
854!> \param xmgrace ...
855!> \par History
856!> * 04.2013 created [Juerg Hutter]
857! **************************************************************************************************
858 SUBROUTINE atom_print_orbitals(atom, iw, xmgrace)
859 TYPE(atom_type), POINTER :: atom
860 INTEGER, INTENT(IN) :: iw
861 LOGICAL, INTENT(IN), OPTIONAL :: xmgrace
862
863 CHARACTER(LEN=40) :: fnbody
864 INTEGER :: z
865 LOGICAL :: graph
866
867 SELECT CASE (atom%method_type)
868 CASE DEFAULT
869 cpabort("Unknown method type for atom_print_orbitals")
870 CASE (do_rks_atom)
871 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfn, "", iw)
872 CASE (do_uks_atom)
873 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfna, "Alpha", iw)
874 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfnb, "Beta", iw)
875 CASE (do_rhf_atom)
876 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfn, "", iw)
877 CASE (do_uhf_atom)
878 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfna, "Alpha", iw)
879 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfnb, "Beta", iw)
880 CASE (do_rohf_atom)
881 cpabort("ROHF not yet implemented for atom_print_orbitals")
882 END SELECT
883
884 graph = .false.
885 IF (PRESENT(xmgrace)) graph = xmgrace
886 IF (graph .AND. iw > 0) THEN
887 z = atom%z
888 fnbody = trim(ptable(z)%symbol)//"_PPorbital"
889 SELECT CASE (atom%method_type)
890 CASE DEFAULT
891 cpabort("Unknown method type for atom_print_orbitals")
892 CASE (do_rks_atom)
893 CALL atom_orbitals_grace(atom, atom%orbitals%wfn, fnbody)
894 CASE (do_uks_atom)
895 CALL atom_orbitals_grace(atom, atom%orbitals%wfna, trim(fnbody)//"alpha")
896 CALL atom_orbitals_grace(atom, atom%orbitals%wfnb, trim(fnbody)//"beta")
897 CASE (do_rhf_atom)
898 CALL atom_orbitals_grace(atom, atom%orbitals%wfn, fnbody)
899 CASE (do_uhf_atom)
900 CALL atom_orbitals_grace(atom, atom%orbitals%wfna, trim(fnbody)//"alpha")
901 CALL atom_orbitals_grace(atom, atom%orbitals%wfnb, trim(fnbody)//"beta")
902 CASE (do_rohf_atom)
903 cpabort("ROHF not yet implemented for atom_print_orbitals")
904 END SELECT
905 END IF
906
907 END SUBROUTINE atom_print_orbitals
908
909! **************************************************************************************************
910!> \brief Print atomic orbitals of the given spin.
911!> \param atom information about the atomic kind
912!> \param wfn atomic orbitals
913!> \param description description string
914!> \param iw output file unit
915!> \par History
916!> * 04.2013 created [Juerg Hutter]
917! **************************************************************************************************
918 SUBROUTINE atom_print_orbitals_helper(atom, wfn, description, iw)
919 TYPE(atom_type), POINTER :: atom
920 REAL(kind=dp), DIMENSION(:, :, 0:), INTENT(INOUT) :: wfn
921 CHARACTER(len=*), INTENT(IN) :: description
922 INTEGER, INTENT(IN) :: iw
923
924 INTEGER :: b, l, maxl, nb, nv, v
925
926 WRITE (iw, '(/,A,A,A)') " Atomic orbital expansion coefficients [", description, "]"
927
928 maxl = atom%state%maxl_calc
929 DO l = 0, maxl
930
931 nb = atom%basis%nbas(l)
932 nv = atom%state%maxn_calc(l)
933 IF (nb > 0 .AND. nv > 0) THEN
934 nv = min(nv, SIZE(wfn, 2))
935 DO v = 1, nv
936 WRITE (iw, '(/," ORBITAL L = ",I1," State = ",I3)') l, v
937 DO b = 1, nb
938 WRITE (iw, '(" ",ES23.15)') wfn(b, v, l)
939 END DO
940 END DO
941 END IF
942 END DO
943 END SUBROUTINE atom_print_orbitals_helper
944
945! **************************************************************************************************
946!> \brief Print atomic orbitals of the given spin.
947!> \param atom information about the atomic kind
948!> \param wfn atomic orbitals
949!> \param fnbody body of file name
950!> \par History
951!> * 02.2025 created [Juerg Hutter]
952! **************************************************************************************************
953 SUBROUTINE atom_orbitals_grace(atom, wfn, fnbody)
954 TYPE(atom_type), POINTER :: atom
955 REAL(kind=dp), DIMENSION(:, :, 0:), INTENT(INOUT) :: wfn
956 CHARACTER(len=*), INTENT(IN) :: fnbody
957
958 CHARACTER(LEN=1), DIMENSION(0:8) :: lname
959 CHARACTER(LEN=1), DIMENSION(1:9) :: wnum
960 CHARACTER(LEN=40) :: fname, legend
961 INTEGER :: b, i, iw, l, m, maxl, nb, nv, v
962 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: gdata, wfnr
963 REAL(kind=dp), DIMENSION(4) :: world_coord
964
965 lname = ['s', 'p', 'd', 'f', 'g', 'h', 'j', 'k', 'l']
966 wnum = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
967 m = atom%basis%grid%nr
968 maxl = atom%state%maxl_calc
969 DO l = 0, maxl
970 fname = trim(fnbody)//"_"//lname(l)//".agr"
971 nb = atom%basis%nbas(l)
972 nv = atom%state%maxn_calc(l)
973 IF (nb > 0 .AND. nv > 0) THEN
974 CALL open_file(file_name=fname, file_status="UNKNOWN", file_action="WRITE", unit_number=iw)
975 nv = min(nv, SIZE(wfn, 2))
976 ALLOCATE (wfnr(m, nv))
977 wfnr = 0.0_dp
978 DO v = 1, nv
979 DO b = 1, nb
980 wfnr(:, v) = wfnr(:, v) + wfn(b, v, l)*atom%basis%bf(:, b, l)
981 END DO
982 END DO
983 world_coord(1) = 0.0_dp
984 world_coord(2) = minval(wfnr) - 0.5_dp
985 world_coord(3) = 15.0_dp
986 world_coord(4) = maxval(wfnr) + 0.5_dp
987 !
988 CALL xm_write_defaults(iw)
989 CALL xm_write_frameport(iw)
990 CALL xm_write_frame(iw, world_coord, &
991 title="PP Radial Wavefunction", &
992 subtitle=lname(l)//"-Quantum Number", &
993 xlabel="Radius [Bohr]", &
994 ylabel="")
995 DO i = 0, nv - 1
996 legend = "WFN "//wnum(i + 1)
997 CALL xm_graph_info(iw, i, 2.5_dp, legend)
998 END DO
999 ALLOCATE (gdata(m, 2))
1000 gdata(1:m, 1) = atom%basis%grid%rad(1:m)
1001 DO i = 0, nv - 1
1002 gdata(1:m, 2) = wfnr(1:m, i + 1)
1003 CALL xm_graph_data(iw, i, gdata)
1004 END DO
1005 DEALLOCATE (gdata, wfnr)
1006 CALL close_file(iw)
1007 END IF
1008 END DO
1009 END SUBROUTINE atom_orbitals_grace
1010
1011END MODULE atom_output
program graph
Program to Map on grid the hills spawned during a metadynamics run.
Definition graph.F:19
Routines that print various information about an atomic kind.
Definition atom_output.F:11
subroutine, public atom_print_energies(atom, iw)
Print energy components.
subroutine, public atom_print_orbitals(atom, iw, xmgrace)
Print atomic orbitals.
subroutine, public atom_print_basis(atom_basis, iw, title)
Print atomic basis set.
subroutine, public atom_print_iteration(iter, deps, etot, iw)
Print convergence information.
subroutine, public atom_print_basis_file(atom_basis, wfn)
Print the optimized atomic basis set into a file.
subroutine, public atom_print_state(state, iw)
Print information about electronic state.
Definition atom_output.F:88
subroutine, public atom_print_zmp_iteration(iter, deps, atom, iw)
Printing of the atomic iterations when ZMP is active.
subroutine, public atom_print_method(atom, iw)
Print information about the electronic structure method in use.
subroutine, public atom_write_pseudo_param(gthpot, iunit, fopt)
Print GTH pseudo-potential parameters.
subroutine, public atom_print_potential(potential, iw)
Print information about the pseudo-potential.
subroutine, public atom_print_info(zval, info, iw)
Print an information string related to the atomic kind.
Definition atom_output.F:69
Define the atom type and its sub types.
Definition atom_types.F:15
integer, parameter, public num_basis
Definition atom_types.F:69
integer, parameter, public cgto_basis
Definition atom_types.F:69
integer, parameter, public gto_basis
Definition atom_types.F:69
integer, parameter, public sto_basis
Definition atom_types.F:69
integer, parameter, public lmat
Definition atom_types.F:67
Some basic routines for atomic calculations.
Definition atom_utils.F:15
pure integer function, dimension(0:lmat), public get_maxn_occ(occupation)
Return the maximum principal quantum number of occupied orbitals.
Definition atom_utils.F:301
subroutine, public get_rho0(atom, rho0)
Calculate the total electron density at R=0.
pure integer function, public get_maxl_occ(occupation)
Return the maximum orbital quantum number of occupied orbitals.
Definition atom_utils.F:281
Definition atom.F:9
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:311
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:122
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_rhf_atom
integer, parameter, public do_rks_atom
integer, parameter, public sgp_pseudo
integer, parameter, public do_dkh3_atom
integer, parameter, public gth_pseudo
integer, parameter, public ecp_pseudo
integer, parameter, public do_nonrel_atom
integer, parameter, public do_dkh0_atom
integer, parameter, public do_uhf_atom
integer, parameter, public upf_pseudo
integer, parameter, public poly_conf
integer, parameter, public do_dkh2_atom
integer, parameter, public no_pseudo
integer, parameter, public do_uks_atom
integer, parameter, public barrier_conf
integer, parameter, public do_zoramp_atom
integer, parameter, public do_dkh1_atom
integer, parameter, public do_rohf_atom
integer, parameter, public xc_none
integer, parameter, public do_sczoramp_atom
checks the input and perform some automatic "magic" on it
subroutine, public xc_functionals_expand(functionals, xc_section)
expand a shortcutted functional section
objects that represent the structure of input sections and the data contained in an input section
type(section_vals_type) function, pointer, public section_vals_get_subs_vals2(section_vals, i_section, i_rep_section)
returns the values of the n-th non default subsection (null if no such section exists (not so many no...
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
real(kind=dp), dimension(-1:2 *maxfac+1), parameter, public dfac
real(kind=dp), parameter, public rootpi
Periodic Table related data definitions.
type(atom), dimension(0:nelem), public ptable
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public evolt
Definition physcon.F:183
subroutine, public xc_functional_get_info(functional, lsd, reference, shortform, needs, max_deriv, print_warn)
get the information about the given functional
calculates a functional from libxc and its derivatives
Definition xc_libxc.F:28
logical function, public libxc_check_existence_in_libxc(libxc_params)
This function checks whether a functional name belongs to LibXC.
Definition xc_libxc.F:138
integer function, public libxc_get_reference_length(libxc_params, lsd)
This function returns the maximum length of the reference string for a given LibXC functional.
Definition xc_libxc.F:159
Routines to facilitate writing XMGRACE files.
Definition xmgrace.F:14
subroutine, public xm_graph_data(iw, gnum, gdata)
...
Definition xmgrace.F:324
subroutine, public xm_write_frameport(iw)
...
Definition xmgrace.F:94
subroutine, public xm_write_frame(iw, wcoord, title, subtitle, xlabel, ylabel)
...
Definition xmgrace.F:123
subroutine, public xm_write_defaults(iw)
...
Definition xmgrace.F:37
subroutine, public xm_graph_info(iw, gnum, linewidth, legend)
...
Definition xmgrace.F:254
Provides all information about a basis set.
Definition atom_types.F:78
Provides all information about a pseudopotential.
Definition atom_types.F:98
Provides all information on states and occupation.
Definition atom_types.F:198
Provides all information about an atomic kind.
Definition atom_types.F:293