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,
intent(in) :: fixed_occ
82 logical,
optional,
intent(in) :: is_complex
83 logical,
optional,
intent(in) :: packed
85 integer :: nkpt, dim, nst, ierr
86 real(real64),
allocatable :: new_occ(:,:)
93 message(1) =
"Unable to read states information."
97 if (st%parallel_in_states)
then
98 message(1) =
"Internal error: cannot use states_elec_look_and_load when parallel in states."
103 allocate(new_occ(1:nst, 1:st%nik))
105 new_occ(1:min(nst, st%nst),:) = st%occ(1:min(nst, st%nst),:)
106 safe_deallocate_a(st%occ)
107 call move_alloc(new_occ, st%occ)
117 safe_deallocate_a(st%node)
118 safe_allocate(st%node(1:st%nst))
121 safe_deallocate_a(st%eigenval)
122 safe_allocate(st%eigenval(1:st%nst, 1:st%nik))
123 st%eigenval = huge(st%eigenval)
125 if (
present(is_complex))
then
136 if (st%d%ispin ==
spinors)
then
137 safe_allocate(st%spin(1:3, 1:st%nst, 1:st%nik))
142 call states_elec_load(restart, namespace, space, st, mesh, kpoints, fixed_occ, ierr)
144 message(1) =
"Unable to read wavefunctions."
153 subroutine states_elec_dump(restart, space, st, mesh, kpoints, ierr, iter, lr, st_start_writing, verbose)
154 type(restart_t),
intent(in) :: restart
155 class(space_t),
intent(in) :: space
156 type(states_elec_t),
intent(in) :: st
157 class(mesh_t),
intent(in) :: mesh
158 type(kpoints_t),
intent(in) :: kpoints
159 integer,
intent(out) :: ierr
160 integer,
optional,
intent(in) :: iter
162 type(lr_t),
optional,
intent(in) :: lr
163 integer,
optional,
intent(in) :: st_start_writing
164 logical,
optional,
intent(in) :: verbose
166 integer :: iunit_wfns, iunit_occs, iunit_states
167 integer :: err, err2(2), ik, idir, ist, idim, itot
169 character(len=MAX_PATH_LEN) :: filename
170 character(len=300) :: lines(3)
171 logical :: lr_wfns_are_associated, should_write, verbose_
172 real(real64) :: kpoint(space%dim)
173 real(real64),
allocatable :: dpsi(:)
174 complex(real64),
allocatable :: zpsi(:)
188 message(1) =
"Info: Writing states."
194 if (
present(lr))
then
195 lr_wfns_are_associated = (
allocated(lr%ddl_psi) .and.
states_are_real(st)) .or. &
197 assert(lr_wfns_are_associated)
204 write(lines(1),
'(a20,1i10)')
'nst= ', st%nst
205 write(lines(2),
'(a20,1i10)')
'dim= ', st%d%dim
206 write(lines(3),
'(a20,1i10)')
'nik= ', st%nik
208 if (err /= 0) ierr = ierr + 1
213 lines(1) =
'# #k-point #st #dim filename'
215 lines(2) =
'%Real_Wavefunctions'
217 lines(2) =
'%Complex_Wavefunctions'
220 if (err /= 0) ierr = ierr + 2
224 lines(1) =
'# occupations | eigenvalue[a.u.] | Im(eigenvalue) [a.u.] | k-points | k-weights | filename | ik | ist | idim'
225 lines(2) =
'%Occupations_Eigenvalues_K-Points'
227 if (err /= 0) ierr = ierr + 4
231 safe_allocate(dpsi(1:mesh%np))
233 safe_allocate(zpsi(1:mesh%np))
240 kpoint(1:space%dim) = &
241 kpoints%get_point(st%d%get_kpoint_index(ik), absolute_coordinates = .
true.)
244 do idim = 1, st%d%dim
246 write(filename,
'(i10.10)') itot
248 write(lines(1),
'(i8,a,i8,a,i8,3a)') ik,
' | ', ist,
' | ', idim,
' | "', trim(filename),
'"'
250 if (err /= 0) err2(1) = err2(1) + 1
252 write(lines(1),
'(e23.16,a,e23.16)') st%occ(ist,ik),
' | ', st%eigenval(ist, ik)
253 write(lines(1),
'(a,a,e23.16)') trim(lines(1)),
' | ',
m_zero
254 do idir = 1, space%dim
255 write(lines(1),
'(a,a,e23.16)') trim(lines(1)),
' | ', kpoint(idir)
257 write(lines(1),
'(a,a,e23.16,a,i10.10,3(a,i8))') trim(lines(1)), &
258 ' | ', st%kweights(ik),
' | ', itot,
' | ', ik,
' | ', ist,
' | ', idim
260 if (err /= 0) err2(1) = err2(1) + 1
262 should_write = st%st_start <= ist .and. ist <= st%st_end
263 if (should_write .and.
present(st_start_writing))
then
264 if (ist < st_start_writing) should_write = .false.
267 if (should_write)
then
268 if (.not.
present(lr))
then
269 if (st%d%kpt%start <= ik .and. ik <= st%d%kpt%end)
then
281 if (st%d%kpt%start <= ik .and. ik <= st%d%kpt%end)
then
284 lr%ddl_psi(:, idim, ist, ik), err, root = root)
287 lr%zdl_psi(:, idim, ist, ik), err, root = root)
293 if (err /= 0) err2(2) = err2(2) + 1
300 if (err2(1) /= 0) ierr = ierr + 8
301 if (err2(2) /= 0) ierr = ierr + 16
303 safe_deallocate_a(dpsi)
304 safe_deallocate_a(zpsi)
308 if (err /= 0) ierr = ierr + 32
310 if (err /= 0) ierr = ierr + 64
311 if (
present(iter))
then
312 write(lines(1),
'(a,i7)')
'Iter = ', iter
314 if (err /= 0) ierr = ierr + 128
321 message(1) =
"Info: Finished writing states."
338 subroutine states_elec_load(restart, namespace, space, st, mesh, kpoints, fixed_occ, &
339 ierr, iter, lr, lowest_missing, label, verbose, skip)
342 class(
space_t),
intent(in) :: space
344 class(
mesh_t),
intent(in) :: mesh
346 logical,
intent(in) :: fixed_occ
347 integer,
intent(out) :: ierr
348 integer,
optional,
intent(out) :: iter
349 type(
lr_t),
optional,
intent(inout) :: lr
350 integer,
optional,
intent(out) :: lowest_missing(:, :)
351 character(len=*),
optional,
intent(in) :: label
352 logical,
optional,
intent(in) :: verbose
353 logical,
optional,
intent(in) :: skip(:)
355 integer :: states_elec_file, wfns_file, occ_file, err, ik, ist, idir, idim
356 integer :: idone, iread, ntodo
357 character(len=12) :: filename
358 character(len=1) :: char
359 logical,
allocatable :: filled(:, :, :)
360 character(len=256) :: lines(3), label_
361 character(len=50) :: str
363 real(real64) :: my_occ, imev, my_kweight
364 logical :: read_occ, lr_allocated, verbose_
365 logical :: integral_occs
366 real(real64),
allocatable :: dpsi(:)
367 complex(real64),
allocatable :: zpsi(:)
368 character(len=256),
allocatable :: restart_file(:, :, :)
369 logical,
allocatable :: restart_file_present(:, :, :)
370 real(real64) :: kpoint(space%dim), read_kpoint(space%dim)
373 integer,
allocatable :: lowest_missing_tmp(:, :)
380 if (
present(lowest_missing)) lowest_missing = 1
381 if (
present(iter)) iter = 0
383 if (
present(skip))
then
384 assert(ubound(skip, dim = 1) == st%nst)
397 if (
present(label))
then
400 if (
present(lr))
then
401 label_ =
" for linear response"
407 message(1) =
'Info: Reading states'
408 if (len(trim(label_)) > 0)
then
414 if (.not.
present(lr))
then
415 st%fromScratch = .false.
421 integral_occs = .
true.
424 st%fixed_occ = .
true.
426 read_occ = .not. st%fixed_occ
429 if (.not.
present(lr))
then
430 st%eigenval(:, :) =
m_zero
434 if (.not.
present(lr) .and. read_occ)
then
440 if (
present(lr))
then
441 lr_allocated = (
allocated(lr%ddl_psi) .and.
states_are_real(st)) .or. &
451 call restart_read(restart, states_elec_file, lines, 3, err)
455 read(lines(2), *) str, idim
456 read(lines(3), *) str, ik
457 if (idim == 2 .and. st%d%dim == 1)
then
458 write(
message(1),
'(a)')
'Incompatible restart information: saved calculation is spinors, this one is not.'
462 if (idim == 1 .and. st%d%dim == 2)
then
463 write(
message(1),
'(a)')
'Incompatible restart information: this calculation is spinors, saved one is not.'
467 if (ik < st%nik)
then
468 write(
message(1),
'(a)')
'Incompatible restart information: not enough k-points.'
469 write(
message(2),
'(2(a,i6))')
'Expected ', st%nik,
' > Read ', ik
484 read(lines(2),
'(a)') str
485 if (str(2:8) ==
'Complex')
then
486 message(1) =
"Cannot read real states from complex wavefunctions."
489 else if (str(2:5) /=
'Real')
then
490 message(1) =
"Restart file 'wfns' does not specify real/complex; cannot check compatibility."
498 if (err /= 0) ierr = ierr - 2**7
511 safe_allocate(dpsi(1:mesh%np))
513 safe_allocate(zpsi(1:mesh%np))
516 safe_allocate(restart_file(1:st%d%dim, st%st_start:st%st_end, 1:st%nik))
517 safe_allocate(restart_file_present(1:st%d%dim, st%st_start:st%st_end, 1:st%nik))
518 restart_file_present = .false.
526 read(lines(1),
'(a)') char
527 if (char ==
'%')
then
531 read(lines(1), *) ik, char, ist, char, idim, char, filename
540 if (ist >= st%st_start .and. ist <= st%st_end .and. &
541 ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
543 restart_file(idim, ist, ik) = trim(filename)
544 restart_file_present(idim, ist, ik) = .
true.
548 if (.not.
present(lr))
then
552 read(lines(1), *) my_occ, char, st%eigenval(ist, ik), char, imev, char, &
553 (read_kpoint(idir), char, idir = 1, space%dim), my_kweight
557 if (ist >= st%st_start .and. ist <= st%st_end .and. &
558 ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
559 restart_file_present(idim, ist, ik) = .false.
564 kpoint(1:space%dim) = &
565 kpoints%get_point(st%d%get_kpoint_index(ik), absolute_coordinates = .
true.)
567 if (any(abs(kpoint(1:space%dim) - read_kpoint(1:space%dim)) > 1e-12_real64))
then
570 write(
message(1),
'(a,i6)')
'Incompatible restart information: k-point mismatch for ik ', ik
571 write(
message(2),
'(a,99f18.12)')
' Expected : ', kpoint(1:space%dim)
572 write(
message(3),
'(a,99f18.12)')
' Read : ', read_kpoint(1:space%dim)
575 if (ist >= st%st_start .and. ist <= st%st_end .and. &
576 ik >= st%d%kpt%start .and. ik <= st%d%kpt%end)
then
577 restart_file_present(idim, ist, ik) = .false.
582 st%occ(ist, ik) = my_occ
583 integral_occs = integral_occs .and. &
584 abs((st%occ(ist, ik) - st%smear%el_per_state) * st%occ(ist, ik)) <=
m_epsilon
589 if (
present(iter))
then
594 read(lines(1), *) filename, filename, iter
605 safe_allocate(filled(1:st%d%dim, st%st_start:st%st_end, st%d%kpt%start:st%d%kpt%end))
608 if (
present(lowest_missing)) lowest_missing = st%nst + 1
613 ntodo = st%lnst*st%d%kpt%nlocal*st%d%dim
617 do ik = st%d%kpt%start, st%d%kpt%end
618 do ist = st%st_start, st%st_end
619 if (
present(skip))
then
623 do idim = 1, st%d%dim
625 if (.not. restart_file_present(idim, ist, ik))
then
626 if (
present(lowest_missing))
then
627 lowest_missing(idim, ik) = min(lowest_missing(idim, ik), ist)
639 if (.not.
present(lr))
then
642 call lalg_copy(mesh%np, dpsi, lr%ddl_psi(:, idim, ist, ik))
645 if (.not.
present(lr))
then
648 call lalg_copy(mesh%np, zpsi, lr%zdl_psi(:, idim, ist, ik))
654 filled(idim, ist, ik) = .
true.
656 else if (
present(lowest_missing))
then
657 lowest_missing(idim, ik) = min(lowest_missing(idim, ik), ist)
669 safe_deallocate_a(dpsi)
670 safe_deallocate_a(zpsi)
671 safe_deallocate_a(restart_file)
672 safe_deallocate_a(restart_file_present)
678 if (st%parallel_in_states .or. st%d%kpt%parallel)
then
680 call st%st_kpt_mpi_grp%allreduce(iread_tmp, iread, 1, mpi_integer, mpi_sum)
683 if (st%d%kpt%parallel)
then
685 if (
present(lowest_missing))
then
686 safe_allocate(lowest_missing_tmp(1:st%d%dim, 1:st%nik))
687 lowest_missing_tmp = lowest_missing
688 call st%d%kpt%mpi_grp%allreduce(lowest_missing_tmp(1,1), lowest_missing(1,1), st%d%dim*st%nik, &
689 mpi_integer, mpi_min)
690 safe_deallocate_a(lowest_missing_tmp)
694 if (fixed_occ .and. iread == st%nst * st%nik * st%d%dim)
then
697 call smear_init(st%smear, namespace, st%d%ispin, fixed_occ = .
true., integral_occs = integral_occs, kpoints = kpoints)
700 if (.not.
present(lr) .and. .not.
present(skip))
call fill_random()
703 safe_deallocate_a(filled)
705 if (ierr == 0 .and. iread /= st%nst * st%nik * st%d%dim)
then
713 if (.not.
present(lr))
then
714 write(str,
'(a,i5)')
'Reading states.'
716 write(str,
'(a,i5)')
'Reading states information for linear response.'
719 if (.not.
present(skip))
then
720 write(
message(1),
'(a,i6,a,i6,a)')
'Only ', iread,
' files out of ', &
721 st%nst * st%nik * st%d%dim,
' could be read.'
723 write(
message(1),
'(a,i6,a,i6,a)')
'Only ', iread,
' files out of ', &
724 st%nst * st%nik * st%d%dim,
' were loaded.'
731 message(1) =
'Info: States reading done.'
743 do ik = st%d%kpt%start, st%d%kpt%end
745 do ist = st%st_start, st%st_end
746 do idim = 1, st%d%dim
747 if (filled(idim, ist, ik)) cycle
759 logical function index_is_wrong() !< .
true. if the index (idim, ist, ik) is not present in st structure...
762 if (idim > st%d%dim .or. idim < 1 .or. &
763 ist > st%nst .or. ist < 1 .or. &
764 ik > st%nik .or. ik < 1)
then
778 class(
space_t),
intent(in) :: space
780 class(
mesh_t),
intent(in) :: mesh
781 integer,
intent(out) :: ierr
782 integer,
optional,
intent(in) :: iter
784 integer :: iunit, isp, err, err2(2)
785 character(len=MAX_PATH_LEN) :: filename
786 character(len=300) :: lines(2)
797 message(1) =
"Debug: Writing density restart."
804 lines(1) =
'# #spin #nspin filename'
805 lines(2) =
'%densities'
807 if (err /= 0) ierr = ierr + 1
810 do isp = 1, st%d%nspin
812 write(lines(1),
'(i8,a,i8,a)') isp,
' | ', st%d%nspin,
' | "'//trim(adjustl(filename))//
'"'
814 if (err /= 0) err2(1) = err2(1) + 1
817 if (err /= 0) err2(2) = err2(2) + 1
820 if (err2(1) /= 0) ierr = ierr + 2
821 if (err2(2) /= 0) ierr = ierr + 4
825 if (err /= 0) ierr = ierr + 8
826 if (
present(iter))
then
827 write(lines(1),
'(a,i7)')
'Iter = ', iter
829 if (err /= 0) ierr = ierr + 16
835 message(1) =
"Debug: Writing density restart done."
845 class(
space_t),
intent(in) :: space
847 class(
mesh_t),
intent(in) :: mesh
848 integer,
intent(out) :: ierr
850 integer :: err, err2, isp
851 character(len=MAX_PATH_LEN) :: filename
863 message(1) =
"Debug: Reading density restart."
874 do isp = 1, st%d%nspin
880 if (err /= 0) err2 = err2 + 1
883 if (err2 /= 0) ierr = ierr + 1
885 message(1) =
"Debug: Reading density restart done."
893 class(
space_t),
intent(in) :: space
895 class(
mesh_t),
intent(in) :: mesh
896 integer,
intent(out) :: ierr
898 integer :: isp, err, err2(2), idir
899 character(len=MAX_PATH_LEN) :: filename
905 assert(
allocated(st%frozen_rho))
912 message(1) =
"Debug: Writing frozen densities restart."
918 do isp = 1, st%d%nspin
922 if (err /= 0) err2(2) = err2(2) + 1
924 if (
allocated(st%frozen_tau))
then
927 if (err /= 0) err2 = err2 + 1
930 if (
allocated(st%frozen_gdens))
then
931 do idir = 1, space%dim
932 if (st%d%nspin == 1)
then
933 write(filename, fmt=
'(a,i1)')
'frozen_gdens-dir', idir
935 write(filename, fmt=
'(a,i1,a,i1)')
'frozen_gdens-dir', idir,
'-', isp
938 if (err /= 0) err2 = err2 + 1
942 if (
allocated(st%frozen_ldens))
then
945 if (err /= 0) err2 = err2 + 1
949 if (err2(1) /= 0) ierr = ierr + 2
950 if (err2(2) /= 0) ierr = ierr + 4
954 message(1) =
"Debug: Writing frozen densities restart done."
964 class(
space_t),
intent(in) :: space
966 class(
mesh_t),
intent(in) :: mesh
967 integer,
intent(out) :: ierr
969 integer :: err, err2, isp, idir
970 character(len=MAX_PATH_LEN) :: filename
974 assert(
allocated(st%frozen_rho))
984 message(1) =
"Debug: Reading densities restart."
988 do isp = 1, st%d%nspin
991 if (err /= 0) err2 = err2 + 1
993 if (
allocated(st%frozen_tau))
then
996 if (err /= 0) err2 = err2 + 1
999 if (
allocated(st%frozen_gdens))
then
1000 do idir = 1, space%dim
1001 if (st%d%nspin == 1)
then
1002 write(filename, fmt=
'(a,i1)')
'frozen_gdens-dir', idir
1004 write(filename, fmt=
'(a,i1,a,i1)')
'frozen_gdens-dir', idir,
'-', isp
1007 if (err /= 0) err2 = err2 + 1
1011 if (
allocated(st%frozen_ldens))
then
1014 if (err /= 0) err2 = err2 + 1
1018 if (err2 /= 0) ierr = ierr + 1
1020 message(1) =
"Debug: Reading frozen densities restart done."
1031 class(
mesh_t),
intent(in) :: mesh
1033 class(
space_t),
intent(in) :: space
1037 integer :: ip, id, is, ik, nstates, state_from, ierr, ncols
1038 integer :: ib, idim, inst, inik, normalize
1039 real(real64) :: xx(space%dim), rr, psi_re, psi_im
1040 character(len=150) :: filename
1041 complex(real64),
allocatable :: zpsi(:, :)
1043 integer,
parameter :: &
1044 state_from_formula = 1, &
1045 state_from_file = -10010, &
1046 normalize_yes = 1, &
1129 if (
parse_block(namespace,
'UserDefinedStates', blk) == 0)
then
1136 safe_allocate(zpsi(1:mesh%np, 1:st%d%dim))
1142 if (ncols < 5 .or. ncols > 6)
then
1143 message(1) =
'Each line in the UserDefinedStates block must have'
1144 message(2) =
'five or six columns.'
1160 if (.not.(id == idim .and. is == inst .and. ik == inik )) cycle
1166 select case (state_from)
1167 case (state_from_formula)
1170 blk, ib - 1, 4, st%user_def_states(id, is, ik))
1172 write(
message(1),
'(a,3i5)')
'Substituting state of orbital with k, ist, dim = ', ik, is, id
1173 write(
message(2),
'(2a)')
' with the expression:'
1174 write(
message(3),
'(2a)')
' ',trim(st%user_def_states(id, is, ik))
1180 case (state_from_file)
1186 write(
message(1),
'(a,3i5)')
'Substituting state of orbital with k, ist, dim = ', ik, is, id
1187 write(
message(2),
'(2a)')
' with data from file:'
1188 write(
message(3),
'(2a)')
' ',trim(filename)
1194 if (.not.(st%st_start <= is .and. st%st_end >= is &
1195 .and. st%d%kpt%start <= ik .and. st%d%kpt%end >= ik)) cycle
1197 select case (state_from)
1199 case (state_from_formula)
1208 zpsi(ip, 1) = cmplx(psi_re, psi_im, real64)
1211 case (state_from_file)
1215 message(1) =
'Could not read the file!'
1216 write(
message(2),
'(a,i1)')
'Error code: ', ierr
1221 message(1) =
'Wrong entry in UserDefinedStates, column 4.'
1222 message(2) =
'You may state "formula" or "file" here.'
1232 select case (normalize)
1235 case (normalize_yes)
1236 assert(st%d%dim == 1)
1240 message(1) =
'The sixth column in UserDefinedStates may either be'
1241 message(2) =
'"normalize_yes" or "normalize_no"'
1251 safe_deallocate_a(zpsi)
1269 integer,
intent(out) :: ierr
1271 integer :: iunit_spin
1272 integer :: err, err2(2), ik, ist
1273 character(len=300) :: lines(3)
1289 lines(1) =
'# #k-point #st #spin(x) spin(y) spin(z)'
1291 if (err /= 0) ierr = ierr + 1
1296 write(lines(1),
'(i8,a,i8,3(a,f18.12))') ik,
' | ', ist,
' | ', &
1297 st%spin(1,ist,ik),
' | ', st%spin(2,ist,ik),
' | ', st%spin(3,ist,ik)
1299 if (err /= 0) err2(1) = err2(1) + 1
1304 if (err2(1) /= 0) ierr = ierr + 8
1305 if (err2(2) /= 0) ierr = ierr + 16
1326 integer,
intent(out) :: ierr
1328 integer :: spin_file, err, ik, ist
1329 character(len=256) :: lines(3)
1330 real(real64) :: spin(3)
1331 character(len=1) :: char
1350 if (err /= 0) ierr = ierr - 2**7
1366 read(lines(1),
'(a)') char
1367 if (char ==
'%')
then
1371 read(lines(1), *) ik, char, ist, char, spin(1), char, spin(2), char, spin(3)
1376 st%spin(1:3, ist, ik) = spin(1:3)
1389 class(
space_t),
intent(in) :: space
1390 type(
restart_t),
intent(inout) :: restart
1391 class(
mesh_t),
intent(in) :: mesh
1393 character(len=*),
optional,
intent(in) :: prefix
1397 complex(real64),
allocatable :: rotation_matrix(:,:), psi(:, :)
1398 integer :: ist, jst, ncols, iqn
1399 character(len=256) :: block_name
1432 if (
parse_block(namespace, trim(block_name), blk) == 0)
then
1433 if (st%parallel_in_states)
then
1437 message(1) =
"Number of rows in block " // trim(block_name) //
" must equal number of states in this calculation."
1444 safe_allocate(rotation_matrix(1:stin%nst, 1:stin%nst))
1445 safe_allocate(psi(1:mesh%np, 1:st%d%dim))
1451 if (ncols /= stin%nst)
then
1452 write(
message(1),
'(a,i6,a,i6,3a,i6,a)')
"Number of columns (", ncols,
") in row ", ist,
" of block ", &
1453 trim(block_name),
" must equal number of states (", stin%nst,
") read from gs restart."
1456 do jst = 1, stin%nst
1463 do iqn = st%d%kpt%start, st%d%kpt%end
1470 do ist = st%st_start, st%st_end
1477 safe_deallocate_a(rotation_matrix)
1478 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
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, fixed_occ, 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, fixed_occ, 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), parameter, public type_cmplx
type(type_t), parameter, public type_float
logical function index_is_wrong()
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.