37  use, 
intrinsic :: iso_fortran_env
 
   73    type(ion_state_t) :: ions_state
 
   74    real(real64), 
allocatable :: vecpot(:), vecpot_vel(:)
 
   82    type(namespace_t),        
intent(in)    :: namespace
 
   83    class(space_t),           
intent(in)    :: space
 
   84    type(states_elec_t),      
intent(inout) :: st
 
   85    class(mesh_t),            
intent(in)    :: mesh
 
   86    type(hamiltonian_elec_t), 
intent(inout) :: hm
 
   87    type(partner_list_t),     
intent(in)    :: ext_partners
 
   88    real(real64),             
intent(in)    :: time
 
   96    call hm%update(mesh, namespace, space, ext_partners, time = time)
 
  107    ext_partners, time, dt, save_pos)
 
  108    class(propagation_ops_elec_t), 
intent(inout) :: wo
 
  109    type(grid_t),                  
intent(in)    :: gr
 
  110    type(hamiltonian_elec_t),      
intent(inout) :: hm
 
  111    type(states_elec_t),           
intent(inout) :: st
 
  112    type(namespace_t),             
intent(in)    :: namespace
 
  113    type(electron_space_t),        
intent(in)    :: space
 
  114    type(ion_dynamics_t),          
intent(inout) :: ions_dyn
 
  115    type(ions_t),                  
intent(inout) :: ions
 
  116    type(partner_list_t),          
intent(in)    :: ext_partners
 
  117    real(real64),                  
intent(in)    :: time
 
  118    real(real64),                  
intent(in)    :: dt
 
  119    logical, 
optional,             
intent(in)    :: save_pos
 
  121    real(real64) :: dt_ions
 
  129      dt_ions = dt * ions_dyn%ionic_scale
 
  144    class(propagation_ops_elec_t),    
intent(inout) :: wo
 
  145    type(ion_dynamics_t),    
intent(inout) :: ions_dyn
 
  146    type(ions_t),            
intent(inout) :: ions
 
  164    class(propagation_ops_elec_t), 
intent(inout) :: wo
 
  165    type(gauge_field_t),           
intent(inout) :: gfield
 
  166    real(real64),                  
intent(in)    :: dt
 
  167    real(real64),                  
intent(in)    :: time
 
  168    logical,  
optional,            
intent(in)    :: save_gf
 
  177        safe_allocate(wo%vecpot(1:gfield%space%dim))
 
  178        safe_allocate(wo%vecpot_vel(1:gfield%space%dim))
 
  194    class(
space_t),                
intent(in)    :: space
 
  196    class(
mesh_t),                 
intent(in)    :: mesh
 
  206    if (
associated(gfield)) 
then 
  209      safe_deallocate_a(wo%vecpot)
 
  210      safe_deallocate_a(wo%vecpot_vel)
 
  211      call hm%update(mesh, namespace, space, ext_partners)
 
  224    class(
mesh_t),            
intent(in)    :: mesh
 
  226    real(real64),             
intent(in)    :: dt
 
  234    do ik = st%d%kpt%start, st%d%kpt%end
 
  236      do ib = st%group%block_start, st%group%block_end
 
  240        call hm%phase%set_phase_corr(mesh, st%group%psib(ib, ik), async=.
true.)
 
  242          call te%apply_batch(namespace, mesh, hm, st%group%psib(ib, ik), dt, &
 
  243            inh_psib = hm%inh_st%group%psib(ib, ik))
 
  245          call te%apply_batch(namespace, mesh, hm, st%group%psib(ib, ik), dt)
 
  247        call hm%phase%unset_phase_corr(mesh, st%group%psib(ib, ik))
 
  268    type(
grid_t),             
intent(in)    :: gr
 
  270    real(real64),             
intent(in)    :: dt
 
  271    real(real64), 
optional,          
intent(in)    :: dt2
 
  272    real(real64), 
optional,          
intent(in)    :: vmagnus(:,:,:)
 
  284    do ik = st%d%kpt%start, st%d%kpt%end
 
  286      do ib = st%group%block_start, st%group%block_end
 
  290        call hm%phase%set_phase_corr(gr, st%group%psib(ib, ik), async=.
true.)
 
  291        if (
present(dt2)) 
then 
  292          call st%group%psib(ib, ik)%copy_to(zpsib_dt)
 
  293          if (st%group%psib(ib, ik)%is_packed()) 
