Octopus
electrons.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!! Copyright (C) 2009 X. Andrade
3!! Copyright (C) 2020 M. Oliveira
4!!
5!! This program is free software; you can redistribute it and/or modify
6!! it under the terms of the GNU General Public License as published by
7!! the Free Software Foundation; either version 2, or (at your option)
8!! any later version.
9!!
10!! This program is distributed in the hope that it will be useful,
11!! but WITHOUT ANY WARRANTY; without even the implied warranty of
12!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13!! GNU General Public License for more details.
14!!
15!! You should have received a copy of the GNU General Public License
16!! along with this program; if not, write to the Free Software
17!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18!! 02110-1301, USA.
19!!
20
21#include "global.h"
22
23
24module electrons_oct_m
25 use accel_oct_m
33 use debug_oct_m
35 use dipole_oct_m
37 use elf_oct_m
41 use forces_oct_m
43 use global_oct_m
44 use grid_oct_m
52 use ions_oct_m
53 use kick_oct_m
57 use lasers_oct_m
58 use lda_u_oct_m
59 use loct_oct_m
60 use mesh_oct_m
63 use mpi_oct_m
70 use output_oct_m
72 use parser_oct_m
73 use pes_oct_m
90 use scf_oct_m
91 use space_oct_m
95 use stress_oct_m
96 use sort_oct_m
97 use system_oct_m
98 use td_oct_m
101 use v_ks_oct_m
102 use xc_oct_m
103 use xc_f03_lib_m
104 use xc_oep_oct_m
108
109 implicit none
110
111 private
112 public :: &
114
115
121 type, extends(system_t) :: electrons_t
122 ! Components are public by default
123 type(electron_space_t) :: space
124 class(ions_t), pointer :: ions => null()
125 type(photons_t), pointer :: photons => null()
126 type(grid_t) :: gr
127 type(states_elec_t) :: st
128 type(v_ks_t) :: ks
129 type(output_t) :: outp
130 type(multicomm_t) :: mc
131 type(hamiltonian_elec_t) :: hm
132 type(td_t) :: td
133 type(current_t) :: current_calculator
134 type(dipole_t) :: dipole
135 type(scf_t) :: scf
136
137 type(kpoints_t) :: kpoints
138
139 logical :: generate_epot
140
141 type(states_elec_t) :: st_copy
142
143 ! At the moment this is not treated as an external potential
144 class(lasers_t), pointer :: lasers => null()
145 class(gauge_field_t), pointer :: gfield => null()
146
147 ! List with all the external partners
148 ! This will become a list of interactions in the future
149 type(partner_list_t) :: ext_partners
150
151 !TODO: have a list of self interactions
152 type(xc_interaction_t), pointer :: xc_interaction => null()
153
154 logical :: ions_propagated = .false.
155 contains
156 procedure :: init_interaction => electrons_init_interaction
157 procedure :: init_parallelization => electrons_init_parallelization
158 procedure :: init_algorithm => electrons_init_algorithm
159 procedure :: initial_conditions => electrons_initial_conditions
160 procedure :: do_algorithmic_operation => electrons_do_algorithmic_operation
161 procedure :: is_tolerance_reached => electrons_is_tolerance_reached
162 procedure :: update_quantity => electrons_update_quantity
163 procedure :: init_interaction_as_partner => electrons_init_interaction_as_partner
164 procedure :: copy_quantities_to_interaction => electrons_copy_quantities_to_interaction
165 procedure :: output_start => electrons_output_start
166 procedure :: output_write => electrons_output_write
167 procedure :: output_finish => electrons_output_finish
168 procedure :: process_is_slave => electrons_process_is_slave
169 procedure :: restart_write_data => electrons_restart_write_data
170 procedure :: restart_read_data => electrons_restart_read_data
171 procedure :: update_kinetic_energy => electrons_update_kinetic_energy
172 procedure :: propagation_start => electrons_propagation_start
173 final :: electrons_finalize
174 end type electrons_t
175
176 interface electrons_t
177 procedure electrons_constructor
178 end interface electrons_t
179
180contains
181
182 !----------------------------------------------------------
183 function electrons_constructor(namespace, generate_epot) result(sys)
184 class(electrons_t), pointer :: sys
185 type(namespace_t), intent(in) :: namespace
186 logical, optional, intent(in) :: generate_epot
187
188 integer :: iatom
189 type(lattice_vectors_t) :: latt_inp
190 logical :: has_photons
191
192 push_sub_with_profile(electrons_constructor)
193
194 allocate(sys)
195
196 sys%namespace = namespace
197
198 call messages_obsolete_variable(sys%namespace, 'SystemName')
199
200 sys%space = electron_space_t(sys%namespace)
201 call sys%space%write_info(sys%namespace)
202 if (sys%space%has_mixed_periodicity()) then
203 call messages_experimental('Support for mixed periodicity systems')
204 end if
205
206 sys%ions => ions_t(sys%namespace, latt_inp=latt_inp)
207
208 call grid_init_stage_1(sys%gr, sys%namespace, sys%space, sys%ions%symm, latt_inp, sys%ions%natoms, sys%ions%pos)
209
210 if (sys%space%is_periodic()) then
211 call sys%ions%latt%write_info(sys%namespace)
212 end if
213
214 ! Sanity check for atomic coordinates
215 do iatom = 1, sys%ions%natoms
216 if (.not. sys%gr%box%contains_point(sys%ions%pos(:, iatom))) then
217 if (sys%space%periodic_dim /= sys%space%dim) then
218 ! FIXME: This could fail for partial periodicity systems
219 ! because contains_point is too strict with atoms close to
220 ! the upper boundary to the cell.
221 write(message(1), '(a,i5,a)') "Atom ", iatom, " is outside the box."
222 call messages_warning(1, namespace=sys%namespace)
223 end if
224 end if
225 end do
227 ! we need k-points for periodic systems
228 call kpoints_init(sys%kpoints, sys%namespace, sys%gr%symm, sys%space%dim, sys%space%periodic_dim, sys%ions%latt)
229
230 call states_elec_init(sys%st, sys%namespace, sys%space, sys%ions%val_charge(), sys%kpoints)
231 call sys%st%write_info(sys%namespace)
232 ! if independent particles in N dimensions are being used, need to initialize them
233 ! after masses are set to 1 in grid_init_stage_1 -> derivatives_init
234 call modelmb_copy_masses (sys%st%modelmbparticles, sys%gr%der%masses)
235 call elf_init(sys%namespace)
236
237 sys%generate_epot = optional_default(generate_epot, .true.)
239 call sys%dipole%init(sys%space)
240
241 sys%supported_interactions_as_partner = [current_to_mxll_field]
242 sys%quantities(current)%updated_on_demand = .true.
243 sys%quantities(dipole)%updated_on_demand = .true.
244 call current_init(sys%current_calculator, sys%namespace)
246 !%Variable EnablePhotons
247 !%Type logical
248 !%Default no
249 !%Section Hamiltonian
250 !%Description
251 !% This variable can be used to enable photons in several types of calculations.
252 !% It can be used to activate the one-photon OEP formalism.
253 !% In the case of CalculationMode = casida, it enables photon modes as
254 !% described in ACS Photonics 2019, 6, 11, 2757-2778.
255 !% Finally, if set to yes when solving the ferquency-dependent Sternheimer
256 !% equation, the photons are coupled to the electronic subsystem.
257 !%End
258 call messages_obsolete_variable(namespace, 'OEPPtX', 'EnablePhotons')
259 call parse_variable(namespace, 'EnablePhotons', .false., has_photons)
260 if (has_photons) then
261 call messages_experimental("EnablePhotons = yes")
262 sys%photons => photons_t(sys%namespace)
263 else
264 nullify(sys%photons)
265 end if
267 pop_sub_with_profile(electrons_constructor)
268 end function electrons_constructor
269
270 ! ---------------------------------------------------------
271 subroutine electrons_init_interaction(this, interaction)
272 class(electrons_t), target, intent(inout) :: this
273 class(interaction_t), intent(inout) :: interaction
274
275 real(real64) :: dmin
276 integer :: rankmin, depth
277 logical :: mxll_interaction_present = .false.
278 logical :: calc_dipole
279
280 push_sub(electrons_init_interactions)
281
282 select type (interaction)
284 call interaction%init(this%gr, 3)
285 mxll_interaction_present = .true.
286 interaction%type = mxll_field_trans
288 call interaction%init(this%gr, 3)
289 mxll_interaction_present = .true.
291 call interaction%init(this%gr, 3)
292 mxll_interaction_present = .true.
293 class default
294 message(1) = "Trying to initialize an unsupported interaction by the electrons."
295 call messages_fatal(1, namespace=this%namespace)
296 end select
297
298 if (mxll_interaction_present) then
299 calc_dipole = any(this%hm%mxll%coupling_mode == &
301
302 if (calc_dipole) then
303 assert(this%space%periodic_dim == 0)
304 this%hm%mxll%calc_field_dip = .true.
305 this%hm%mxll%center_of_mass(1:3) = this%ions%center_of_mass()
306 this%hm%mxll%center_of_mass_ip = mesh_nearest_point(this%gr, this%hm%mxll%center_of_mass, dmin, rankmin)
307 this%hm%mxll%center_of_mass_rankmin = rankmin
308 end if
309 end if
310
311 ! set interpolation depth for field-transfer interactions
312 select type (interaction)
313 class is (field_transfer_t)
314 ! interpolation depth depends on the propagator
315 select type (algo => this%algo)
316 type is (propagator_exp_mid_t)
317 depth = 3
318 type is (propagator_aetrs_t)
319 depth = 3
320 type is (propagator_bomd_t)
321 depth = 1
322 class default
323 message(1) = "The chosen propagator does not yet support interaction interpolation"
324 call messages_fatal(1, namespace=this%namespace)
325 end select
326
327 call interaction%init_interpolation(depth, interaction%label)
328 end select
329
330 pop_sub(electrons_init_interactions)
331 end subroutine electrons_init_interaction
332
333 ! ---------------------------------------------------------
334 subroutine electrons_init_parallelization(this, grp)
335 class(electrons_t), intent(inout) :: this
336 type(mpi_grp_t), intent(in) :: grp
337
338 integer(int64) :: index_range(4)
339 real(real64) :: mesh_global, mesh_local, wfns
340 integer :: idir
341 real(real64) :: spiral_q(3), spiral_q_red(3)
342 type(block_t) :: blk
343
345
346 call mpi_grp_copy(this%grp, grp)
347
348 ! store the ranges for these two indices (serves as initial guess
349 ! for parallelization strategy)
350 index_range(1) = this%gr%np_global ! Number of points in mesh
351 index_range(2) = this%st%nst ! Number of states
352 index_range(3) = this%st%nik ! Number of k-points
353 index_range(4) = 100000 ! Some large number
354
355 ! create index and domain communicators
356 call multicomm_init(this%mc, this%namespace, this%grp, calc_mode_par, &
357 mpi_world%size, index_range, (/ 5000, 1, 1, 1 /))
358
359 call this%ions%partition(this%mc)
360 call kpoints_distribute(this%st, this%mc)
361 call states_elec_distribute_nodes(this%st, this%namespace, this%mc)
362
363
364 if (parse_is_defined(this%namespace, 'TDMomentumTransfer') .or. &
365 parse_is_defined(this%namespace, 'TDReducedMomentumTransfer')) then
366 if (parse_block(this%namespace, 'TDMomentumTransfer', blk) == 0) then
367 do idir = 1, this%space%dim
368 call parse_block_float(blk, 0, idir - 1, spiral_q(idir))
369 end do
370 else if(parse_block(this%namespace, 'TDReducedMomentumTransfer', blk) == 0) then
371 do idir = 1, this%space%dim
372 call parse_block_float(blk, 0, idir - 1, spiral_q_red(idir))
373 end do
374 call kpoints_to_absolute(this%kpoints%latt, spiral_q_red(1:this%space%dim), spiral_q(1:this%space%dim))
375 end if
376 call parse_block_end(blk)
377 call grid_init_stage_2(this%gr, this%namespace, this%space, this%mc, spiral_q)
378 else
379 call grid_init_stage_2(this%gr, this%namespace, this%space, this%mc)
380 end if
381
382 if (this%st%symmetrize_density) then
383 call mesh_check_symmetries(this%gr, this%gr%symm, this%ions%space%periodic_dim)
384 end if
385
386 call output_init(this%outp, this%namespace, this%space, this%st, this%gr, this%st%nst, this%ks)
387 call states_elec_densities_init(this%st, this%gr)
388 call states_elec_exec_init(this%st, this%namespace, this%mc)
389
390 if (associated(this%photons)) then
391 this%ks%has_photons = .true.
392 end if
393
394 call v_ks_init(this%ks, this%namespace, this%gr, this%st, this%ions, this%mc, this%space, this%kpoints)
395 if (this%ks%theory_level == kohn_sham_dft .or. this%ks%theory_level == generalized_kohn_sham_dft) then
396 this%xc_interaction => xc_interaction_t(this)
397 end if
398
399 ! For the moment the photons are initialized here
400
401 if(this%ks%has_photons) then
402 this%ks%pt => this%photons%modes
403 ! Temporary creation that should go in the system initialization later
404 call photon_mode_set_n_electrons(this%photons%modes, this%st%qtot)
405 write(message(1), '(a,i5,a)') 'Happy to have ', this%photons%modes%nmodes, ' photon modes with us.'
406 call messages_info(1)
407 call mf_init(this%ks%pt_mx, this%gr, this%st, this%ions, this%ks%pt)
408 ! OEP for photons
409 if(bitand(this%ks%xc_family, xc_family_oep) /= 0 .and. this%ks%xc%functional(func_x,1)%id == xc_oep_x) then
410 this%ks%oep_photon%level = this%ks%oep%level
411 call xc_oep_photon_init(this%ks%oep_photon, this%namespace, this%ks%xc_family, this%gr, this%st, this%mc, this%space)
412 else
413 this%ks%oep_photon%level = oep_level_none
414 end if
415
416 end if
417
418
419 ! Temporary place for the initialization of the lasers
420 this%lasers => lasers_t(this%namespace)
421 call lasers_parse_external_fields(this%lasers)
422 call lasers_generate_potentials(this%lasers, this%gr, this%space, this%ions%latt)
423 if(this%lasers%no_lasers > 0) then
424 call this%ext_partners%add(this%lasers)
425 call lasers_check_symmetries(this%lasers, this%kpoints)
426 else
427 deallocate(this%lasers)
428 end if
429
430 ! Temporary place for the initialization of the gauge field
431 this%gfield => gauge_field_t(this%namespace, this%ions%latt%rcell_volume)
432 if(gauge_field_is_used(this%gfield)) then
433 call this%ext_partners%add(this%gfield)
434 call gauge_field_check_symmetries(this%gfield, this%kpoints)
435 else
436 deallocate(this%gfield)
437 end if
438
439 call hamiltonian_elec_init(this%hm, this%namespace, this%space, this%gr, this%ions, this%ext_partners, &
440 this%st, this%ks%theory_level, this%ks%xc, this%mc, this%kpoints, &
441 need_exchange = output_need_exchange(this%outp) .or. this%ks%oep%level /= oep_level_none, &
442 xc_photons = this%ks%xc_photons )
443
444 if (this%hm%pcm%run_pcm .and. this%mc%par_strategy /= p_strategy_serial .and. this%mc%par_strategy /= p_strategy_states) then
445 call messages_experimental('Parallel in domain calculations with PCM')
446 end if
447
448 ! Print memory requirements
449 call messages_print_with_emphasis(msg='Approximate memory requirements', namespace=this%namespace)
450
451 mesh_global = mesh_global_memory(this%gr)
452 mesh_local = mesh_local_memory(this%gr)
453
454 call messages_write('Mesh')
455 call messages_new_line()
456 call messages_write(' global :')
457 call messages_write(mesh_global, units = unit_megabytes, fmt = '(f10.1)')
458 call messages_new_line()
459 call messages_write(' local :')
460 call messages_write(mesh_local, units = unit_megabytes, fmt = '(f10.1)')
461 call messages_new_line()
462 call messages_write(' total :')
463 call messages_write(mesh_global + mesh_local, units = unit_megabytes, fmt = '(f10.1)')
464 call messages_new_line()
465 call messages_info()
466
467 wfns = states_elec_wfns_memory(this%st, this%gr)
468 call messages_write('States')
469 call messages_new_line()
470 call messages_write(' real :')
471 call messages_write(wfns, units = unit_megabytes, fmt = '(f10.1)')
472 call messages_write(' (par_kpoints + par_states + par_domains)')
473 call messages_new_line()
474 call messages_write(' complex :')
475 call messages_write(2.0_8*wfns, units = unit_megabytes, fmt = '(f10.1)')
476 call messages_write(' (par_kpoints + par_states + par_domains)')
477 call messages_new_line()
478 call messages_info()
479
480 call messages_print_with_emphasis(namespace=this%namespace)
481
482 if (this%generate_epot) then
483 message(1) = "Info: Generating external potential"
484 call messages_info(1, namespace=this%namespace)
485 call hamiltonian_elec_epot_generate(this%hm, this%namespace, this%space, this%gr, this%ions, &
486 this%ext_partners, this%st)
487 message(1) = " done."
488 call messages_info(1, namespace=this%namespace)
489 end if
490
491 if (this%ks%theory_level /= independent_particles) then
492 call poisson_async_init(this%hm%psolver, this%mc)
493 ! slave nodes do not call the calculation routine
494 if (multicomm_is_slave(this%mc)) then
495 !for the moment we only have one type of slave
496 call poisson_slave_work(this%hm%psolver, this%namespace)
497 end if
498 end if
499
500 allocate(this%supported_interactions(0))
501 select case (this%hm%mxll%coupling_mode)
503 this%supported_interactions = [this%supported_interactions, mxll_e_field_to_matter]
505 this%supported_interactions = [this%supported_interactions, mxll_vec_pot_to_matter]
506 if (this%hm%mxll%add_zeeman) then
507 this%supported_interactions = [this%supported_interactions, mxll_b_field_to_matter]
508 end if
510 if (this%hm%mxll%add_electric_dip .or. this%hm%mxll%add_electric_quad) then
511 this%supported_interactions = [this%supported_interactions, mxll_e_field_to_matter]
512 end if
513 if (this%hm%mxll%add_magnetic_dip) then
514 this%supported_interactions = [this%supported_interactions, mxll_b_field_to_matter]
515 end if
517 ! Do not initialize any interaction with Maxwell
518 case default
519 message(1) = "Unknown maxwell-matter coupling"
520 call messages_fatal(1, namespace=this%namespace)
521 end select
522
524 end subroutine electrons_init_parallelization
525
526 ! ---------------------------------------------------------
527 subroutine electrons_init_algorithm(this, factory)
528 class(electrons_t), intent(inout) :: this
529 class(algorithm_factory_t), intent(in) :: factory
530
532
533 call system_init_algorithm(this, factory)
534
535 select type (algo => this%algo)
536 class is (propagator_t)
537
538 call td_init(this%td, this%namespace, this%space, this%gr, this%ions, this%st, this%ks, &
539 this%hm, this%ext_partners, this%outp)
540
541 ! this corresponds to the first part of td_init_run
542 call td_allocate_wavefunctions(this%td, this%namespace, this%mc, this%gr, this%ions, this%st, &
543 this%hm, this%space)
544 call td_init_gaugefield(this%td, this%namespace, this%gr, this%st, this%ks, this%hm, &
545 this%ext_partners, this%space)
546
547 end select
548
550 end subroutine electrons_init_algorithm
551
552 ! ---------------------------------------------------------
553 subroutine electrons_initial_conditions(this)
554 class(electrons_t), intent(inout) :: this
555
557
558 select type (algo => this%algo)
559 class is (propagator_t)
560 call td_set_from_scratch(this%td, .true.)
561 call td_load_restart_from_gs(this%td, this%namespace, this%space, this%mc, this%gr, &
562 this%ext_partners, this%st, this%ks, this%hm)
563 end select
564
566 end subroutine electrons_initial_conditions
567
568 ! ---------------------------------------------------------
569 subroutine electrons_propagation_start(this)
570 class(electrons_t), intent(inout) :: this
571
573
574 call system_propagation_start(this)
575
576 ! additional initialization needed for electrons
577 call td_init_with_wavefunctions(this%td, this%namespace, this%space, this%mc, this%gr, this%ions, &
578 this%ext_partners, this%st, this%ks, this%hm, this%outp, td_get_from_scratch(this%td))
579
581 end subroutine electrons_propagation_start
582
583 ! ---------------------------------------------------------
584 logical function electrons_do_algorithmic_operation(this, operation, updated_quantities) result(done)
585 class(electrons_t), intent(inout) :: this
586 class(algorithmic_operation_t), intent(in) :: operation
587 integer, allocatable, intent(out) :: updated_quantities(:)
588
589 logical :: update_energy_
590 type(gauge_field_t), pointer :: gfield
591 real(real64) :: time
592
594 call profiling_in(trim(this%namespace%get())//":"//trim(operation%id))
595
596 update_energy_ = .true.
597
598 ! kick at t > 0 still missing!
599
600 done = .true.
601 select type (algo => this%algo)
602 class is (propagator_t)
603 time = algo%iteration%value()
604 select case (operation%id)
605 case (aetrs_first_half)
606 ! propagate half of the time step with H(time)
607 call get_fields_from_interaction(this, time)
608 call propagation_ops_elec_update_hamiltonian(this%namespace, this%space, this%st, this%gr, &
609 this%hm, this%ext_partners, time)
610 call propagation_ops_elec_exp_apply(this%td%tr%te, this%namespace, this%st, this%gr, this%hm, m_half*algo%dt)
611
612 case (aetrs_extrapolate)
613 ! Do the extrapolation of the Hamiltonian
614 ! First the extrapolation of the potential
615 call potential_interpolation_new(this%td%tr%vksold, this%gr%np, this%st%d%nspin, &
616 time+algo%dt, algo%dt, this%hm%vhxc, vtau=this%hm%vtau)
617
618 !Get the potentials from the interpolator
619 call propagation_ops_elec_interpolate_get(this%gr, this%hm, this%td%tr%vksold)
621 ! Second the ions and gauge field which later on will be treated as extrapolation
622 ! of interactions, but this is not yet possible
623
624 ! move the ions to time t
625 call propagation_ops_elec_move_ions(this%td%tr%propagation_ops_elec, this%gr, this%hm, &
626 this%st, this%namespace, this%space, this%td%ions_dyn, this%ions, this%ext_partners, &
627 time+algo%dt, algo%dt)
628
629 !Propagate gauge field
630 gfield => list_get_gauge_field(this%ext_partners)
631 if(associated(gfield)) then
632 call propagation_ops_elec_propagate_gauge_field(this%td%tr%propagation_ops_elec, gfield, &
633 algo%dt, time+algo%dt)
634 end if
635
636 !Update Hamiltonian and current
637 call get_fields_from_interaction(this, time+algo%dt)
638 call propagation_ops_elec_update_hamiltonian(this%namespace, this%space, this%st, this%gr, &
639 this%hm, this%ext_partners, time+algo%dt)
640
641 case (aetrs_second_half)
642 !Do the time propagation for the second half of the time step
643 call propagation_ops_elec_fuse_density_exp_apply(this%td%tr%te, this%namespace, this%st, &
644 this%gr, this%hm, m_half*algo%dt)
645
647 ! the half step of this propagator screws with the gauge field kick
648 gfield => list_get_gauge_field(this%ext_partners)
649 if(associated(gfield)) then
650 assert(gauge_field_is_propagated(gfield) .eqv. .false.)
651 end if
652
653 ! Do the extrapolation of the Hamiltonian
654 ! First the extrapolation of the potential
655 call potential_interpolation_new(this%td%tr%vksold, this%gr%np, this%st%d%nspin, &
656 time+algo%dt, algo%dt, this%hm%vhxc, vtau=this%hm%vtau)
657
658 ! get the potentials from the interpolator
659 if (this%hm%theory_level /= independent_particles) then
660 call potential_interpolation_interpolate(this%td%tr%vksold, 3, &
661 time+algo%dt, algo%dt, time + algo%dt/m_two, &
662 this%hm%vhxc, vtau=this%hm%vtau)
663 end if
664
665 ! Second the ions which later on will be treated as extrapolation of interactions,
666 ! but this is not yet possible
667 ! move the ions to the half step
668 call propagation_ops_elec_move_ions(this%td%tr%propagation_ops_elec, this%gr, this%hm, this%st, &
669 this%namespace, this%space, this%td%ions_dyn, this%ions, this%ext_partners, &
670 time + m_half*algo%dt, m_half*algo%dt, save_pos=.true.)
671
672 call get_fields_from_interaction(this, time + m_half*algo%dt)
673 call propagation_ops_elec_update_hamiltonian(this%namespace, this%space, this%st, this%gr, &
674 this%hm, this%ext_partners, time + m_half*algo%dt)
675
676 case (expmid_propagate)
677 ! Do the actual propagation step
678 call propagation_ops_elec_fuse_density_exp_apply(this%td%tr%te, this%namespace, this%st, &
679 this%gr, this%hm, algo%dt)
680
681 ! restore to previous time
682 call propagation_ops_elec_restore_ions(this%td%tr%propagation_ops_elec, this%td%ions_dyn, this%ions)
683
684 case (bomd_start)
685 call scf_init(this%scf, this%namespace, this%gr, this%ions, this%st, this%mc, this%hm, this%space)
686 ! the ions are propagated inside the propagation step already, so no need to do it at the end
687 this%ions_propagated = .true.
688
689 case (verlet_update_pos)
690 ! move the ions to time t
691 call ion_dynamics_propagate(this%td%ions_dyn, this%ions, time+algo%dt, &
692 algo%dt, this%namespace)
693
694 case (bomd_elec_scf)
695 call hamiltonian_elec_epot_generate(this%hm, this%namespace, this%space, this%gr, this%ions, &
696 this%ext_partners, this%st, time = time+algo%dt)
697 ! now calculate the eigenfunctions
698 call scf_run(this%scf, this%namespace, this%space, this%mc, this%gr, this%ions, &
699 this%ext_partners, this%st, this%ks, this%hm, verbosity = verb_compact)
700 ! TODO: Check if this call is realy needed. - NTD
701 call hamiltonian_elec_epot_generate(this%hm, this%namespace, this%space, this%gr, this%ions, &
702 this%ext_partners, this%st, time = time+algo%dt)
703
704 ! update Hamiltonian and eigenvalues (fermi is *not* called)
705 call v_ks_calc(this%ks, this%namespace, this%space, this%hm, this%st, this%ions, this%ext_partners, &
706 calc_eigenval = .true., time = time+algo%dt, calc_energy = .true.)
707
708 ! Get the energies.
709 call energy_calc_total(this%namespace, this%space, this%hm, this%gr, this%st, this%ext_partners, iunit = -1)
710
711 case (verlet_compute_acc)
712 ! Do nothing, forces are computing in scf_run
713
714 case (verlet_compute_vel)
715 call ion_dynamics_propagate_vel(this%td%ions_dyn, this%ions)
716 ! TODO: Check if this call is realy needed. - NTD
717 call hamiltonian_elec_epot_generate(this%hm, this%namespace, this%space, this%gr, this%ions, &
718 this%ext_partners, this%st, time = time+algo%dt)
719 call this%ions%update_kinetic_energy()
720
721 case (expmid_start)
722 this%ions_propagated = .false.
723
724 case (aetrs_start)
725 ! the ions are propagated inside the propagation step already, so no need to do it at the end
726 this%ions_propagated = .true.
727
728 case (iteration_done)
730 done = .false.
731
732 case (bomd_finish)
733 call scf_end(this%scf)
734
736 case default
737 done = .false.
738 end select
739
740 end select
741
742 call profiling_out(trim(this%namespace%get())//":"//trim(operation%id))
745
746 ! ---------------------------------------------------------
747 logical function electrons_is_tolerance_reached(this, tol) result(converged)
748 class(electrons_t), intent(in) :: this
749 real(real64), intent(in) :: tol
750
752
753 converged = .false.
754
757
758 ! ---------------------------------------------------------
759 subroutine electrons_update_quantity(this, iq)
760 class(electrons_t), intent(inout) :: this
761 integer, intent(in) :: iq
762
764 call profiling_in(trim(this%namespace%get())//":"//"UPDATE_QUANTITY")
765
766 ! We are only allowed to update quantities that can be updated on demand
767 assert(this%quantities(iq)%updated_on_demand)
768
769 select case (iq)
770 case (current)
771 call states_elec_allocate_current(this%st, this%space, this%gr)
772 call current_calculate(this%current_calculator, this%namespace, this%gr, &
773 this%hm, this%space, this%st)
774 case (dipole)
775 call this%dipole%calculate(this%gr, this%ions, this%st)
776 case default
777 message(1) = "Incompatible quantity."
778 call messages_fatal(1, namespace=this%namespace)
779 end select
780
781 call profiling_out(trim(this%namespace%get())//":"//"UPDATE_QUANTITY")
783 end subroutine electrons_update_quantity
784
785 ! ---------------------------------------------------------
786 subroutine electrons_init_interaction_as_partner(partner, interaction)
787 class(electrons_t), intent(in) :: partner
788 class(interaction_surrogate_t), intent(inout) :: interaction
789
791
792 select type (interaction)
794 call interaction%init_from_partner(partner%gr, partner%space, partner%namespace)
795 class default
796 message(1) = "Unsupported interaction."
797 call messages_fatal(1, namespace=partner%namespace)
798 end select
799
802
803 ! ---------------------------------------------------------
804 subroutine electrons_copy_quantities_to_interaction(partner, interaction)
805 class(electrons_t), intent(inout) :: partner
806 class(interaction_surrogate_t), intent(inout) :: interaction
807
809 call profiling_in(trim(partner%namespace%get())//":"//"COPY_QUANTITY_INTER")
810
811 select type (interaction)
813 assert(allocated(partner%st%current))
814 interaction%partner_field(:,:) = partner%st%current(1:partner%gr%np,:,1)
815 call interaction%do_mapping()
816 class default
817 message(1) = "Unsupported interaction."
818 call messages_fatal(1, namespace=partner%namespace)
819 end select
820
821 call profiling_out(trim(partner%namespace%get())//":"//"COPY_QUANTITY_INTER")
824
825 ! ---------------------------------------------------------
826 subroutine electrons_output_start(this)
827 class(electrons_t), intent(inout) :: this
828
829 push_sub(electrons_output_start)
830
832 end subroutine electrons_output_start
833
834 ! ---------------------------------------------------------
835 subroutine electrons_output_write(this)
836 class(electrons_t), intent(inout) :: this
837
838 integer :: iter
839
841 call profiling_in(trim(this%namespace%get())//":"//"OUTPUT_WRITE")
842
843 select type (algo => this%algo)
844 class is (propagator_t)
845 iter = this%iteration%counter()
846
847 call td_write_iter(this%td%write_handler, this%namespace, this%space, this%outp, this%gr, &
848 this%st, this%hm, this%ions, this%ext_partners, this%hm%kick, this%ks, algo%dt, iter, this%mc, this%td%recalculate_gs)
849
850 if (this%outp%anything_now(iter)) then ! output
851 call td_write_output(this%namespace, this%space, this%gr, this%st, this%hm, this%ks, &
852 this%outp, this%ions, this%ext_partners, iter, algo%dt)
853 end if
854 end select
855
856 call profiling_out(trim(this%namespace%get())//":"//"OUTPUT_WRITE")
858 end subroutine electrons_output_write
859
860 ! ---------------------------------------------------------
861 subroutine electrons_output_finish(this)
862 class(electrons_t), intent(inout) :: this
863
865
867 end subroutine electrons_output_finish
868
869 ! ---------------------------------------------------------
870 logical function electrons_process_is_slave(this) result(is_slave)
871 class(electrons_t), intent(in) :: this
872
874
875 is_slave = multicomm_is_slave(this%mc)
876
878 end function electrons_process_is_slave
880 ! ---------------------------------------------------------
881 subroutine electrons_exec_end_of_timestep_tasks(this, prop)
882 class(electrons_t), intent(inout) :: this
883 class(propagator_t), intent(in) :: prop
884
885 logical :: stopping
886 logical :: generate
887 logical :: update_energy_
888 integer :: nt
889 real(real64) :: time
890 type(gauge_field_t), pointer :: gfield
891
893 call profiling_in(trim(this%namespace%get())//":"//"END_OF_TIMESTEP")
894
895 stopping = .false.
896
897 nt = this%td%iter
898 ! this is the time at the end of the timestep, as required in all routines here
899 time = prop%dt*nt
900 update_energy_ = .true.
901
902 !Apply mask absorbing boundaries
903 if (this%hm%abs_boundaries%abtype == mask_absorbing) call zvmask(this%gr, this%hm, this%st)
904
905 !Photoelectron stuff
906 if (this%td%pesv%calc_spm .or. this%td%pesv%calc_mask .or. this%td%pesv%calc_flux) then
907 call pes_calc(this%td%pesv, this%namespace, this%space, this%gr, this%st, &
908 prop%dt, nt, this%gr%der, this%hm%kpoints, this%ext_partners, stopping)
909 end if
910
911 ! For BOMD, we do not want the lines below to be executed
912 select type(prop)
913 type is(propagator_bomd_t)
914 call profiling_out(trim(this%namespace%get())//":"//"END_OF_TIMESTEP")
916 return
917 end select
918
919 ! The propagation of the ions and the gauge field is currently done here.
920 ! TODO: this code is to be moved to their own systems at some point
921 generate = .false.
922 if (ion_dynamics_ions_move(this%td%ions_dyn)) then
923 if (.not. this%ions_propagated) then
924 call ion_dynamics_propagate(this%td%ions_dyn, this%ions, abs(nt*prop%dt), this%td%ions_dyn%ionic_scale*prop%dt, &
925 this%namespace)
926 generate = .true.
927 end if
928 end if
929
930 gfield => list_get_gauge_field(this%ext_partners)
931 if(associated(gfield)) then
932 if (gauge_field_is_propagated(gfield) .and. .not. this%ions_propagated) then
934 end if
935 end if
936
937 if (generate .or. this%ions%has_time_dependent_species()) then
938 call hamiltonian_elec_epot_generate(this%hm, this%namespace, this%space, this%gr, this%ions, &
939 this%ext_partners, this%st, time = abs(nt*prop%dt))
940 end if
941
942 call v_ks_calc(this%ks, this%namespace, this%space, this%hm, this%st, this%ions, this%ext_partners, &
943 calc_eigenval = update_energy_, time = abs(nt*prop%dt), calc_energy = update_energy_)
944
945 if (update_energy_) then
946 call energy_calc_total(this%namespace, this%space, this%hm, this%gr, this%st, this%ext_partners, iunit = -1)
947 end if
948
949 ! Recalculate forces, update velocities...
950 if (ion_dynamics_ions_move(this%td%ions_dyn)) then
951 call forces_calculate(this%gr, this%namespace, this%ions, this%hm, this%ext_partners, this%st, &
952 this%ks, t = abs(nt*prop%dt), dt = prop%dt)
953 call ion_dynamics_propagate_vel(this%td%ions_dyn, this%ions, atoms_moved = generate)
954 call this%ions%update_kinetic_energy()
955 else
956 if (this%outp%what(option__output__forces) .or. this%td%write_handler%out(out_separate_forces)%write) then
957 call forces_calculate(this%gr, this%namespace, this%ions, this%hm, this%ext_partners, &
958 this%st, this%ks, t = abs(nt*prop%dt), dt = prop%dt)
959 end if
960 end if
961
962 if (this%outp%what(option__output__stress)) then
963 call stress_calculate(this%namespace, this%gr, this%hm, this%st, this%ions, this%ks, this%ext_partners)
964 end if
965
966 if(associated(gfield)) then
967 if(gauge_field_is_propagated(gfield)) then
968 if(this%ks%xc%kernel_lrc_alpha>m_epsilon) then
969 call gauge_field_get_force(gfield, this%gr, this%st%d%spin_channels, this%st%current, this%ks%xc%kernel_lrc_alpha)
970 else
971 call gauge_field_get_force(gfield, this%gr, this%st%d%spin_channels, this%st%current)
972 endif
974 end if
975 end if
976
977 !We update the occupation matrices
978 call lda_u_update_occ_matrices(this%hm%lda_u, this%namespace, this%gr, this%st, this%hm%hm_base, this%hm%phase, this%hm%energy)
979
980 ! this is needed to be compatible with the code in td_*
981 this%td%iter = this%td%iter + 1
982
983 call profiling_out(trim(this%namespace%get())//":"//"END_OF_TIMESTEP")
986
987 ! ---------------------------------------------------------
988 subroutine electrons_restart_write_data(this)
989 class(electrons_t), intent(inout) :: this
990
991 integer :: ierr
992
994 call profiling_in(trim(this%namespace%get())//":"//"RESTART_WRITE")
995
996 select type (algo => this%algo)
997 class is (propagator_t)
998 call td_write_data(this%td%write_handler)
999 call td_dump(this%td, this%namespace, this%space, this%gr, this%st, this%hm, &
1000 this%ks, this%ext_partners, this%iteration%counter(), ierr)
1001 if (ierr /= 0) then
1002 message(1) = "Unable to write time-dependent restart information."
1003 call messages_warning(1, namespace=this%namespace)
1004 end if
1005
1006 ! TODO: this is here because of legacy reasons and should be moved to the output framework
1007 call pes_output(this%td%pesv, this%namespace, this%space, this%gr, this%st, this%iteration%counter(), &
1008 this%outp, algo%dt, this%ions)
1009 end select
1010
1011 call profiling_out(trim(this%namespace%get())//":"//"RESTART_WRITE")
1013 end subroutine electrons_restart_write_data
1014
1015 ! ---------------------------------------------------------
1016 ! this function returns true if restart data could be read
1017 logical function electrons_restart_read_data(this)
1018 class(electrons_t), intent(inout) :: this
1019
1020 logical :: from_scratch
1021
1023 call profiling_in(trim(this%namespace%get())//":"//"RESTART_READ")
1024
1025 select type (algo => this%algo)
1026 class is (propagator_t)
1027 from_scratch = .false.
1028 call td_load_restart_from_td(this%td, this%namespace, this%space, this%mc, this%gr, &
1029 this%ext_partners, this%st, this%ks, this%hm, from_scratch)
1030 call td_set_from_scratch(this%td, from_scratch)
1031 if (from_scratch) then
1032 ! restart data could not be loaded
1034 else
1035 ! restart data could be loaded
1037 end if
1038 end select
1039
1040 call profiling_out(trim(this%namespace%get())//":"//"RESTART_READ")
1042 end function electrons_restart_read_data
1043
1044 !----------------------------------------------------------
1045 subroutine electrons_update_kinetic_energy(this)
1046 class(electrons_t), intent(inout) :: this
1047
1049
1050 if (states_are_real(this%st)) then
1051 this%kinetic_energy = denergy_calc_electronic(this%namespace, this%hm, this%gr%der, this%st, terms = term_kinetic)
1052 else
1053 this%kinetic_energy = zenergy_calc_electronic(this%namespace, this%hm, this%gr%der, this%st, terms = term_kinetic)
1054 end if
1055
1057
1058 end subroutine electrons_update_kinetic_energy
1059
1060 ! ---------------------------------------------------------
1061 subroutine get_fields_from_interaction(this, time)
1062 class(electrons_t), intent(inout) :: this
1063 real(real64), intent(in) :: time
1064
1065 type(interaction_iterator_t) :: iter
1066 real(real64), allocatable :: field_tmp(:, :)
1067
1069
1070 if (this%hm%mxll%coupling_mode == no_maxwell_coupling) then
1072 return
1073 end if
1074
1075 safe_allocate(field_tmp(1:this%gr%np, 1:this%gr%box%dim))
1076 this%hm%mxll%e_field = m_zero
1077 this%hm%mxll%b_field = m_zero
1078 this%hm%mxll%vec_pot = m_zero
1079
1080 ! interpolate field from interaction
1081 call iter%start(this%interactions)
1082 do while (iter%has_next())
1083 select type (interaction => iter%get_next())
1084 class is (mxll_e_field_to_matter_t)
1085 call interaction%interpolate(time, field_tmp)
1086 call lalg_axpy(this%gr%np, 3, m_one, field_tmp, this%hm%mxll%e_field)
1087 class is (mxll_vec_pot_to_matter_t)
1088 call interaction%interpolate(time, field_tmp)
1089 call lalg_axpy(this%gr%np, 3, m_one, field_tmp, this%hm%mxll%vec_pot)
1090 class is (mxll_b_field_to_matter_t)
1091 call interaction%interpolate(time, field_tmp)
1092 call lalg_axpy(this%gr%np, 3, m_one, field_tmp, this%hm%mxll%b_field)
1093 end select
1094 end do
1095
1096 safe_deallocate_a(field_tmp)
1098
1099 end subroutine get_fields_from_interaction
1100
1101 !----------------------------------------------------------
1102 subroutine electrons_finalize(sys)
1103 type(electrons_t), intent(inout) :: sys
1104
1105 type(partner_iterator_t) :: iter
1106 class(interaction_partner_t), pointer :: partner
1107
1108 push_sub(electrons_finalize)
1109
1110 if (associated(sys%algo)) then
1111 select type (algo => sys%algo)
1112 class is (propagator_t)
1113 call td_end_run(sys%td, sys%st, sys%hm)
1114 call td_end(sys%td)
1115 end select
1116 end if
1117
1118 if (sys%ks%theory_level /= independent_particles) then
1119 call poisson_async_end(sys%hm%psolver, sys%mc)
1120 end if
1121
1122 call iter%start(sys%ext_partners)
1123 do while (iter%has_next())
1124 partner => iter%get_next()
1125 safe_deallocate_p(partner)
1126 end do
1127 call sys%ext_partners%empty()
1128
1129 safe_deallocate_p(sys%xc_interaction)
1130
1131 call hamiltonian_elec_end(sys%hm)
1132
1133 nullify(sys%gfield)
1134 nullify(sys%lasers)
1135
1136 call multicomm_end(sys%mc)
1137
1138 call xc_oep_photon_end(sys%ks%oep_photon)
1139 if (sys%ks%has_photons) then
1140 call mf_end(sys%ks%pt_mx)
1141 end if
1142
1143 call sys%dipole%end()
1144
1145 call v_ks_end(sys%ks)
1146
1147 call states_elec_end(sys%st)
1148
1149 deallocate(sys%ions)
1150 safe_deallocate_p(sys%photons)
1151
1152 call kpoints_end(sys%kpoints)
1153
1154 call grid_end(sys%gr)
1155
1156 call system_end(sys)
1157
1158 pop_sub(electrons_finalize)
1159 end subroutine electrons_finalize
1160
1161end module electrons_oct_m
1162
1163!! Local Variables:
1164!! mode: f90
1165!! coding: utf-8
1166!! End:
constant times a vector plus a vector
Definition: lalg_basic.F90:170
integer, parameter, public mask_absorbing
This module defines the abstract interfact for algorithm factories.
This module implements the basic elements defining algorithms.
Definition: algorithm.F90:141
character(len=algo_label_len), parameter, public iteration_done
Definition: algorithm.F90:172
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_serial
single domain, all states, k-points on a single processor
integer, parameter, public p_strategy_states
parallelization in states
subroutine, public current_calculate(this, namespace, gr, hm, space, st)
Compute total electronic current density.
Definition: current.F90:367
subroutine, public current_init(this, namespace)
Definition: current.F90:177
This module implements a calculator for the density and defines related functions.
Definition: density.F90:120
This modules implements the dipole moment of the matter system.
Definition: dipole.F90:108
logical function electrons_restart_read_data(this)
Definition: electrons.F90:1111
subroutine electrons_init_parallelization(this, grp)
Definition: electrons.F90:428
subroutine electrons_init_algorithm(this, factory)
Definition: electrons.F90:621
logical function electrons_process_is_slave(this)
Definition: electrons.F90:964
subroutine electrons_init_interaction(this, interaction)
Definition: electrons.F90:365
subroutine electrons_finalize(sys)
Definition: electrons.F90:1196
subroutine electrons_exec_end_of_timestep_tasks(this, prop)
Definition: electrons.F90:975
logical function electrons_do_algorithmic_operation(this, operation, updated_quantities)
Definition: electrons.F90:678
subroutine electrons_update_quantity(this, iq)
Definition: electrons.F90:853
subroutine electrons_propagation_start(this)
Definition: electrons.F90:663
subroutine electrons_output_write(this)
Definition: electrons.F90:929
subroutine get_fields_from_interaction(this, time)
Definition: electrons.F90:1155
subroutine electrons_output_finish(this)
Definition: electrons.F90:955
subroutine electrons_output_start(this)
Definition: electrons.F90:920
subroutine electrons_init_interaction_as_partner(partner, interaction)
Definition: electrons.F90:880
class(electrons_t) function, pointer electrons_constructor(namespace, generate_epot)
Definition: electrons.F90:277
subroutine electrons_update_kinetic_energy(this)
Definition: electrons.F90:1139
logical function electrons_is_tolerance_reached(this, tol)
Definition: electrons.F90:841
subroutine electrons_copy_quantities_to_interaction(partner, interaction)
Definition: electrons.F90:898
subroutine electrons_restart_write_data(this)
Definition: electrons.F90:1082
subroutine electrons_initial_conditions(this)
Definition: electrons.F90:647
subroutine, public elf_init(namespace)
Definition: elf.F90:144
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,...
real(real64) function, public zenergy_calc_electronic(namespace, hm, der, st, terms)
real(real64) function, public denergy_calc_electronic(namespace, hm, der, st, terms)
type(gauge_field_t) function, pointer, public list_get_gauge_field(partners)
This module implements the field transfer.
subroutine, public forces_calculate(gr, namespace, ions, hm, ext_partners, st, ks, vhxc_old, t, dt)
Definition: forces.F90:336
subroutine, public gauge_field_do_algorithmic_operation(this, operation, dt, time)
subroutine, public gauge_field_check_symmetries(this, kpoints)
subroutine, public gauge_field_get_force(this, gr, spin_channels, current, lrc_alpha)
logical pure function, public gauge_field_is_propagated(this)
logical pure function, public gauge_field_is_used(this)
real(real64), parameter, public m_two
Definition: global.F90:189
real(real64), parameter, public m_zero
Definition: global.F90:187
real(real64), parameter, public m_epsilon
Definition: global.F90:203
real(real64), parameter, public m_half
Definition: global.F90:193
real(real64), parameter, public m_one
Definition: global.F90:188
This module implements the underlying real-space grid.
Definition: grid.F90:117
subroutine, public grid_init_stage_1(gr, namespace, space, symm, latt, n_sites, site_position)
First stage of the grid initialization.
Definition: grid.F90:194
subroutine, public grid_init_stage_2(gr, namespace, space, mc, qvector)
Second stage of the grid initialization.
Definition: grid.F90:465
subroutine, public grid_end(gr)
finalize a grid object
Definition: grid.F90:493
integer, parameter, public term_kinetic
integer, parameter, public generalized_kohn_sham_dft
subroutine, public zvmask(mesh, hm, st)
subroutine, public hamiltonian_elec_end(hm)
integer, parameter, public independent_particles
subroutine, public hamiltonian_elec_epot_generate(this, namespace, space, gr, ions, ext_partners, st, time)
subroutine, public hamiltonian_elec_init(hm, namespace, space, gr, ions, ext_partners, st, theory_level, xc, mc, kpoints, need_exchange, xc_photons)
integer, parameter, public kohn_sham_dft
integer, parameter, public mxll_vec_pot_to_matter
integer, parameter, public mxll_b_field_to_matter
integer, parameter, public mxll_e_field_to_matter
integer, parameter, public current_to_mxll_field
This module defines the abstract interaction_t class, and some auxiliary classes for interactions.
This module defines classes and functions for interaction partners.
subroutine, public ion_dynamics_propagate(this, ions, time, dt, namespace)
logical pure function, public ion_dynamics_ions_move(this)
subroutine, public ion_dynamics_propagate_vel(this, ions, atoms_moved)
subroutine, public kpoints_end(this)
Definition: kpoints.F90:1012
subroutine, public kpoints_init(this, namespace, symm, dim, periodic_dim, latt)
Definition: kpoints.F90:322
subroutine, public kpoints_to_absolute(latt, kin, kout)
Definition: kpoints.F90:1031
subroutine, public lasers_check_symmetries(this, kpoints)
Definition: lasers.F90:553
subroutine, public lasers_parse_external_fields(this)
Definition: lasers.F90:243
subroutine, public lasers_generate_potentials(this, mesh, space, latt)
Definition: lasers.F90:442
subroutine, public lda_u_update_occ_matrices(this, namespace, mesh, st, hm_base, phase, energy)
Definition: lda_u.F90:796
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:118
subroutine, public mesh_check_symmetries(mesh, symm, periodic_dim)
Definition: mesh.F90:832
integer function, public mesh_nearest_point(mesh, pos, dmin, rankmin)
Returns the index of the point which is nearest to a given vector position pos.
Definition: mesh.F90:380
real(real64) pure function, public mesh_global_memory(mesh)
Definition: mesh.F90:779
real(real64) pure function, public mesh_local_memory(mesh)
Definition: mesh.F90:790
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
Definition: messages.F90:930
character(len=512), private msg
Definition: messages.F90:165
subroutine, public messages_warning(no_lines, all_nodes, namespace)
Definition: messages.F90:543
subroutine, public messages_obsolete_variable(namespace, name, rep)
Definition: messages.F90:1057
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
Definition: messages.F90:624
subroutine, public messages_new_line()
Definition: messages.F90:1146
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:420
subroutine, public messages_experimental(name, namespace)
Definition: messages.F90:1097
general module for modelmb particles
subroutine, public modelmb_copy_masses(this, masses)
==============================================================
subroutine mpi_grp_copy(mpi_grp_out, mpi_grp_in)
Definition: mpi.F90:403
type(mpi_grp_t), public mpi_world
Definition: mpi.F90:266
This module handles the communicators for the various parallelization strategies.
Definition: multicomm.F90:145
subroutine, public multicomm_end(mc)
Definition: multicomm.F90:891
logical pure function, public multicomm_is_slave(this)
Definition: multicomm.F90:1135
subroutine, public multicomm_init(mc, namespace, base_grp, mode_para, n_node, index_range, min_range)
create index and domain communicators
Definition: multicomm.F90:264
integer, parameter, public mxll_field_trans
integer, parameter, public length_gauge_dipole
integer, parameter, public no_maxwell_coupling
integer, parameter, public velocity_gauge_dipole
integer, parameter, public multipolar_expansion
integer, parameter, public full_minimal_coupling
this module contains the output system
Definition: output_low.F90:115
this module contains the output system
Definition: output.F90:115
logical function, public output_need_exchange(outp)
Definition: output.F90:877
subroutine, public output_init(outp, namespace, space, st, gr, nst, ks)
Definition: output.F90:206
logical function, public parse_is_defined(namespace, name)
Definition: parser.F90:502
integer function, public parse_block(namespace, name, blk, check_varinfo_)
Definition: parser.F90:618
subroutine, public pes_calc(pes, namespace, space, mesh, st, dt, iter, der, kpoints, ext_partners, stopping)
Definition: pes.F90:269
subroutine, public pes_output(pes, namespace, space, gr, st, iter, outp, dt, ions)
Definition: pes.F90:295
subroutine, public mf_init(this, gr, st, ions, pt_mode)
subroutine, public mf_end(this)
subroutine, public photon_mode_set_n_electrons(this, qtot)
subroutine, public poisson_async_init(this, mc)
Definition: poisson.F90:1339
subroutine, public poisson_slave_work(this, namespace)
Definition: poisson.F90:1391
subroutine, public poisson_async_end(this, mc)
Definition: poisson.F90:1364
subroutine, public potential_interpolation_interpolate(potential_interpolation, order, time, dt, t, vhxc, vtau)
subroutine, public potential_interpolation_new(potential_interpolation, np, nspin, time, dt, vhxc, vtau)
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 propagation_ops_elec_restore_ions(wo, ions_dyn, ions)
subroutine, public propagation_ops_elec_move_ions(wo, gr, hm, st, namespace, space, ions_dyn, ions, ext_partners, time, dt, save_pos)
subroutine, public propagation_ops_elec_propagate_gauge_field(wo, gfield, dt, time, save_gf)
subroutine, public propagation_ops_elec_update_hamiltonian(namespace, space, st, mesh, hm, ext_partners, time)
subroutine, public propagation_ops_elec_exp_apply(te, namespace, st, mesh, hm, dt)
subroutine, public propagation_ops_elec_interpolate_get(mesh, hm, interp)
subroutine, public propagation_ops_elec_fuse_density_exp_apply(te, namespace, st, gr, hm, dt, dt2, vmagnus)
character(len=algo_label_len), parameter, public aetrs_start
character(len=algo_label_len), parameter, public aetrs_finish
character(len=algo_label_len), parameter, public aetrs_extrapolate
character(len=algo_label_len), parameter, public aetrs_first_half
character(len=algo_label_len), parameter, public aetrs_second_half
character(len=algo_label_len), parameter, public bomd_start
character(len=algo_label_len), parameter, public bomd_elec_scf
character(len=algo_label_len), parameter, public bomd_finish
character(len=algo_label_len), parameter, public expmid_extrapolate
character(len=algo_label_len), parameter, public expmid_finish
character(len=algo_label_len), parameter, public expmid_start
character(len=algo_label_len), parameter, public expmid_propagate
This module implements the basic propagator framework.
Definition: propagator.F90:117
character(len=30), parameter, public verlet_compute_acc
type(algorithmic_operation_t), parameter, public op_verlet_compute_acc
character(len=30), parameter, public verlet_update_pos
type(algorithmic_operation_t), parameter, public op_verlet_compute_vel
character(len=30), parameter, public verlet_compute_vel
This module defines the quantity_t class and the IDs for quantities, which can be exposed by a system...
Definition: quantity.F90:137
integer, parameter, public current
Definition: quantity.F90:146
integer, parameter, public dipole
Definition: quantity.F90:146
Implementation details for regridding.
Definition: regridding.F90:170
subroutine, public scf_run(scf, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, outp, verbosity, iters_done, restart_load, restart_dump)
Definition: scf.F90:574
integer, parameter, public verb_compact
Definition: scf.F90:197
subroutine, public scf_init(scf, namespace, gr, ions, st, mc, hm, space)
Definition: scf.F90:237
subroutine, public scf_end(scf)
Definition: scf.F90:526
This module is intended to contain "only mathematical" functions and procedures.
Definition: sort.F90:117
pure logical function, public states_are_real(st)
This module handles spin dimensions of the states and the k-point distribution.
real(real64) function, public states_elec_wfns_memory(st, mesh)
return the memory usage of a states_elec_t object
subroutine, public states_elec_distribute_nodes(st, namespace, mc)
@Brief. Distribute states over the processes for states parallelization
subroutine, public states_elec_densities_init(st, gr)
subroutine, public states_elec_end(st)
finalize the states_elec_t object
subroutine, public states_elec_init(st, namespace, space, valence_charge, kpoints)
Initialize a new states_elec_t object.
subroutine, public kpoints_distribute(this, mc)
distribute k-points over the nodes in the corresponding communicator
subroutine, public states_elec_exec_init(st, namespace, mc)
Further initializations.
subroutine, public states_elec_allocate_current(st, space, mesh)
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:184
This module implements the abstract system type.
Definition: system.F90:118
subroutine, public system_end(this)
Definition: system.F90:1116
subroutine, public system_propagation_start(this)
Definition: system.F90:988
subroutine, public system_init_algorithm(this, factory)
Definition: system.F90:917
Definition: td.F90:114
subroutine, public td_end(td)
Definition: td.F90:610
subroutine, public td_load_restart_from_gs(td, namespace, space, mc, gr, ext_partners, st, ks, hm)
Definition: td.F90:1154
subroutine, public td_end_run(td, st, hm)
Definition: td.F90:625
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:545
logical function, public td_get_from_scratch(td)
Definition: td.F90:1510
subroutine, public td_set_from_scratch(td, from_scratch)
Definition: td.F90:1521
subroutine, public td_dump(td, namespace, space, gr, st, hm, ks, ext_partners, iter, ierr)
Definition: td.F90:1286
subroutine, public td_init_gaugefield(td, namespace, gr, st, ks, hm, ext_partners, space)
Definition: td.F90:579
subroutine, public td_init_with_wavefunctions(td, namespace, space, mc, gr, ions, ext_partners, st, ks, hm, outp, from_scratch)
Definition: td.F90:842
subroutine, public td_load_restart_from_td(td, namespace, space, mc, gr, ext_partners, st, ks, hm, from_scratch)
Definition: td.F90:1118
subroutine, public td_write_output(namespace, space, gr, st, hm, ks, outp, ions, ext_partners, iter, dt)
Definition: td_write.F90:1228
subroutine, public td_write_data(writ)
Definition: td_write.F90:1194
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:1029
integer, parameter, public out_separate_forces
Definition: td_write.F90:201
This module defines the unit system, used for input and output.
type(unit_t), public unit_megabytes
For large amounts of data (natural code units are bytes)
subroutine, public v_ks_end(ks)
Definition: v_ks.F90:612
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:732
subroutine, public v_ks_init(ks, namespace, gr, st, ions, mc, space, kpoints)
Definition: v_ks.F90:243
integer, parameter, public xc_oep_x
Exact exchange.
integer, parameter, public func_x
Definition: xc.F90:114
integer, parameter, public oep_level_none
the OEP levels
Definition: xc_oep.F90:172
subroutine, public xc_oep_photon_init(oep, namespace, family, gr, st, mc, space)
subroutine, public xc_oep_photon_end(oep)
Abstract class for the algorithm factories.
Descriptor of one algorithmic operation.
Definition: algorithm.F90:163
Class to transfer a current to a Maxwell field.
Extension of space that contains the knowledge of the spin dimension.
Class describing the electron system.
Definition: electrons.F90:214
class defining the field_transfer interaction
These class extend the list and list iterator to make an interaction list.
abstract interaction class
abstract class for general interaction partners
surrogate interaction class to avoid circular dependencies between modules.
This is defined even when running serial.
Definition: mpi.F90:142
class to transfer a Maxwell B field to a matter system
class to transfer a Maxwell field to a medium
class to transfer a Maxwell vector potential to a medium
Implements a propagator for Approximate ETRS.
Implements a propagator for Born-Oppenheimer molecular dynamics.
Implements the explicit exponential midpoint propagator (without predictor-corrector)
Abstract class implementing propagators.
Definition: propagator.F90:138
Abstract class for systems.
Definition: system.F90:172
int true(void)