25 use,
intrinsic :: iso_fortran_env
48 type(target_t),
intent(inout) :: tg
49 type(namespace_t),
intent(in) :: namespace
54 complex(real64) :: alpha(3)
59 message(1) =
'Info: Using a spin target'
69 if (
parse_block(namespace,
'OCTTargetSpin', blk) == 0)
then
76 alpha = alpha/norm2(abs(alpha))
78 tg%spin_matrix(1, 1) = alpha(3)
79 tg%spin_matrix(2, 2) = -alpha(3)
80 tg%spin_matrix(1, 2) = alpha(1) -
m_zi * alpha(2)
81 tg%spin_matrix(2, 1) = alpha(1) +
m_zi * alpha(2)
88 message(1) =
'If "OCTTargetOperator = oct_tg_spin", then you must'
89 message(2) =
'supply a "OCTTargetSpin" block.'
101 real(real64) function target_j1_spin(tg, gr, psi) result(j1)
102 type(target_t),
intent(in) :: tg
103 type(grid_t),
intent(in) :: gr
104 type(states_elec_t),
intent(in) :: psi
107 complex(real64),
allocatable :: zpsi(:, :)
109 push_sub(target_j1_spin)
111 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
118 j1 = j1 + real(tg%spin_matrix(i,j)*
zmf_dotp(gr, zpsi(:, i), zpsi(:, j)))
122 safe_deallocate_a(zpsi)
124 pop_sub(target_j1_spin)
132 type(target_t),
intent(in) :: tg
133 type(grid_t),
intent(in) :: gr
134 type(states_elec_t),
intent(in) :: psi_in
135 type(states_elec_t),
intent(inout) :: chi_out
138 complex(real64),
allocatable :: zpsi(:, :), zchi(:, :)
142 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
143 safe_allocate(zchi(1:gr%np, 1:tg%st%d%dim))
145 call states_elec_get_state(psi_in, gr, 1, 1, zpsi)
147 zchi(1:gr%np, 1:tg%st%d%dim) = 0.0_real64
151 zchi(1:gr%np, i) = zchi(1:gr%np, i) + tg%spin_matrix(i, j)*zpsi(1:gr%np, j)
155 call states_elec_set_state(chi_out, gr, 1, 1, zchi)
157 safe_deallocate_a(zpsi)
158 safe_deallocate_a(zchi)
real(real64), parameter, public m_zero
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_zi
This module implements the underlying real-space grid.
This module defines various routines, operating on mesh functions.
subroutine, public messages_variable_is_block(namespace, name)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
logical function, public parse_is_defined(namespace, name)
integer function, public parse_block(namespace, name, blk, check_varinfo_)
subroutine, public target_init_spin(tg, namespace)
subroutine, public target_chi_spin(tg, gr, psi_in, chi_out)
real(real64) function, public target_j1_spin(tg, gr, psi)