call zpsib_dt%do_pack(copy = .false.)
 
  297            call te%apply_batch(namespace, gr, hm, st%group%psib(ib, ik), dt, psib2 = zpsib_dt, &
 
  298              deltat2 = dt2, inh_psib = hm%inh_st%group%psib(ib, ik))
 
  300            call te%apply_batch(namespace, gr, hm, st%group%psib(ib, ik), dt, psib2 = zpsib_dt, &
 
  303          call hm%phase%unset_phase_corr(gr, st%group%psib(ib, ik), async=.
true.)
 
  312            call te%apply_batch(namespace, gr, hm, st%group%psib(ib, ik), dt, vmagnus=vmagnus, &
 
  313              inh_psib = hm%inh_st%group%psib(ib, ik))
 
  315            call te%apply_batch(namespace, gr, hm, st%group%psib(ib, ik), dt, vmagnus=vmagnus)
 
  317          call hm%phase%unset_phase_corr(gr, st%group%psib(ib, ik), async=.
true.)
 
  342    integer,                  
intent(in)    :: ib
 
  343    integer,                  
intent(in)    :: ik
 
  346    if (hm%apply_packed()) 
then 
  348      call st%group%psib(ib, ik)%do_pack(async=.
true.)
 
  358    integer,                  
intent(in)    :: ib
 
  359    integer,                  
intent(in)    :: ik
 
  362    if (hm%apply_packed()) 
then 
  364      call st%group%psib(ib, ik)%do_unpack(async=.
true.)
 
  374    integer,                  
intent(in)    :: ib
 
  375    integer,                  
intent(in)    :: ik
 
  378    if (hm%apply_packed()) 
then 
  380      call st%group%psib(ib, ik)%finish_unpack()
 
  388    class(
mesh_t),                   
intent(in)    :: mesh
 
  403    class(
mesh_t),                   
intent(in)    :: mesh
 
  406    real(real64), 
parameter :: density_threshold = 1.0e-8_real64
 
  409    if (.not. hm%mxll%calc_field_dip) 
return 
  411    select case (hm%mxll%coupling_mode)
 
  413      if (hm%mxll%add_electric_dip) 
then 
  416      if (hm%mxll%add_magnetic_dip) 
then 
  428      real(real64) :: field_dip(3)
 
  429      real(real64), 
intent(in)  :: field_full(:,:)
 
  431      real(real64), 
allocatable :: total_density(:), mask_density(:)
 
  432      real(real64) :: integral_mask
 
  436      select case (hm%mxll%dipole_field)
 
  438        safe_allocate(total_density(1:mesh%np))
 
  439        safe_allocate(mask_density(
size(total_density)))
 
  440        total_density = sum(st%rho(1:mesh%np,:), dim=2)
 
  445        mask_density = merge(
m_one, 
m_zero, total_density > density_threshold)
 
  447        do idir = 1, mesh%box%dim
 
  448          field_dip(idir) = 
dmf_integrate(mesh, mask_density*field_full(:,idir))/integral_mask
 
  450        safe_deallocate_a(total_density)
 
  451        safe_deallocate_a(mask_density)
 
  454        if (mesh%mpi_grp%rank == hm%mxll%center_of_mass_rankmin) 
then 
  455          field_dip(1:3) = field_full(hm%mxll%center_of_mass_ip,1:3)
 
  457        if (mesh%parallel_in_domains) 
call mesh%allreduce(field_dip(:))
 
subroutine, public accel_finish()
 
subroutine, public accel_set_stream(stream_number)
 
This module implements batches of mesh functions.
 
This module implements a calculator for the density and defines related functions.
 
subroutine, public density_calc_end(this, allreduce, symmetrize)
Finalize the density calculation.
 
subroutine, public density_calc_accumulate(this, psib, async)
Accumulate weighted orbital densities for a batch psib.
 
subroutine, public density_calc_init(this, st, gr, density)
initialize the density calculator
 
type(gauge_field_t) function, pointer, public list_get_gauge_field(partners)
 
subroutine, public gauge_field_set_vec_pot_vel(this, vec_pot_vel)
 
subroutine, public gauge_field_set_vec_pot(this, vec_pot)
 
subroutine, public gauge_field_get_vec_pot(this, vec_pot)
 
subroutine, public gauge_field_do_algorithmic_operation(this, operation, dt, time)
 
subroutine, public gauge_field_get_vec_pot_vel(this, vec_pot_vel)
 
logical pure function, public gauge_field_is_propagated(this)
 
real(real64), parameter, public m_zero
 
real(real64), parameter, public m_one
 
This module implements the underlying real-space grid.
 
subroutine, public hamiltonian_elec_epot_generate(this, namespace, space, gr, ions, ext_partners, st, time)
 
pure logical function, public hamiltonian_elec_inh_term(hm)
 
This module defines classes and functions for interaction partners.
 
subroutine, public ion_dynamics_restore_state(this, ions, state)
 
subroutine, public ion_dynamics_propagate(this, ions, time, dt, namespace)
 
subroutine, public ion_dynamics_save_state(this, ions, state)
 
logical pure function, public ion_dynamics_ions_move(this)
 
subroutine, public lda_u_update_occ_matrices(this, namespace, mesh, st, hm_base, phase, energy)
 
This module defines various routines, operating on mesh functions.
 
real(real64) function, public dmf_integrate(mesh, ff, mask, reduce)
Integrate a function on the mesh.
 
This module defines the meshes, which are used in Octopus.
 
integer, parameter, public length_gauge_dipole
 
integer, parameter, public dipole_average
 
integer, parameter, public velocity_gauge_dipole
 
integer, parameter, public multipolar_expansion
 
integer, parameter, public dipole_at_com
 
subroutine, public potential_interpolation_get(potential_interpolation, np, nspin, i, vhxc, vtau)
 
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
 
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
 
subroutine, public 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_do_unpack(st, hm, ib, ik)
 
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_do_pack(st, hm, ib, ik)
 
subroutine, public propagation_ops_elec_interpolate_get(mesh, hm, interp)
 
subroutine, public propagation_ops_elec_restore_gauge_field(wo, namespace, space, hm, mesh, ext_partners)
 
subroutine, public propagation_ops_finish_unpack(st, hm, ib, ik)
 
subroutine calculate_mxll_dipole_field(hm, mesh, st)
 
subroutine, public propagation_ops_elec_fuse_density_exp_apply(te, namespace, st, gr, hm, dt, dt2, vmagnus)
 
type(algorithmic_operation_t), parameter, public op_verlet_compute_acc
 
real(real64) function, dimension(3) get_field_dip(field_full)
 
Description of the grid, containing information on derivatives, stencil, and symmetries.
 
Describes mesh distribution to nodes.
 
The states_elec_t class contains all electronic wave functions.
 
batches of electronic states