(git:97501a3)
Loading...
Searching...
No Matches
qs_mo_io.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Definition and initialisation of the mo data type.
10!> \par History
11!> - adapted to the new QS environment data structure (02.04.2002,MK)
12!> - set_mo_occupation added (17.04.02,MK)
13!> - correct_mo_eigenvalues added (18.04.02,MK)
14!> - calculate_density_matrix moved from qs_scf to here (22.04.02,MK)
15!> - mo_set_p_type added (23.04.02,MK)
16!> - PRIVATE attribute set for TYPE mo_set_type (23.04.02,MK)
17!> - started conversion to LSD (1.2003, Joost VandeVondele)
18!> - Split of from qs_mo_types (07.2014, JGH)
19!> \author Matthias Krack (09.05.2001,MK)
20! **************************************************************************************************
22
34 USE cp_files, ONLY: close_file,&
36 USE cp_fm_types, ONLY: cp_fm_get_info,&
47 USE cp_output_handling, ONLY: cp_p_file,&
55 USE kahan_sum, ONLY: accurate_sum
56 USE kinds, ONLY: default_path_length,&
58 dp
60 USE orbital_pointers, ONLY: indco,&
61 nco,&
62 nso
63 USE orbital_symbols, ONLY: cgf_symbol,&
67 USE physcon, ONLY: evolt
71 USE qs_kind_types, ONLY: get_qs_kind,&
76 USE qs_mo_types, ONLY: get_mo_set,&
78#include "./base/base_uses.f90"
79
80 IMPLICIT NONE
81
82 PRIVATE
83
84 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_mo_io'
85
86 PUBLIC :: wfn_restart_file_name, &
95
96CONTAINS
97
98! **************************************************************************************************
99!> \brief ...
100!> \param mo_array ...
101!> \param particle_set ...
102!> \param dft_section ...
103!> \param qs_kind_set ...
104!> \param matrix_ks ...
105! **************************************************************************************************
106 SUBROUTINE write_mo_set_to_restart(mo_array, particle_set, dft_section, qs_kind_set, matrix_ks)
107
108 TYPE(mo_set_type), DIMENSION(:), INTENT(IN) :: mo_array
109 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
110 TYPE(section_vals_type), POINTER :: dft_section
111 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
112 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
113 POINTER :: matrix_ks
114
115 CHARACTER(LEN=*), PARAMETER :: routinen = 'write_mo_set_to_restart'
116 CHARACTER(LEN=30), DIMENSION(2), PARAMETER :: &
117 keys = (/"SCF%PRINT%RESTART_HISTORY", "SCF%PRINT%RESTART "/)
118
119 INTEGER :: handle, ikey, ires, ispin
120 TYPE(cp_logger_type), POINTER :: logger
121
122 CALL timeset(routinen, handle)
123
124 logger => cp_get_default_logger()
125
126 IF (btest(cp_print_key_should_output(logger%iter_info, &
127 dft_section, keys(1)), cp_p_file) .OR. &
128 btest(cp_print_key_should_output(logger%iter_info, &
129 dft_section, keys(2)), cp_p_file)) THEN
130
131 IF (mo_array(1)%use_mo_coeff_b) THEN
132 ! we are using the dbcsr mo_coeff
133 ! we copy it to the fm for anycase
134 DO ispin = 1, SIZE(mo_array)
135 IF (.NOT. ASSOCIATED(mo_array(ispin)%mo_coeff_b)) THEN
136 cpassert(.false.)
137 END IF
138 CALL copy_dbcsr_to_fm(mo_array(ispin)%mo_coeff_b, &
139 mo_array(ispin)%mo_coeff) !fm->dbcsr
140 END DO
141 END IF
142
143 DO ikey = 1, SIZE(keys)
144 IF (btest(cp_print_key_should_output(logger%iter_info, &
145 dft_section, keys(ikey)), cp_p_file)) THEN
146 ires = cp_print_key_unit_nr(logger, dft_section, keys(ikey), &
147 extension=".wfn", file_status="REPLACE", file_action="WRITE", &
148 do_backup=.true., file_form="UNFORMATTED")
149 IF (PRESENT(matrix_ks)) THEN
150 CALL write_mo_set_low(mo_array, particle_set=particle_set, qs_kind_set=qs_kind_set, &
151 ires=ires, matrix_ks=matrix_ks)
152 ELSE
153 CALL write_mo_set_low(mo_array, particle_set=particle_set, qs_kind_set=qs_kind_set, &
154 ires=ires)
155 END IF
156 CALL cp_print_key_finished_output(ires, logger, dft_section, trim(keys(ikey)))
157 END IF
158 END DO
159 END IF
160
161 CALL timestop(handle)
162
163 END SUBROUTINE write_mo_set_to_restart
164
165! **************************************************************************************************
166!> \brief calculates density matrix from mo set and writes the density matrix
167!> into a binary restart file
168!> \param mo_array mos
169!> \param dft_section dft input section
170!> \param tmpl_matrix template dbcsr matrix
171!> \author Mohammad Hossein Bani-Hashemian
172! **************************************************************************************************
173 SUBROUTINE write_dm_binary_restart(mo_array, dft_section, tmpl_matrix)
174
175 TYPE(mo_set_type), DIMENSION(:), INTENT(IN) :: mo_array
176 TYPE(section_vals_type), POINTER :: dft_section
177 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: tmpl_matrix
178
179 CHARACTER(LEN=*), PARAMETER :: routinen = 'write_dm_binary_restart'
180
181 CHARACTER(LEN=default_path_length) :: file_name, project_name
182 INTEGER :: handle, ispin, unit_nr
183 LOGICAL :: do_dm_restart
184 REAL(kind=dp) :: cs_pos
185 TYPE(cp_logger_type), POINTER :: logger
186 TYPE(dbcsr_type), POINTER :: matrix_p_tmp
187
188 CALL timeset(routinen, handle)
189 logger => cp_get_default_logger()
190 IF (logger%para_env%is_source()) THEN
191 unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
192 ELSE
193 unit_nr = -1
194 END IF
195
196 project_name = logger%iter_info%project_name
197 CALL section_vals_val_get(dft_section, "SCF%PRINT%DM_RESTART_WRITE", l_val=do_dm_restart)
198 NULLIFY (matrix_p_tmp)
199
200 IF (do_dm_restart) THEN
201 ALLOCATE (matrix_p_tmp)
202 DO ispin = 1, SIZE(mo_array)
203 CALL dbcsr_create(matrix_p_tmp, template=tmpl_matrix(ispin)%matrix, name="DM RESTART")
204
205 IF (.NOT. ASSOCIATED(mo_array(ispin)%mo_coeff_b)) cpabort("mo_coeff_b NOT ASSOCIATED")
206
207 CALL copy_fm_to_dbcsr(mo_array(ispin)%mo_coeff, mo_array(ispin)%mo_coeff_b)
208 CALL calculate_density_matrix(mo_array(ispin), matrix_p_tmp, &
209 use_dbcsr=.true., retain_sparsity=.false.)
210
211 WRITE (file_name, '(A,I0,A)') trim(project_name)//"_SCF_DM_SPIN_", ispin, "_RESTART.dm"
212 cs_pos = dbcsr_checksum(matrix_p_tmp, pos=.true.)
213 IF (unit_nr > 0) THEN
214 WRITE (unit_nr, '(T2,A,E20.8)') "Writing restart DM "//trim(file_name)//" with checksum: ", cs_pos
215 END IF
216 CALL dbcsr_binary_write(matrix_p_tmp, file_name)
217
218 CALL dbcsr_release(matrix_p_tmp)
219 END DO
220 DEALLOCATE (matrix_p_tmp)
221 END IF
222
223 CALL timestop(handle)
224
225 END SUBROUTINE write_dm_binary_restart
226
227! **************************************************************************************************
228!> \brief ...
229!> \param mo_array ...
230!> \param rt_mos ...
231!> \param particle_set ...
232!> \param dft_section ...
233!> \param qs_kind_set ...
234! **************************************************************************************************
235 SUBROUTINE write_rt_mos_to_restart(mo_array, rt_mos, particle_set, dft_section, qs_kind_set)
236
237 TYPE(mo_set_type), DIMENSION(:), INTENT(IN) :: mo_array
238 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN) :: rt_mos
239 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
240 TYPE(section_vals_type), POINTER :: dft_section
241 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
242
243 CHARACTER(LEN=*), PARAMETER :: routinen = 'write_rt_mos_to_restart'
244 CHARACTER(LEN=43), DIMENSION(2), PARAMETER :: keys = (/ &
245 "REAL_TIME_PROPAGATION%PRINT%RESTART_HISTORY", &
246 "REAL_TIME_PROPAGATION%PRINT%RESTART "/)
247
248 INTEGER :: handle, ikey, ires
249 TYPE(cp_logger_type), POINTER :: logger
250
251 CALL timeset(routinen, handle)
252 logger => cp_get_default_logger()
253
254 IF (btest(cp_print_key_should_output(logger%iter_info, &
255 dft_section, keys(1)), cp_p_file) .OR. &
256 btest(cp_print_key_should_output(logger%iter_info, &
257 dft_section, keys(2)), cp_p_file)) THEN
258
259 DO ikey = 1, SIZE(keys)
260
261 IF (btest(cp_print_key_should_output(logger%iter_info, &
262 dft_section, keys(ikey)), cp_p_file)) THEN
263 ires = cp_print_key_unit_nr(logger, dft_section, keys(ikey), &
264 extension=".rtpwfn", file_status="REPLACE", file_action="WRITE", &
265 do_backup=.true., file_form="UNFORMATTED")
266 CALL write_mo_set_low(mo_array, qs_kind_set=qs_kind_set, particle_set=particle_set, &
267 ires=ires, rt_mos=rt_mos)
268 CALL cp_print_key_finished_output(ires, logger, dft_section, trim(keys(ikey)))
269 END IF
270 END DO
271 END IF
272
273 CALL timestop(handle)
274
275 END SUBROUTINE write_rt_mos_to_restart
276
277! **************************************************************************************************
278!> \brief ...
279!> \param mo_array ...
280!> \param qs_kind_set ...
281!> \param particle_set ...
282!> \param ires ...
283!> \param rt_mos ...
284!> \param matrix_ks ...
285! **************************************************************************************************
286 SUBROUTINE write_mo_set_low(mo_array, qs_kind_set, particle_set, ires, rt_mos, matrix_ks)
287
288 TYPE(mo_set_type), DIMENSION(:), INTENT(IN) :: mo_array
289 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
290 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
291 INTEGER :: ires
292 TYPE(cp_fm_type), DIMENSION(:), INTENT(IN), &
293 OPTIONAL :: rt_mos
294 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
295 POINTER :: matrix_ks
296
297 CHARACTER(LEN=*), PARAMETER :: routinen = 'write_mo_set_low'
298
299 INTEGER :: handle, iatom, ikind, imat, iset, &
300 ishell, ispin, lmax, lshell, &
301 max_block, nao, natom, nmo, nset, &
302 nset_max, nshell_max, nspin
303 INTEGER, DIMENSION(:), POINTER :: nset_info, nshell
304 INTEGER, DIMENSION(:, :), POINTER :: l, nshell_info
305 INTEGER, DIMENSION(:, :, :), POINTER :: nso_info
306 REAL(kind=dp), DIMENSION(:), POINTER :: mo_eigenvalues, mo_occupation_numbers
307 TYPE(cp_fm_type), POINTER :: mo_coeff
308 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
309 TYPE(qs_dftb_atom_type), POINTER :: dftb_parameter
310
311 CALL timeset(routinen, handle)
312
313 NULLIFY (mo_coeff)
314 NULLIFY (mo_eigenvalues)
315 NULLIFY (mo_occupation_numbers)
316
317 nspin = SIZE(mo_array)
318 nao = mo_array(1)%nao
319
320 IF (ires > 0) THEN
321 ! Create some info about the basis set first
322 natom = SIZE(particle_set, 1)
323 nset_max = 0
324 nshell_max = 0
325
326 DO iatom = 1, natom
327 NULLIFY (orb_basis_set, dftb_parameter)
328 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
329 CALL get_qs_kind(qs_kind_set(ikind), &
330 basis_set=orb_basis_set, &
331 dftb_parameter=dftb_parameter)
332 IF (ASSOCIATED(orb_basis_set)) THEN
333 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
334 nset=nset, &
335 nshell=nshell, &
336 l=l)
337 nset_max = max(nset_max, nset)
338 DO iset = 1, nset
339 nshell_max = max(nshell_max, nshell(iset))
340 END DO
341 ELSEIF (ASSOCIATED(dftb_parameter)) THEN
342 CALL get_dftb_atom_param(dftb_parameter, lmax=lmax)
343 nset_max = max(nset_max, 1)
344 nshell_max = max(nshell_max, lmax + 1)
345 ELSE
346 ! We assume here an atom without a basis set
347 ! CPABORT("Unknown basis type. ")
348 END IF
349 END DO
350
351 ALLOCATE (nso_info(nshell_max, nset_max, natom))
352 nso_info(:, :, :) = 0
353
354 ALLOCATE (nshell_info(nset_max, natom))
355 nshell_info(:, :) = 0
356
357 ALLOCATE (nset_info(natom))
358 nset_info(:) = 0
359
360 DO iatom = 1, natom
361 NULLIFY (orb_basis_set, dftb_parameter)
362 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
363 CALL get_qs_kind(qs_kind_set(ikind), &
364 basis_set=orb_basis_set, dftb_parameter=dftb_parameter)
365 IF (ASSOCIATED(orb_basis_set)) THEN
366 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
367 nset=nset, &
368 nshell=nshell, &
369 l=l)
370 nset_info(iatom) = nset
371 DO iset = 1, nset
372 nshell_info(iset, iatom) = nshell(iset)
373 DO ishell = 1, nshell(iset)
374 lshell = l(ishell, iset)
375 nso_info(ishell, iset, iatom) = nso(lshell)
376 END DO
377 END DO
378 ELSEIF (ASSOCIATED(dftb_parameter)) THEN
379 CALL get_dftb_atom_param(dftb_parameter, lmax=lmax)
380 nset_info(iatom) = 1
381 nshell_info(1, iatom) = lmax + 1
382 DO ishell = 1, lmax + 1
383 lshell = ishell - 1
384 nso_info(ishell, 1, iatom) = nso(lshell)
385 END DO
386 ELSE
387 ! We assume here an atom without a basis set
388 ! CPABORT("Unknown basis type. ")
389 END IF
390 END DO
391
392 WRITE (ires) natom, nspin, nao, nset_max, nshell_max
393 WRITE (ires) nset_info
394 WRITE (ires) nshell_info
395 WRITE (ires) nso_info
396
397 DEALLOCATE (nset_info)
398
399 DEALLOCATE (nshell_info)
400
401 DEALLOCATE (nso_info)
402 END IF
403
404 ! Use the ScaLAPACK block size as a default for buffering columns
405 CALL cp_fm_get_info(mo_array(1)%mo_coeff, ncol_block=max_block)
406 DO ispin = 1, nspin
407 mo_coeff => mo_array(ispin)%mo_coeff
408 nmo = mo_array(ispin)%nmo
409 IF (nmo > 0) THEN
410 mo_eigenvalues => mo_array(ispin)%eigenvalues
411 mo_occupation_numbers => mo_array(ispin)%occupation_numbers
412 IF (PRESENT(matrix_ks)) THEN
413 ! With OT: use the Kohn-Sham matrix for the update of the MO eigenvalues
414 CALL calculate_subspace_eigenvalues(orbitals=mo_coeff, &
415 ks_matrix=matrix_ks(ispin)%matrix, &
416 evals_arg=mo_eigenvalues)
417 END IF
418 IF (ires > 0) THEN
419 WRITE (ires) nmo, &
420 mo_array(ispin)%homo, &
421 mo_array(ispin)%lfomo, &
422 mo_array(ispin)%nelectron
423 WRITE (ires) mo_eigenvalues(1:nmo), mo_occupation_numbers(1:nmo)
424 END IF
425 END IF
426 IF (PRESENT(rt_mos)) THEN
427 DO imat = 2*ispin - 1, 2*ispin
428 CALL cp_fm_write_unformatted(rt_mos(imat), ires)
429 END DO
430 ELSE
431 CALL cp_fm_write_unformatted(mo_coeff, ires)
432 END IF
433 END DO
434
435 CALL timestop(handle)
436
437 END SUBROUTINE write_mo_set_low
438
439! **************************************************************************************************
440!> \brief ...
441!> \param filename ...
442!> \param exist ...
443!> \param section ...
444!> \param logger ...
445!> \param kp ...
446!> \param xas ...
447!> \param rtp ...
448! **************************************************************************************************
449 SUBROUTINE wfn_restart_file_name(filename, exist, section, logger, kp, xas, rtp)
450 CHARACTER(LEN=default_path_length), INTENT(OUT) :: filename
451 LOGICAL, INTENT(OUT) :: exist
452 TYPE(section_vals_type), POINTER :: section
453 TYPE(cp_logger_type), POINTER :: logger
454 LOGICAL, INTENT(IN), OPTIONAL :: kp, xas, rtp
455
456 INTEGER :: n_rep_val
457 LOGICAL :: my_kp, my_rtp, my_xas
458 TYPE(section_vals_type), POINTER :: print_key
459
460 my_kp = .false.
461 my_xas = .false.
462 my_rtp = .false.
463 IF (PRESENT(kp)) my_kp = kp
464 IF (PRESENT(xas)) my_xas = xas
465 IF (PRESENT(rtp)) my_rtp = rtp
466
467 exist = .false.
468 CALL section_vals_val_get(section, "WFN_RESTART_FILE_NAME", n_rep_val=n_rep_val)
469 IF (n_rep_val > 0) THEN
470 CALL section_vals_val_get(section, "WFN_RESTART_FILE_NAME", c_val=filename)
471 ELSE
472 IF (my_xas) THEN
473 ! try to read from the filename that is generated automatically from the printkey
474 print_key => section_vals_get_subs_vals(section, "PRINT%RESTART")
475 filename = cp_print_key_generate_filename(logger, print_key, &
476 extension="", my_local=.false.)
477 ELSE IF (my_rtp) THEN
478 ! try to read from the filename that is generated automatically from the printkey
479 print_key => section_vals_get_subs_vals(section, "REAL_TIME_PROPAGATION%PRINT%RESTART")
480 filename = cp_print_key_generate_filename(logger, print_key, &
481 extension=".rtpwfn", my_local=.false.)
482 ELSE IF (my_kp) THEN
483 ! try to read from the filename that is generated automatically from the printkey
484 print_key => section_vals_get_subs_vals(section, "SCF%PRINT%RESTART")
485 filename = cp_print_key_generate_filename(logger, print_key, &
486 extension=".kp", my_local=.false.)
487 ELSE
488 ! try to read from the filename that is generated automatically from the printkey
489 print_key => section_vals_get_subs_vals(section, "SCF%PRINT%RESTART")
490 filename = cp_print_key_generate_filename(logger, print_key, &
491 extension=".wfn", my_local=.false.)
492 END IF
493 END IF
494 IF (.NOT. my_xas) THEN
495 INQUIRE (file=filename, exist=exist)
496 END IF
497
498 END SUBROUTINE wfn_restart_file_name
499
500! **************************************************************************************************
501!> \brief ...
502!> \param mo_array ...
503!> \param qs_kind_set ...
504!> \param particle_set ...
505!> \param para_env ...
506!> \param id_nr ...
507!> \param multiplicity ...
508!> \param dft_section ...
509!> \param natom_mismatch ...
510!> \param cdft ...
511!> \param out_unit ...
512! **************************************************************************************************
513 SUBROUTINE read_mo_set_from_restart(mo_array, qs_kind_set, particle_set, &
514 para_env, id_nr, multiplicity, dft_section, natom_mismatch, &
515 cdft, out_unit)
516
517 TYPE(mo_set_type), DIMENSION(:), INTENT(INOUT) :: mo_array
518 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
519 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
520 TYPE(mp_para_env_type), POINTER :: para_env
521 INTEGER, INTENT(IN) :: id_nr, multiplicity
522 TYPE(section_vals_type), POINTER :: dft_section
523 LOGICAL, INTENT(OUT), OPTIONAL :: natom_mismatch
524 LOGICAL, INTENT(IN), OPTIONAL :: cdft
525 INTEGER, INTENT(IN), OPTIONAL :: out_unit
526
527 CHARACTER(LEN=*), PARAMETER :: routinen = 'read_mo_set_from_restart'
528
529 CHARACTER(LEN=default_path_length) :: file_name
530 INTEGER :: handle, ispin, my_out_unit, natom, &
531 nspin, restart_unit
532 LOGICAL :: exist, my_cdft
533 TYPE(cp_logger_type), POINTER :: logger
534
535 CALL timeset(routinen, handle)
536 logger => cp_get_default_logger()
537 my_cdft = .false.
538 IF (PRESENT(cdft)) my_cdft = cdft
539 my_out_unit = -1
540 IF (PRESENT(out_unit)) my_out_unit = out_unit
541
542 nspin = SIZE(mo_array)
543 restart_unit = -1
544
545 IF (para_env%is_source()) THEN
546
547 natom = SIZE(particle_set, 1)
548 CALL wfn_restart_file_name(file_name, exist, dft_section, logger)
549 IF (id_nr /= 0) THEN
550 ! Is it one of the backup files?
551 file_name = trim(file_name)//".bak-"//adjustl(cp_to_string(id_nr))
552 END IF
553
554 CALL open_file(file_name=file_name, &
555 file_action="READ", &
556 file_form="UNFORMATTED", &
557 file_status="OLD", &
558 unit_number=restart_unit)
559
560 END IF
561
562 CALL read_mos_restart_low(mo_array, para_env=para_env, qs_kind_set=qs_kind_set, &
563 particle_set=particle_set, natom=natom, &
564 rst_unit=restart_unit, multiplicity=multiplicity, natom_mismatch=natom_mismatch)
565
566 IF (PRESENT(natom_mismatch)) THEN
567 ! read_mos_restart_low only the io_node returns natom_mismatch, must broadcast it
568 CALL para_env%bcast(natom_mismatch)
569 IF (natom_mismatch) THEN
570 IF (para_env%is_source()) CALL close_file(unit_number=restart_unit)
571 CALL timestop(handle)
572 RETURN
573 END IF
574 END IF
575
576 ! Close restart file
577 IF (para_env%is_source()) THEN
578 IF (my_out_unit > 0) THEN
579 WRITE (unit=my_out_unit, fmt="(T2,A)") &
580 "WFN_RESTART| Restart file "//trim(file_name)//" read"
581 END IF
582 CALL close_file(unit_number=restart_unit)
583 END IF
584
585 ! CDFT has no real dft_section and does not need to print
586 IF (.NOT. my_cdft) THEN
587 DO ispin = 1, nspin
588 CALL write_mo_set_to_output_unit(mo_array(ispin), qs_kind_set, particle_set, &
589 dft_section, 4, 0, final_mos=.false.)
590 END DO
591 END IF
592
593 CALL timestop(handle)
594
595 END SUBROUTINE read_mo_set_from_restart
596
597! **************************************************************************************************
598!> \brief ...
599!> \param mo_array ...
600!> \param rt_mos ...
601!> \param qs_kind_set ...
602!> \param particle_set ...
603!> \param para_env ...
604!> \param id_nr ...
605!> \param multiplicity ...
606!> \param dft_section ...
607! **************************************************************************************************
608 SUBROUTINE read_rt_mos_from_restart(mo_array, rt_mos, qs_kind_set, particle_set, para_env, id_nr, multiplicity, dft_section)
609
610 TYPE(mo_set_type), DIMENSION(:), INTENT(INOUT) :: mo_array
611 TYPE(cp_fm_type), DIMENSION(:), POINTER :: rt_mos
612 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
613 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
614 TYPE(mp_para_env_type), POINTER :: para_env
615 INTEGER, INTENT(IN) :: id_nr, multiplicity
616 TYPE(section_vals_type), POINTER :: dft_section
617
618 CHARACTER(LEN=*), PARAMETER :: routinen = 'read_rt_mos_from_restart'
619
620 CHARACTER(LEN=default_path_length) :: file_name
621 INTEGER :: handle, ispin, natom, nspin, &
622 restart_unit, unit_nr
623 LOGICAL :: exist
624 TYPE(cp_logger_type), POINTER :: logger
625
626 CALL timeset(routinen, handle)
627 logger => cp_get_default_logger()
628
629 nspin = SIZE(mo_array)
630 restart_unit = -1
631
632 IF (para_env%is_source()) THEN
633
634 natom = SIZE(particle_set, 1)
635 CALL wfn_restart_file_name(file_name, exist, dft_section, logger, rtp=.true.)
636 IF (id_nr /= 0) THEN
637 ! Is it one of the backup files?
638 file_name = trim(file_name)//".bak-"//adjustl(cp_to_string(id_nr))
639 END IF
640
641 unit_nr = cp_logger_get_default_unit_nr(logger, local=.true.)
642 IF (unit_nr > 0) THEN
643 WRITE (unit_nr, '(T2,A)') "Read RTP restart from the file: "//trim(file_name)
644 END IF
645
646 CALL open_file(file_name=file_name, &
647 file_action="READ", &
648 file_form="UNFORMATTED", &
649 file_status="OLD", &
650 unit_number=restart_unit)
651
652 END IF
653
654 CALL read_mos_restart_low(mo_array, rt_mos=rt_mos, para_env=para_env, &
655 particle_set=particle_set, qs_kind_set=qs_kind_set, natom=natom, &
656 rst_unit=restart_unit, multiplicity=multiplicity)
657
658 ! Close restart file
659 IF (para_env%is_source()) CALL close_file(unit_number=restart_unit)
660
661 DO ispin = 1, nspin
662 CALL write_mo_set_to_output_unit(mo_array(ispin), qs_kind_set, particle_set, &
663 dft_section, 4, 0, final_mos=.false.)
664 END DO
665
666 CALL timestop(handle)
667
668 END SUBROUTINE read_rt_mos_from_restart
669
670! **************************************************************************************************
671!> \brief Reading the mos from apreviously defined restart file
672!> \param mos ...
673!> \param para_env ...
674!> \param qs_kind_set ...
675!> \param particle_set ...
676!> \param natom ...
677!> \param rst_unit ...
678!> \param multiplicity ...
679!> \param rt_mos ...
680!> \param natom_mismatch ...
681!> \par History
682!> 12.2007 created [MI]
683!> \author MI
684! **************************************************************************************************
685 SUBROUTINE read_mos_restart_low(mos, para_env, qs_kind_set, particle_set, natom, rst_unit, &
686 multiplicity, rt_mos, natom_mismatch)
687
688 TYPE(mo_set_type), DIMENSION(:), INTENT(INOUT) :: mos
689 TYPE(mp_para_env_type), POINTER :: para_env
690 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
691 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
692 INTEGER, INTENT(IN) :: natom, rst_unit
693 INTEGER, INTENT(in), OPTIONAL :: multiplicity
694 TYPE(cp_fm_type), DIMENSION(:), OPTIONAL, POINTER :: rt_mos
695 LOGICAL, INTENT(OUT), OPTIONAL :: natom_mismatch
696
697 INTEGER :: homo, homo_read, i, iatom, ikind, imat, irow, iset, iset_read, ishell, &
698 ishell_read, iso, ispin, lfomo_read, lmax, lshell, my_mult, nao, nao_read, natom_read, &
699 nelectron, nelectron_read, nmo, nmo_read, nnshell, nset, nset_max, nshell_max, nspin, &
700 nspin_read, offset_read
701 INTEGER, DIMENSION(:), POINTER :: nset_info, nshell
702 INTEGER, DIMENSION(:, :), POINTER :: l, nshell_info
703 INTEGER, DIMENSION(:, :, :), POINTER :: nso_info, offset_info
704 LOGICAL :: minbas, natom_match, use_this
705 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: eig_read, occ_read
706 REAL(kind=dp), DIMENSION(:, :), POINTER :: vecbuffer, vecbuffer_read
707 TYPE(cp_logger_type), POINTER :: logger
708 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
709 TYPE(qs_dftb_atom_type), POINTER :: dftb_parameter
710
711 logger => cp_get_default_logger()
712
713 nspin = SIZE(mos)
714 nao = mos(1)%nao
715 my_mult = 0
716 IF (PRESENT(multiplicity)) my_mult = multiplicity
717
718 IF (para_env%is_source()) THEN
719 READ (rst_unit) natom_read, nspin_read, nao_read, nset_max, nshell_max
720 IF (PRESENT(rt_mos)) THEN
721 IF (nspin_read /= nspin) THEN
722 cpabort("To change nspin is not possible. ")
723 END IF
724 ELSE
725 ! we should allow for restarting with different spin settings
726 IF (nspin_read /= nspin) THEN
727 WRITE (cp_logger_get_default_unit_nr(logger), *) &
728 "READ RESTART : WARNING : nspin is not equal "
729 END IF
730 ! this case needs fixing of homo/lfomo/nelec/occupations ...
731 IF (nspin_read > nspin) THEN
732 cpabort("Reducing nspin is not possible. ")
733 END IF
734 END IF
735
736 natom_match = (natom_read == natom)
737
738 IF (natom_match) THEN ! actually do the read read
739
740 ! Let's make it possible to change the basis set
741 ALLOCATE (nso_info(nshell_max, nset_max, natom_read))
742 ALLOCATE (nshell_info(nset_max, natom_read))
743 ALLOCATE (nset_info(natom_read))
744 ALLOCATE (offset_info(nshell_max, nset_max, natom_read))
745
746 IF (nao_read /= nao) THEN
747 WRITE (cp_logger_get_default_unit_nr(logger), *) &
748 " READ RESTART : WARNING : DIFFERENT # AOs ", nao, nao_read
749 IF (PRESENT(rt_mos)) &
750 cpabort("To change basis is not possible. ")
751 END IF
752
753 READ (rst_unit) nset_info
754 READ (rst_unit) nshell_info
755 READ (rst_unit) nso_info
756
757 i = 1
758 DO iatom = 1, natom
759 DO iset = 1, nset_info(iatom)
760 DO ishell = 1, nshell_info(iset, iatom)
761 offset_info(ishell, iset, iatom) = i
762 i = i + nso_info(ishell, iset, iatom)
763 END DO
764 END DO
765 END DO
766
767 ALLOCATE (vecbuffer_read(1, nao_read))
768
769 END IF ! natom_match
770 END IF ! ionode
771
772 ! make natom_match and natom_mismatch uniform across all nodes
773 CALL para_env%bcast(natom_match)
774 IF (PRESENT(natom_mismatch)) natom_mismatch = .NOT. natom_match
775 ! handle natom_match false
776 IF (.NOT. natom_match) THEN
777 IF (PRESENT(natom_mismatch)) THEN
778 WRITE (cp_logger_get_default_unit_nr(logger), *) &
779 " READ RESTART : WARNING : DIFFERENT natom, returning ", natom, natom_read
780 RETURN
781 ELSE
782 cpabort("Incorrect number of atoms in restart file. ")
783 END IF
784 END IF
785
786 CALL para_env%bcast(nspin_read)
787
788 ALLOCATE (vecbuffer(1, nao))
789
790 DO ispin = 1, nspin
791
792 nmo = mos(ispin)%nmo
793 homo = mos(ispin)%homo
794 mos(ispin)%eigenvalues(:) = 0.0_dp
795 mos(ispin)%occupation_numbers(:) = 0.0_dp
796 CALL cp_fm_set_all(mos(ispin)%mo_coeff, 0.0_dp)
797
798 IF (para_env%is_source() .AND. (nmo > 0)) THEN
799 READ (rst_unit) nmo_read, homo_read, lfomo_read, nelectron_read
800 ALLOCATE (eig_read(nmo_read), occ_read(nmo_read))
801 eig_read = 0.0_dp
802 occ_read = 0.0_dp
803
804 nmo = min(nmo, nmo_read)
805 IF (nmo_read < nmo) &
806 CALL cp_warn(__location__, &
807 "The number of MOs on the restart unit is smaller than the number of "// &
808 "the allocated MOs. The MO set will be padded with zeros!")
809 IF (nmo_read > nmo) &
810 CALL cp_warn(__location__, &
811 "The number of MOs on the restart unit is greater than the number of "// &
812 "the allocated MOs. The read MO set will be truncated!")
813
814 READ (rst_unit) eig_read(1:nmo_read), occ_read(1:nmo_read)
815 mos(ispin)%eigenvalues(1:nmo) = eig_read(1:nmo)
816 mos(ispin)%occupation_numbers(1:nmo) = occ_read(1:nmo)
817 DEALLOCATE (eig_read, occ_read)
818
819 mos(ispin)%homo = homo_read
820 mos(ispin)%lfomo = lfomo_read
821 IF (homo_read > nmo) THEN
822 IF (nelectron_read == mos(ispin)%nelectron) THEN
823 CALL cp_warn(__location__, &
824 "The number of occupied MOs on the restart unit is larger than "// &
825 "the allocated MOs. The read MO set will be truncated and the occupation numbers recalculated!")
826 CALL set_mo_occupation(mo_set=mos(ispin))
827 ELSE
828 ! can not make this a warning i.e. homo must be smaller than nmo
829 ! otherwise e.g. set_mo_occupation will go out of bounds
830 cpabort("Number of occupied MOs on restart unit larger than allocated MOs. ")
831 END IF
832 END IF
833 END IF
834
835 CALL para_env%bcast(nmo)
836 CALL para_env%bcast(mos(ispin)%homo)
837 CALL para_env%bcast(mos(ispin)%lfomo)
838 CALL para_env%bcast(mos(ispin)%nelectron)
839 CALL para_env%bcast(mos(ispin)%eigenvalues)
840 CALL para_env%bcast(mos(ispin)%occupation_numbers)
841
842 IF (PRESENT(rt_mos)) THEN
843 DO imat = 2*ispin - 1, 2*ispin
844 DO i = 1, nmo
845 IF (para_env%is_source()) THEN
846 READ (rst_unit) vecbuffer
847 ELSE
848 vecbuffer(1, :) = 0.0_dp
849 END IF
850 CALL para_env%bcast(vecbuffer)
851 CALL cp_fm_set_submatrix(rt_mos(imat), &
852 vecbuffer, 1, i, nao, 1, transpose=.true.)
853 END DO
854 END DO
855 ELSE
856 DO i = 1, nmo
857 IF (para_env%is_source()) THEN
858 READ (rst_unit) vecbuffer_read
859 ! now, try to assign the read to the real vector
860 ! in case the basis set changed this involves some guessing
861 irow = 1
862 DO iatom = 1, natom
863 NULLIFY (orb_basis_set, dftb_parameter, l, nshell)
864 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
865 CALL get_qs_kind(qs_kind_set(ikind), &
866 basis_set=orb_basis_set, dftb_parameter=dftb_parameter)
867 IF (ASSOCIATED(orb_basis_set)) THEN
868 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
869 nset=nset, &
870 nshell=nshell, &
871 l=l)
872 minbas = .false.
873 ELSEIF (ASSOCIATED(dftb_parameter)) THEN
874 CALL get_dftb_atom_param(dftb_parameter, lmax=lmax)
875 nset = 1
876 minbas = .true.
877 ELSE
878 ! assume an atom without basis set
879 ! CPABORT("Unknown basis set type. ")
880 nset = 0
881 END IF
882
883 use_this = .true.
884 iset_read = 1
885 DO iset = 1, nset
886 ishell_read = 1
887 IF (minbas) THEN
888 nnshell = lmax + 1
889 ELSE
890 nnshell = nshell(iset)
891 END IF
892 DO ishell = 1, nnshell
893 IF (minbas) THEN
894 lshell = ishell - 1
895 ELSE
896 lshell = l(ishell, iset)
897 END IF
898 IF (iset_read > nset_info(iatom)) use_this = .false.
899 IF (use_this) THEN ! avoids out of bound access of the lower line if false
900 IF (nso(lshell) == nso_info(ishell_read, iset_read, iatom)) THEN
901 offset_read = offset_info(ishell_read, iset_read, iatom)
902 ishell_read = ishell_read + 1
903 IF (ishell_read > nshell_info(iset, iatom)) THEN
904 ishell_read = 1
905 iset_read = iset_read + 1
906 END IF
907 ELSE
908 use_this = .false.
909 END IF
910 END IF
911 DO iso = 1, nso(lshell)
912 IF (use_this) THEN
913 IF (offset_read - 1 + iso .LT. 1 .OR. offset_read - 1 + iso .GT. nao_read) THEN
914 vecbuffer(1, irow) = 0.0_dp
915 ELSE
916 vecbuffer(1, irow) = vecbuffer_read(1, offset_read - 1 + iso)
917 END IF
918 ELSE
919 vecbuffer(1, irow) = 0.0_dp
920 END IF
921 irow = irow + 1
922 END DO
923 use_this = .true.
924 END DO
925 END DO
926 END DO
927
928 ELSE
929
930 vecbuffer(1, :) = 0.0_dp
931
932 END IF
933
934 CALL para_env%bcast(vecbuffer)
935 CALL cp_fm_set_submatrix(mos(ispin)%mo_coeff, &
936 vecbuffer, 1, i, nao, 1, transpose=.true.)
937 END DO
938 END IF
939 ! Skip extra MOs if there any
940 IF (para_env%is_source()) THEN
941 !ignore nmo = 0
942 IF (nmo > 0) THEN
943 DO i = nmo + 1, nmo_read
944 READ (rst_unit) vecbuffer_read
945 END DO
946 END IF
947 END IF
948
949 IF (.NOT. PRESENT(rt_mos)) THEN
950 IF (ispin == 1 .AND. nspin_read < nspin) THEN
951
952 mos(ispin + 1)%homo = mos(ispin)%homo
953 mos(ispin + 1)%lfomo = mos(ispin)%lfomo
954 nelectron = mos(ispin)%nelectron
955 IF (my_mult .NE. 1) THEN
956 CALL cp_abort(__location__, &
957 "Restarting an LSD calculation from an LDA wfn only works for multiplicity=1 (singlets).")
958 END IF
959 IF (mos(ispin + 1)%nelectron < 0) THEN
960 cpabort("LSD: too few electrons for this multiplisity. ")
961 END IF
962 mos(ispin + 1)%eigenvalues = mos(ispin)%eigenvalues
963 mos(ispin)%occupation_numbers = mos(ispin)%occupation_numbers/2.0_dp
964 mos(ispin + 1)%occupation_numbers = mos(ispin)%occupation_numbers
965 CALL cp_fm_to_fm(mos(ispin)%mo_coeff, mos(ispin + 1)%mo_coeff)
966 EXIT
967 END IF
968 END IF
969 END DO ! ispin
970
971 DEALLOCATE (vecbuffer)
972
973 IF (para_env%is_source()) THEN
974 DEALLOCATE (vecbuffer_read)
975 DEALLOCATE (offset_info)
976 DEALLOCATE (nso_info)
977 DEALLOCATE (nshell_info)
978 DEALLOCATE (nset_info)
979 END IF
980
981 END SUBROUTINE read_mos_restart_low
982
983! **************************************************************************************************
984!> \brief Write MO information to output file (eigenvalues, occupation numbers, coefficients)
985!> \param mo_set ...
986!> \param qs_kind_set ...
987!> \param particle_set ...
988!> \param dft_section ...
989!> \param before Digits before the dot
990!> \param kpoint An integer that labels the current k point, e.g. its index
991!> \param final_mos ...
992!> \param spin ...
993!> \param solver_method ...
994!> \param rtp ...
995!> \param cpart ...
996!> \param sim_step ...
997!> \param umo_set ...
998!> \date 15.05.2001
999!> \par History:
1000!> - Optionally print Cartesian MOs (20.04.2005, MK)
1001!> - Revise printout of MO information (05.05.2021, MK)
1002!> \par Variables
1003!> - after : Number of digits after point.
1004!> - before: Number of digits before point.
1005!> \author Matthias Krack (MK)
1006!> \version 1.1
1007! **************************************************************************************************
1008 SUBROUTINE write_mo_set_to_output_unit(mo_set, qs_kind_set, particle_set, &
1009 dft_section, before, kpoint, final_mos, spin, &
1010 solver_method, rtp, cpart, sim_step, umo_set)
1011
1012 TYPE(mo_set_type), INTENT(IN) :: mo_set
1013 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
1014 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
1015 TYPE(section_vals_type), POINTER :: dft_section
1016 INTEGER, INTENT(IN) :: before, kpoint
1017 LOGICAL, INTENT(IN), OPTIONAL :: final_mos
1018 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: spin
1019 CHARACTER(LEN=2), INTENT(IN), OPTIONAL :: solver_method
1020 LOGICAL, INTENT(IN), OPTIONAL :: rtp
1021 INTEGER, INTENT(IN), OPTIONAL :: cpart, sim_step
1022 TYPE(mo_set_type), INTENT(IN), OPTIONAL :: umo_set
1023
1024 CHARACTER(LEN=12) :: symbol
1025 CHARACTER(LEN=12), DIMENSION(:), POINTER :: bcgf_symbol
1026 CHARACTER(LEN=14) :: fmtstr5
1027 CHARACTER(LEN=15) :: energy_str, orbital_str, step_string
1028 CHARACTER(LEN=2) :: element_symbol, my_solver_method
1029 CHARACTER(LEN=2*default_string_length) :: name
1030 CHARACTER(LEN=21) :: vector_str
1031 CHARACTER(LEN=22) :: fmtstr4
1032 CHARACTER(LEN=24) :: fmtstr2
1033 CHARACTER(LEN=25) :: fmtstr1
1034 CHARACTER(LEN=29) :: fmtstr6
1035 CHARACTER(LEN=4) :: reim
1036 CHARACTER(LEN=40) :: fmtstr3
1037 CHARACTER(LEN=6), DIMENSION(:), POINTER :: bsgf_symbol
1038 INTEGER :: after, first_mo, from, homo, iatom, icgf, ico, icol, ikind, imo, irow, iset, &
1039 isgf, ishell, iso, iw, jcol, last_mo, left, lmax, lshell, nao, natom, ncgf, ncol, nmo, &
1040 nset, nsgf, numo, right, scf_step, to, width
1041 INTEGER, DIMENSION(:), POINTER :: mo_index_range, nshell
1042 INTEGER, DIMENSION(:, :), POINTER :: l
1043 LOGICAL :: ionode, my_final, my_rtp, &
1044 print_cartesian, print_eigvals, &
1045 print_eigvecs, print_occup, &
1046 should_output
1047 REAL(kind=dp) :: gap, maxocc
1048 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: mo_eigenvalues, mo_occupation_numbers
1049 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: cmatrix, smatrix
1050 REAL(kind=dp), DIMENSION(:), POINTER :: eigenvalues, occupation_numbers
1051 TYPE(cp_fm_type), POINTER :: mo_coeff, umo_coeff
1052 TYPE(cp_logger_type), POINTER :: logger
1053 TYPE(gto_basis_set_type), POINTER :: orb_basis_set
1054 TYPE(qs_dftb_atom_type), POINTER :: dftb_parameter
1055
1056 NULLIFY (bcgf_symbol)
1057 NULLIFY (bsgf_symbol)
1058 NULLIFY (logger)
1059 NULLIFY (mo_index_range)
1060 NULLIFY (nshell)
1061 NULLIFY (mo_coeff)
1062
1063 logger => cp_get_default_logger()
1064 ionode = logger%para_env%is_source()
1065 CALL section_vals_val_get(dft_section, "PRINT%MO%EIGENVALUES", l_val=print_eigvals)
1066 CALL section_vals_val_get(dft_section, "PRINT%MO%EIGENVECTORS", l_val=print_eigvecs)
1067 CALL section_vals_val_get(dft_section, "PRINT%MO%OCCUPATION_NUMBERS", l_val=print_occup)
1068 CALL section_vals_val_get(dft_section, "PRINT%MO%CARTESIAN", l_val=print_cartesian)
1069 CALL section_vals_val_get(dft_section, "PRINT%MO%MO_INDEX_RANGE", i_vals=mo_index_range)
1070 CALL section_vals_val_get(dft_section, "PRINT%MO%NDIGITS", i_val=after)
1071 after = min(max(after, 1), 16)
1072
1073 ! Do we print the final MO information after SCF convergence is reached (default: no)
1074 IF (PRESENT(final_mos)) THEN
1075 my_final = final_mos
1076 ELSE
1077 my_final = .false.
1078 END IF
1079
1080 ! complex MOS for RTP, no eigenvalues
1081 my_rtp = .false.
1082 IF (PRESENT(rtp)) THEN
1083 my_rtp = rtp
1084 ! print the first time step if MO print required
1085 should_output = btest(cp_print_key_should_output(logger%iter_info, dft_section, &
1086 "PRINT%MO"), cp_p_file) &
1087 .OR. (sim_step == 1)
1088 ELSE
1089 should_output = btest(cp_print_key_should_output(logger%iter_info, dft_section, &
1090 "PRINT%MO"), cp_p_file) .OR. my_final
1091 END IF
1092
1093 IF ((.NOT. should_output) .OR. (.NOT. (print_eigvals .OR. print_eigvecs .OR. print_occup))) RETURN
1094
1095 IF (my_rtp) THEN
1096 cpassert(PRESENT(sim_step))
1097 cpassert(PRESENT(cpart))
1098 scf_step = sim_step
1099 IF (cpart == 0) THEN
1100 reim = "IMAG"
1101 ELSE
1102 reim = "REAL"
1103 END IF
1104 print_eigvals = .false.
1105 ELSE
1106 scf_step = max(0, logger%iter_info%iteration(logger%iter_info%n_rlevel) - 1)
1107 END IF
1108
1109 IF (.NOT. my_final) THEN
1110 IF (.NOT. my_rtp) THEN
1111 step_string = " AFTER SCF STEP"
1112 ELSE
1113 step_string = " AFTER RTP STEP"
1114 END IF
1115 END IF
1116
1117 IF (PRESENT(solver_method)) THEN
1118 my_solver_method = solver_method
1119 ELSE
1120 ! Traditional diagonalization is assumed as default solver method
1121 my_solver_method = "TD"
1122 END IF
1123
1124 ! Retrieve MO information
1125 CALL get_mo_set(mo_set=mo_set, &
1126 mo_coeff=mo_coeff, &
1127 eigenvalues=eigenvalues, &
1128 occupation_numbers=occupation_numbers, &
1129 homo=homo, &
1130 maxocc=maxocc, &
1131 nao=nao, &
1132 nmo=nmo)
1133 IF (PRESENT(umo_set)) THEN
1134 CALL get_mo_set(mo_set=umo_set, &
1135 mo_coeff=umo_coeff, &
1136 nmo=numo)
1137 nmo = nmo + numo
1138 ELSE
1139 numo = 0
1140 END IF
1141 ALLOCATE (mo_eigenvalues(nmo))
1142 mo_eigenvalues(:) = 0.0_dp
1143 mo_eigenvalues(1:nmo - numo) = eigenvalues(1:nmo - numo)
1144 ALLOCATE (mo_occupation_numbers(nmo))
1145 mo_occupation_numbers(:) = 0.0_dp
1146 mo_occupation_numbers(1:nmo - numo) = occupation_numbers(1:nmo - numo)
1147 IF (numo > 0) THEN
1148 CALL get_mo_set(mo_set=umo_set, &
1149 eigenvalues=eigenvalues)
1150 mo_eigenvalues(nmo - numo + 1:nmo) = eigenvalues(1:numo)
1151 END IF
1152
1153 IF (print_eigvecs) THEN
1154 ALLOCATE (smatrix(nao, nmo))
1155 CALL cp_fm_get_submatrix(mo_coeff, smatrix(1:nao, 1:nmo - numo))
1156 IF (numo > 0) THEN
1157 CALL cp_fm_get_submatrix(umo_coeff, smatrix(1:nao, nmo - numo + 1:nmo))
1158 END IF
1159 IF (.NOT. ionode) THEN
1160 DEALLOCATE (smatrix)
1161 END IF
1162 END IF
1163
1164 iw = cp_print_key_unit_nr(logger, dft_section, "PRINT%MO", &
1165 ignore_should_output=should_output, &
1166 extension=".MOLog")
1167
1168 IF (iw > 0) THEN
1169
1170 natom = SIZE(particle_set)
1171 CALL get_qs_kind_set(qs_kind_set, ncgf=ncgf, nsgf=nsgf)
1172
1173 ! Definition of the variable formats
1174
1175 fmtstr1 = "(T2,A,21X, ( X,I5, X))"
1176 fmtstr2 = "(T2,A,21X, (1X,F . ))"
1177 fmtstr3 = "(T2,A,I5,1X,I5,1X,A,1X,A6, (1X,F . ))"
1178
1179 width = before + after + 3
1180 ncol = int(56/width)
1181
1182 right = max((after - 2), 1)
1183 left = width - right - 5
1184
1185 WRITE (unit=fmtstr1(11:12), fmt="(I2)") ncol
1186 WRITE (unit=fmtstr1(14:15), fmt="(I2)") left
1187 WRITE (unit=fmtstr1(21:22), fmt="(I2)") right
1188
1189 WRITE (unit=fmtstr2(11:12), fmt="(I2)") ncol
1190 WRITE (unit=fmtstr2(18:19), fmt="(I2)") width - 1
1191 WRITE (unit=fmtstr2(21:22), fmt="(I2)") after
1192
1193 WRITE (unit=fmtstr3(27:28), fmt="(I2)") ncol
1194 WRITE (unit=fmtstr3(34:35), fmt="(I2)") width - 1
1195 WRITE (unit=fmtstr3(37:38), fmt="(I2)") after
1196
1197 IF (my_final .OR. (my_solver_method == "TD")) THEN
1198 energy_str = "EIGENVALUES"
1199 vector_str = "EIGENVECTORS"
1200 ELSE
1201 energy_str = "ENERGIES"
1202 vector_str = "COEFFICIENTS"
1203 END IF
1204
1205 IF (my_rtp) THEN
1206 energy_str = "ZEROS"
1207 vector_str = trim(reim)//" RTP COEFFICIENTS"
1208 END IF
1209
1210 IF (print_eigvecs) THEN
1211
1212 IF (print_cartesian) THEN
1213
1214 orbital_str = "CARTESIAN"
1215
1216 ALLOCATE (cmatrix(ncgf, ncgf))
1217 cmatrix = 0.0_dp
1218
1219 ! Transform spherical MOs to Cartesian MOs
1220 icgf = 1
1221 isgf = 1
1222 DO iatom = 1, natom
1223 NULLIFY (orb_basis_set, dftb_parameter)
1224 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind)
1225 CALL get_qs_kind(qs_kind_set(ikind), &
1226 basis_set=orb_basis_set, &
1227 dftb_parameter=dftb_parameter)
1228 IF (ASSOCIATED(orb_basis_set)) THEN
1229 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
1230 nset=nset, &
1231 nshell=nshell, &
1232 l=l)
1233 DO iset = 1, nset
1234 DO ishell = 1, nshell(iset)
1235 lshell = l(ishell, iset)
1236 CALL dgemm("T", "N", nco(lshell), nmo, nso(lshell), 1.0_dp, &
1237 orbtramat(lshell)%c2s, nso(lshell), &
1238 smatrix(isgf, 1), nsgf, 0.0_dp, &
1239 cmatrix(icgf, 1), ncgf)
1240 icgf = icgf + nco(lshell)
1241 isgf = isgf + nso(lshell)
1242 END DO
1243 END DO
1244 ELSE IF (ASSOCIATED(dftb_parameter)) THEN
1245 CALL get_dftb_atom_param(dftb_parameter, lmax=lmax)
1246 DO ishell = 1, lmax + 1
1247 lshell = ishell - 1
1248 CALL dgemm("T", "N", nco(lshell), nsgf, nso(lshell), 1.0_dp, &
1249 orbtramat(lshell)%c2s, nso(lshell), &
1250 smatrix(isgf, 1), nsgf, 0.0_dp, &
1251 cmatrix(icgf, 1), ncgf)
1252 icgf = icgf + nco(lshell)
1253 isgf = isgf + nso(lshell)
1254 END DO
1255 ELSE
1256 ! assume atom without basis set
1257 ! CPABORT("Unknown basis set type")
1258 END IF
1259 END DO ! iatom
1260
1261 ELSE
1262
1263 orbital_str = "SPHERICAL"
1264
1265 END IF ! print_cartesian
1266
1267 name = trim(energy_str)//", OCCUPATION NUMBERS, AND "// &
1268 trim(orbital_str)//" "//trim(vector_str)
1269
1270 IF (.NOT. my_final) &
1271 WRITE (unit=name, fmt="(A,1X,I0)") trim(name)//step_string, scf_step
1272
1273 ELSE IF (print_occup .OR. print_eigvals) THEN
1274 name = trim(energy_str)//" AND OCCUPATION NUMBERS"
1275
1276 IF (.NOT. my_final) &
1277 WRITE (unit=name, fmt="(A,1X,I0)") trim(name)//step_string, scf_step
1278 END IF ! print_eigvecs
1279
1280 ! Print headline
1281 IF (PRESENT(spin) .AND. (kpoint > 0)) THEN
1282 WRITE (unit=iw, fmt="(/,T2,A,I0)") &
1283 "MO| "//trim(spin)//" "//trim(name)//" FOR K POINT ", kpoint
1284 ELSE IF (PRESENT(spin)) THEN
1285 WRITE (unit=iw, fmt="(/,T2,A)") &
1286 "MO| "//trim(spin)//" "//trim(name)
1287 ELSE IF (kpoint > 0) THEN
1288 WRITE (unit=iw, fmt="(/,T2,A,I0)") &
1289 "MO| "//trim(name)//" FOR K POINT ", kpoint
1290 ELSE
1291 WRITE (unit=iw, fmt="(/,T2,A)") &
1292 "MO| "//trim(name)
1293 END IF
1294
1295 ! Check if only a subset of the MOs has to be printed
1296 IF ((mo_index_range(1) > 0) .AND. &
1297 (mo_index_range(2) > 0) .AND. &
1298 (mo_index_range(2) >= mo_index_range(1))) THEN
1299 first_mo = max(1, mo_index_range(1))
1300 last_mo = min(nmo, mo_index_range(2))
1301 IF (first_mo > nmo) THEN
1302 cpwarn("The first MO index is larger than the number of MOs.")
1303 END IF
1304 ELSE
1305 first_mo = 1
1306 last_mo = nmo
1307 END IF
1308
1309 IF (print_eigvecs) THEN
1310
1311 ! Print full MO information
1312
1313 DO icol = first_mo, last_mo, ncol
1314
1315 from = icol
1316 to = min((from + ncol - 1), last_mo)
1317
1318 WRITE (unit=iw, fmt="(T2,A)") "MO|"
1319 WRITE (unit=iw, fmt=fmtstr1) &
1320 "MO|", (jcol, jcol=from, to)
1321 WRITE (unit=iw, fmt=fmtstr2) &
1322 "MO|", (mo_eigenvalues(jcol), jcol=from, to)
1323 WRITE (unit=iw, fmt="(T2,A)") "MO|"
1324 WRITE (unit=iw, fmt=fmtstr2) &
1325 "MO|", (mo_occupation_numbers(jcol), jcol=from, to)
1326 WRITE (unit=iw, fmt="(T2,A)") "MO|"
1327
1328 irow = 1
1329
1330 DO iatom = 1, natom
1331
1332 IF (iatom /= 1) WRITE (unit=iw, fmt="(T2,A)") "MO|"
1333
1334 NULLIFY (orb_basis_set, dftb_parameter)
1335 CALL get_atomic_kind(particle_set(iatom)%atomic_kind, &
1336 element_symbol=element_symbol, kind_number=ikind)
1337 CALL get_qs_kind(qs_kind_set(ikind), &
1338 basis_set=orb_basis_set, &
1339 dftb_parameter=dftb_parameter)
1340
1341 IF (print_cartesian) THEN
1342
1343 IF (ASSOCIATED(orb_basis_set)) THEN
1344 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
1345 nset=nset, &
1346 nshell=nshell, &
1347 l=l, &
1348 cgf_symbol=bcgf_symbol)
1349
1350 icgf = 1
1351 DO iset = 1, nset
1352 DO ishell = 1, nshell(iset)
1353 lshell = l(ishell, iset)
1354 DO ico = 1, nco(lshell)
1355 WRITE (unit=iw, fmt=fmtstr3) &
1356 "MO|", irow, iatom, adjustr(element_symbol), bcgf_symbol(icgf), &
1357 (cmatrix(irow, jcol), jcol=from, to)
1358 icgf = icgf + 1
1359 irow = irow + 1
1360 END DO
1361 END DO
1362 END DO
1363 ELSE IF (ASSOCIATED(dftb_parameter)) THEN
1364 CALL get_dftb_atom_param(dftb_parameter, lmax=lmax)
1365 icgf = 1
1366 DO ishell = 1, lmax + 1
1367 lshell = ishell - 1
1368 DO ico = 1, nco(lshell)
1369 symbol = cgf_symbol(1, indco(1:3, icgf))
1370 symbol(1:2) = " "
1371 WRITE (unit=iw, fmt=fmtstr3) &
1372 "MO|", irow, iatom, adjustr(element_symbol), symbol, &
1373 (cmatrix(irow, jcol), jcol=from, to)
1374 icgf = icgf + 1
1375 irow = irow + 1
1376 END DO
1377 END DO
1378 ELSE
1379 ! assume atom without basis set
1380 ! CPABORT("Unknown basis set type")
1381 END IF
1382
1383 ELSE
1384
1385 IF (ASSOCIATED(orb_basis_set)) THEN
1386 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
1387 nset=nset, &
1388 nshell=nshell, &
1389 l=l, &
1390 sgf_symbol=bsgf_symbol)
1391 isgf = 1
1392 DO iset = 1, nset
1393 DO ishell = 1, nshell(iset)
1394 lshell = l(ishell, iset)
1395 DO iso = 1, nso(lshell)
1396 WRITE (unit=iw, fmt=fmtstr3) &
1397 "MO|", irow, iatom, adjustr(element_symbol), bsgf_symbol(isgf), &
1398 (smatrix(irow, jcol), jcol=from, to)
1399 isgf = isgf + 1
1400 irow = irow + 1
1401 END DO
1402 END DO
1403 END DO
1404 ELSE IF (ASSOCIATED(dftb_parameter)) THEN
1405 CALL get_dftb_atom_param(dftb_parameter, lmax=lmax)
1406 isgf = 1
1407 DO ishell = 1, lmax + 1
1408 lshell = ishell - 1
1409 DO iso = 1, nso(lshell)
1410 symbol = sgf_symbol(1, lshell, -lshell + iso - 1)
1411 symbol(1:2) = " "
1412 WRITE (unit=iw, fmt=fmtstr3) &
1413 "MO|", irow, iatom, adjustr(element_symbol), symbol, &
1414 (smatrix(irow, jcol), jcol=from, to)
1415 isgf = isgf + 1
1416 irow = irow + 1
1417 END DO
1418 END DO
1419 ELSE
1420 ! assume atom without basis set
1421 ! CPABORT("Unknown basis set type")
1422 END IF
1423
1424 END IF ! print_cartesian
1425
1426 END DO ! iatom
1427
1428 END DO ! icol
1429
1430 WRITE (unit=iw, fmt="(T2,A)") "MO|"
1431
1432 ! Release work storage
1433
1434 DEALLOCATE (smatrix)
1435 IF (print_cartesian) THEN
1436 DEALLOCATE (cmatrix)
1437 END IF
1438
1439 ELSE IF (print_occup .OR. print_eigvals) THEN
1440
1441 WRITE (unit=iw, fmt="(T2,A)") "MO|"
1442 fmtstr4 = "(T2,A,I7,3(1X,F22. ))"
1443 WRITE (unit=fmtstr4(19:20), fmt="(I2)") after
1444 IF (my_final .OR. (my_solver_method == "TD")) THEN
1445 WRITE (unit=iw, fmt="(A)") &
1446 " MO| Index Eigenvalue [a.u.] Eigenvalue [eV] Occupation"
1447 ELSE
1448 WRITE (unit=iw, fmt="(A)") &
1449 " MO| Index Energy [a.u.] Energy [eV] Occupation"
1450 END IF
1451 DO imo = first_mo, last_mo
1452 WRITE (unit=iw, fmt=fmtstr4) &
1453 "MO|", imo, mo_eigenvalues(imo), &
1454 mo_eigenvalues(imo)*evolt, &
1455 mo_occupation_numbers(imo)
1456 END DO
1457 fmtstr5 = "(A,T59,F22. )"
1458 WRITE (unit=fmtstr5(12:13), fmt="(I2)") after
1459 WRITE (unit=iw, fmt=fmtstr5) &
1460 " MO| Sum:", accurate_sum(mo_occupation_numbers(:))
1461
1462 END IF ! print_eigvecs
1463
1464 IF (.NOT. my_rtp) THEN
1465 fmtstr6 = "(A,T18,F17. ,A,T41,F17. ,A)"
1466 WRITE (unit=fmtstr6(12:13), fmt="(I2)") after
1467 WRITE (unit=fmtstr6(25:26), fmt="(I2)") after
1468 WRITE (unit=iw, fmt=fmtstr6) &
1469 " MO| E(Fermi):", mo_set%mu, " a.u.", mo_set%mu*evolt, " eV"
1470 END IF
1471 IF ((homo > 0) .AND. .NOT. my_rtp) THEN
1472 IF ((mo_occupation_numbers(homo) == maxocc) .AND. (last_mo > homo)) THEN
1473 gap = mo_eigenvalues(homo + 1) - &
1474 mo_eigenvalues(homo)
1475 WRITE (unit=iw, fmt=fmtstr6) &
1476 " MO| Band gap:", gap, " a.u.", gap*evolt, " eV"
1477 END IF
1478 END IF
1479 WRITE (unit=iw, fmt="(A)") ""
1480
1481 END IF ! iw
1482
1483 IF (ALLOCATED(mo_eigenvalues)) DEALLOCATE (mo_eigenvalues)
1484 IF (ALLOCATED(mo_occupation_numbers)) DEALLOCATE (mo_occupation_numbers)
1485
1486 CALL cp_print_key_finished_output(iw, logger, dft_section, "PRINT%MO", &
1487 ignore_should_output=should_output)
1488
1489 END SUBROUTINE write_mo_set_to_output_unit
1490
1491END MODULE qs_mo_io
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum)
...
subroutine, public dbcsr_binary_write(matrix, filepath)
...
subroutine, public dbcsr_release(matrix)
...
real(kind=dp) function, public dbcsr_checksum(matrix, pos)
Calculates the checksum of a DBCSR matrix.
DBCSR operations in CP2K.
subroutine, public copy_dbcsr_to_fm(matrix, fm)
Copy a DBCSR matrix to a BLACS matrix.
subroutine, public copy_fm_to_dbcsr(fm, matrix, keep_sparsity)
Copy a BLACS matrix to a dbcsr 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:308
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:119
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_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 ...
recursive integer function, public cp_logger_get_default_unit_nr(logger, local, skip_not_ionode)
asks the default unit number of the given logger. try to use cp_logger_get_unit_nr
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
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
sums arrays of real/complex numbers with much reduced round-off as compared to a naive implementation...
Definition kahan_sum.F:29
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.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nco
integer, dimension(:, :), allocatable, public indco
integer, dimension(:), allocatable, public nso
orbital_symbols
character(len=12) function, public cgf_symbol(n, lxyz)
Build a Cartesian orbital symbol (orbital labels for printing).
character(len=6) function, public sgf_symbol(n, l, m)
Build a spherical orbital symbol (orbital labels for printing).
Calculation of the spherical harmonics and the corresponding orbital transformation matrices.
type(orbtramat_type), dimension(:), pointer, public orbtramat
Define the data structure for the particle information.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public evolt
Definition physcon.F:183
collects routines that calculate density matrices
Definition of the DFTB parameter types.
Working with the DFTB parameter types.
subroutine, public get_dftb_atom_param(dftb_parameter, name, typ, defined, z, zeff, natorb, lmax, skself, occupation, eta, energy, cutoff, xi, di, rcdisp, dudq)
...
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg)
Get attributes of an atomic kind set.
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:450
subroutine, public read_mo_set_from_restart(mo_array, qs_kind_set, particle_set, para_env, id_nr, multiplicity, dft_section, natom_mismatch, cdft, out_unit)
...
Definition qs_mo_io.F:516
subroutine, public read_rt_mos_from_restart(mo_array, rt_mos, qs_kind_set, particle_set, para_env, id_nr, multiplicity, dft_section)
...
Definition qs_mo_io.F:609
subroutine, public write_mo_set_to_output_unit(mo_set, qs_kind_set, particle_set, dft_section, before, kpoint, final_mos, spin, solver_method, rtp, cpart, sim_step, umo_set)
Write MO information to output file (eigenvalues, occupation numbers, coefficients)
Definition qs_mo_io.F:1011
subroutine, public write_dm_binary_restart(mo_array, dft_section, tmpl_matrix)
calculates density matrix from mo set and writes the density matrix into a binary restart file
Definition qs_mo_io.F:174
subroutine, public write_mo_set_low(mo_array, qs_kind_set, particle_set, ires, rt_mos, matrix_ks)
...
Definition qs_mo_io.F:287
subroutine, public read_mos_restart_low(mos, para_env, qs_kind_set, particle_set, natom, rst_unit, multiplicity, rt_mos, natom_mismatch)
Reading the mos from apreviously defined restart file.
Definition qs_mo_io.F:687
subroutine, public write_mo_set_to_restart(mo_array, particle_set, dft_section, qs_kind_set, matrix_ks)
...
Definition qs_mo_io.F:107
subroutine, public write_rt_mos_to_restart(mo_array, rt_mos, particle_set, dft_section, qs_kind_set)
...
Definition qs_mo_io.F:236
collects routines that perform operations directly related to MOs
Set occupation of molecular orbitals.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
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.
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.