29 use,
intrinsic :: iso_fortran_env
75 type(restart_t),
intent(in) :: restart
76 type(namespace_t),
intent(in) :: namespace
77 class(space_t),
intent(in) :: space
78 type(states_elec_t),
target,
intent(inout) :: st
79 class(mesh_t),
intent(in) :: mesh
80 type(kpoints_t),
intent(in) :: kpoints
81 logical,
optional,
intent(in) :: is_complex
82 logical,
optional,
intent(in) :: packed
84 integer :: nkpt, dim, nst, ierr
85 real(real64),
allocatable :: new_occ(:,:)
92 message(1) =
"Unable to read states information."
96 if (st%parallel_in_states)
then
97 message(1) =
"Internal error: cannot use states_elec_look_and_load when parallel in states."
102 safe_allocate(new_occ(1:nst, 1:st%nik))
104 new_occ(1:min(nst, st%nst),:) = st%occ(1:min(nst, st%nst),:)
105 safe_deallocate_a(st%occ)
106 call move_alloc(new_occ, st%occ)
116 safe_deallocate_a(st%node)
117 safe_allocate(st%node(1:st%nst))
120 safe_deallocate_a(st%eigenval)
121 safe_allocate(st%eigenval(1:st%nst, 1:st%nik))
122 st%eigenval = huge(st%eigenval)
124 if (
present(is_complex))
then
135 if (st%d%ispin ==
spinors)
then
136 safe_allocate(st%spin(1:3, 1:st%nst, 1:st%nik))
143 message(1) =
"Unable to read wavefunctions."
152 subroutine states_elec_dump(restart, space, st, mesh, kpoints, ierr, iter, lr, st_start_writing, verbose)
153 type(restart_t),
intent(in) :: restart
154 class(space_t),
intent(in) :: space
155 type(states_elec_t),
intent(in) :: st
156 class(mesh_t),
intent(in) :: mesh
157 type(kpoints_t),
intent(in) :: kpoints
158 integer,
intent(out) :: ierr
159 integer,
optional,
intent(in) :: iter
161 type(lr_t),
optional,
intent(in) :: lr
162 integer,
optional,
intent(in) :: st_start_writing
163 logical,
optional,
intent(in) :: verbose
165 integer :: iunit_wfns, iunit_occs, iunit_states
166 integer :: err, err2(2), ik, idir, ist, idim, itot
168 character(len=MAX_PATH_LEN) :: filename
169 character(len=300) :: lines(3)
170 logical :: lr_wfns_are_associated, should_write, verbose_
171 real(real64) :: kpoint(space%dim)
172 real(real64),
allocatable :: dpsi(:), rff_global(:)
173 complex(real64),
allocatable :: zpsi(:), zff_global(:)
187 message(1) =
"Info: Writing states."
193 if (
present(lr))
then
194 lr_wfns_are_associated = (
allocated(lr%ddl_psi) .and.
states_are_real(st)) .or. &
196 assert(lr_wfns_are_associated)
203 write(lines(1),
'(a20,1i10)')
'nst= ', st%nst
204 write(lines(2),
'(a20,1i10)')
'dim= ', st%d%dim
205 write(lines(3),
'(a20,1i10)')
'nik= ', st%nik
207 if (err /= 0) ierr = ierr + 1
212 lines(1) =
'# #k-point #st #dim filename'
214 lines(2) =
'%Real_Wavefunctions'
216 lines(2) =
'%Complex_Wavefunctions'
219 if (err /= 0) ierr = ierr + 2
223 lines(1) =
'# occupations | eigenvalue[a.u.] | Im(eigenvalue) [a.u.] | k-points | k-weights | filename | ik | ist | idim'
224 lines(2) =
'%Occupations_Eigenvalues_K-Points'
226 if (err /= 0) ierr = ierr + 4
230 safe_allocate(dpsi(1:mesh%np))
231 safe_allocate(rff_global(1:mesh%np_global))
233 safe_allocate(zpsi(1:mesh%np))
234 safe_allocate(zff_global(1:mesh%np_global))
241 kpoint(1:space%dim) = &
242 kpoints%get_point(st%d%get_kpoint_index(ik), absolute_coordinates = .
true.)
245 do idim = 1, st%d%dim
247 write(filename,
'(i10.10)') itot
249 write(lines(1),
'(i8,a,i8,a,i8,3a)') ik,
' | ', ist,
' | ', idim,
' | "', trim(filename),
'"'
251 if (err /= 0) err2(1) = err2(1) + 1
253 write(lines(1),
'(e23.16,a,e23.16)') st%occ(ist,ik),
' | ', st%eigenval(ist, ik)
254 write(lines(1),
'(a,a,e23.16)') trim(lines(1)),
' | ',
m_zero
255 do idir = 1, space%dim
256 write(lines(1),
'(a,a,e23.16)') trim(lines(1)),
' | ', kpoint(idir)
258 write(lines(1),
'(a,a,e23.16,a,i10.10,3(a,i8))') trim(lines(1)), &
259 ' | ', st%kweights(ik),
' | ', itot,
' | ', ik,
' | ', ist,
' | ', idim
261 if (err /= 0) err2(1) = err2(1) + 1
263 should_write = st%st_start <= ist .and. ist <= st%st_end
264 if (should_write .and.
present(st_start_writing))
then
265 if (ist < st_start_writing) should_write = .false.
268 if (should_write)
then
269 if (.not.
present(lr))
then
270 if (st%d%kpt%start <= ik .and. ik <= st%d%kpt%end)
then
282 if (st%d%kpt%start <= ik .and. ik <= st%d%kpt%end)
then
285 lr%ddl_psi(:, idim, ist, ik), err, root = root)
288 lr%zdl_psi(:, idim, ist, ik), err, root = root)
294 if (err /= 0) err2(2) = err2(2) + 1
301 if (err2(1) /= 0) ierr = ierr + 8
302 if (err2(2) /= 0) ierr = ierr + 16
304 safe_deallocate_a(dpsi)
305 safe_deallocate_a(zpsi)
306 safe_deallocate_a(rff_global)
307 safe_deallocate_a(zff_global)
311 if (err /= 0) ierr = ierr + 32
313 if (err /= 0) ierr = ierr + 64
314 if (
present(iter))
then
315 write(lines(1),
'(a,i7)')
'Iter = ', iter
317 if (err /= 0) ierr = ierr + 128
324 message(1) =
"Info: Finished writing states."
341 subroutine states_elec_load(restart, namespace, space, st, mesh, kpoints, ierr, iter, lr, lowest_missing, label, verbose, skip)
344 class(
space_t),
intent(in) :: space
346 class(
mesh_t),
intent(in) :: mesh
348 integer,
intent(out) :: ierr
349 integer,
optional,
intent(out) :: iter
350 type(
lr_t),
optional,
intent(inout) :: lr
351 integer,
optional,
intent(out) :: lowest_missing(:, :)
352 character(len=*),
optional,
intent(in) :: label
353 logical,
optional,
intent(in) :: verbose
354 logical,
optional,
intent(in) :: skip(:)
356 integer :: states_elec_file, wfns_file, occ_file, err, ik, ist, idir, idim
357 integer :: idone, iread, ntodo
358 character(len=12) :: filename
359 character(len=1) :: char
360 logical,
allocatable :: filled(:, :, :)
361 character(len=256) :: lines(3), label_
362 character(len=50) :: str
364 real(real64) :: my_occ, imev, my_kweight
365 logical :: read_occ, lr_allocated, verbose_
366 logical :: integral_occs
367 real(real64),
allocatable :: dpsi(:)
368 complex(real64),
allocatable :: zpsi(:), zpsil(:)
369 character(len=256),
allocatable :: restart_file(:, :, :)
370 logical,
allocatable :: restart_file_present(:, :, :)
371 real(real64) :: kpoint(space%dim), read_kpoint(space%dim)
374 integer,
allocatable :: lowest_missing_tmp(:, :)
381 if (
present(lowest_missing)) lowest_missing = 1
382 if (
present(iter)) iter = 0
384 if (
present(skip))
then
385 assert(ubound(skip, dim = 1) == st%nst)
398 if (
present(label))
then
401 if (
present(lr))
then
402 label_ =
" for linear response"
408 message(1) =
'Info: Reading states'
409 if (len(trim(label_)) > 0)
then
415 if (.not.
present(lr))
then
416 st%fromScratch = .false.
422 integral_occs = .
true.
423 if (st%restart_fixed_occ)
then
425 st%fixed_occ = .
true.
427 read_occ = .not. st%fixed_occ
430 if (.not.
present(lr))
then
431 st%eigenval(:, :) =
m_zero
435 if (.not.
present(lr) .and. read_occ)
then
441 if (
present(lr))
then
442 lr_allocated = (
allocated(lr%ddl_psi) .and.
states_are_real(st)) .or. &
452 call restart_read(restart, states_elec_file, lines, 3, err)
456 read(lines(2), *) str, idim
457 read(lines(3), *) str, ik
458 if (idim == 2 .and. st%d%dim == 1)
then
459 write(
message(1),
'(a)')
'Incompatible restart information: saved calculation is spinors, this one is not.'
463 if (idim == 1 .and. st%d%dim == 2)
then
464 write(
message(1),
'(a)')
'Incompatible restart information: this calculation is spinors, saved one is not.'
468 if (ik < st%nik)
then
469 write(
message(1),
'(a)')
'Incompatible restart information: not enough k-points.'
470 write(
message(2),
'(2(a,i6))')
'Expected ', st%nik,
' > Read ', ik
485 read(lines(2),
'(a)') str
486 if (str(2:8) ==
'Complex')
then
487 message(1) =
"Cannot read real states from complex wavefunctions."
490 else if (str(2:5) /=
'Real')
then
491 message(1) =
"Restart file 'wfns' does not specify real/complex; cannot check compatibility."
499 if (err /= 0) ierr = ierr - 2**7
512 safe_allocate(dpsi(1:mesh%np))
514 safe_allocate(zpsi(1:mesh%np))
517 safe_allocate(restart_file(1:st%d%dim, st%st_start:st%st_end, 1:st%nik))
518 safe_allocate(restart_file_present(1:st%d%dim, st%st_start:st%st_end, 1:st%nik))
519 restart_file_present = .false.
527 read(lines(1),
'(a)') char
528 if (char ==
'%')
then
532 read(lines(1), *) ik, char, ist, char, idim, char, filename
541 if (ist >= st%st_start .and. ist <= st%st_end .and. &
542 ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
544 restart_file(idim, ist, ik) = trim(filename)
545 restart_file_present(idim, ist, ik) = .
true.
549 if (.not.
present(lr))
then
553 read(lines(1), *) my_occ, char, st%eigenval(ist, ik), char, imev, char, &
554 (read_kpoint(idir), char, idir = 1, space%dim), my_kweight
558 if (ist >= st%st_start .and. ist <= st%st_end .and. &
559 ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
560 restart_file_present(idim, ist, ik) = .false.
565 kpoint(1:space%dim) = &
566 kpoints%get_point(st%d%get_kpoint_index(ik), absolute_coordinates = .
true.)
568 if (any(abs(kpoint(1:space%dim) - read_kpoint(1:space%dim)) > 1e-12_real64))
then
571 write(
message(1),
'(a,i6)')
'Incompatible restart information: k-point mismatch for ik ', ik
572 write(
message(2),
'(a,99f18.12)')
' Expected : ', kpoint(1:space%dim)
573 write(
message(3),
'(a,99f18.12)')
' Read : ', read_kpoint(1:space%dim)
576 if (ist >= st%st_start .and. ist <= st%st_end .and. &
577 ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
578 restart_file_present(idim, ist, ik) = .false.
583 st%occ(ist, ik) = my_occ
584 integral_occs = integral_occs .and. &
585 abs((st%occ(ist, ik) - st%smear%el_per_state) * st%occ(ist, ik)) <=
m_epsilon
590 if (
present(iter))
then
595 read(lines(1), *) filename, filename, iter
606 safe_allocate(filled(1:st%d%dim, st%st_start:st%st_end, st%d%kpt%start:st%d%kpt%end))
609 if (
present(lowest_missing)) lowest_missing = st%nst + 1
614 ntodo = st%lnst*st%d%kpt%nlocal*st%d%dim
618 do ik = st%d%kpt%start, st%d%kpt%end
619 do ist = st%st_start, st%st_end
620 if (
present(skip))
then
624 do idim = 1, st%d%dim
626 if (.not. restart_file_present(idim, ist, ik))
then
627 if (
present(lowest_missing))
then
628 lowest_missing(idim, ik) = min(lowest_missing(idim, ik), ist)
640 if (.not.
present(lr))
then
643 call lalg_copy(mesh%np, dpsi, lr%ddl_psi(:, idim, ist, ik))
646 if (.not.
present(lr))
then
649 call lalg_copy(mesh%np, zpsi, lr%zdl_psi(:, idim, ist, ik))
655 filled(idim, ist, ik) = .
true.
657 else if (
present(lowest_missing))
then
658 lowest_missing(idim, ik) = min(lowest_missing(idim, ik), ist)
670 safe_deallocate_a(dpsi)
671 safe_deallocate_a(zpsi)
672 safe_deallocate_a(zpsil)
673 safe_deallocate_a(restart_file)
674 safe_deallocate_a(restart_file_present)
680 if (st%parallel_in_states .or. st%d%kpt%parallel)
then
682 call st%st_kpt_mpi_grp%allreduce(iread_tmp, iread, 1, mpi_integer, mpi_sum)
685 if (st%d%kpt%parallel)
then
687 if (
present(lowest_missing))
then
688 safe_allocate(lowest_missing_tmp(1:st%d%dim, 1:st%nik))
689 lowest_missing_tmp = lowest_missing
690 call st%d%kpt%mpi_grp%allreduce(lowest_missing_tmp(1,1), lowest_missing(1,1), st%d%dim*st%nik, &
691 mpi_integer, mpi_min)
692 safe_deallocate_a(lowest_missing_tmp)
696 if (st%restart_fixed_occ .and. iread == st%nst * st%nik * st%d%dim)
then
699 call smear_init(st%smear, namespace, st%d%ispin, fixed_occ = .
true., integral_occs = integral_occs, kpoints = kpoints)
702 if (.not.
present(lr) .and. .not.
present(skip))
call fill_random()
705 safe_deallocate_a(filled)
707 if (ierr == 0 .and. iread /= st%nst * st%nik * st%d%dim)
then
715 if (.not.
present(lr))
then
716 write(str,
'(a,i5)')
'Reading states.'
718 write(str,
'(a,i5)')
'Reading states information for linear response.'
721 if (.not.
present(skip))
then
722 write(
message(1),
'(a,i6,a,i6,a)')
'Only ', iread,
' files out of ', &
723 st%nst * st%nik * st%d%dim,
' could be read.'
725 write(
message(1),
'(a,i6,a,i6,a)')
'Only ', iread,
' files out of ', &
726 st%nst * st%nik * st%d%dim,
' were loaded.'
733 message(1) =
'Info: States reading done.'
745 do ik = st%d%kpt%start, st%d%kpt%end
747 do ist = st%st_start, st%st_end
748 do idim = 1, st%d%dim
749 if (filled(idim, ist, ik)) cycle
761 logical function index_is_wrong() !< .
true. if the index (idim, ist, ik) is not present in st structure...
764 if (idim > st%d%dim .or. idim < 1 .or. &
765 ist > st%nst .or. ist < 1 .or. &
766 ik > st%nik .or. ik < 1)
then
780 class(
space_t),
intent(in) :: space
782 class(
mesh_t),
intent(in) :: mesh
783 integer,
intent(out) :: ierr
784 integer,
optional,
intent(in) :: iter
786 integer :: iunit, isp, err, err2(2)
787 character(len=MAX_PATH_LEN) :: filename
788 character(len=300) :: lines(2)
799 message(1) =
"Debug: Writing density restart."
806 lines(1) =
'# #spin #nspin filename'
807 lines(2) =
'%densities'
809 if (err /= 0) ierr = ierr + 1
812 do isp = 1, st%d%nspin
814 write(lines(1),
'(i8,a,i8,a)') isp,
' | ', st%d%nspin,
' | "'//trim(adjustl(filename))//
'"'
816 if (err /= 0) err2(1) = err2(1) + 1
819 if (err /= 0) err2(2) = err2(2) + 1
822 if (err2(1) /= 0) ierr = ierr + 2
823 if (err2(2) /= 0) ierr = ierr + 4
827 if (err /= 0) ierr = ierr + 8
828 if (
present(iter))
then
829 write(lines(1),
'(a,i7)')
'Iter = ', iter
831 if (err /= 0) ierr = ierr + 16
837 message(1) =
"Debug: Writing density restart done."
847 class(
space_t),
intent(in) :: space
849 class(
mesh_t),
intent(in) :: mesh
850 integer,
intent(out) :: ierr
852 integer :: err, err2, isp
853 character(len=MAX_PATH_LEN) :: filename
865 message(1) =
"Debug: Reading density restart."
876 do isp = 1, st%d%nspin
882 if (err /= 0) err2 = err2 + 1
885 if (err2 /= 0) ierr = ierr + 1
887 message(1) =
"Debug: Reading density restart done."
895 class(
space_t),
intent(in) :: space
897 class(
mesh_t),
intent(in) :: mesh
898 integer,
intent(out) :: ierr
900 integer :: isp, err, err2(2), idir
901 character(len=MAX_PATH_LEN) :: filename
907 assert(
allocated(st%frozen_rho))
914 message(1) =
"Debug: Writing frozen densities restart."
920 do isp = 1, st%d%nspin
924 if (err /= 0) err2(2) = err2(2) + 1
926 if (
allocated(st%frozen_tau))
then
929 if (err /= 0) err2 = err2 + 1
932 if (
allocated(st%frozen_gdens))
then
933 do idir = 1, space%dim
934 if (st%d%nspin == 1)
then
935 write(filename, fmt=
'(a,i1)')
'frozen_gdens-dir', idir
937 write(filename, fmt=
'(a,i1,a,i1)')
'frozen_tau-dir', idir,
'-', isp
940 if (err /= 0) err2 = err2 + 1
944 if (
allocated(st%frozen_ldens))
then
947 if (err /= 0) err2 = err2 + 1
951 if (err2(1) /= 0) ierr = ierr + 2
952 if (err2(2) /= 0) ierr = ierr + 4
956 message(1) =
"Debug: Writing frozen densities restart done."
966 class(
space_t),
intent(in) :: space
968 class(
mesh_t),
intent(in) :: mesh
969 integer,
intent(out) :: ierr
971 integer :: err, err2, isp, idir
972 character(len=MAX_PATH_LEN) :: filename
976 assert(
allocated(st%frozen_rho))
986 message(1) =
"Debug: Reading densities restart."
990 do isp = 1, st%d%nspin
993 if (err /= 0) err2 = err2 + 1
995 if (
allocated(st%frozen_tau))
then
998 if (err /= 0) err2 = err2 + 1
1001 if (
allocated(st%frozen_gdens))
then
1002 do idir = 1, space%dim
1003 if (st%d%nspin == 1)
then
1004 write(filename, fmt=
'(a,i1)')
'frozen_gdens-dir', idir
1006 write(filename, fmt=
'(a,i1,a,i1)')
'frozen_tau-dir', idir,
'-', isp
1009 if (err /= 0) err2 = err2 + 1
1013 if (
allocated(st%frozen_ldens))
then
1016 if (err /= 0) err2 = err2 + 1
1020 if (err2 /= 0) ierr = ierr + 1
1022 message(1) =
"Debug: Reading frozen densities restart done."
1033 class(
mesh_t),
intent(in) :: mesh
1035 class(
space_t),
intent(in) :: space
1039 integer :: ip, id, is, ik, nstates, state_from, ierr, ncols
1040 integer :: ib, idim, inst, inik, normalize
1041 real(real64) :: xx(space%dim), rr, psi_re, psi_im
1042 character(len=150) :: filename
1043 complex(real64),
allocatable :: zpsi(:, :)
1045 integer,
parameter :: &
1046 state_from_formula = 1, &
1047 state_from_file = -10010, &
1048 normalize_yes = 1, &
1100 if (
parse_block(namespace,
'UserDefinedStates', blk) == 0)
then
1107 safe_allocate(zpsi(1:mesh%np, 1:st%d%dim))
1113 if (ncols < 5 .or. ncols > 6)
then
1114 message(1) =
'Each line in the UserDefinedStates block must have'
1115 message(2) =
'five or six columns.'
1131 if (.not.(id == idim .and. is == inst .and. ik == inik )) cycle
1137 select case (state_from)
1138 case (state_from_formula)
1141 blk, ib - 1, 4, st%user_def_states(id, is, ik))
1143 write(
message(1),
'(a,3i5)')
'Substituting state of orbital with k, ist, dim = ', ik, is, id
1144 write(
message(2),
'(2a)')
' with the expression:'
1145 write(
message(3),
'(2a)')
' ',trim(st%user_def_states(id, is, ik))
1151 case (state_from_file)
1157 write(
message(1),
'(a,3i5)')
'Substituting state of orbital with k, ist, dim = ', ik, is, id
1158 write(
message(2),
'(2a)')
' with data from file:'
1159 write(
message(3),
'(2a)')
' ',trim(filename)
1165 if (.not.(st%st_start <= is .and. st%st_end >= is &
1166 .and. st%d%kpt%start <= ik .and. st%d%kpt%end >= ik)) cycle
1168 select case (state_from)
1170 case (state_from_formula)
1179 zpsi(ip, 1) = psi_re +
m_zi * psi_im
1182 case (state_from_file)
1186 message(1) =
'Could not read the file!'
1187 write(
message(2),
'(a,i1)')
'Error code: ', ierr
1192 message(1) =
'Wrong entry in UserDefinedStates, column 4.'
1193 message(2) =
'You may state "formula" or "file" here.'
1203 select case (normalize)
1206 case (normalize_yes)
1207 assert(st%d%dim == 1)
1211 message(1) =
'The sixth column in UserDefinedStates may either be'
1212 message(2) =
'"normalize_yes" or "normalize_no"'
1222 safe_deallocate_a(zpsi)
1240 integer,
intent(out) :: ierr
1242 integer :: iunit_spin
1243 integer :: err, err2(2), ik, ist
1244 character(len=300) :: lines(3)
1260 lines(1) =
'# #k-point #st #spin(x) spin(y) spin(z)'
1262 if (err /= 0) ierr = ierr + 1
1267 write(lines(1),
'(i8,a,i8,3(a,f18.12))') ik,
' | ', ist,
' | ', &
1268 st%spin(1,ist,ik),
' | ', st%spin(2,ist,ik),
' | ', st%spin(3,ist,ik)
1270 if (err /= 0) err2(1) = err2(1) + 1
1275 if (err2(1) /= 0) ierr = ierr + 8
1276 if (err2(2) /= 0) ierr = ierr + 16
1297 integer,
intent(out) :: ierr
1299 integer :: spin_file, err, ik, ist
1300 character(len=256) :: lines(3)
1301 real(real64) :: spin(3)
1302 character(len=1) :: char
1321 if (err /= 0) ierr = ierr - 2**7
1337 read(lines(1),
'(a)') char
1338 if (char ==
'%')
then
1342 read(lines(1), *) ik, char, ist, char, spin(1), char, spin(2), char, spin(3)
1347 st%spin(1:3, ist, ik) = spin(1:3)
1360 class(
space_t),
intent(in) :: space
1361 type(
restart_t),
intent(inout) :: restart
1362 class(
mesh_t),
intent(in) :: mesh
1364 character(len=*),
optional,
intent(in) :: prefix
1368 complex(real64),
allocatable :: rotation_matrix(:,:), psi(:, :)
1369 integer :: ist, jst, ncols, iqn
1370 character(len=256) :: block_name
1402 if (
parse_block(namespace, trim(block_name), blk) == 0)
then
1403 if (st%parallel_in_states)
then
1407 message(1) =
"Number of rows in block " // trim(block_name) //
" must equal number of states in this calculation."
1414 safe_allocate(rotation_matrix(1:stin%nst, 1:stin%nst))
1415 safe_allocate(psi(1:mesh%np, 1:st%d%dim))
1421 if (ncols /= stin%nst)
then
1422 write(
message(1),
'(a,i6,a,i6,3a,i6,a)')
"Number of columns (", ncols,
") in row ", ist,
" of block ", &
1423 trim(block_name),
" must equal number of states (", stin%nst,
") read from gs restart."
1426 do jst = 1, stin%nst
1433 do iqn = st%d%kpt%start, st%d%kpt%end
1440 do ist = st%st_start, st%st_end
1447 safe_deallocate_a(rotation_matrix)
1448 safe_deallocate_a(psi)
ssize_t read(int __fd, void *__buf, size_t __nbytes) __attribute__((__access__(__write_only__
Copies a vector x, to a vector y.
This module handles the calculation mode.
integer, parameter, public p_strategy_max
integer, parameter, public p_strategy_domains
parallelization in domains
integer, parameter, public spinors
real(real64), parameter, public m_zero
complex(real64), parameter, public m_zi
real(real64), parameter, public m_epsilon
complex(real64), parameter, public m_z1
subroutine, public zio_function_input(filename, namespace, space, mesh, ff, ierr, map)
Reads a mesh function from file filename, and puts it into ff. If the map argument is passed,...
This module is intended to contain "only mathematical" functions and procedures.
This module defines various routines, operating on mesh functions.
subroutine, public zmf_normalize(mesh, dim, psi, norm)
Normalize a mesh function psi.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
subroutine, public messages_not_implemented(feature, namespace)
character(len=512), private msg
subroutine, public messages_variable_is_block(namespace, name)
subroutine, public messages_warning(no_lines, all_nodes, namespace)
subroutine, public print_date(str)
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
logical function mpi_grp_is_root(grp)
Is the current MPI process of grpcomm, root.
type(mpi_grp_t), public mpi_world
This module handles the communicators for the various parallelization strategies.
this module contains the low-level part of the output system
character(len=max_path_len) function, public get_filename_with_spin(output, nspin, spin_index)
Returns the filame as output, or output-spX is spin polarized.
logical function, public parse_is_defined(namespace, name)
integer function, public parse_block(namespace, name, blk, check_varinfo_)
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
subroutine, public restart_read(restart, iunit, lines, nlines, ierr)
subroutine, public restart_close(restart, iunit)
Close a file previously opened with restart_open.
subroutine, public restart_write(restart, iunit, lines, nlines, ierr)
logical pure function, public restart_skip(restart)
Returns true if the restart information should neither be read nor written. This might happen because...
integer function, public restart_open(restart, filename, status, position, silent)
Open file "filename" found inside the current restart directory. Depending on the type of restart,...
subroutine, public smear_init(this, namespace, ispin, fixed_occ, integral_occs, kpoints)
pure logical function, public states_are_complex(st)
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
subroutine, public states_elec_end(st)
finalize the states_elec_t object
subroutine, public states_elec_allocate_wfns(st, mesh, wfs_type, skip, packed)
Allocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_copy(stout, stin, exclude_wfns, exclude_eigenval, special)
make a (selective) copy of a states_elec_t object
subroutine, public states_elec_generate_random(st, mesh, kpoints, ist_start_, ist_end_, ikpt_start_, ikpt_end_, normalized)
randomize states
subroutine, public states_elec_look(restart, nik, dim, nst, ierr)
Reads the 'states' file in the restart directory, and finds out the nik, dim, and nst contained in it...
This module handles reading and writing restart information for the states_elec_t.
subroutine, public states_elec_read_user_def_orbitals(mesh, namespace, space, st)
the routine reads formulas for user-defined wavefunctions from the input file and fills the respectiv...
subroutine, public states_elec_load_frozen(restart, space, st, mesh, ierr)
subroutine, public states_elec_dump(restart, space, st, mesh, kpoints, ierr, iter, lr, st_start_writing, verbose)
subroutine, public states_elec_look_and_load(restart, namespace, space, st, mesh, kpoints, is_complex, packed)
subroutine, public states_elec_transform(st, namespace, space, restart, mesh, kpoints, prefix)
subroutine, public states_elec_load(restart, namespace, space, st, mesh, kpoints, ierr, iter, lr, lowest_missing, label, verbose, skip)
returns in ierr: <0 => Fatal error, or nothing read =0 => read all wavefunctions >0 => could only rea...
subroutine, public states_elec_load_spin(restart, st, ierr)
returns in ierr: <0 => Fatal error, or nothing read =0 => read all wavefunctions >0 => could only rea...
subroutine, public states_elec_dump_frozen(restart, space, st, mesh, ierr)
subroutine, public states_elec_load_rho(restart, space, st, mesh, ierr)
subroutine, public states_elec_dump_rho(restart, space, st, mesh, ierr, iter)
subroutine, public states_elec_dump_spin(restart, st, ierr)
subroutine, public conv_to_c_string(str)
converts to c string
type(type_t), public type_float
type(type_t), public type_cmplx
logical function index_is_wrong()
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.