Octopus
td.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
21module td_oct_m
27 use debug_oct_m
32 use epot_oct_m
34 use forces_oct_m
36 use global_oct_m
37 use grid_oct_m
40 use io_oct_m
42 use ions_oct_m
43 use kick_oct_m
44 use, intrinsic :: iso_fortran_env
45 use lasers_oct_m
46 use lda_u_oct_m
49 use loct_oct_m
51 use mesh_oct_m
53 use mpi_oct_m
56 use output_oct_m
58 use parser_oct_m
59 use pes_oct_m
69 use scf_oct_m
71 use space_oct_m
75 use stress_oct_m
77 use types_oct_m
78 use unit_oct_m
80 use v_ks_oct_m
83 use xc_oct_m
84
85 implicit none
86
87 private
88 public :: &
89 td_t, &
90 td_run, &
92 td_init, &
94 td_end, &
95 td_end_run, &
98 td_dump, &
106
108 integer, parameter, public :: &
109 EHRENFEST = 1, &
110 bo = 2
111
112 type td_t
113 private
114 type(propagator_base_t), public :: tr
115 type(scf_t), public :: scf
116 type(ion_dynamics_t), public :: ions_dyn
117 real(real64), public :: dt
118 integer, public :: max_iter
119 integer, public :: iter
120 logical, public :: recalculate_gs
121
122 type(pes_t), public :: pesv
123
124 integer, public :: dynamics
125 integer, public :: energy_update_iter
126 real(real64) :: scissor
127
128 logical :: freeze_occ
129 logical :: freeze_u
130 integer :: freeze_orbitals
131
132 logical :: from_scratch = .false.
133
134 type(td_write_t), public :: write_handler
135 type(restart_t) :: restart_load
136 type(restart_t) :: restart_dump
137 end type td_t
138
139
140contains
141
142 subroutine td_run_init()
143
144 push_sub(td_run_init)
145
146 call calc_mode_par%set_parallelization(p_strategy_states, default = .true.)
147
148 pop_sub(td_run_init)
149 end subroutine td_run_init
150
151 ! ---------------------------------------------------------
152
153 subroutine td_init(td, namespace, space, gr, ions, st, ks, hm, ext_partners, outp)
154 type(td_t), intent(inout) :: td
155 type(namespace_t), intent(in) :: namespace
156 class(space_t), intent(in) :: space
157 type(grid_t), intent(in) :: gr
158 type(ions_t), intent(inout) :: ions
159 type(states_elec_t), intent(in) :: st
160 type(v_ks_t), intent(in) :: ks
161 type(hamiltonian_elec_t), intent(in) :: hm
162 type(partner_list_t), intent(in) :: ext_partners
163 type(output_t), intent(in) :: outp
164
165 integer :: default
166 real(real64) :: propagation_time
167 type(lasers_t), pointer :: lasers
168 logical :: symmetrize
169
170 push_sub(td_init)
171
172 if (hm%pcm%run_pcm) call messages_experimental("PCM for CalculationMode = td", namespace=namespace)
173
174 symmetrize = hm%kpoints%use_symmetries .or. st%symmetrize_density
175 call ion_dynamics_init(td%ions_dyn, namespace, ions, symmetrize, gr%symmetrizer)
176
177 if (td%ions_dyn%ions_move()) then
178 if (hm%kpoints%use_symmetries) then
179 message(1) = "KPoints symmetries cannot be used with moving ions."
180 message(2) = "Please set KPointsSymmetries = no."
181 call messages_fatal(2, namespace=namespace)
182 end if
183 if (st%symmetrize_density) then
184 message(1) = "Symmetrization of the density cannot be used with moving ions."
185 message(2) = "Please set SymmetrizeDensity = no."
186 call messages_fatal(2, namespace=namespace)
187 end if
188 end if
189
190 td%iter = 0
191
192 !%Variable TDTimeStep
193 !%Type float
194 !%Section Time-Dependent::Propagation
195 !%Description
196 !% The time-step for the time propagation. For most propagators you
197 !% want to use the largest value that is possible without the
198 !% evolution becoming unstable.
199 !%
200 !% While prior versions of Octopus used to have a default time step, however,
201 !% this now needs to be systematically defined.
202 !%End
203
204 call parse_variable(namespace, 'TDTimeStep', -m_one, td%dt, unit = units_inp%time)
206 if (td%dt <= m_zero) then
207 write(message(1),'(a)') 'A positive value for TDTimeStep must be defined in the input file.'
208 call messages_fatal(1, namespace=namespace)
209 end if
211 call messages_print_var_value('TDTimeStep', td%dt, unit = units_out%time, namespace=namespace)
214 if (parse_is_defined(namespace, 'TDMaxSteps') .and. parse_is_defined(namespace, 'TDPropagationTime')) then
215 call messages_write('You cannot set TDMaxSteps and TDPropagationTime at the same time')
216 call messages_fatal(namespace=namespace)
217 end if
219 !%Variable TDPropagationTime
220 !%Type float
221 !%Section Time-Dependent::Propagation
222 !%Description
223 !% The length of the time propagation. You cannot set this variable
224 !% at the same time as <tt>TDMaxSteps</tt>. By default this variable will
225 !% not be used.
226 !%
227 !% The units for this variable are <math>\hbar</math>/Hartree (or <math>\hbar</math>/eV if you
228 !% selected <tt>ev_angstrom</tt> as input units). The approximate conversions to
229 !% femtoseconds are 1 fs = 41.34 <math>\hbar</math>/Hartree = 1.52 <math>\hbar</math>/eV.
230 !%End
231 call parse_variable(namespace, 'TDPropagationTime', -1.0_real64, propagation_time, unit = units_inp%time)
232
233 call messages_obsolete_variable(namespace, 'TDMaximumIter', 'TDMaxSteps')
234
235 !%Variable TDMaxSteps
236 !%Type integer
237 !%Default 1500
238 !%Section Time-Dependent::Propagation
239 !%Description
240 !% Number of time-propagation steps that will be performed. You
241 !% cannot use this variable together with <tt>TDPropagationTime</tt>.
242 !%End
243 default = 1500
244 if (propagation_time > m_zero) default = nint(propagation_time/td%dt)
245 call parse_variable(namespace, 'TDMaxSteps', default, td%max_iter)
247 if (propagation_time <= m_zero) propagation_time = td%dt*td%max_iter
248
249 call messages_print_var_value('TDPropagationTime', propagation_time, unit = units_out%time, namespace=namespace)
250 call messages_print_var_value('TDMaxSteps', td%max_iter, namespace=namespace)
251
252 if (td%max_iter < 1) then
253 write(message(1), '(a,i6,a)') "Input: '", td%max_iter, "' is not a valid value for TDMaxSteps."
254 message(2) = '(TDMaxSteps <= 1)'
255 call messages_fatal(2, namespace=namespace)
256 end if
257
258 td%iter = 0
259
260 td%dt = td%dt
261
262 lasers => list_get_lasers(ext_partners)
263
264 ! now the photoelectron stuff
265 call pes_init(td%pesv, namespace, space, gr, gr%box, st, outp%restart_write_interval, hm%kpoints, &
266 hm%abs_boundaries, ext_partners, td%max_iter, td%dt)
267
268 !%Variable TDDynamics
269 !%Type integer
270 !%Default ehrenfest
271 !%Section Time-Dependent::Propagation
272 !%Description
273 !% Type of dynamics to follow during a time propagation.
274 !% For BO, you must set <tt>MoveIons = yes</tt>.
275 !%Option ehrenfest 1
276 !% Ehrenfest dynamics.
277 !%Option bo 2
278 !% Born-Oppenheimer (Experimental).
279 !%End
280
281 call parse_variable(namespace, 'TDDynamics', ehrenfest, td%dynamics)
282 if (.not. varinfo_valid_option('TDDynamics', td%dynamics)) call messages_input_error(namespace, 'TDDynamics')
283 call messages_print_var_option('TDDynamics', td%dynamics, namespace=namespace)
284 if (td%dynamics .ne. ehrenfest) then
285 if (.not. td%ions_dyn%is_active()) then
286 message(1) = "TDDynamics=bo can only be used if MoveIons=yes or CellDynamics=yes"
287 call messages_fatal(1, namespace=namespace)
288 end if
289 end if
290
291 !%Variable RecalculateGSDuringEvolution
292 !%Type logical
293 !%Default no
294 !%Section Time-Dependent::Propagation
295 !%Description
296 !% In order to calculate some information about the system along the
297 !% evolution (e.g. projection onto the ground-state KS determinant,
298 !% projection of the TDKS spin-orbitals onto the ground-state KS
299 !% spin-orbitals), the ground-state KS orbitals are needed. If the
300 !% ionic potential changes -- that is, the ions move -- one may want
301 !% to recalculate the ground state. You may do this by setting this
302 !% variable.
303 !%
304 !% The recalculation is not done every time step, but only every
305 !% <tt>RestartWriteInterval</tt> time steps.
306 !%End
307 call parse_variable(namespace, 'RecalculateGSDuringEvolution', .false., td%recalculate_gs)
308 if (hm%lda_u_level /= dft_u_none .and. td%recalculate_gs) then
309 call messages_not_implemented("DFT+U with RecalculateGSDuringEvolution=yes", namespace=namespace)
310 end if
311
312 !%Variable TDScissor
313 !%Type float
314 !%Default 0.0
315 !%Section Time-Dependent
316 !%Description
317 !% (experimental) If set, a scissor operator will be applied in the
318 !% Hamiltonian, shifting the excitation energies by the amount
319 !% specified. By default, it is not applied.
320 !%End
321 call parse_variable(namespace, 'TDScissor', m_zero, td%scissor)
322 call messages_print_var_value('TDScissor', td%scissor, namespace=namespace)
323
324 call propagator_elec_init(gr, namespace, st, td%tr, hm%ks_pot, td%ions_dyn%is_active() .and.&
325 list_has_gauge_field(ext_partners), family_is_mgga_with_exc(ks%xc), td%ions_dyn%cell_relax())
326
327 if (associated(lasers) .and. mpi_grp_is_root(mpi_world)) then
328 call messages_print_with_emphasis(msg="Time-dependent external fields", namespace=namespace)
329 call laser_write_info(lasers%lasers, dt=td%dt, max_iter=td%max_iter, namespace=namespace)
330 call messages_print_with_emphasis(namespace=namespace)
331 end if
332
333 !%Variable TDEnergyUpdateIter
334 !%Type integer
335 !%Section Time-Dependent::Propagation
336 !%Description
337 !% This variable controls after how many iterations Octopus
338 !% updates the total energy during a time-propagation run. For
339 !% iterations where the energy is not updated, the last calculated
340 !% value is reported. If you set this variable to 1, the energy
341 !% will be calculated in each step.
342 !%End
343
344 default = 10
345 call parse_variable(namespace, 'TDEnergyUpdateIter', default, td%energy_update_iter)
346
347 if (gr%der%boundaries%spiralBC .and. hm%ep%reltype == spin_orbit) then
348 message(1) = "Generalized Bloch theorem cannot be used with spin-orbit coupling."
349 call messages_fatal(1, namespace=namespace)
350 end if
351
352 if (gr%der%boundaries%spiralBC) then
353 if (any(abs(hm%kick%easy_axis(1:2)) > m_epsilon)) then
354 message(1) = "Generalized Bloch theorem cannot be used for an easy axis not along the z direction."
355 call messages_fatal(1, namespace=namespace)
356 end if
357 end if
358
359 !%Variable TDFreezeOrbitals
360 !%Type integer
361 !%Default 0
362 !%Section Time-Dependent
363 !%Description
364 !% (Experimental) You have the possibility of "freezing" a number of orbitals during a time-propagation.
365 !% The Hartree and exchange-correlation potential due to these orbitals (which
366 !% will be the lowest-energy ones) will be added during the propagation, but the orbitals
367 !% will not be propagated.
368 !%Option sae -1
369 !% Single-active-electron approximation. This option is only valid for time-dependent
370 !% calculations (<tt>CalculationMode = td</tt>). Also, the nuclei should not move.
371 !% The idea is that all orbitals except the last one are frozen. The orbitals are to
372 !% be read from a previous ground-state calculation. The active orbital is then treated
373 !% as independent (whether it contains one electron or two) -- although it will
374 !% feel the Hartree and exchange-correlation potentials from the ground-state electronic
375 !% configuration.
376 !%
377 !% It is almost equivalent to setting <tt>TDFreezeOrbitals = N-1</tt>, where <tt>N</tt> is the number
378 !% of orbitals, but not completely.
379 !%End
380 call parse_variable(namespace, 'TDFreezeOrbitals', 0, td%freeze_orbitals)
381
382 if (td%freeze_orbitals /= 0) then
383 call messages_experimental('TDFreezeOrbitals', namespace=namespace)
384
385 if (hm%lda_u_level /= dft_u_none) then
386 call messages_not_implemented('TDFreezeOrbitals with DFT+U', namespace=namespace)
387 end if
388 end if
389
390
391 pop_sub(td_init)
392 nullify(lasers)
393 end subroutine td_init
394
395 ! ---------------------------------------------------------
396 subroutine td_init_run(td, namespace, mc, gr, ions, st, ks, hm, ext_partners, outp, space, from_scratch)
397 type(td_t), intent(inout) :: td
398 type(namespace_t), intent(in) :: namespace
399 type(multicomm_t), intent(inout) :: mc
400 type(grid_t), intent(inout) :: gr
401 type(ions_t), intent(inout) :: ions
402 type(states_elec_t), intent(inout) :: st
403 type(v_ks_t), intent(inout) :: ks
404 type(hamiltonian_elec_t), intent(inout) :: hm
405 type(partner_list_t), intent(in) :: ext_partners
406 type(output_t), intent(inout) :: outp
407 type(electron_space_t), intent(in) :: space
408 logical, intent(inout) :: from_scratch
409 push_sub(td_init_run)
410
411 ! NOTE: please do not change code in this function, but only in functions
412 ! called from here because the logic of this function is replicated in the
413 ! multisystem framework in different places
414
415 call td_allocate_wavefunctions(td, namespace, mc, gr, ions, st, hm, space)
416 call td_init_gaugefield(td, namespace, gr, st, ks, hm, ext_partners, space)
417
418 td%from_scratch = from_scratch
419
420 if (.not. td%from_scratch) then
421 call td_load_restart_from_td(td, namespace, space, mc, gr, ext_partners, st, ks, hm, td%from_scratch)
422 if (td%from_scratch) then
423 message(1) = "Unable to read time-dependent restart information: Starting from scratch"
424 call messages_warning(1, namespace=namespace)
425 end if
426 end if
427
428 if (td%iter >= td%max_iter) then
429 message(1) = "All requested iterations have already been done. Use FromScratch = yes if you want to redo them."
430 call messages_info(1, namespace=namespace)
432 td%iter = td%iter + 1
433 if ((td%ions_dyn%is_active()) .and. td%recalculate_gs) call restart_end(td%restart_load)
434 pop_sub(td_init_run)
435 return
436 end if
437
438 if (td%from_scratch) then
439 call td_load_restart_from_gs(td, namespace, space, mc, gr, ext_partners, st, ks, hm)
440 end if
441
442 call td_init_with_wavefunctions(td, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, outp, td%from_scratch)
443
444 pop_sub(td_init_run)
445 end subroutine td_init_run
446
447 ! ---------------------------------------------------------
448 subroutine td_allocate_wavefunctions(td, namespace, mc, gr, ions, st, hm, space)
449 type(td_t), intent(inout) :: td
450 type(namespace_t), intent(in) :: namespace
451 type(multicomm_t), intent(inout) :: mc
452 type(grid_t), intent(inout) :: gr
453 type(ions_t), intent(inout) :: ions
454 type(states_elec_t), intent(inout) :: st
455 type(hamiltonian_elec_t), intent(inout) :: hm
456 class(space_t), intent(in) :: space
457
459
460 ! Allocate wavefunctions during time-propagation
461 if (td%dynamics == ehrenfest) then
462 !Note: this is not really clean to do this
463 if (hm%lda_u_level /= dft_u_none .and. states_are_real(st)) then
464 call lda_u_end(hm%lda_u)
465 !complex wfs are required for Ehrenfest
466 call states_elec_allocate_wfns(st, gr, type_cmplx, packed=.true.)
467 call lda_u_init(hm%lda_u, namespace, space, hm%lda_u_level, gr, ions, st, mc, &
468 hm%kpoints, hm%phase%is_allocated())
469 else
470 !complex wfs are required for Ehrenfest
471 call states_elec_allocate_wfns(st, gr, type_cmplx, packed=.true.)
472 end if
473 else
474 call states_elec_allocate_wfns(st, gr, packed=.true.)
475 call scf_init(td%scf, namespace, gr, ions, st, mc, hm, space)
476 end if
477
479 end subroutine td_allocate_wavefunctions
480
481 ! ---------------------------------------------------------
482 subroutine td_init_gaugefield(td, namespace, gr, st, ks, hm, ext_partners, space)
483 type(td_t), intent(inout) :: td
484 type(namespace_t), intent(in) :: namespace
485 type(grid_t), intent(inout) :: gr
486 type(states_elec_t), intent(inout) :: st
487 type(v_ks_t), intent(inout) :: ks
488 type(hamiltonian_elec_t), intent(inout) :: hm
489 type(partner_list_t), intent(in) :: ext_partners
490 class(space_t), intent(in) :: space
491
492 type(gauge_field_t), pointer :: gfield
493
494 push_sub(td_init_gaugefield)
495
496 gfield => list_get_gauge_field(ext_partners)
497 if(associated(gfield)) then
498 if (gauge_field_is_used(gfield)) then
499 !if the gauge field is applied, we need to tell v_ks to calculate the current
500 call v_ks_calculate_current(ks, .true.)
501
502 ! initialize the vector field and update the hamiltonian
503 call gauge_field_init_vec_pot(gfield, st%qtot)
504 call hm%update(gr, namespace, space, ext_partners, time = td%dt*td%iter)
505
506 end if
507 end if
508
509 pop_sub(td_init_gaugefield)
510 end subroutine td_init_gaugefield
511
512 ! ---------------------------------------------------------
513 subroutine td_end(td)
514 type(td_t), intent(inout) :: td
515
516 push_sub(td_end)
517
518 call pes_end(td%pesv)
519 call propagator_elec_end(td%tr) ! clean the evolution method
520 call ion_dynamics_end(td%ions_dyn)
521
522 if (td%dynamics == bo) call scf_end(td%scf)
523
524 pop_sub(td_end)
525 end subroutine td_end
526
527 ! ---------------------------------------------------------
528 subroutine td_end_run(td, st, hm)
529 type(td_t), intent(inout) :: td
530 type(states_elec_t), intent(inout) :: st
531 type(hamiltonian_elec_t), intent(inout) :: hm
532
533 push_sub(td_end_run)
534
535 if (st%pack_states .and. hm%apply_packed()) call st%unpack()
536
537 call restart_end(td%restart_dump)
538 call td_write_end(td%write_handler)
539
540 ! free memory
542 if ((td%ions_dyn%is_active()).and. td%recalculate_gs) call restart_end(td%restart_load)
543
544 pop_sub(td_end_run)
545 end subroutine td_end_run
546
547 ! ---------------------------------------------------------
548 subroutine td_run(td, namespace, mc, gr, ions, st, ks, hm, ext_partners, outp, space, from_scratch)
549 type(td_t), intent(inout) :: td
550 type(namespace_t), intent(in) :: namespace
551 type(multicomm_t), intent(inout) :: mc
552 type(grid_t), intent(inout) :: gr
553 type(ions_t), intent(inout) :: ions
554 type(states_elec_t), intent(inout) :: st
555 type(v_ks_t), intent(inout) :: ks
556 type(hamiltonian_elec_t), intent(inout) :: hm
557 type(partner_list_t), intent(in) :: ext_partners
558 type(output_t), intent(inout) :: outp
559 type(electron_space_t), intent(in) :: space
560 logical, intent(inout) :: from_scratch
561
562 logical :: stopping
563 integer :: iter, scsteps
564 real(real64) :: etime
565
566 push_sub(td_run)
567
568 etime = loct_clock()
569 ! This is the time-propagation loop. It starts at t=0 and finishes
570 ! at td%max_iter*dt. The index i runs from 1 to td%max_iter, and
571 ! step "iter" means propagation from (iter-1)*dt to iter*dt.
572 propagation: do iter = td%iter, td%max_iter
573
574 stopping = clean_stop(mc%master_comm) .or. walltimer_alarm(mc%master_comm)
576 call profiling_in("TIME_STEP")
577
578 if (iter > 1) then
579 if (((iter-1)*td%dt <= hm%kick%time) .and. (iter*td%dt > hm%kick%time)) then
580 if (.not. hm%pcm%localf) then
581 call kick_apply(space, gr, st, td%ions_dyn, ions, hm%kick, hm%psolver, hm%kpoints)
582 else
583 call kick_apply(space, gr, st, td%ions_dyn, ions, hm%kick, hm%psolver, hm%kpoints, pcm = hm%pcm)
584 end if
585 call td_write_kick(outp, namespace, space, gr, hm%kick, ions, iter)
586 !We activate the sprial BC only after the kick,
587 !to be sure that the first iteration corresponds to the ground state
588 if (gr%der%boundaries%spiralBC) gr%der%boundaries%spiral = .true.
589 end if
590 end if
591
592 ! time iterate the system, one time step.
593 select case (td%dynamics)
594 case (ehrenfest)
595 call propagator_elec_dt(ks, namespace, space, hm, gr, st, td%tr, iter*td%dt, td%dt, iter, td%ions_dyn, &
596 ions, ext_partners, mc, outp, td%write_handler, scsteps = scsteps, &
597 update_energy = (mod(iter, td%energy_update_iter) == 0) .or. (iter == td%max_iter))
598 case (bo)
599 call propagator_elec_dt_bo(td%scf, namespace, space, gr, ks, st, hm, ions, ext_partners, mc, outp, iter, &
600 td%dt, td%ions_dyn, scsteps)
601 end select
602
603 !Apply mask absorbing boundaries
604 if (hm%abs_boundaries%abtype == mask_absorbing) then
605 if (states_are_real(st)) then
606 call dvmask(gr, hm, st)
607 else
608 call zvmask(gr, hm, st)
609 end if
610 end if
611
612 !Photoelectron stuff
613 if (td%pesv%calc_spm .or. td%pesv%calc_mask .or. td%pesv%calc_flux) then
614 call pes_calc(td%pesv, namespace, space, gr, st, td%dt, iter, gr%der, hm%kpoints, ext_partners, stopping)
615 end if
616
617 call td_write_iter(td%write_handler, namespace, space, outp, gr, st, hm, ions, ext_partners, &
618 hm%kick, ks, td%dt, iter, mc, td%recalculate_gs)
619
620 ! write down data
621 call td_check_point(td, namespace, mc, gr, ions, st, ks, hm, ext_partners, outp, space, &
622 iter, scsteps, etime, stopping, from_scratch)
623
624 ! check if debug mode should be enabled or disabled on the fly
625 call io_debug_on_the_fly(namespace)
626
627 call profiling_out("TIME_STEP")
628 if (stopping) exit
629
630 end do propagation
631
632 pop_sub(td_run)
633 end subroutine td_run
634
635 subroutine td_print_header(namespace)
636 type(namespace_t), intent(in) :: namespace
637
638 push_sub(td_print_header)
639
640 write(message(1), '(a7,1x,a14,a14,a10,a17)') 'Iter ', 'Time ', 'Energy ', 'SC Steps', 'Elapsed Time '
642 call messages_info(1, namespace=namespace)
643 call messages_print_with_emphasis(namespace=namespace)
644
645 pop_sub(td_print_header)
646 end subroutine td_print_header
647
648 ! ---------------------------------------------------------
649 subroutine td_check_point(td, namespace, mc, gr, ions, st, ks, hm, ext_partners, outp, space, &
650 iter, scsteps, etime, stopping, from_scratch)
651 type(td_t), intent(inout) :: td
652 type(namespace_t), intent(in) :: namespace
653 type(multicomm_t), intent(in) :: mc
654 type(grid_t), intent(inout) :: gr
655 type(ions_t), intent(inout) :: ions
656 type(states_elec_t), intent(inout) :: st
657 type(v_ks_t), intent(inout) :: ks
658 type(hamiltonian_elec_t), intent(inout) :: hm
659 type(partner_list_t), intent(in) :: ext_partners
660 type(output_t), intent(in) :: outp
661 type(electron_space_t), intent(in) :: space
662 integer, intent(in) :: iter
663 integer, intent(in) :: scsteps
664 real(real64), intent(inout) :: etime
665 logical, intent(in) :: stopping
666 logical, intent(inout) :: from_scratch
667
668 integer :: ierr
669
670 push_sub(td_check_point)
671
672 call td_print_message(td, namespace, ions, hm, iter, scsteps, etime)
673
674 if (outp%anything_now(iter)) then ! output
675 call td_write_output(namespace, space, gr, st, hm, ks, outp, ions, ext_partners, iter, td%dt)
676 end if
677
678 if (mod(iter, outp%restart_write_interval) == 0 .or. iter == td%max_iter .or. stopping) then ! restart
679 !if (iter == td%max_iter) outp%iter = ii - 1
680 call td_write_data(td%write_handler)
681 call td_dump(td, namespace, space, gr, st, hm, ks, ext_partners, iter, ierr)
682 if (ierr /= 0) then
683 message(1) = "Unable to write time-dependent restart information."
684 call messages_warning(1, namespace=namespace)
685 end if
686
687 call pes_output(td%pesv, namespace, space, gr, st, iter, outp, td%dt, ions)
688
689 if ((td%ions_dyn%is_active()) .and. td%recalculate_gs) then
690 call messages_print_with_emphasis(msg='Recalculating the ground state.', namespace=namespace)
691 from_scratch = .false.
693 call electrons_ground_state_run(namespace, mc, gr, ions, ext_partners, st, ks, hm, outp, space, from_scratch)
694 call states_elec_allocate_wfns(st, gr, packed=.true.)
695 call td_load(td%restart_load, namespace, space, gr, st, hm, ext_partners, td, ks, ierr)
696 if (ierr /= 0) then
697 message(1) = "Unable to load TD states."
698 call messages_fatal(1, namespace=namespace)
699 end if
700 call density_calc(st, gr, st%rho)
701 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, &
702 calc_eigenval=.true., time = iter*td%dt, calc_energy=.true.)
703 call forces_calculate(gr, namespace, ions, hm, ext_partners, st, ks, t = iter*td%dt, dt = td%dt)
704 assert(.not. td%ions_dyn%cell_relax())
705 call messages_print_with_emphasis(msg="Time-dependent simulation proceeds", namespace=namespace)
706 call td_print_header(namespace)
707 end if
708 end if
709
710 pop_sub(td_check_point)
711 end subroutine td_check_point
712
713 ! ---------------------------------------------------------
714 subroutine td_print_message(td, namespace, ions, hm, iter, scsteps, etime)
715 type(td_t), intent(inout) :: td
716 type(namespace_t), intent(in) :: namespace
717 type(ions_t), intent(inout) :: ions
718 type(hamiltonian_elec_t), intent(inout) :: hm
719 integer, intent(in) :: iter
720 integer, intent(in) :: scsteps
721 real(real64), intent(inout) :: etime
722
723 push_sub(td_print_message)
724
725 write(message(1), '(i7,1x,2f14.6,i10,f14.3)') iter, units_from_atomic(units_out%time, iter*td%dt), &
726 units_from_atomic(units_out%energy, hm%energy%total + ions%kinetic_energy), scsteps, &
727 loct_clock() - etime
728 call messages_info(1, namespace=namespace)
729 call td_update_elapsed_time(etime)
730
731 pop_sub(td_print_message)
732 end subroutine td_print_message
733
734 ! ---------------------------------------------------------
735 subroutine td_update_elapsed_time(etime)
736 real(real64), intent(inout) :: etime
737
738 push_sub(td_update_elapsed_time)
739
740 etime = loct_clock()
741
743 end subroutine td_update_elapsed_time
744
745 ! ---------------------------------------------------------
746 subroutine td_init_with_wavefunctions(td, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, outp, from_scratch)
747 type(td_t), intent(inout) :: td
748 type(namespace_t), intent(in) :: namespace
749 type(electron_space_t), intent(in) :: space
750 type(multicomm_t), intent(in) :: mc
751 type(grid_t), intent(inout) :: gr
752 type(ions_t), intent(inout) :: ions
753 type(partner_list_t), intent(in) :: ext_partners
754 type(states_elec_t), target, intent(inout) :: st
755 type(v_ks_t), intent(inout) :: ks
756 type(hamiltonian_elec_t), intent(inout) :: hm
757 type(output_t), intent(inout) :: outp
758 logical, intent(in) :: from_scratch
759
760 integer :: ierr
761 real(real64) :: x
762 real(real64) :: ndinitial(space%dim)
763 logical :: freeze_hxc, freeze_occ, freeze_u
764 type(restart_t) :: restart, restart_frozen
765 type(gauge_field_t), pointer :: gfield
766 type(lasers_t), pointer :: lasers
768
769 !We activate the sprial BC only after the kick,
770 !to be sure that the first iteration corresponds to the ground state
771 if (gr%der%boundaries%spiralBC) then
772 if ((td%iter-1)*td%dt > hm%kick%time) then
773 gr%der%boundaries%spiral = .true.
774 end if
775 hm%vnl%spin => st%spin
776 hm%phase%spin => st%spin
777 !We fill st%spin. In case of restart, we read it in td_load
778 if (from_scratch) call states_elec_fermi(st, namespace, gr)
779 end if
780
781 if (from_scratch) then
782 ! Initialize the occupation matrices and U for DFT+U
783 ! This must be called before parsing TDFreezeOccupations and TDFreezeU
784 ! in order that the code does properly the initialization.
785 call lda_u_update_occ_matrices(hm%lda_u, namespace, gr, st, hm%hm_base, hm%phase, hm%energy)
786 end if
787
788 if (td%freeze_orbitals > 0) then
789 if (from_scratch) then
790 ! In this case, we first freeze the orbitals, then calculate the Hxc potential.
791 call states_elec_freeze_orbitals(st, namespace, space, gr, mc, hm%kpoints, &
792 td%freeze_orbitals, family_is_mgga(ks%xc_family))
793 else
794 call restart_init(restart, namespace, restart_td, restart_type_load, mc, ierr, mesh=gr)
795 if (ierr == 0) then
796 call td_load_frozen(namespace, restart, space, gr, st, hm, ierr)
797 end if
798 if (ierr /= 0) then
799 td%iter = 0
800 message(1) = "Unable to read frozen restart information."
801 call messages_fatal(1, namespace=namespace)
802 end if
803 call restart_end(restart)
804 end if
805 write(message(1),'(a,i4,a,i4,a)') 'Info: The lowest', td%freeze_orbitals, &
806 ' orbitals have been frozen.', st%nst, ' will be propagated.'
807 call messages_info(1, namespace=namespace)
809 call density_calc(st, gr, st%rho)
810 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval=.true., time = td%iter*td%dt)
811 else if (td%freeze_orbitals < 0) then
812 ! This means SAE approximation. We calculate the Hxc first, then freeze all
813 ! orbitals minus one.
814 write(message(1),'(a)') 'Info: The single-active-electron approximation will be used.'
815 call messages_info(1, namespace=namespace)
816 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval=.true., time = td%iter*td%dt)
817 if (from_scratch) then
818 call states_elec_freeze_orbitals(st, namespace, space, gr, mc, hm%kpoints, st%nst-1, family_is_mgga(ks%xc_family))
819 else
820 call messages_not_implemented("TDFreezeOrbials < 0 with FromScratch=no", namespace=namespace)
821 end if
823 call v_ks_freeze_hxc(ks)
824 call density_calc(st, gr, st%rho)
825 else
826 ! Normal run.
827 call density_calc(st, gr, st%rho)
828 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval=.true., time = td%iter*td%dt)
829 end if
830
831 !%Variable TDFreezeHXC
832 !%Type logical
833 !%Default no
834 !%Section Time-Dependent
835 !%Description
836 !% The electrons are evolved as independent particles feeling the Hartree and
837 !% exchange-correlation potentials from the ground-state electronic configuration.
838 !%End
839 call parse_variable(namespace, 'TDFreezeHXC', .false., freeze_hxc)
840 if (freeze_hxc) then
841 write(message(1),'(a)') 'Info: Freezing Hartree and exchange-correlation potentials.'
842 call messages_info(1, namespace=namespace)
843
844 if (.not. from_scratch) then
845
846 call restart_init(restart_frozen, namespace, restart_gs, restart_type_load, mc, ierr, mesh=gr, exact=.true.)
847 call states_elec_load(restart_frozen, namespace, space, st, gr, hm%kpoints, ierr, label = ": gs")
848 call states_elec_transform(st, namespace, space, restart_frozen, gr, hm%kpoints)
849 call restart_end(restart_frozen)
850
851 call density_calc(st, gr, st%rho)
852 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval=.true., time = td%iter*td%dt)
853
854 call restart_init(restart_frozen, namespace, restart_td, restart_type_load, mc, ierr, mesh=gr)
855 call states_elec_load(restart_frozen, namespace, space, st, gr, hm%kpoints, ierr, iter=td%iter, label = ": td")
856 call restart_end(restart_frozen)
857 call hm%ks_pot%run_zero_iter(td%tr%vks_old)
858
859 end if
860
861 call v_ks_freeze_hxc(ks)
862
863 end if
864
865 x = minval(st%eigenval(st%st_start, :))
866 if (st%parallel_in_states) then
867 call st%mpi_grp%bcast(x, 1, mpi_double_precision, 0)
868 end if
869 call hm%update_span(gr%spacing(1:space%dim), x, namespace)
870 ! initialize Fermi energy
871 call states_elec_fermi(st, namespace, gr, compute_spin = .not. gr%der%boundaries%spiralBC)
872 call energy_calc_total(namespace, space, hm, gr, st, ext_partners)
873
874 !%Variable TDFreezeDFTUOccupations
875 !%Type logical
876 !%Default no
877 !%Section Time-Dependent
878 !%Description
879 !% The occupation matrices than enters in the DFT+U potential
880 !% are not evolved during the time evolution.
881 !%End
882 call parse_variable(namespace, 'TDFreezeDFTUOccupations', .false., freeze_occ)
883 if (freeze_occ) then
884 write(message(1),'(a)') 'Info: Freezing DFT+U occupation matrices that enters in the DFT+U potential.'
885 call messages_info(1, namespace=namespace)
886 call lda_u_freeze_occ(hm%lda_u)
887
888 !In this case we should reload GS wavefunctions
889 if (hm%lda_u_level /= dft_u_none .and. .not. from_scratch) then
890 call restart_init(restart_frozen, namespace, restart_gs, restart_type_load, mc, ierr, mesh=gr)
891 call lda_u_load(restart_frozen, hm%lda_u, st, hm%energy%dft_u, ierr, occ_only = .true.)
892 call restart_end(restart_frozen)
893 end if
894 end if
895
896 !%Variable TDFreezeU
897 !%Type logical
898 !%Default no
899 !%Section Time-Dependent
900 !%Description
901 !% The effective U of DFT+U is not evolved during the time evolution.
902 !%End
903 call parse_variable(namespace, 'TDFreezeU', .false., freeze_u)
904 if (freeze_u) then
905 write(message(1),'(a)') 'Info: Freezing the effective U of DFT+U.'
906 call messages_info(1, namespace=namespace)
907 call lda_u_freeze_u(hm%lda_u)
908
909 !In this case we should reload GS wavefunctions
910 if (hm%lda_u_level == dft_u_acbn0 .and. .not. from_scratch) then
911 call restart_init(restart_frozen, namespace, restart_gs, restart_type_load, mc, ierr, mesh=gr)
912 call lda_u_load(restart_frozen, hm%lda_u, st, hm%energy%dft_u, ierr, u_only = .true.)
913 call restart_end(restart_frozen)
914 write(message(1),'(a)') 'Loaded GS effective U of DFT+U'
915 call messages_info(1, namespace=namespace)
916 call lda_u_write_u(hm%lda_u, namespace=namespace)
917 call lda_u_write_v(hm%lda_u, namespace=namespace)
918 end if
919 end if
920
921 ! This needs to be called before the calculation of the forces,
922 ! as we need to test of we output the forces or not
923 call td_write_init(td%write_handler, namespace, space, outp, gr, st, hm, ions, ext_partners, &
924 ks, td%ions_dyn%is_active(), &
925 list_has_gauge_field(ext_partners), hm%kick, td%iter, td%max_iter, td%dt, mc)
926
927 ! Resets the nondipole integration after laser-file has been written.
928 lasers => list_get_lasers(ext_partners)
929 if(associated(lasers)) then
930 if (lasers_with_nondipole_field(lasers)) then
931 ndinitial(1:space%dim)=m_zero
932 call lasers_set_nondipole_parameters(lasers,ndinitial,m_zero)
933 end if
934 end if
935 nullify(lasers)
936
937 call td_init_ions_and_forces(td, namespace, space, gr, ions, ext_partners, st, ks, hm, outp)
938
939 if (td%scissor > m_epsilon) then
940 call scissor_init(hm%scissor, namespace, space, st, gr, hm%d, hm%kpoints, hm%phase, td%scissor, mc)
941 end if
942
943 if (td%iter == 0) call td_run_zero_iter(td, namespace, space, gr, ions, st, ks, hm, ext_partners, outp, mc)
944
945 gfield => list_get_gauge_field(ext_partners)
946 if(associated(gfield)) then
947 if (gauge_field_is_propagated(gfield)) then
948 if(ks%xc%kernel_lrc_alpha > m_epsilon) then
949 call gauge_field_get_force(gfield, gr, st%d%spin_channels, st%current, ks%xc%kernel_lrc_alpha)
950 call messages_experimental('TD-LRC kernel')
951 else
952 call gauge_field_get_force(gfield, gr, st%d%spin_channels, st%current)
953 endif
954 endif
955 end if
956
957 !call td_check_trotter(td, sys, h)
958 td%iter = td%iter + 1
959
960 call restart_init(td%restart_dump, namespace, restart_td, restart_type_dump, mc, ierr, mesh=gr)
961 if (td%ions_dyn%is_active() .and. td%recalculate_gs) then
962 ! We will also use the TD restart directory as temporary storage during the time propagation
963 call restart_init(td%restart_load, namespace, restart_td, restart_type_load, mc, ierr, mesh=gr)
964 end if
965
966 call messages_print_with_emphasis(msg="Time-Dependent Simulation", namespace=namespace)
967 call td_print_header(namespace)
968
969 if (td%pesv%calc_spm .or. td%pesv%calc_mask .and. from_scratch) then
970 call pes_init_write(td%pesv,gr,st, namespace)
971 end if
972
973 if (st%pack_states .and. hm%apply_packed()) call st%pack()
974
976 end subroutine td_init_with_wavefunctions
977
978 ! ---------------------------------------------------------
979 subroutine td_init_ions_and_forces(td, namespace, space, gr, ions, ext_partners, st, ks, hm, outp)
980 type(td_t), intent(inout) :: td
981 type(namespace_t), intent(in) :: namespace
982 type(electron_space_t), intent(in) :: space
983 type(grid_t), intent(inout) :: gr
984 type(ions_t), intent(inout) :: ions
985 type(partner_list_t), intent(in) :: ext_partners
986 type(states_elec_t), target, intent(inout) :: st
987 type(v_ks_t), intent(inout) :: ks
988 type(hamiltonian_elec_t), intent(inout) :: hm
989 type(output_t), intent(inout) :: outp
990
992
993 ! Calculate initial forces and kinetic energy
994 if (td%ions_dyn%ions_move()) then
995 if (td%iter > 0) then
996 call td_read_coordinates(td, namespace, ions)
997 if (ion_dynamics_drive_ions(td%ions_dyn)) then
998 call ion_dynamics_propagate(td%ions_dyn, ions, td%iter*td%dt, td%dt, namespace)
999 end if
1000 call hamiltonian_elec_epot_generate(hm, namespace, space, gr, ions, ext_partners, st, time = td%iter*td%dt)
1001 ! recompute potential because the ions have moved
1002 call v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval=.true., time = td%iter*td%dt)
1003 end if
1004
1005 call forces_calculate(gr, namespace, ions, hm, ext_partners, st, ks, t = td%iter*td%dt, dt = td%dt)
1006
1007 call ions%update_kinetic_energy()
1008 else
1009 if (outp%what(option__output__forces) .or. td%write_handler%out(out_separate_forces)%write) then
1010 call forces_calculate(gr, namespace, ions, hm, ext_partners, st, ks, t = td%iter*td%dt, dt = td%dt)
1011 end if
1012 end if
1013
1014 if (outp%what(option__output__stress) .or. td%ions_dyn%cell_relax()) then
1015 call stress_calculate(namespace, gr, hm, st, ions, ks, ext_partners)
1016 if (td%ions_dyn%cell_relax()) then
1017 call td%ions_dyn%update_stress(ions%space, st%stress_tensors%total, ions%latt%rlattice, ions%latt%rcell_volume)
1018 end if
1019 end if
1020
1022 end subroutine td_init_ions_and_forces
1023
1024 ! ---------------------------------------------------------
1025 subroutine td_load_restart_from_td(td, namespace, space, mc, gr, ext_partners, st, ks, hm, from_scratch)
1026 type(td_t), intent(inout) :: td
1027 type(namespace_t), intent(in) :: namespace
1028 class(space_t), intent(in) :: space
1029 type(multicomm_t), intent(in) :: mc
1030 type(grid_t), intent(inout) :: gr
1031 type(partner_list_t), intent(in) :: ext_partners
1032 type(states_elec_t), target, intent(inout) :: st
1033 type(v_ks_t), intent(inout) :: ks
1034 type(hamiltonian_elec_t), intent(inout) :: hm
1035 logical, intent(inout) :: from_scratch
1036
1037 integer :: ierr
1038 type(restart_t) :: restart
1039
1040 push_sub(td_load_restart_from_td)
1041
1042 !We redistribute the states before the restarting
1043 if (td%freeze_orbitals > 0) then
1044 call states_elec_freeze_redistribute_states(st, namespace, gr, mc, td%freeze_orbitals)
1045 end if
1046
1047 call restart_init(restart, namespace, restart_td, restart_type_load, mc, ierr, mesh=gr)
1048 if (ierr == 0) then
1049 call td_load(restart, namespace, space, gr, st, hm, ext_partners, td, ks, ierr)
1050 end if
1051 call restart_end(restart)
1052 if (ierr /= 0) then
1053 from_scratch = .true.
1054 td%iter = 0
1055 end if
1056
1058 end subroutine td_load_restart_from_td
1059
1060 ! ---------------------------------------------------------
1061 subroutine td_load_restart_from_gs(td, namespace, space, mc, gr, ext_partners, st, ks, hm)
1062 type(td_t), intent(inout) :: td
1063 type(namespace_t), intent(in) :: namespace
1064 class(space_t), intent(in) :: space
1065 type(multicomm_t), intent(in) :: mc
1066 type(grid_t), intent(inout) :: gr
1067 type(partner_list_t), intent(in) :: ext_partners
1068 type(states_elec_t), target, intent(inout) :: st
1069 type(v_ks_t), intent(inout) :: ks
1070 type(hamiltonian_elec_t), intent(inout) :: hm
1071
1072 integer :: ierr
1073 type(restart_t) :: restart
1074
1075 push_sub(td_load_restart_from_gs)
1076
1077 call restart_init(restart, namespace, restart_gs, restart_type_load, mc, ierr, mesh=gr, exact=.true.)
1078
1079 if (.not. st%only_userdef_istates) then
1080 if (ierr == 0) then
1081 call states_elec_load(restart, namespace, space, st, gr, hm%kpoints, ierr, label = ": gs")
1082 end if
1083 if (ierr /= 0) then
1084 message(1) = 'Unable to read ground-state wavefunctions.'
1085 call messages_fatal(1, namespace=namespace)
1086 end if
1087 end if
1088
1089 ! check if we should deploy user-defined wavefunctions.
1090 ! according to the settings in the input file the routine
1091 ! overwrites orbitals that were read from restart/gs
1092 if (parse_is_defined(namespace, 'UserDefinedStates')) then
1093 call states_elec_read_user_def_orbitals(gr, namespace, space, st)
1094 end if
1095
1096 call states_elec_transform(st, namespace, space, restart, gr, hm%kpoints)
1097 call restart_end(restart)
1098
1100 end subroutine td_load_restart_from_gs
1101
1102 ! ---------------------------------------------------------
1103 subroutine td_run_zero_iter(td, namespace, space, gr, ions, st, ks, hm, ext_partners, outp, mc)
1104 type(td_t), intent(inout) :: td
1105 type(namespace_t), intent(in) :: namespace
1106 type(electron_space_t), intent(in) :: space
1107 type(grid_t), intent(inout) :: gr
1108 type(ions_t), intent(inout) :: ions
1109 type(states_elec_t), intent(inout) :: st
1110 type(v_ks_t), intent(inout) :: ks
1111 type(hamiltonian_elec_t), intent(inout) :: hm
1112 type(partner_list_t), intent(in) :: ext_partners
1113 type(output_t), intent(in) :: outp
1114 type(multicomm_t), intent(in) :: mc
1115
1116 push_sub(td_run_zero_iter)
1117
1118 call td_write_iter(td%write_handler, namespace, space, outp, gr, st, hm, ions, ext_partners, &
1119 hm%kick, ks, td%dt, 0, mc, td%recalculate_gs)
1120
1121 ! I apply the delta electric field *after* td_write_iter, otherwise the
1122 ! dipole matrix elements in write_proj are wrong
1123 if (abs(hm%kick%time) <= m_epsilon) then
1124 if (.not. hm%pcm%localf) then
1125 call kick_apply(space, gr, st, td%ions_dyn, ions, hm%kick, hm%psolver, hm%kpoints)
1126 else
1127 call kick_apply(space, gr, st, td%ions_dyn, ions, hm%kick, hm%psolver, hm%kpoints, pcm = hm%pcm)
1128 end if
1129 call td_write_kick(outp, namespace, space, gr, hm%kick, ions, 0)
1130
1131 !We activate the sprial BC only after the kick
1132 if (gr%der%boundaries%spiralBC) then
1133 gr%der%boundaries%spiral = .true.
1134 end if
1135 end if
1136 call hm%ks_pot%run_zero_iter(td%tr%vks_old)
1137
1138 if (any(outp%output_interval > 0)) then
1139 call td_write_data(td%write_handler)
1140 call td_write_output(namespace, space, gr, st, hm, ks, outp, ions, ext_partners, 0)
1141 end if
1142
1143 pop_sub(td_run_zero_iter)
1144 end subroutine td_run_zero_iter
1145
1146
1147 ! ---------------------------------------------------------
1149 subroutine td_read_coordinates(td, namespace, ions)
1150 type(td_t), intent(in) :: td
1151 type(namespace_t), intent(in) :: namespace
1152 type(ions_t), intent(inout) :: ions
1153
1154 integer :: iatom, iter, iunit
1155
1156 push_sub(td_read_coordinates)
1157
1158 iunit = io_open('td.general/coordinates', namespace, action='read', status='old', die=.false.)
1159 if (iunit == -1) then
1160 message(1) = "Could not open file '"//trim(io_workpath('td.general/coordinates', namespace))//"'."
1161 message(2) = "Starting simulation from initial geometry."
1162 call messages_warning(2, namespace=namespace)
1163 pop_sub(td_read_coordinates)
1164 return
1165 end if
1166
1167 call io_skip_header(iunit)
1168 do iter = 0, td%iter - 1
1169 read(iunit, *) ! skip previous iterations... sorry, but no portable seek in Fortran
1170 end do
1171 read(iunit, '(32x)', advance='no') ! skip the time index.
1172
1173 do iatom = 1, ions%natoms
1174 read(iunit, '(3es24.16)', advance='no') ions%pos(:, iatom)
1175 ions%pos(:, iatom) = units_to_atomic(units_out%length, ions%pos(:, iatom))
1176 end do
1177 do iatom = 1, ions%natoms
1178 read(iunit, '(3es24.16)', advance='no') ions%vel(:, iatom)
1179 ions%vel(:, iatom) = units_to_atomic(units_out%velocity, ions%vel(:, iatom))
1180 end do
1181 do iatom = 1, ions%natoms
1182 read(iunit, '(3es24.16)', advance='no') ions%tot_force(:, iatom)
1183 ions%tot_force(:, iatom) = units_to_atomic(units_out%force, ions%tot_force(:, iatom))
1184 end do
1185
1186 call io_close(iunit)
1187
1188 pop_sub(td_read_coordinates)
1189 end subroutine td_read_coordinates
1190
1191 ! ---------------------------------------------------------
1192 subroutine td_dump(td, namespace, space, gr, st, hm, ks, ext_partners, iter, ierr)
1193 type(td_t), intent(in) :: td
1194 type(namespace_t), intent(in) :: namespace
1195 class(space_t), intent(in) :: space
1196 type(grid_t), intent(in) :: gr
1197 type(states_elec_t), intent(in) :: st
1198 type(hamiltonian_elec_t), intent(in) :: hm
1199 type(v_ks_t), intent(in) :: ks
1200 type(partner_list_t), intent(in) :: ext_partners
1201 integer, intent(in) :: iter
1202 integer, intent(out) :: ierr
1203
1204 type(gauge_field_t), pointer :: gfield
1205 integer :: err, err2
1206
1207 push_sub(td_dump)
1208
1209 ierr = 0
1210
1211 if (restart_skip(td%restart_dump)) then
1212 pop_sub(td_dump)
1213 return
1214 end if
1215
1216 message(1) = "Debug: Writing td restart."
1217 call messages_info(1, namespace=namespace, debug_only=.true.)
1218
1219 ! first write resume file
1220 call states_elec_dump(td%restart_dump, space, st, gr, hm%kpoints, err, iter=iter)
1221 if (err /= 0) ierr = ierr + 1
1222
1223 call states_elec_dump_rho(td%restart_dump, space, st, gr, ierr, iter=iter)
1224 if (err /= 0) ierr = ierr + 1
1225
1226 if (hm%lda_u_level /= dft_u_none) then
1227 call lda_u_dump(td%restart_dump, namespace, hm%lda_u, st, gr, ierr)
1228 if (err /= 0) ierr = ierr + 1
1229 end if
1230
1231 call potential_interpolation_dump(td%tr%vks_old, space, td%restart_dump, gr, st%d%nspin, err2)
1232 if (err2 /= 0) ierr = ierr + 2
1233
1234 call pes_dump(td%pesv, namespace, td%restart_dump, st, gr, err)
1235 if (err /= 0) ierr = ierr + 4
1236
1237 ! Gauge field restart
1238 gfield => list_get_gauge_field(ext_partners)
1239 if(associated(gfield)) then
1240 call gauge_field_dump(td%restart_dump, gfield, ierr)
1241 end if
1243 if (gr%der%boundaries%spiralBC) then
1244 call states_elec_dump_spin(td%restart_dump, st, err)
1245 if (err /= 0) ierr = ierr + 8
1246 end if
1247
1248 if (ks%has_photons) then
1249 call mf_photons_dump(td%restart_dump, ks%pt_mx, gr, td%dt, ks%pt, err)
1250 if (err /= 0) ierr = ierr + 16
1251 end if
1252
1253 if (ks%xc_photon /= 0) then
1254 ! photon-free mean field
1255 call ks%xc_photons%mf_dump(td%restart_dump, err)
1256 if (err /= 0) ierr = ierr + 32
1257 end if
1258
1259 if (allocated(st%frozen_rho)) then
1260 call states_elec_dump_frozen(td%restart_dump, space, st, gr, ierr)
1261 end if
1262 if (err /= 0) ierr = ierr + 64
1263
1264 if (td%ions_dyn%ions_move() .or. td%ions_dyn%cell_relax()) then
1265 call ion_dynamics_dump(td%ions_dyn, td%restart_dump, err)
1266 end if
1267 if (err /= 0) ierr = ierr + 128
1268
1269 message(1) = "Debug: Writing td restart done."
1270 call messages_info(1, namespace=namespace, debug_only=.true.)
1271
1272 pop_sub(td_dump)
1273 end subroutine td_dump
1274
1275 ! ---------------------------------------------------------
1276 subroutine td_load(restart, namespace, space, gr, st, hm, ext_partners, td, ks, ierr)
1277 type(restart_t), intent(in) :: restart
1278 type(namespace_t), intent(in) :: namespace
1279 class(space_t), intent(in) :: space
1280 type(grid_t), intent(in) :: gr
1281 type(states_elec_t), intent(inout) :: st
1282 type(hamiltonian_elec_t), intent(inout) :: hm
1283 type(partner_list_t), intent(in) :: ext_partners
1284 type(td_t), intent(inout) :: td
1285 type(v_ks_t), intent(inout) :: ks
1286 integer, intent(out) :: ierr
1287
1288 integer :: err, err2
1289 type(gauge_field_t), pointer :: gfield
1290 push_sub(td_load)
1291
1292 ierr = 0
1293
1294 if (restart_skip(restart)) then
1295 ierr = -1
1296 pop_sub(td_load)
1297 return
1298 end if
1299
1300 message(1) = "Debug: Reading td restart."
1301 call messages_info(1, namespace=namespace, debug_only=.true.)
1302
1303 ! Read states
1304 call states_elec_load(restart, namespace, space, st, gr, hm%kpoints, err, iter=td%iter, label = ": td")
1305 if (err /= 0) then
1306 ierr = ierr + 1
1307 end if
1308
1309 ! read potential from previous interactions
1310 call potential_interpolation_load(td%tr%vks_old, namespace, space, restart, gr, st%d%nspin, err2)
1311 if (err2 /= 0) ierr = ierr + 2
1312
1313 if (hm%lda_u_level /= dft_u_none) then
1314 call lda_u_load(restart, hm%lda_u, st, hm%energy%dft_u, ierr)
1315 if (err /= 0) ierr = ierr + 1
1316 end if
1317
1318
1319 ! read PES restart
1320 if (td%pesv%calc_spm .or. td%pesv%calc_mask .or. td%pesv%calc_flux) then
1321 call pes_load(td%pesv, namespace, restart, st, err)
1322 if (err /= 0) ierr = ierr + 4
1323 end if
1324
1325 ! Gauge field restart
1326 gfield => list_get_gauge_field(ext_partners)
1327 if (associated(gfield)) then
1328 call gauge_field_load(restart, gfield, err)
1329 if (err /= 0) then
1330 ierr = ierr + 8
1331 else
1332 call hm%update(gr, namespace, space, ext_partners, time = td%dt*td%iter)
1333 end if
1334 end if
1335
1336 ! add photon restart
1337 if (ks%has_photons) then
1338 call mf_photons_load(restart, ks%pt_mx, gr, err)
1339 end if
1340 if (err /= 0) ierr = ierr + 16
1341
1342 if (ks%xc_photon /= 0) then
1343 call ks%xc_photons%mf_load(restart, space, err)
1344 end if
1345 if (err /= 0) ierr = ierr + 32
1346
1347 if (gr%der%boundaries%spiralBC) then
1348 call states_elec_load_spin(restart, st, err)
1349 !To ensure back compatibility, if the file is not present, we use the
1350 !current states to get the spins
1351 if (err /= 0) call states_elec_fermi(st, namespace, gr)
1352 end if
1353
1354 if (td%ions_dyn%is_active()) then
1355 call ion_dynamics_load(td%ions_dyn, restart, err)
1356 end if
1357 if (err /= 0) ierr = ierr + 64
1358
1359 message(1) = "Debug: Reading td restart done."
1360 call messages_info(1, namespace=namespace, debug_only=.true.)
1361
1362 pop_sub(td_load)
1363 end subroutine td_load
1364
1365 ! ---------------------------------------------------------
1366 subroutine td_load_frozen(namespace, restart, space, mesh, st, hm, ierr)
1367 type(namespace_t), intent(in) :: namespace
1368 type(restart_t), intent(in) :: restart
1369 class(space_t), intent(in) :: space
1370 class(mesh_t), intent(in) :: mesh
1371 type(states_elec_t), intent(inout) :: st
1372 type(hamiltonian_elec_t), intent(inout) :: hm
1373 integer, intent(out) :: ierr
1374
1375 push_sub(td_load_frozen)
1376
1377 ierr = 0
1378
1379 if (restart_skip(restart)) then
1380 ierr = -1
1381 pop_sub(td_load_frozen)
1382 return
1383 end if
1384
1385 message(1) = "Debug: Reading td frozen restart."
1386 call messages_info(1, namespace=namespace, debug_only=.true.)
1387
1388 safe_allocate(st%frozen_rho(1:mesh%np, 1:st%d%nspin))
1389 if (family_is_mgga(hm%xc%family)) then
1390 safe_allocate(st%frozen_tau(1:mesh%np, 1:st%d%nspin))
1391 safe_allocate(st%frozen_gdens(1:mesh%np, 1:space%dim, 1:st%d%nspin))
1392 safe_allocate(st%frozen_ldens(1:mesh%np, 1:st%d%nspin))
1393 end if
1394
1395 call states_elec_load_frozen(restart, space, st, mesh, ierr)
1396
1397 message(1) = "Debug: Reading td frozen restart done."
1398 call messages_info(1, namespace=namespace, debug_only=.true.)
1399
1400 pop_sub(td_load_frozen)
1401 end subroutine td_load_frozen
1402
1403 ! ---------------------------------------------------------
1404 logical function td_get_from_scratch(td)
1405 type(td_t), intent(in) :: td
1406
1407 push_sub(td_get_from_scratch)
1408
1409 td_get_from_scratch = td%from_scratch
1410
1411 pop_sub(td_get_from_scratch)
1412 end function td_get_from_scratch
1413
1414 ! ---------------------------------------------------------
1415 subroutine td_set_from_scratch(td, from_scratch)
1416 type(td_t), intent(inout) :: td
1417 logical, intent(in) :: from_scratch
1418
1419 push_sub(td_set_from_scratch)
1420
1421 td%from_scratch = from_scratch
1422
1423 pop_sub(td_set_from_scratch)
1424 end subroutine td_set_from_scratch
1425end module td_oct_m
1426
1427!! Local Variables:
1428!! mode: f90
1429!! coding: utf-8
1430!! End:
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
Definition: messages.F90:180
integer, parameter, public mask_absorbing
Module implementing boundary conditions in Octopus.
Definition: boundaries.F90:122
This module handles the calculation mode.
type(calc_mode_par_t), public calc_mode_par
Singleton instance of parallel calculation mode.
integer, parameter, public p_strategy_states
parallelization in states
This module implements a calculator for the density and defines related functions.
Definition: density.F90:120
subroutine, public states_elec_freeze_adjust_qtot(st)
Definition: density.F90:812
subroutine, public states_elec_freeze_redistribute_states(st, namespace, mesh, mc, nn)
Definition: density.F90:784
subroutine, public states_elec_freeze_orbitals(st, namespace, space, gr, mc, kpoints, n, family_is_mgga)
Calculate partial density for frozen orbitals.
Definition: density.F90:653
subroutine, public density_calc(st, gr, density, istin)
Computes the density from the orbitals in st.
Definition: density.F90:610
subroutine, public electrons_ground_state_run(namespace, mc, gr, ions, ext_partners, st, ks, hm, outp, space, fromScratch)
subroutine, public energy_calc_total(namespace, space, hm, gr, st, ext_partners, iunit, full)
This subroutine calculates the total energy of the system. Basically, it adds up the KS eigenvalues,...
integer, parameter, public spin_orbit
Definition: epot.F90:166
logical function, public list_has_gauge_field(partners)
type(gauge_field_t) function, pointer, public list_get_gauge_field(partners)
type(lasers_t) function, pointer, public list_get_lasers(partners)
subroutine, public forces_calculate(gr, namespace, ions, hm, ext_partners, st, ks, vhxc_old, t, dt)
Definition: forces.F90:339
subroutine, public gauge_field_load(restart, gfield, ierr)
subroutine, public gauge_field_get_force(this, gr, spin_channels, current, lrc_alpha)
subroutine, public gauge_field_dump(restart, gfield, ierr)
logical pure function, public gauge_field_is_propagated(this)
logical pure function, public gauge_field_is_used(this)
subroutine, public gauge_field_init_vec_pot(this, qtot)
real(real64), parameter, public m_zero
Definition: global.F90:188
real(real64), parameter, public m_epsilon
Definition: global.F90:204
real(real64), parameter, public m_one
Definition: global.F90:189
This module implements the underlying real-space grid.
Definition: grid.F90:117
subroutine, public zvmask(mesh, hm, st)
subroutine, public hamiltonian_elec_epot_generate(this, namespace, space, gr, ions, ext_partners, st, time)
subroutine, public dvmask(mesh, hm, st)
This module defines classes and functions for interaction partners.
Definition: io.F90:114
subroutine, public io_close(iunit, grp)
Definition: io.F90:418
subroutine, public io_skip_header(iunit)
Definition: io.F90:597
character(len=max_path_len) function, public io_workpath(path, namespace)
Definition: io.F90:270
subroutine, public io_debug_on_the_fly(namespace)
check if debug mode should be enabled or disabled on the fly
Definition: io.F90:486
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
Definition: io.F90:352
subroutine, public ion_dynamics_dump(this, restart, ierr)
subroutine, public ion_dynamics_propagate(this, ions, time, dt, namespace)
Interface for the ion/cell dynamics.
subroutine, public ion_dynamics_load(this, restart, ierr)
subroutine, public ion_dynamics_init(this, namespace, ions, symmetrize, symm)
subroutine, public ion_dynamics_end(this)
logical pure function, public ion_dynamics_drive_ions(this)
Is the ion dynamics activated or not.
subroutine, public kick_apply(space, mesh, st, ions_dyn, ions, kick, psolver, kpoints, pcm)
Applies the delta-function electric field where k = kick%delta_strength.
Definition: kick.F90:1135
subroutine, public lasers_set_nondipole_parameters(this, ndfield, nd_integration_time)
Set parameters for nondipole SFA calculation.
Definition: lasers.F90:752
logical function, public lasers_with_nondipole_field(lasers)
Check if a nondipole SFA correction should be computed for the given laser.
Definition: lasers.F90:739
subroutine, public laser_write_info(lasers, namespace, dt, max_iter, iunit)
Definition: lasers.F90:930
subroutine, public lda_u_dump(restart, namespace, this, st, mesh, ierr)
Definition: lda_u_io.F90:646
subroutine, public lda_u_write_u(this, iunit, namespace)
Definition: lda_u_io.F90:530
subroutine, public lda_u_load(restart, this, st, dftu_energy, ierr, occ_only, u_only)
Definition: lda_u_io.F90:727
subroutine, public lda_u_write_v(this, iunit, namespace)
Definition: lda_u_io.F90:579
integer, parameter, public dft_u_none
Definition: lda_u.F90:201
subroutine, public lda_u_freeze_occ(this)
Definition: lda_u.F90:888
subroutine, public lda_u_freeze_u(this)
Definition: lda_u.F90:895
subroutine, public lda_u_end(this)
Definition: lda_u.F90:655
subroutine, public lda_u_init(this, namespace, space, level, gr, ions, st, mc, kpoints, has_phase)
Definition: lda_u.F90:282
integer, parameter, public dft_u_acbn0
Definition: lda_u.F90:201
subroutine, public lda_u_update_occ_matrices(this, namespace, mesh, st, hm_base, phase, energy)
Definition: lda_u.F90:798
This module implements fully polymorphic linked lists, and some specializations thereof.
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:118
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
Definition: messages.F90:920
subroutine, public messages_not_implemented(feature, namespace)
Definition: messages.F90:1113
character(len=512), private msg
Definition: messages.F90:165
subroutine, public messages_warning(no_lines, all_nodes, namespace)
Definition: messages.F90:537
subroutine, public messages_obsolete_variable(namespace, name, rep)
Definition: messages.F90:1045
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:160
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:414
subroutine, public messages_input_error(namespace, var, details, row, column)
Definition: messages.F90:713
subroutine, public messages_experimental(name, namespace)
Definition: messages.F90:1085
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:616
logical function mpi_grp_is_root(grp)
Is the current MPI process of grpcomm, root.
Definition: mpi.F90:409
type(mpi_grp_t), public mpi_world
Definition: mpi.F90:270
This module handles the communicators for the various parallelization strategies.
Definition: multicomm.F90:145
this module contains the low-level part of the output system
Definition: output_low.F90:115
this module contains the output system
Definition: output.F90:115
logical function, public parse_is_defined(namespace, name)
Definition: parser.F90:502
subroutine, public pes_calc(pes, namespace, space, mesh, st, dt, iter, der, kpoints, ext_partners, stopping)
Definition: pes.F90:269
subroutine, public pes_init(pes, namespace, space, mesh, box, st, save_iter, kpoints, abs_boundaries, ext_partners, max_iter, dt)
Definition: pes.F90:175
subroutine, public pes_output(pes, namespace, space, gr, st, iter, outp, dt, ions)
Definition: pes.F90:295
subroutine, public pes_init_write(pes, mesh, st, namespace)
Definition: pes.F90:399
subroutine, public pes_end(pes)
Definition: pes.F90:255
subroutine, public pes_load(pes, namespace, restart, st, ierr)
Definition: pes.F90:359
subroutine, public pes_dump(pes, namespace, restart, st, mesh, ierr)
Definition: pes.F90:319
subroutine, public mf_photons_load(restart, this, gr, ierr)
subroutine, public mf_photons_dump(restart, this, gr, dt, pt_mode, ierr)
subroutine, public potential_interpolation_load(potential_interpolation, namespace, space, restart, mesh, nspin, err2)
subroutine, public potential_interpolation_dump(potential_interpolation, space, restart, mesh, nspin, err2)
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
Definition: profiling.F90:623
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
Definition: profiling.F90:552
subroutine, public propagator_elec_dt_bo(scf, namespace, space, gr, ks, st, hm, ions, ext_partners, mc, outp, iter, dt, ions_dyn, scsteps)
subroutine, public propagator_elec_init(gr, namespace, st, tr, ks_pot, have_fields, family_is_mgga_with_exc, relax_cell)
subroutine, public propagator_elec_dt(ks, namespace, space, hm, gr, st, tr, time, dt, nt, ions_dyn, ions, ext_partners, mc, outp, write_handler, scsteps, update_energy, qcchi)
Propagates st from time - dt to t. If dt<0, it propagates backwards from t+|dt| to t.
subroutine, public propagator_elec_end(tr)
This module implements the basic propagator framework.
Definition: propagator.F90:117
logical function, public clean_stop(comm)
returns true if a file named stop exists
Definition: restart.F90:277
integer, parameter, public restart_gs
Definition: restart.F90:200
subroutine, public restart_init(restart, namespace, data_type, type, mc, ierr, mesh, dir, exact)
Initializes a restart object.
Definition: restart.F90:517
integer, parameter, public restart_type_dump
Definition: restart.F90:246
logical pure function, public restart_skip(restart)
Returns true if the restart information should neither be read nor written. This might happen because...
Definition: restart.F90:970
integer, parameter, public restart_td
Definition: restart.F90:200
integer, parameter, public restart_type_load
Definition: restart.F90:246
subroutine, public restart_end(restart)
Definition: restart.F90:723
subroutine, public scf_init(scf, namespace, gr, ions, st, mc, hm, space)
Definition: scf.F90:253
subroutine, public scf_end(scf)
Definition: scf.F90:546
subroutine, public scissor_init(this, namespace, space, st, mesh, d, kpoints, phase, gap, mc)
Definition: scissor.F90:162
pure logical function, public states_are_real(st)
subroutine, public states_elec_fermi(st, namespace, mesh, compute_spin)
calculate the Fermi level for the states in this object
subroutine, public states_elec_deallocate_wfns(st)
Deallocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_allocate_wfns(st, mesh, wfs_type, skip, packed)
Allocates the KS wavefunctions defined within a states_elec_t structure.
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_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_dump_rho(restart, space, st, mesh, ierr, iter)
subroutine, public states_elec_dump_spin(restart, st, ierr)
This module implements the calculation of the stress tensor.
Definition: stress.F90:118
subroutine, public stress_calculate(namespace, gr, hm, st, ions, ks, ext_partners)
This computes the total stress on the lattice.
Definition: stress.F90:186
Definition: td.F90:114
subroutine, public td_check_point(td, namespace, mc, gr, ions, st, ks, hm, ext_partners, outp, space, iter, scsteps, etime, stopping, from_scratch)
Definition: td.F90:744
subroutine, public td_end(td)
Definition: td.F90:607
subroutine, public td_load_restart_from_gs(td, namespace, space, mc, gr, ext_partners, st, ks, hm)
Definition: td.F90:1155
subroutine td_print_message(td, namespace, ions, hm, iter, scsteps, etime)
Definition: td.F90:808
subroutine, public td_run_init()
Definition: td.F90:236
subroutine, public td_end_run(td, st, hm)
Definition: td.F90:622
subroutine, public td_init(td, namespace, space, gr, ions, st, ks, hm, ext_partners, outp)
Definition: td.F90:247
subroutine, public td_allocate_wavefunctions(td, namespace, mc, gr, ions, st, hm, space)
Definition: td.F90:542
logical function, public td_get_from_scratch(td)
Definition: td.F90:1498
subroutine td_load_frozen(namespace, restart, space, mesh, st, hm, ierr)
Definition: td.F90:1460
subroutine td_print_header(namespace)
Definition: td.F90:729
integer, parameter, public bo
Definition: td.F90:201
subroutine td_load(restart, namespace, space, gr, st, hm, ext_partners, td, ks, ierr)
Definition: td.F90:1370
subroutine, public td_set_from_scratch(td, from_scratch)
Definition: td.F90:1509
subroutine, public td_dump(td, namespace, space, gr, st, hm, ks, ext_partners, iter, ierr)
Definition: td.F90:1286
subroutine td_read_coordinates(td, namespace, ions)
reads the pos and vel from coordinates file
Definition: td.F90:1243
subroutine, public td_run(td, namespace, mc, gr, ions, st, ks, hm, ext_partners, outp, space, from_scratch)
Definition: td.F90:642
subroutine td_run_zero_iter(td, namespace, space, gr, ions, st, ks, hm, ext_partners, outp, mc)
Definition: td.F90:1197
subroutine, public td_init_gaugefield(td, namespace, gr, st, ks, hm, ext_partners, space)
Definition: td.F90:576
subroutine td_update_elapsed_time(etime)
Definition: td.F90:829
subroutine, public td_init_with_wavefunctions(td, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, outp, from_scratch)
Definition: td.F90:840
subroutine, public td_load_restart_from_td(td, namespace, space, mc, gr, ext_partners, st, ks, hm, from_scratch)
Definition: td.F90:1119
subroutine td_init_ions_and_forces(td, namespace, space, gr, ions, ext_partners, st, ks, hm, outp)
Definition: td.F90:1073
subroutine, public td_init_run(td, namespace, mc, gr, ions, st, ks, hm, ext_partners, outp, space, from_scratch)
Definition: td.F90:490
subroutine, public td_write_output(namespace, space, gr, st, hm, ks, outp, ions, ext_partners, iter, dt)
Definition: td_write.F90:1237
subroutine, public td_write_data(writ)
Definition: td_write.F90:1203
subroutine, public td_write_kick(outp, namespace, space, mesh, kick, ions, iter)
Definition: td_write.F90:335
subroutine, public td_write_end(writ)
Definition: td_write.F90:987
subroutine, public td_write_iter(writ, namespace, space, outp, gr, st, hm, ions, ext_partners, kick, ks, dt, iter, mc, recalculate_gs)
Definition: td_write.F90:1034
subroutine, public td_write_init(writ, namespace, space, outp, gr, st, hm, ions, ext_partners, ks, ions_move, with_gauge_field, kick, iter, max_iter, dt, mc)
Initialize files to write when prograting in time.
Definition: td_write.F90:373
integer, parameter, public out_separate_forces
Definition: td_write.F90:201
type(type_t), public type_cmplx
Definition: types.F90:134
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
Definition: unit.F90:132
This module defines the unit system, used for input and output.
type(unit_system_t), public units_out
type(unit_system_t), public units_inp
the units systems for reading and writing
subroutine, public v_ks_freeze_hxc(ks)
Definition: v_ks.F90:1448
subroutine, public v_ks_calculate_current(this, calc_cur)
Definition: v_ks.F90:1459
subroutine, public v_ks_calc(ks, namespace, space, hm, st, ions, ext_partners, calc_eigenval, time, calc_energy, calc_current, force_semilocal)
Definition: v_ks.F90:738
This module provices a simple timer class which can be used to trigger the writing of a restart file ...
Definition: walltimer.F90:121
logical function, public walltimer_alarm(comm, print)
indicate whether time is up
Definition: walltimer.F90:303
Definition: xc.F90:114
pure logical function, public family_is_mgga(family, only_collinear)
Is the xc function part of the mGGA family.
Definition: xc.F90:571
logical pure function, public family_is_mgga_with_exc(xcs)
Is the xc function part of the mGGA family with an energy functional.
Definition: xc.F90:584
Extension of space that contains the knowledge of the spin dimension.
Description of the grid, containing information on derivatives, stencil, and symmetries.
Definition: grid.F90:169
Describes mesh distribution to nodes.
Definition: mesh.F90:186
Stores all communicators and groups.
Definition: multicomm.F90:206
output handler class
Definition: output_low.F90:164
The states_elec_t class contains all electronic wave functions.
int true(void)