(git:1155b05)
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) &
196 WRITE (iw, '(T36,A,T61,F20.12)') " XC Energy ::", atom%energy%exc
197 WRITE (iw, '(T36,A,T61,F20.12)') " Coulomb Energy ::", atom%energy%ecoulomb
198 IF (atom%energy%eexchange /= 0._dp) &
199 WRITE (iw, '(T34,A,T61,F20.12)') "HF Exchange Energy ::", atom%energy%eexchange
200 IF (atom%potential%ppot_type /= no_pseudo) THEN
201 WRITE (iw, '(T20,A,T61,F20.12)') " Total Pseudopotential Energy ::", atom%energy%epseudo
202 WRITE (iw, '(T20,A,T61,F20.12)') " Local Pseudopotential Energy ::", atom%energy%eploc
203 IF (atom%energy%elsd /= 0._dp) &
204 WRITE (iw, '(T20,A,T61,F20.12)') " Local Spin-potential Energy ::", atom%energy%elsd
205 WRITE (iw, '(T20,A,T61,F20.12)') " Nonlocal Pseudopotential Energy ::", atom%energy%epnl
206 END IF
207 IF (atom%potential%confinement) THEN
208 WRITE (iw, '(T36,A,T61,F20.12)') " Confinement ::", atom%energy%econfinement
209 END IF
210
211 IF (atom%state%multiplicity == -1) THEN
212 WRITE (iw, '(/,A,T20,A,T30,A,T36,A,T49,A,T71,A,/)') " Orbital energies", &
213 "State", "L", "Occupation", "Energy[a.u.]", "Energy[eV]"
214 DO l = 0, atom%state%maxl_calc
215 n = atom%state%maxn_calc(l)
216 DO i = 1, n
217 WRITE (iw, '(T23,I2,T30,I1,T36,F10.3,T46,F15.6,T66,F15.6)') &
218 i, l, atom%state%occupation(l, i), atom%orbitals%ener(i, l), atom%orbitals%ener(i, l)*evolt
219 END DO
220 IF (n > 0) WRITE (iw, *)
221 END DO
222 ELSE
223 WRITE (iw, '(/,A,T20,A,T30,A,T36,A,T42,A,T55,A,T71,A,/)') " Orbital energies", &
224 "State", "Spin", "L", "Occupation", "Energy[a.u.]", "Energy[eV]"
225 DO l = 0, atom%state%maxl_calc
226 n = atom%state%maxn_calc(l)
227 DO i = 1, n
228 WRITE (iw, '(T23,I2,T29,A,T36,I1,T42,F10.3,T52,F15.6,T68,F13.6)') &
229 i, "alpha", l, atom%state%occa(l, i), atom%orbitals%enera(i, l), atom%orbitals%enera(i, l)*evolt
230 END DO
231 DO i = 1, n
232 WRITE (iw, '(T23,I2,T29,A,T36,I1,T42,F10.3,T52,F15.6,T68,F13.6)') &
233 i, " beta", l, atom%state%occb(l, i), atom%orbitals%enerb(i, l), atom%orbitals%enerb(i, l)*evolt
234 END DO
235 IF (n > 0) WRITE (iw, *)
236 END DO
237 END IF
238
239 CALL get_rho0(atom, drho)
240 WRITE (iw, '(/,A,T66,F15.6)') " Total Electron Density at R=0: ", drho
241
242 END SUBROUTINE atom_print_energies
243
244! **************************************************************************************************
245!> \brief Printing of the atomic iterations when ZMP is active.
246!> \param iter current iteration number
247!> \param deps convergence
248!> \param atom intormation about the atomic kind
249!> \param iw output file unit
250!> \author D. Varsano [daniele.varsano@nano.cnr.it]
251! **************************************************************************************************
252 SUBROUTINE atom_print_zmp_iteration(iter, deps, atom, iw)
253 INTEGER, INTENT(IN) :: iter
254 REAL(dp), INTENT(IN) :: deps
255 TYPE(atom_type), INTENT(IN) :: atom
256 INTEGER, INTENT(IN) :: iw
257
258 IF (iter == 1) THEN
259 WRITE (iw, '(/," ",79("*"),/,T33,"Integral",T48,"Integral",/,T3,A,T16,A,T33,A,T46,A,T69,A/," ",79("*"))') &
260 "Iteration", "Convergence", "rho diff.", "rho*v_xc[au]", "Energy[au]"
261 END IF
262 WRITE (iw, '(T3,I9,T15,G13.6,T30,G13.6,T46,G13.6,T61,F20.12)') iter, deps, atom%rho_diff_integral, &
263 atom%energy%exc, atom%energy%etot
264
265 END SUBROUTINE atom_print_zmp_iteration
266
267! **************************************************************************************************
268!> \brief Print convergence information.
269!> \param iter current iteration number
270!> \param deps convergency
271!> \param etot total energy
272!> \param iw output file unit
273!> \par History
274!> * 08.2008 created [Juerg Hutter]
275! **************************************************************************************************
276 SUBROUTINE atom_print_iteration(iter, deps, etot, iw)
277 INTEGER, INTENT(IN) :: iter
278 REAL(dp), INTENT(IN) :: deps, etot
279 INTEGER, INTENT(IN) :: iw
280
281 IF (iter == 1) THEN
282 WRITE (iw, '(/," ",79("*"),/,T19,A,T38,A,T70,A,/," ",79("*"))') &
283 "Iteration", "Convergence", "Energy [au]"
284 END IF
285 WRITE (iw, '(T20,i8,T34,G14.6,T61,F20.12)') iter, deps, etot
286
287 END SUBROUTINE atom_print_iteration
288
289! **************************************************************************************************
290!> \brief Print atomic basis set.
291!> \param atom_basis atomic basis set
292!> \param iw output file unit
293!> \param title header to print on top of the basis set
294!> \par History
295!> * 09.2008 created [Juerg Hutter]
296! **************************************************************************************************
297 SUBROUTINE atom_print_basis(atom_basis, iw, title)
299 INTEGER, INTENT(IN) :: iw
300 CHARACTER(len=*) :: title
301
302 INTEGER :: i, j, l
303
304 WRITE (iw, '(/,A)') trim(title)
305 SELECT CASE (atom_basis%basis_type)
306 CASE (gto_basis)
307 IF (atom_basis%geometrical) THEN
308 WRITE (iw, '(/," ",21("*"),A,22("*"))') " Geometrical Gaussian Type Orbitals "
309 WRITE (iw, '(A,F15.8,T41,A,F15.8)') " Initial exponent: ", atom_basis%aval, &
310 " Proportionality factor: ", atom_basis%cval
311 ELSE
312 WRITE (iw, '(/," ",21("*"),A,21("*"))') " Uncontracted Gaussian Type Orbitals "
313 END IF
314 DO l = 0, lmat
315 IF (atom_basis%nbas(l) > 0) THEN
316 SELECT CASE (l)
317 CASE DEFAULT
318 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
319 "X Exponents: ", (i, atom_basis%am(i, l), i=1, atom_basis%nbas(l))
320 CASE (0)
321 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
322 "s Exponents: ", (i, atom_basis%am(i, 0), i=1, atom_basis%nbas(0))
323 CASE (1)
324 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
325 "p Exponents: ", (i, atom_basis%am(i, 1), i=1, atom_basis%nbas(1))
326 CASE (2)
327 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
328 "d Exponents: ", (i, atom_basis%am(i, 2), i=1, atom_basis%nbas(2))
329 CASE (3)
330 WRITE (iw, '(/,T2,A,(T30,I5,T51,F30.8))') &
331 "f Exponents: ", (i, atom_basis%am(i, 3), i=1, atom_basis%nbas(3))
332 END SELECT
333 END IF
334 END DO
335 WRITE (iw, '(" ",79("*"))')
336 CASE (cgto_basis)
337 WRITE (iw, '(/," ",22("*"),A,22("*"))') " Contracted Gaussian Type Orbitals "
338 DO l = 0, lmat
339 IF (atom_basis%nbas(l) > 0) THEN
340 IF (l == 0) WRITE (iw, '(A)') " s Functions"
341 IF (l == 1) WRITE (iw, '(A)') " p Functions"
342 IF (l == 2) WRITE (iw, '(A)') " d Functions"
343 IF (l == 3) WRITE (iw, '(A)') " f Functions"
344 IF (l >= 3) WRITE (iw, '(A)') " x Functions"
345 DO i = 1, atom_basis%nprim(l)
346 WRITE (iw, '(F15.6,5(T21,6F10.6,/))') &
347 atom_basis%am(i, l), (atom_basis%cm(i, j, l), j=1, atom_basis%nbas(l))
348 END DO
349 END IF
350 END DO
351 WRITE (iw, '(" ",79("*"))')
352 CASE (sto_basis)
353 WRITE (iw, '(/," ",28("*"),A,29("*"))') " Slater Type Orbitals "
354 DO l = 0, lmat
355 DO i = 1, atom_basis%nbas(l)
356 SELECT CASE (l)
357 CASE DEFAULT
358 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, l), "X Exponent :", atom_basis%as(i, l)
359 CASE (0)
360 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 0), "S Exponent :", atom_basis%as(i, 0)
361 CASE (1)
362 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 1), "P Exponent :", atom_basis%as(i, 1)
363 CASE (2)
364 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 2), "D Exponent :", atom_basis%as(i, 2)
365 CASE (3)
366 WRITE (iw, '(T10,I1,A,T40,F25.12)') atom_basis%ns(i, 3), "F Exponent :", atom_basis%as(i, 3)
367 END SELECT
368 END DO
369 END DO
370 WRITE (iw, '(" ",79("*"))')
371 CASE (num_basis)
372 cpabort("")
373 CASE DEFAULT
374 cpabort("")
375 END SELECT
376
377 END SUBROUTINE atom_print_basis
378
379! **************************************************************************************************
380!> \brief Print the optimized atomic basis set into a file.
381!> \param atom_basis atomic basis set
382!> \param wfn ...
383!> \par History
384!> * 11.2016 revised output format [Matthias Krack]
385!> * 11.2011 Slater basis functions [Juerg Hutter]
386!> * 03.2011 created [Juerg Hutter]
387!> \note The basis set is stored as the file 'OPT_BASIS' inside the current working directory.
388!> It may be a good idea, however, to specify the name of this file via some input section.
389! **************************************************************************************************
390 SUBROUTINE atom_print_basis_file(atom_basis, wfn)
392 REAL(kind=dp), DIMENSION(:, :, 0:), OPTIONAL :: wfn
393
394 INTEGER :: i, im, iw, l
395 REAL(kind=dp) :: expzet, prefac, zeta
396
397 CALL open_file(file_name="OPT_BASIS", file_status="UNKNOWN", file_action="WRITE", unit_number=iw)
398 SELECT CASE (atom_basis%basis_type)
399 CASE (gto_basis)
400 IF (atom_basis%geometrical) THEN
401 WRITE (iw, '(/," ",21("*"),A,22("*"))') " Geometrical Gaussian Type Orbitals "
402 WRITE (iw, '(A,F15.8,T41,A,F15.8)') " Initial exponent: ", atom_basis%aval, &
403 " Proportionality factor: ", atom_basis%cval
404 ELSE
405 WRITE (iw, '(T3,A)') "BASIS_TYPE GAUSSIAN"
406 END IF
407 DO l = 0, lmat
408 IF (atom_basis%nbas(l) > 0) THEN
409 SELECT CASE (l)
410 CASE DEFAULT
411 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
412 "X_EXPONENTS ", (atom_basis%am(i, l), i=1, atom_basis%nbas(l))
413 CASE (0)
414 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
415 "S_EXPONENTS ", (atom_basis%am(i, 0), i=1, atom_basis%nbas(0))
416 CASE (1)
417 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
418 "P_EXPONENTS ", (atom_basis%am(i, 1), i=1, atom_basis%nbas(1))
419 CASE (2)
420 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
421 "D_EXPONENTS ", (atom_basis%am(i, 2), i=1, atom_basis%nbas(2))
422 CASE (3)
423 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
424 "F_EXPONENTS ", (atom_basis%am(i, 3), i=1, atom_basis%nbas(3))
425 END SELECT
426 END IF
427 END DO
428 CASE (cgto_basis)
429 cpabort("")
430 CASE (sto_basis)
431 WRITE (iw, '(T3,A)') "BASIS_TYPE SLATER"
432 DO l = 0, lmat
433 IF (atom_basis%nbas(l) > 0) THEN
434 SELECT CASE (l)
435 CASE DEFAULT
436 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
437 "X_EXPONENTS ", (atom_basis%as(i, l), i=1, atom_basis%nbas(l))
438 WRITE (iw, '(T3,A,60I3)') &
439 "X_QUANTUM_NUMBERS ", (atom_basis%ns(i, l), i=1, atom_basis%nbas(l))
440 CASE (0)
441 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
442 "S_EXPONENTS ", (atom_basis%as(i, 0), i=1, atom_basis%nbas(0))
443 WRITE (iw, '(T3,A,60I3)') &
444 "S_QUANTUM_NUMBERS ", (atom_basis%ns(i, 0), i=1, atom_basis%nbas(0))
445 CASE (1)
446 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
447 "P_EXPONENTS ", (atom_basis%as(i, 1), i=1, atom_basis%nbas(1))
448 WRITE (iw, '(T3,A,60I3)') &
449 "P_QUANTUM_NUMBERS ", (atom_basis%ns(i, 1), i=1, atom_basis%nbas(1))
450 CASE (2)
451 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
452 "D_EXPONENTS ", (atom_basis%as(i, 2), i=1, atom_basis%nbas(2))
453 WRITE (iw, '(T3,A,60I3)') &
454 "D_QUANTUM_NUMBERS ", (atom_basis%ns(i, 2), i=1, atom_basis%nbas(2))
455 CASE (3)
456 WRITE (iw, '(T3,A,(T15,F20.8,:," \"))') &
457 "F_EXPONENTS ", (atom_basis%as(i, 3), i=1, atom_basis%nbas(3))
458 WRITE (iw, '(T3,A,60I3)') &
459 "F_QUANTUM_NUMBERS ", (atom_basis%ns(i, 3), i=1, atom_basis%nbas(3))
460 END SELECT
461 END IF
462 END DO
463 CASE (num_basis)
464 cpabort("")
465 CASE DEFAULT
466 cpabort("")
467 END SELECT
468
469 IF (PRESENT(wfn)) THEN
470 SELECT CASE (atom_basis%basis_type)
471 CASE DEFAULT
472 CASE (gto_basis)
473 IF (.NOT. atom_basis%geometrical) THEN
474 WRITE (iw, '(/,T3,A)') "ORBITAL COEFFICENTS (Quickstep normalization)"
475 im = min(6, SIZE(wfn, 2))
476 DO l = 0, lmat
477 IF (atom_basis%nbas(l) > 0) THEN
478 WRITE (iw, '(T3,A,I3)') "L Quantum Number:", l
479 ! Quickstep normalization
480 expzet = 0.25_dp*real(2*l + 3, dp)
481 prefac = sqrt(rootpi/2._dp**(l + 2)*dfac(2*l + 1))
482 DO i = 1, atom_basis%nbas(l)
483 zeta = (2._dp*atom_basis%am(i, l))**expzet
484 WRITE (iw, '(T5,F14.8,2x,6F12.8)') atom_basis%am(i, l), wfn(i, 1:im, l)*prefac/zeta
485 END DO
486 END IF
487 END DO
488 END IF
489 END SELECT
490 END IF
491
492 CALL close_file(unit_number=iw)
493
494 END SUBROUTINE atom_print_basis_file
495
496! **************************************************************************************************
497!> \brief Print information about the electronic structure method in use.
498!> \param atom information about the atomic kind
499!> \param iw output file unit
500!> \par History
501!> * 09.2015 direct use of the LibXC Fortran interface [Andreas Gloess]
502!> * 10.2012 LibXC interface [Fabien Tran]
503!> * 02.2010 unrestricted KS and HF methods [Juerg Hutter]
504!> * 04.2009 print geometrical Gaussian type orbitals [Juerg Hutter]
505!> * 09.2008 new subroutine's prototype; print relativistic methods [Juerg Hutter]
506!> * 09.2008 created [Juerg Hutter]
507! **************************************************************************************************
508 SUBROUTINE atom_print_method(atom, iw)
509 TYPE(atom_type) :: atom
510 INTEGER, INTENT(IN) :: iw
511
512 CHARACTER(len=160) :: shortform
513 CHARACTER(len=:), ALLOCATABLE :: reference
514 INTEGER :: ifun, il, meth, myfun, reltyp
515 LOGICAL :: lsd
516 TYPE(section_vals_type), POINTER :: xc_fun, xc_fun_section, xc_section
517
518 NULLIFY (xc_fun, xc_fun_section, xc_section)
519
520 meth = atom%method_type
521
522 xc_section => atom%xc_section
523 xc_fun_section => section_vals_get_subs_vals(xc_section, "XC_FUNCTIONAL")
524 SELECT CASE (meth)
525 CASE DEFAULT
526 cpabort("")
527 CASE (do_rks_atom)
528 CALL section_vals_val_get(xc_fun_section, "_SECTION_PARAMETERS_", i_val=myfun)
529 CASE (do_uks_atom)
530 CALL section_vals_val_get(xc_fun_section, "_SECTION_PARAMETERS_", i_val=myfun)
531 CASE (do_rhf_atom)
532 myfun = xc_none
533 CASE (do_uhf_atom)
534 myfun = xc_none
535 CASE (do_rohf_atom)
536 myfun = xc_none
537 END SELECT
538
539 SELECT CASE (meth)
540 CASE DEFAULT
541 cpabort("")
542 CASE (do_rks_atom)
543 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Restricted Kohn-Sham Calculation')")
544 CASE (do_uks_atom)
545 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Unrestricted Kohn-Sham Calculation')")
546 CASE (do_rhf_atom)
547 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Restricted Hartree-Fock Calculation')")
548 CASE (do_uhf_atom)
549 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Unrestricted Hartree-Fock Calculation')")
550 CASE (do_rohf_atom)
551 IF (iw > 0) WRITE (iw, fmt="(/,' METHOD | Restricted Open-Shell Kohn-Sham Calculation')")
552 END SELECT
553
554 ! zmp
555 IF (atom%do_zmp) THEN
556 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Method on atomic radial density')")
557 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Lambda : ',F5.1)") atom%lambda
558 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Reading external density : ',A20)") atom%ext_file
559 IF (atom%dm) THEN
560 IF (iw > 0) WRITE (iw, fmt="(' ZMP | The file is in the form of a density matrix')")
561 ELSE
562 IF (iw > 0) WRITE (iw, fmt="(' ZMP | The file is in the form of a linear density')")
563 END IF
564 IF (atom%doread) THEN
565 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Restarting calculation from ',A20,' file if present')") atom%zmp_restart_file
566 END IF
567 ELSE IF (atom%read_vxc) THEN
568 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Calculating density from external V_xc')")
569 IF (iw > 0) WRITE (iw, fmt="(' ZMP | Reading external v_xc file : ',A20)") atom%ext_vxc_file
570 END IF
571
572 IF (atom%pp_calc) THEN
573 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Nonrelativistic Calculation')")
574 ELSE
575 reltyp = atom%relativistic
576
577 SELECT CASE (reltyp)
578 CASE DEFAULT
579 cpabort("")
580 CASE (do_nonrel_atom)
581 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Nonrelativistic Calculation')")
582 CASE (do_zoramp_atom)
583 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using ZORA(MP)')")
584 CASE (do_sczoramp_atom)
585 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using scaled ZORA(MP)')")
586 CASE (do_dkh0_atom)
587 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 0th order')")
588 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using kietic energy scaling')")
589 CASE (do_dkh1_atom)
590 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 1st order')")
591 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Foldy-Wouthuysen transformation')")
592 CASE (do_dkh2_atom)
593 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 2nd order')")
594 CASE (do_dkh3_atom)
595 IF (iw > 0) WRITE (iw, fmt="(' METHOD | Relativistic Calculation using Douglas-Kroll 3rd order')")
596 END SELECT
597 END IF
598
599 lsd = (meth == do_uks_atom)
600
601 IF (myfun /= xc_none) THEN
602 CALL xc_functionals_expand(xc_fun_section, xc_section)
603 IF (iw > 0) THEN
604 ifun = 0
605 DO
606 ifun = ifun + 1
607 xc_fun => section_vals_get_subs_vals2(xc_fun_section, i_section=ifun)
608 IF (.NOT. ASSOCIATED(xc_fun)) EXIT
609 IF (libxc_check_existence_in_libxc(xc_fun)) THEN
610 ALLOCATE (CHARACTER(LEN=libxc_get_reference_length(xc_fun, lsd)) :: reference)
611 ELSE
612 ALLOCATE (CHARACTER(LEN=20*default_string_length) :: reference)
613 END IF
614 CALL xc_functional_get_info(xc_fun, lsd=lsd, reference=reference, shortform=shortform)
615 WRITE (iw, fmt="(' FUNCTIONAL| ',a,':')") &
616 trim(xc_fun%section%name)
617 DO il = 1, len_trim(reference), 67
618 WRITE (iw, fmt="(' FUNCTIONAL| ',a67)") reference(il:)
619 END DO
620 DEALLOCATE (reference)
621 END DO
622 END IF
623 ELSE
624 IF (iw > 0) WRITE (iw, fmt="(' FUNCTIONAL| NO EXCHANGE-CORRELATION FUNCTIONAL USED.')")
625 END IF
626
627 END SUBROUTINE atom_print_method
628
629! **************************************************************************************************
630!> \brief Print information about the pseudo-potential.
631!> \param potential pseudo-potential
632!> \param iw output file unit
633!> \par History
634!> * 05.2017 SGP pseudo-potentials [Juerg Hutter]
635!> * 02.2016 pseudo-potential in Quantum Espresso UPF format [Juerg Hutter]
636!> * 01.2016 new confinement potential form [Juerg Hutter]
637!> * 03.2010 extension of GTH pseudo-potential definition [Juerg Hutter]
638!> * 05.2009 GTH pseudo-potential [Juerg Hutter]
639!> * 09.2008 created [Juerg Hutter]
640! **************************************************************************************************
641 SUBROUTINE atom_print_potential(potential, iw)
642 TYPE(atom_potential_type) :: potential
643 INTEGER, INTENT(IN) :: iw
644
645 CHARACTER(len=60) :: pline
646 INTEGER :: i, j, k, l
647
648 SELECT CASE (potential%ppot_type)
649 CASE (no_pseudo)
650 WRITE (iw, '(/," ",28("*"),A,27("*"))') " All Electron Potential "
651 CASE (gth_pseudo)
652 WRITE (iw, '(/," ",29("*"),A,29("*"))') " GTH Pseudopotential "
653 WRITE (iw, '(T10,A,T76,F5.1)') " Core Charge ", potential%gth_pot%zion
654 WRITE (iw, '(T10,A,T66,F15.6)') " Rc ", potential%gth_pot%rc
655 WRITE (pline, '(5F12.6)') (potential%gth_pot%cl(i), i=1, potential%gth_pot%ncl)
656 WRITE (iw, '(T10,A,T21,A60)') " C1 C2 ... ", adjustr(pline)
657 IF (potential%gth_pot%lpotextended) THEN
658 DO k = 1, potential%gth_pot%nexp_lpot
659 WRITE (iw, '(T10,A,F10.6,T38,A,4F10.6)') " LPot: rc=", potential%gth_pot%alpha_lpot(k), &
660 "CX=", (potential%gth_pot%cval_lpot(i, k), i=1, potential%gth_pot%nct_lpot(k))
661 END DO
662 END IF
663 IF (potential%gth_pot%nlcc) THEN
664 DO k = 1, potential%gth_pot%nexp_nlcc
665 WRITE (iw, '(T10,A,F10.6,T38,A,4F10.6)') " LSDPot: rc=", potential%gth_pot%alpha_nlcc(k), &
666 "CX=", (potential%gth_pot%cval_nlcc(i, k)*4.0_dp*pi, i=1, potential%gth_pot%nct_nlcc(k))
667 END DO
668 END IF
669 IF (potential%gth_pot%lsdpot) THEN
670 DO k = 1, potential%gth_pot%nexp_lsd
671 WRITE (iw, '(T10,A,F10.6,T38,A,4F10.6)') " LSDPot: rc=", potential%gth_pot%alpha_lsd(k), &
672 "CX=", (potential%gth_pot%cval_lsd(i, k), i=1, potential%gth_pot%nct_lsd(k))
673 END DO
674 END IF
675 DO l = 0, lmat
676 IF (potential%gth_pot%nl(l) > 0) THEN
677 WRITE (iw, '(T10,A,T76,I5)') " Angular momentum ", l
678 WRITE (iw, '(T10,A,T66,F15.6)') " Rcnl ", potential%gth_pot%rcnl(l)
679 WRITE (iw, '(T10,A,T76,I5)') " Nl ", potential%gth_pot%nl(l)
680 WRITE (pline, '(5F12.6)') (potential%gth_pot%hnl(1, j, l), j=1, potential%gth_pot%nl(l))
681 WRITE (iw, '(T10,A,T21,A60)') " Hnl ", adjustr(pline)
682 DO i = 2, potential%gth_pot%nl(l)
683 WRITE (pline, '(T21,5F12.6)') (potential%gth_pot%hnl(i, j, l), j=i, potential%gth_pot%nl(l))
684 WRITE (iw, '(T21,A60)') adjustr(pline)
685 END DO
686 END IF
687 END DO
688 IF (potential%gth_pot%soc) THEN
689 WRITE (iw, '(T10,A)') " Spin-orbit coupling parameters "
690 DO l = 1, lmat
691 IF (potential%gth_pot%nl(l) > 0) THEN
692 WRITE (iw, '(T10,A,T76,I5)') " Angular momentum ", l
693 WRITE (iw, '(T10,A,T66,F15.6)') " Rcnl ", potential%gth_pot%rcnl(l)
694 WRITE (iw, '(T10,A,T76,I5)') " Nl ", potential%gth_pot%nl(l)
695 WRITE (pline, '(5F12.6)') (potential%gth_pot%knl(1, j, l), j=1, potential%gth_pot%nl(l))
696 WRITE (iw, '(T10,A,T21,A60)') " Hnl ", adjustr(pline)
697 DO i = 2, potential%gth_pot%nl(l)
698 WRITE (pline, '(T21,5F12.6)') (potential%gth_pot%knl(i, j, l), j=i, potential%gth_pot%nl(l))
699 WRITE (iw, '(T21,A60)') adjustr(pline)
700 END DO
701 END IF
702 END DO
703 END IF
704 CASE (upf_pseudo)
705 WRITE (iw, '(/," ",29("*"),A,29("*"))') " UPF Pseudopotential "
706 DO k = 1, potential%upf_pot%maxinfo
707 WRITE (iw, '(A80)') potential%upf_pot%info(k)
708 END DO
709 CASE (sgp_pseudo)
710 WRITE (iw, '(/," ",29("*"),A,29("*"))') " SGP Pseudopotential "
711 WRITE (iw, '(T10,A,T76,F5.1)') " Core Charge ", potential%sgp_pot%zion
712 CASE (ecp_pseudo)
713 WRITE (iw, '(/," ",26("*"),A,27("*"))') " Effective Core Potential "
714 WRITE (iw, '(T10,A,T76,F5.1)') " Core Charge ", potential%ecp_pot%zion
715 DO k = 1, potential%ecp_pot%nloc
716 IF (k == 1) THEN
717 WRITE (iw, '(T10,A,T40,I3,T49,2F16.8)') " Local Potential ", potential%ecp_pot%nrloc(k), &
718 potential%ecp_pot%bloc(k), potential%ecp_pot%aloc(k)
719 ELSE
720 WRITE (iw, '(T40,I3,T49,2F16.8)') potential%ecp_pot%nrloc(k), &
721 potential%ecp_pot%bloc(k), potential%ecp_pot%aloc(k)
722 END IF
723 END DO
724 DO l = 0, potential%ecp_pot%lmax
725 WRITE (iw, '(T10,A,I3)') " ECP l-value ", l
726 DO k = 1, potential%ecp_pot%npot(l)
727 WRITE (iw, '(T40,I3,T49,2F16.8)') potential%ecp_pot%nrpot(k, l), &
728 potential%ecp_pot%bpot(k, l), potential%ecp_pot%apot(k, l)
729 END DO
730 END DO
731 CASE DEFAULT
732 cpabort("")
733 END SELECT
734 IF (potential%confinement) THEN
735 IF (potential%conf_type == poly_conf) THEN
736 WRITE (iw, '(/,T10,A,T51,F12.6," * (R /",F6.2,")**",F6.2)') &
737 " Confinement Potential ", potential%acon, potential%rcon, potential%scon
738 ELSE IF (potential%conf_type == barrier_conf) THEN
739 WRITE (iw, '(/,T10,A)') " Confinement Potential s*F[(r-ron)/w] "
740 WRITE (iw, '(T57,A,F12.6,A)') "s =", potential%acon, " Ha"
741 WRITE (iw, '(T57,A,F12.6,A)') "w =", potential%rcon, " Bohr"
742 WRITE (iw, '(T57,A,F12.6,A)') "ron =", potential%scon, " Bohr"
743 ELSE
744 cpabort("")
745 END IF
746 ELSE
747 WRITE (iw, '(/,T10,A)') " No Confinement Potential is applied "
748 END IF
749 WRITE (iw, '(" ",79("*"))')
750
751 END SUBROUTINE atom_print_potential
752
753! **************************************************************************************************
754!> \brief Print GTH pseudo-potential parameters.
755!> \param gthpot pseudo-potential
756!> \param iunit output file unit
757!> \param fopt ...
758!> \par History
759!> * 09.2012 created [Juerg Hutter]
760!> \note The pseudo-potential is written into the 'iunit' file unit or as the file 'GTH-PARAMETER'
761!> inside the current working directory if the I/O unit is not given explicitly.
762! **************************************************************************************************
763 SUBROUTINE atom_write_pseudo_param(gthpot, iunit, fopt)
764 TYPE(atom_gthpot_type), INTENT(INOUT) :: gthpot
765 INTEGER, INTENT(IN), OPTIONAL :: iunit
766 REAL(kind=dp), INTENT(IN), OPTIONAL :: fopt
767
768 INTEGER :: i, iw, j, k, n
769
770 IF (PRESENT(iunit)) THEN
771 iw = iunit
772 ELSE
773 CALL open_file(file_name="GTH-PARAMETER", file_status="UNKNOWN", file_action="WRITE", unit_number=iw)
774 END IF
775 IF (PRESENT(fopt)) THEN
776 WRITE (iw, '(A,F30.8)') "# "//trim(adjustl(gthpot%symbol)), fopt
777 ELSE
778 WRITE (iw, '(A)') trim(adjustl(gthpot%symbol))//" "//trim(adjustl(gthpot%pname))
779 END IF
780 WRITE (iw, '(4I5)') gthpot%econf(0:3)
781 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%rc, gthpot%ncl, (gthpot%cl(i), i=1, gthpot%ncl)
782 IF (gthpot%lpotextended) THEN
783 WRITE (iw, '(A,I5)') " LPOT", gthpot%nexp_lpot
784 DO i = 1, gthpot%nexp_lpot
785 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%alpha_lpot(i), gthpot%nct_lpot(i), &
786 (gthpot%cval_lpot(j, i), j=1, gthpot%nct_lpot(i))
787 END DO
788 END IF
789 IF (gthpot%lsdpot) THEN
790 WRITE (iw, '(A,I5)') " LSD ", gthpot%nexp_lsd
791 DO i = 1, gthpot%nexp_lsd
792 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%alpha_lsd(i), gthpot%nct_lsd(i), &
793 (gthpot%cval_lsd(j, i), j=1, gthpot%nct_lsd(i))
794 END DO
795 END IF
796 IF (gthpot%nlcc) THEN
797 WRITE (iw, '(A,I5)') " NLCC ", gthpot%nexp_nlcc
798 DO i = 1, gthpot%nexp_nlcc
799 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%alpha_nlcc(i), gthpot%nct_nlcc(i), &
800 (gthpot%cval_nlcc(j, i)*4.0_dp*pi, j=1, gthpot%nct_nlcc(i))
801 END DO
802 END IF
803 n = 0
804 DO i = lmat, 0, -1
805 IF (gthpot%nl(i) > 0) THEN
806 n = i + 1
807 EXIT
808 END IF
809 END DO
810 WRITE (iw, '(I8)') n
811 DO i = 0, n - 1
812 WRITE (iw, '(F20.14,I8,5F20.14)') gthpot%rcnl(i), gthpot%nl(i), (gthpot%hnl(1, k, i), k=1, gthpot%nl(i))
813 SELECT CASE (gthpot%nl(i))
814 CASE (2)
815 WRITE (iw, '(T49,F20.14)') gthpot%hnl(2, 2, i)
816 CASE (3)
817 WRITE (iw, '(T49,2F20.14)') gthpot%hnl(2, 2, i), gthpot%hnl(2, 3, i)
818 WRITE (iw, '(T69,F20.14)') gthpot%hnl(3, 3, i)
819 CASE DEFAULT
820 DO j = 2, gthpot%nl(i)
821 WRITE (iw, '(T29,5F20.14)') (gthpot%hnl(j, k, i), k=j, gthpot%nl(i))
822 END DO
823 END SELECT
824 END DO
825 IF (gthpot%soc) THEN
826 DO i = 1, n - 1
827 WRITE (iw, '(T29,5F20.14)') (gthpot%hnl(1, k, i), k=1, gthpot%nl(i))
828 SELECT CASE (gthpot%nl(i))
829 CASE (2)
830 WRITE (iw, '(T49,F20.14)') gthpot%knl(2, 2, i)
831 CASE (3)
832 WRITE (iw, '(T49,2F20.14)') gthpot%knl(2, 2, i), gthpot%knl(2, 3, i)
833 WRITE (iw, '(T69,F20.14)') gthpot%knl(3, 3, i)
834 CASE DEFAULT
835 DO j = 2, gthpot%nl(i)
836 WRITE (iw, '(T29,5F20.14)') (gthpot%knl(j, k, i), k=j, gthpot%nl(i))
837 END DO
838 END SELECT
839 END DO
840 END IF
841 IF (.NOT. PRESENT(iunit)) CALL close_file(unit_number=iw)
842
843 END SUBROUTINE atom_write_pseudo_param
844
845! **************************************************************************************************
846!> \brief Print atomic orbitals.
847!> \param atom information about the atomic kind
848!> \param iw output file unit
849!> \param xmgrace ...
850!> \par History
851!> * 04.2013 created [Juerg Hutter]
852! **************************************************************************************************
853 SUBROUTINE atom_print_orbitals(atom, iw, xmgrace)
854 TYPE(atom_type), POINTER :: atom
855 INTEGER, INTENT(IN) :: iw
856 LOGICAL, INTENT(IN), OPTIONAL :: xmgrace
857
858 CHARACTER(LEN=40) :: fnbody
859 INTEGER :: z
860 LOGICAL :: graph
861
862 SELECT CASE (atom%method_type)
863 CASE DEFAULT
864 cpabort("")
865 CASE (do_rks_atom)
866 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfn, "", iw)
867 CASE (do_uks_atom)
868 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfna, "Alpha", iw)
869 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfnb, "Beta", iw)
870 CASE (do_rhf_atom)
871 CALL atom_print_orbitals_helper(atom, atom%orbitals%wfn, "", iw)
872 CASE (do_uhf_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_rohf_atom)
876 cpabort("")
877 END SELECT
878
879 graph = .false.
880 IF (PRESENT(xmgrace)) graph = xmgrace
881 IF (graph .AND. iw > 0) THEN
882 z = atom%z
883 fnbody = trim(ptable(z)%symbol)//"_PPorbital"
884 SELECT CASE (atom%method_type)
885 CASE DEFAULT
886 cpabort("")
887 CASE (do_rks_atom)
888 CALL atom_orbitals_grace(atom, atom%orbitals%wfn, fnbody)
889 CASE (do_uks_atom)
890 CALL atom_orbitals_grace(atom, atom%orbitals%wfna, trim(fnbody)//"alpha")
891 CALL atom_orbitals_grace(atom, atom%orbitals%wfnb, trim(fnbody)//"beta")
892 CASE (do_rhf_atom)
893 CALL atom_orbitals_grace(atom, atom%orbitals%wfn, fnbody)
894 CASE (do_uhf_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_rohf_atom)
898 cpabort("")
899 END SELECT
900 END IF
901
902 END SUBROUTINE atom_print_orbitals
903
904! **************************************************************************************************
905!> \brief Print atomic orbitals of the given spin.
906!> \param atom information about the atomic kind
907!> \param wfn atomic orbitals
908!> \param description description string
909!> \param iw output file unit
910!> \par History
911!> * 04.2013 created [Juerg Hutter]
912! **************************************************************************************************
913 SUBROUTINE atom_print_orbitals_helper(atom, wfn, description, iw)
914 TYPE(atom_type), POINTER :: atom
915 REAL(kind=dp), DIMENSION(:, :, 0:), INTENT(INOUT) :: wfn
916 CHARACTER(len=*), INTENT(IN) :: description
917 INTEGER, INTENT(IN) :: iw
918
919 INTEGER :: b, l, maxl, nb, nv, v
920
921 WRITE (iw, '(/,A,A,A)') " Atomic orbital expansion coefficients [", description, "]"
922
923 maxl = atom%state%maxl_calc
924 DO l = 0, maxl
925
926 nb = atom%basis%nbas(l)
927 nv = atom%state%maxn_calc(l)
928 IF (nb > 0 .AND. nv > 0) THEN
929 nv = min(nv, SIZE(wfn, 2))
930 DO v = 1, nv
931 WRITE (iw, '(/," ORBITAL L = ",I1," State = ",I3)') l, v
932 DO b = 1, nb
933 WRITE (iw, '(" ",ES23.15)') wfn(b, v, l)
934 END DO
935 END DO
936 END IF
937 END DO
938 END SUBROUTINE atom_print_orbitals_helper
939
940! **************************************************************************************************
941!> \brief Print atomic orbitals of the given spin.
942!> \param atom information about the atomic kind
943!> \param wfn atomic orbitals
944!> \param fnbody body of file name
945!> \par History
946!> * 02.2025 created [Juerg Hutter]
947! **************************************************************************************************
948 SUBROUTINE atom_orbitals_grace(atom, wfn, fnbody)
949 TYPE(atom_type), POINTER :: atom
950 REAL(kind=dp), DIMENSION(:, :, 0:), INTENT(INOUT) :: wfn
951 CHARACTER(len=*), INTENT(IN) :: fnbody
952
953 CHARACTER(LEN=1), DIMENSION(0:8) :: lname
954 CHARACTER(LEN=1), DIMENSION(1:9) :: wnum
955 CHARACTER(LEN=40) :: fname, legend
956 INTEGER :: b, i, iw, l, m, maxl, nb, nv, v
957 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: gdata, wfnr
958 REAL(kind=dp), DIMENSION(4) :: world_coord
959
960 lname = ['s', 'p', 'd', 'f', 'g', 'h', 'j', 'k', 'l']
961 wnum = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
962 m = atom%basis%grid%nr
963 maxl = atom%state%maxl_calc
964 DO l = 0, maxl
965 fname = trim(fnbody)//"_"//lname(l)//".agr"
966 nb = atom%basis%nbas(l)
967 nv = atom%state%maxn_calc(l)
968 IF (nb > 0 .AND. nv > 0) THEN
969 CALL open_file(file_name=fname, file_status="UNKNOWN", file_action="WRITE", unit_number=iw)
970 nv = min(nv, SIZE(wfn, 2))
971 ALLOCATE (wfnr(m, nv))
972 wfnr = 0.0_dp
973 DO v = 1, nv
974 DO b = 1, nb
975 wfnr(:, v) = wfnr(:, v) + wfn(b, v, l)*atom%basis%bf(:, b, l)
976 END DO
977 END DO
978 world_coord(1) = 0.0_dp
979 world_coord(2) = minval(wfnr) - 0.5_dp
980 world_coord(3) = 15.0_dp
981 world_coord(4) = maxval(wfnr) + 0.5_dp
982 !
983 CALL xm_write_defaults(iw)
984 CALL xm_write_frameport(iw)
985 CALL xm_write_frame(iw, world_coord, &
986 title="PP Radial Wavefunction", &
987 subtitle=lname(l)//"-Quantum Number", &
988 xlabel="Radius [Bohr]", &
989 ylabel="")
990 DO i = 0, nv - 1
991 legend = "WFN "//wnum(i + 1)
992 CALL xm_graph_info(iw, i, 2.5_dp, legend)
993 END DO
994 ALLOCATE (gdata(m, 2))
995 gdata(1:m, 1) = atom%basis%grid%rad(1:m)
996 DO i = 0, nv - 1
997 gdata(1:m, 2) = wfnr(1:m, i + 1)
998 CALL xm_graph_data(iw, i, gdata)
999 END DO
1000 DEALLOCATE (gdata, wfnr)
1001 CALL close_file(iw)
1002 END IF
1003 END DO
1004 END SUBROUTINE atom_orbitals_grace
1005
1006END 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