(git:4dc5213)
Loading...
Searching...
No Matches
xas_restart.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 Initialize the XAS orbitals for specific core excitations
10!> Either the GS orbitals are used as initial guess, or the
11!> xas mos are read from a previous calculation.
12!> In the latter case, the core-hole potetial should be the same.
13!> \note
14!> The restart with the same core-hole potential should be checked
15!> and a wrong restart should stop the program
16!> \par History
17!> created 09.2006
18!> \author MI (09.2006)
19! **************************************************************************************************
21
23 USE cp_dbcsr_api, ONLY: dbcsr_p_type
25 USE cp_files, ONLY: close_file,&
27 USE cp_fm_types, ONLY: cp_fm_create,&
38 USE cp_output_handling, ONLY: cp_p_file,&
44 USE kinds, ONLY: default_path_length,&
46 dp
59 USE qs_mo_types, ONLY: get_mo_set,&
64 USE qs_rho_types, ONLY: qs_rho_get,&
68 USE string_utilities, ONLY: xstring
69 USE xas_env_types, ONLY: get_xas_env,&
72#include "./base/base_uses.f90"
73
74 IMPLICIT NONE
75 PRIVATE
76
77 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xas_restart'
78
79! *** Public subroutines ***
80
82
83CONTAINS
84
85! **************************************************************************************************
86!> \brief Set up for reading the restart
87!> corresponding to the excitation of iatom
88!> If the corresponding restart file does not exist
89!> the GS orbitals are used as initial guess
90!> \param xas_env ...
91!> \param xas_section input section for XAS calculations
92!> qs_env:
93!> \param qs_env ...
94!> \param xas_method ...
95!> \param iatom index of the absorbing atom
96!> \param estate index of the core-hole orbital
97!> \param istate counter of excited states per atom
98!> error:
99!> \par History
100!> 09.2006 created [MI]
101!> \author MI
102! **************************************************************************************************
103 SUBROUTINE xas_read_restart(xas_env, xas_section, qs_env, xas_method, iatom, estate, istate)
104
105 TYPE(xas_environment_type), POINTER :: xas_env
106 TYPE(section_vals_type), POINTER :: xas_section
107 TYPE(qs_environment_type), POINTER :: qs_env
108 INTEGER, INTENT(IN) :: xas_method, iatom
109 INTEGER, INTENT(OUT) :: estate
110 INTEGER, INTENT(IN) :: istate
111
112 CHARACTER(LEN=*), PARAMETER :: routinen = 'xas_read_restart'
113
114 CHARACTER(LEN=default_path_length) :: filename
115 INTEGER :: handle, i, ia, ie, ispin, my_spin, nao, nao_read, nelectron, nexc_atoms, &
116 nexc_atoms_read, nexc_search, nexc_search_read, nmo, nmo_read, output_unit, rst_unit, &
117 xas_estate, xas_estate_read, xas_method_read
118 LOGICAL :: file_exists
119 REAL(dp) :: occ_estate, occ_estate_read, &
120 xas_nelectron, xas_nelectron_read
121 REAL(dp), DIMENSION(:), POINTER :: eigenvalues, occupation_numbers
122 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eig_read, occ_read
123 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer
124 TYPE(cp_fm_type), POINTER :: mo_coeff
125 TYPE(cp_logger_type), POINTER :: logger
126 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
127 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
128 TYPE(mp_para_env_type), POINTER :: para_env
129
130 CALL timeset(routinen, handle)
131
132 file_exists = .false.
133 rst_unit = -1
134
135 NULLIFY (eigenvalues, matrix_s, mos, occupation_numbers, vecbuffer)
136 NULLIFY (logger)
137 logger => cp_get_default_logger()
138
139 output_unit = cp_print_key_unit_nr(logger, xas_section, &
140 "PRINT%PROGRAM_RUN_INFO", extension=".Log")
141
142 CALL get_qs_env(qs_env=qs_env, para_env=para_env)
143
144 IF (para_env%is_source()) THEN
145 CALL wfn_restart_file_name(filename, file_exists, xas_section, logger, &
146 xas=.true.)
147
148 CALL xstring(filename, ia, ie)
149 filename = filename(ia:ie)//'-at'//trim(adjustl(cp_to_string(iatom)))// &
150 '_st'//trim(adjustl(cp_to_string(istate)))//'.rst'
151
152 INQUIRE (file=filename, exist=file_exists)
153 ! open file
154 IF (file_exists) THEN
155
156 CALL open_file(file_name=trim(filename), &
157 file_action="READ", &
158 file_form="UNFORMATTED", &
159 file_position="REWIND", &
160 file_status="OLD", &
161 unit_number=rst_unit)
162
163 IF (output_unit > 0) WRITE (unit=output_unit, fmt="(/,T20,A,I5,/)") &
164 "Read restart file for atom ", iatom
165
166 ELSE IF (.NOT. file_exists) THEN
167 IF (output_unit > 0) WRITE (unit=output_unit, fmt="(/,T10,A,I5,A,/)") &
168 "Restart file for atom ", iatom, &
169 " not available. Initialization done with GS orbitals"
170 END IF
171 END IF
172 CALL para_env%bcast(file_exists)
173
174 CALL get_xas_env(xas_env=xas_env, occ_estate=occ_estate, xas_estate=xas_estate, &
175 xas_nelectron=xas_nelectron, nexc_search=nexc_search, &
176 nexc_atoms=nexc_atoms, spin_channel=my_spin)
177
178 IF (file_exists) THEN
179 CALL get_qs_env(qs_env=qs_env, mos=mos, matrix_s=matrix_s)
180
181 IF (rst_unit > 0) THEN
182 READ (rst_unit) xas_method_read
183 READ (rst_unit) nexc_search_read, nexc_atoms_read, occ_estate_read, xas_nelectron_read
184 READ (rst_unit) xas_estate_read
185
186 IF (xas_method_read /= xas_method) THEN
187 cpabort("READ XAS RESTART: restart with different XAS method is not possible.")
188 END IF
189 IF (nexc_atoms_read /= nexc_atoms) THEN
190 CALL cp_abort(__location__, &
191 "READ XAS RESTART: restart with different excited atoms "// &
192 "is not possible. Start instead a new XAS run with the new set of atoms.")
193 END IF
194 END IF
195
196 CALL para_env%bcast(xas_estate_read)
197 CALL set_xas_env(xas_env=xas_env, xas_estate=xas_estate_read)
198 estate = xas_estate_read
199
200 CALL get_mo_set(mo_set=mos(my_spin), nao=nao)
201 ALLOCATE (vecbuffer(1, nao))
202
203 DO ispin = 1, SIZE(mos)
204 CALL get_mo_set(mo_set=mos(ispin), nmo=nmo, eigenvalues=eigenvalues, &
205 occupation_numbers=occupation_numbers, mo_coeff=mo_coeff, nelectron=nelectron)
206 eigenvalues = 0.0_dp
207 occupation_numbers = 0.0_dp
208 CALL cp_fm_set_all(mo_coeff, 0.0_dp)
209 IF (para_env%is_source()) THEN
210 READ (rst_unit) nao_read, nmo_read
211 IF (nao /= nao_read) THEN
212 cpabort("To change basis is not possible. ")
213 END IF
214 ALLOCATE (eig_read(nmo_read), occ_read(nmo_read))
215 eig_read = 0.0_dp
216 occ_read = 0.0_dp
217 nmo = min(nmo, nmo_read)
218 READ (rst_unit) eig_read(1:nmo_read), occ_read(1:nmo_read)
219 eigenvalues(1:nmo) = eig_read(1:nmo)
220 occupation_numbers(1:nmo) = occ_read(1:nmo)
221 IF (nmo_read > nmo) THEN
222 IF (occupation_numbers(nmo) >= epsilon(0.0_dp)) THEN
223 CALL cp_warn(__location__, &
224 "The number of occupied MOs on the restart unit is larger than "// &
225 "the allocated MOs.")
226 END IF
227
228 END IF
229 DEALLOCATE (eig_read, occ_read)
230 END IF
231 CALL para_env%bcast(eigenvalues)
232 CALL para_env%bcast(occupation_numbers)
233
234 DO i = 1, nmo
235 IF (para_env%is_source()) THEN
236 READ (rst_unit) vecbuffer
237 ELSE
238 vecbuffer(1, :) = 0.0_dp
239 END IF
240 CALL para_env%bcast(vecbuffer)
241 CALL cp_fm_set_submatrix(mo_coeff, &
242 vecbuffer, 1, i, nao, 1, transpose=.true.)
243 END DO
244 ! Skip extra MOs if there any
245 IF (para_env%is_source()) THEN
246 DO i = nmo + 1, nmo_read
247 READ (rst_unit) vecbuffer
248 END DO
249 END IF
250
251 END DO ! ispin
252
253 DEALLOCATE (vecbuffer)
254
255! nspin = SIZE(mos,1)
256! DO ispin = 1,nspin
257! ! ortho so that one can restart for different positions (basis sets?)
258! NULLIFY(mo_coeff)
259! CALL get_mo_set(mo_set=mos(ispin), mo_coeff=mo_coeff,homo=homo)
260! CALL make_basis_sm(mo_coeff,homo,matrix_s(1)%matrix)
261! END DO
262 END IF !file_exist
263
264 IF (para_env%is_source()) THEN
265 IF (file_exists) CALL close_file(unit_number=rst_unit)
266 END IF
267
268 CALL timestop(handle)
269
270 END SUBROUTINE xas_read_restart
271
272! **************************************************************************************************
273!> \brief ...
274!> \param xas_env ...
275!> \param xas_section ...
276!> \param qs_env ...
277!> \param xas_method ...
278!> \param iatom ...
279!> \param istate ...
280! **************************************************************************************************
281 SUBROUTINE xas_write_restart(xas_env, xas_section, qs_env, xas_method, iatom, istate)
282
283 TYPE(xas_environment_type), POINTER :: xas_env
284 TYPE(section_vals_type), POINTER :: xas_section
285 TYPE(qs_environment_type), POINTER :: qs_env
286 INTEGER, INTENT(IN) :: xas_method, iatom, istate
287
288 CHARACTER(LEN=*), PARAMETER :: routinen = 'xas_write_restart'
289
290 CHARACTER(LEN=default_path_length) :: filename
291 CHARACTER(LEN=default_string_length) :: my_middle
292 INTEGER :: handle, ispin, nao, nexc_atoms, &
293 nexc_search, nmo, output_unit, &
294 rst_unit, xas_estate
295 REAL(dp) :: occ_estate, xas_nelectron
296 REAL(dp), DIMENSION(:), POINTER :: eigenvalues, occupation_numbers
297 TYPE(cp_fm_type), POINTER :: mo_coeff
298 TYPE(cp_logger_type), POINTER :: logger
299 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
300 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
301 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
302 TYPE(section_vals_type), POINTER :: print_key
303
304 CALL timeset(routinen, handle)
305 NULLIFY (mos, logger, print_key, particle_set, qs_kind_set)
306 logger => cp_get_default_logger()
307
308 CALL get_xas_env(xas_env=xas_env, occ_estate=occ_estate, xas_estate=xas_estate, &
309 xas_nelectron=xas_nelectron, nexc_search=nexc_search, nexc_atoms=nexc_atoms)
310
311 IF (btest(cp_print_key_should_output(logger%iter_info, &
312 xas_section, "PRINT%RESTART", used_print_key=print_key), &
313 cp_p_file)) THEN
314
315 output_unit = cp_print_key_unit_nr(logger, xas_section, &
316 "PRINT%PROGRAM_RUN_INFO", extension=".Log")
317
318 CALL get_qs_env(qs_env=qs_env, mos=mos)
319
320 ! Open file
321 rst_unit = -1
322 my_middle = 'at'//trim(adjustl(cp_to_string(iatom)))//'_st'//trim(adjustl(cp_to_string(istate)))
323 rst_unit = cp_print_key_unit_nr(logger, xas_section, "PRINT%RESTART", &
324 extension=".rst", file_status="REPLACE", file_action="WRITE", &
325 file_form="UNFORMATTED", middle_name=trim(my_middle))
326
327 filename = cp_print_key_generate_filename(logger, print_key, &
328 middle_name=trim(my_middle), extension=".rst", &
329 my_local=.false.)
330
331 IF (output_unit > 0) THEN
332 WRITE (unit=output_unit, fmt="(/,T10,A,I5,A,A,/)") &
333 "Xas orbitals for the absorbing atom ", iatom, &
334 " are written in ", trim(filename)
335
336 END IF
337
338 ! Write mos
339 IF (rst_unit > 0) THEN
340 WRITE (rst_unit) xas_method
341 WRITE (rst_unit) nexc_search, nexc_atoms, occ_estate, xas_nelectron
342 WRITE (rst_unit) xas_estate
343 END IF
344 DO ispin = 1, SIZE(mos)
345 CALL get_mo_set(mos(ispin), mo_coeff=mo_coeff, nao=nao, nmo=nmo, &
346 eigenvalues=eigenvalues, occupation_numbers=occupation_numbers)
347 IF ((rst_unit > 0)) THEN
348 WRITE (rst_unit) nao, nmo
349 WRITE (rst_unit) eigenvalues(1:nmo), &
350 occupation_numbers(1:nmo)
351 END IF
352 CALL cp_fm_write_unformatted(mo_coeff, rst_unit)
353 END DO
354
355! Close file
356 CALL cp_print_key_finished_output(rst_unit, logger, xas_section, &
357 "PRINT%RESTART")
358 END IF
359
360 IF (btest(cp_print_key_should_output(logger%iter_info, &
361 xas_section, "PRINT%FULL_RESTART", used_print_key=print_key), &
362 cp_p_file)) THEN
363 rst_unit = cp_print_key_unit_nr(logger, xas_section, "PRINT%FULL_RESTART", &
364 extension="_full.rst", file_status="REPLACE", file_action="WRITE", &
365 file_form="UNFORMATTED", middle_name=trim(my_middle))
366
367 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set, qs_kind_set=qs_kind_set)
368 CALL write_mo_set_low(mos, particle_set=particle_set, &
369 qs_kind_set=qs_kind_set, ires=rst_unit)
370 CALL cp_print_key_finished_output(rst_unit, logger, xas_section, "PRINT%FULL_RESTART")
371
372 END IF
373
374 CALL timestop(handle)
375
376 END SUBROUTINE xas_write_restart
377
378!****f* xas_restart/xas_initialize_rho [1.0] *
379
380! **************************************************************************************************
381!> \brief Once the mos and the occupation numbers are initialized
382!> the electronic density of the excited state can be calclated
383!> \param qs_env ...
384!> \param scf_env ...
385!> \param scf_control ...
386!> \par History
387!> 09-2006 MI created
388!> \author MI
389! **************************************************************************************************
390 SUBROUTINE xas_initialize_rho(qs_env, scf_env, scf_control)
391
392 TYPE(qs_environment_type), POINTER :: qs_env
393 TYPE(qs_scf_env_type), POINTER :: scf_env
394 TYPE(scf_control_type), POINTER :: scf_control
395
396 CHARACTER(LEN=*), PARAMETER :: routinen = 'xas_initialize_rho'
397
398 INTEGER :: handle, ispin, my_spin, nelectron
399 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_ao
400 TYPE(dft_control_type), POINTER :: dft_control
401 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
402 TYPE(mp_para_env_type), POINTER :: para_env
403 TYPE(qs_rho_type), POINTER :: rho
404 TYPE(rho_atom_type), DIMENSION(:), POINTER :: rho_atom
405 TYPE(xas_environment_type), POINTER :: xas_env
406
407 CALL timeset(routinen, handle)
408
409 NULLIFY (mos, rho, xas_env, para_env, rho_ao)
410
411 CALL get_qs_env(qs_env, &
412 mos=mos, &
413 rho=rho, &
414 xas_env=xas_env, &
415 para_env=para_env)
416
417 my_spin = xas_env%spin_channel
418 CALL qs_rho_get(rho, rho_ao=rho_ao)
419 DO ispin = 1, SIZE(mos)
420 IF (ispin == my_spin) THEN
421 IF (xas_env%homo_occ == 0) THEN
422 CALL get_mo_set(mos(ispin), nelectron=nelectron)
423 nelectron = nelectron - 1
424 CALL set_mo_set(mos(ispin), nelectron=nelectron)
425 END IF
426 CALL set_mo_occupation(mo_set=qs_env%mos(ispin), smear=scf_control%smear, &
427 xas_env=xas_env)
428 ELSE
429 CALL set_mo_occupation(mo_set=qs_env%mos(ispin), smear=scf_control%smear)
430 END IF
431 CALL calculate_density_matrix(mo_set=mos(ispin), &
432 density_matrix=rho_ao(ispin)%matrix)
433 END DO
434
435 CALL qs_rho_update_rho(rho, qs_env=qs_env)
436 CALL qs_ks_did_change(qs_env%ks_env, rho_changed=.true.)
437
438 IF (scf_env%mixing_method > 1) THEN
439 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
440 IF (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb) THEN
441 cpabort('TB Code not available')
442 ELSE IF (dft_control%qs_control%semi_empirical) THEN
443 cpabort('SE Code not possible')
444 ELSE
445 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
446 CALL mixing_init(scf_env%mixing_method, rho, scf_env%mixing_store, &
447 para_env, rho_atom=rho_atom)
448 END IF
449 END IF
450
451 CALL timestop(handle)
452
453 END SUBROUTINE xas_initialize_rho
454
455! **************************************************************************************************
456!> \brief Find the index of the core orbital that has been excited by XAS
457!> \param xas_env ...
458!> \param mos ...
459!> \param matrix_s ...
460!> \par History
461!> 03-2010 MI created
462!> \author MI
463! **************************************************************************************************
464
465 SUBROUTINE find_excited_core_orbital(xas_env, mos, matrix_s)
466
467 TYPE(xas_environment_type), POINTER :: xas_env
468 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos
469 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
470
471 INTEGER :: i, ic_max, ir_max, m, my_spin, n, nao, &
472 nexc_search, nmo, xas_estate
473 INTEGER, DIMENSION(:), POINTER :: col_indices
474 REAL(dp) :: a_max, b_max, ip_energy, occ_estate
475 REAL(kind=dp), DIMENSION(:), POINTER :: eigenvalues, occupation_numbers
476 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer, vecbuffer2
477 TYPE(cp_fm_type) :: fm_work
478 TYPE(cp_fm_type), POINTER :: excvec_coeff, excvec_overlap, mo_coeff
479
480 NULLIFY (excvec_coeff, excvec_overlap, mo_coeff)
481 ! Some elements from the xas_env
482 CALL get_xas_env(xas_env=xas_env, excvec_coeff=excvec_coeff, &
483 excvec_overlap=excvec_overlap, nexc_search=nexc_search, &
484 xas_estate=xas_estate, occ_estate=occ_estate, spin_channel=my_spin)
485 cpassert(ASSOCIATED(excvec_overlap))
486
487 CALL get_mo_set(mos(my_spin), mo_coeff=mo_coeff, nao=nao, nmo=nmo, &
488 eigenvalues=eigenvalues, occupation_numbers=occupation_numbers)
489 ALLOCATE (vecbuffer(1, nao))
490 vecbuffer = 0.0_dp
491 ALLOCATE (vecbuffer2(1, nexc_search))
492 vecbuffer2 = 0.0_dp
493
494 ! ** use the maximum overlap criterion to find the index of the excited orbital
495 CALL cp_fm_create(fm_work, mo_coeff%matrix_struct)
496 CALL cp_dbcsr_sm_fm_multiply(matrix_s(1)%matrix, mo_coeff, fm_work, ncol=nmo)
497 CALL parallel_gemm("T", "N", 1, xas_env%nexc_search, nao, 1.0_dp, excvec_coeff, &
498 fm_work, 0.0_dp, excvec_overlap, b_first_col=1)
499 CALL cp_fm_get_info(matrix=excvec_overlap, col_indices=col_indices, &
500 nrow_global=m, ncol_global=n)
501 CALL cp_fm_get_submatrix(excvec_overlap, vecbuffer2, 1, 1, &
502 1, nexc_search, transpose=.false.)
503 CALL cp_fm_release(fm_work)
504
505 b_max = 0.0_dp
506 ic_max = xas_estate
507 DO i = 1, nexc_search
508 a_max = abs(vecbuffer2(1, i))
509 IF (a_max > b_max) THEN
510 ic_max = i
511
512 b_max = a_max
513 END IF
514 END DO
515
516 IF (ic_max /= xas_estate) THEN
517 ir_max = xas_estate
518 xas_estate = ic_max
519 occupation_numbers(xas_estate) = occ_estate
520 occupation_numbers(ir_max) = 1.0_dp
521 END IF
522
523 ! Ionization Potential
524 ip_energy = eigenvalues(xas_estate)
525 CALL set_xas_env(xas_env=xas_env, xas_estate=xas_estate, ip_energy=ip_energy)
526
527 CALL cp_fm_get_submatrix(mo_coeff, vecbuffer, 1, xas_estate, &
528 nao, 1, transpose=.true.)
529 CALL cp_fm_set_submatrix(excvec_coeff, vecbuffer, 1, 1, &
530 nao, 1, transpose=.true.)
531
532 DEALLOCATE (vecbuffer, vecbuffer2)
533
534 END SUBROUTINE find_excited_core_orbital
535
536END MODULE xas_restart
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_sm_fm_multiply(matrix, fm_in, fm_out, ncol, alpha, beta)
multiply a dbcsr with a fm matrix
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
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
Definition cp_files.F:504
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
subroutine, public cp_fm_write_unformatted(fm, unit)
...
subroutine, public cp_fm_set_submatrix(fm, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
sets a submatrix of a full matrix fm(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*o...
subroutine, public cp_fm_set_all(matrix, alpha, beta)
set all elements of a matrix to the same value, and optionally the diagonal to a different one
subroutine, public cp_fm_create(matrix, matrix_struct, name, nrow, ncol, set_zero)
creates a new full matrix with the given structure
subroutine, public cp_fm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
gets a submatrix of a full matrix op(target_m)(1:n_rows,1:n_cols) =fm(start_row:start_row+n_rows,...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
character(len=default_path_length) function, public cp_print_key_generate_filename(logger, print_key, middle_name, extension, my_local)
Utility function that returns a unit number to write the print key. Might open a file with a unique f...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
objects that represent the structure of input sections and the data contained in an input section
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
integer, parameter, public default_path_length
Definition kinds.F:58
Interface to the message passing library MPI.
basic linear algebra operations for full matrixes
Define the data structure for the particle information.
collects routines that calculate density matrices
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
subroutine, public qs_ks_did_change(ks_env, s_mstruct_changed, rho_changed, potential_changed, full_reset)
tells that some of the things relevant to the ks calculation did change. has to be called when change...
subroutine, public mixing_init(mixing_method, rho, mixing_store, para_env, rho_atom)
initialiation needed when gspace mixing is used
Definition and initialisation of the mo data type.
Definition qs_mo_io.F:21
subroutine, public wfn_restart_file_name(filename, exist, section, logger, kp, xas, rtp)
...
Definition qs_mo_io.F:458
subroutine, public write_mo_set_low(mo_array, qs_kind_set, particle_set, ires, rt_mos, matrix_ks)
...
Definition qs_mo_io.F:295
Set occupation of molecular orbitals.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public set_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, uniform_occupation, kts, mu, flexible_electron_count)
Set the components of a MO set data structure.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
methods of the rho structure (defined in qs_rho_types)
subroutine, public qs_rho_update_rho(rho_struct, qs_env, rho_xc_external, local_rho_set, task_list_external, task_list_external_soft, pw_env_external, para_env_external)
updates rho_r and rho_g to the rhorho_ao. if use_kinetic_energy_density also computes tau_r and tau_g...
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
module that contains the definitions of the scf types
parameters that control an scf iteration
Utilities for string manipulations.
elemental subroutine, public xstring(string, ia, ib)
...
define create destroy get and put information in xas_env to calculate the x-ray absorption spectra
subroutine, public set_xas_env(xas_env, nexc_search, spin_channel, nexc_atoms, nvirtual, nvirtual2, ip_energy, occ_estate, qs_loc_env, xas_estate, xas_nelectron, homo_occ, scf_env, scf_control)
...
subroutine, public get_xas_env(xas_env, exc_state, nao, nvirtual, nvirtual2, centers_wfn, atom_of_state, exc_atoms, nexc_states, type_of_state, mykind_of_atom, mykind_of_kind, state_of_atom, spectrum, groundstate_coeff, ostrength_sm, dip_fm_set, excvec_coeff, excvec_overlap, unoccupied_orbs, unoccupied_evals, unoccupied_max_iter, unoccupied_eps, all_vectors, all_evals, my_gto_basis, qs_loc_env, stogto_overlap, occ_estate, xas_nelectron, xas_estate, nexc_atoms, nexc_search, spin_channel, scf_env, scf_control)
...
Initialize the XAS orbitals for specific core excitations Either the GS orbitals are used as initial ...
Definition xas_restart.F:20
subroutine, public xas_initialize_rho(qs_env, scf_env, scf_control)
Once the mos and the occupation numbers are initialized the electronic density of the excited state c...
subroutine, public xas_read_restart(xas_env, xas_section, qs_env, xas_method, iatom, estate, istate)
Set up for reading the restart corresponding to the excitation of iatom If the corresponding restart ...
subroutine, public xas_write_restart(xas_env, xas_section, qs_env, xas_method, iatom, istate)
...
subroutine, public find_excited_core_orbital(xas_env, mos, matrix_s)
Find the index of the core orbital that has been excited by XAS.
represent a full matrix
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
keeps the density in various representations, keeping track of which ones are valid.