21 #include "./base/base_uses.f90"
27 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_restarts_util'
45 TYPE(section_vals_type),
POINTER :: velocity_section
46 TYPE(particle_list_type),
OPTIONAL,
POINTER :: particles
47 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: velocity
48 REAL(kind=
dp) :: conv_factor
50 CHARACTER(LEN=*),
PARAMETER :: routinen =
'section_velocity_val_set'
52 INTEGER :: handle, ik, irk, nlist, nloop
54 REAL(kind=
dp),
DIMENSION(:),
POINTER :: vel
55 TYPE(cp_sll_val_type),
POINTER :: new_pos, vals
56 TYPE(section_type),
POINTER :: section
57 TYPE(val_type),
POINTER :: my_val, old_val
59 CALL timeset(routinen, handle)
60 NULLIFY (my_val, old_val, section, vals)
61 cpassert(
ASSOCIATED(velocity_section))
62 cpassert(velocity_section%ref_count > 0)
63 section => velocity_section%section
66 CALL cp_abort(__location__, &
67 "section "//trim(section%name)//
" does not contain keyword "// &
71 check =
PRESENT(particles) .NEQV.
PRESENT(velocity)
73 IF (
PRESENT(particles)) nloop = particles%n_els
74 IF (
PRESENT(velocity)) nloop =
SIZE(velocity, 2)
77 IF (
SIZE(velocity_section%values, 2) == 1)
EXIT
80 vals => velocity_section%values(ik, 1)%list
82 IF (
ASSOCIATED(vals))
THEN
88 IF (
PRESENT(particles)) vel = particles%els(irk)%v(1:3)*conv_factor
89 IF (
PRESENT(velocity)) vel = velocity(1:3, irk)*conv_factor
97 new_pos => new_pos%rest
99 old_val => new_pos%first_el
101 new_pos%first_el => my_val
108 NULLIFY (new_pos%rest)
110 new_pos => new_pos%rest
116 velocity_section%values(ik, 1)%list => vals
118 CALL timestop(handle)
Defines the basic variable types.
integer, parameter, public dp
represent a simple array based list of the given type