26 use,
intrinsic :: iso_fortran_env
54 type(ions_t),
intent(in) :: ions
55 type(namespace_t),
intent(in) :: namespace
56 type(target_t),
intent(inout) :: tg
57 type(td_t),
intent(in) :: td
58 type(oct_t),
intent(in) :: oct
60 integer :: jj, ist, jst
62 character(len=1024) :: expression
65 tg%move_ions = td%ions_dyn%ions_move()
84 if (
parse_block(namespace,
'OCTClassicalTarget', blk) == 0)
then
85 tg%classical_input_string =
" "
88 tg%classical_input_string = trim(tg%classical_input_string) // trim(expression)
92 message(1) =
'If OCTTargetOperator = oct_tg_classical, then you must give the shape'
93 message(2) =
'of this target in the block "OCTClassicalTarget".'
107 if (
parse_block(namespace,
'OCTMomentumDerivatives', blk) == 0)
then
108 safe_allocate(tg%mom_der_array(1:ions%natoms,1:ions%space%dim))
109 do ist = 0, ions%natoms - 1
110 do jst = 0, ions%space%dim - 1
115 else if (oct%algorithm == option__octscheme__oct_cg .or. oct%algorithm == option__octscheme__oct_bfgs)
then
116 message(1) =
'If "OCTTargetOperator = oct_classical" and "OCTScheme = oct_cg" or'
117 message(2) =
'"OCTScheme = oct_bfgs", then you must define the blocks "OCTClassicalTarget",'
118 message(3) =
'"OCTPositionDerivatives" AND "OCTMomentumDerivatives"'
132 if (
parse_block(namespace,
'OCTPositionDerivatives', blk) == 0)
then
133 safe_allocate(tg%pos_der_array(1:ions%natoms,1:ions%space%dim))
134 do ist = 0, ions%natoms-1
135 do jst = 0, ions%space%dim-1
140 else if (oct%algorithm == option__octscheme__oct_cg .or. oct%algorithm == option__octscheme__oct_bfgs)
then
141 message(1) =
'If "OCTTargetOperator = oct_tg_classical" and "OCTScheme = oct_cg" or'
142 message(2) =
'"OCTScheme = oct_bfgs", then you must define the blocks "OCTClassicalTarget",'
143 message(3) =
'"OCTPositionDerivatives" AND "OCTMomentumDerivatives"'
158 safe_deallocate_a(tg%pos_der_array)
159 safe_deallocate_a(tg%mom_der_array)
180 real(real64),
pointer :: q(:, :), p(:, :)
181 real(real64) :: dummy(3)
182 character(len=4096) :: inp_string
189 inp_string = tg%classical_input_string
193 call parse_expression(j1, dummy(1), 1, dummy(1:3), dummy(1), dummy(1), inp_string)
204 type(target_t),
intent(inout) :: tg
205 type(opt_control_state_t),
intent(inout) :: qcpsi
206 type(opt_control_state_t),
intent(inout) :: qcchi
207 type(ions_t),
intent(in) :: ions
209 integer :: ist, jst, ib, iqn
210 character(len=1024) :: temp_string
211 real(real64) :: df_dv, dummy(3)
212 real(real64),
pointer :: q(:, :), p(:, :), tq(:, :), tp(:, :)
213 type(states_elec_t),
pointer :: chi
216 tq => opt_control_point_q(qcchi)
217 tp => opt_control_point_p(qcchi)
218 q => opt_control_point_q(qcpsi)
219 p => opt_control_point_p(qcpsi)
223 do ist = 1, ions%natoms
224 do jst=1, ions%space%dim
225 temp_string = tg%mom_der_array(ist, jst)
226 call parse_array(temp_string, p,
'p')
227 call parse_array(temp_string, q,
'q')
228 call conv_to_c_string(temp_string)
229 call parse_expression(df_dv, dummy(1), 1, dummy(1:3), dummy(1), dummy(1), temp_string)
230 tq(ist, jst) = -df_dv
234 do ist = 1, ions%natoms
235 do jst=1, ions%space%dim
236 temp_string = tg%pos_der_array(ist, jst)
237 call parse_array(temp_string, p,
'p')
238 call parse_array(temp_string, q,
'q')
239 call conv_to_c_string(temp_string)
240 call parse_expression(df_dv, dummy(1), 1, dummy(1:3), dummy(1), dummy(1), temp_string)
245 chi => opt_control_point_qs(qcchi)
248 do iqn = chi%d%kpt%start, chi%d%kpt%end
249 do ib = chi%group%block_start, chi%group%block_end
250 call batch_set_zero(chi%group%psib(ib, iqn))
This module implements common operations on batches of mesh functions.
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
This module contains the definition of the oct_t data type, which contains some of the basic informat...
This module holds the "opt_control_state_t" datatype, which contains a quantum-classical state.
real(real64) function, dimension(:, :), pointer, public opt_control_point_p(ocs)
real(real64) function, dimension(:, :), pointer, public opt_control_point_q(ocs)
subroutine, public parse_array(inp_string, x, arraychar)
A very primitive way to "preprocess" a string that contains reference to the elements of a two-dimens...
integer function, public parse_block(namespace, name, blk, check_varinfo_)
subroutine, public conv_to_c_string(str)
converts to c string
real(real64) function, public target_j1_classical(tg, qcpsi)
subroutine, public target_chi_classical(tg, qcpsi, qcchi, ions)
subroutine, public target_init_classical(ions, namespace, tg, td, oct)
subroutine, public target_end_classical(tg)
subroutine, public target_output_classical
This is the datatype that contains the objects that are propagated: in principle this could be both t...