42 real(real64),
allocatable :: acc(:,:)
43 real(real64),
allocatable :: prev_acc(:,:,:)
44 real(real64),
allocatable :: save_pos(:,:)
45 real(real64),
allocatable :: save_vel(:,:)
46 real(real64),
allocatable :: prev_tot_force(:,:)
47 real(real64),
allocatable :: prev_pos(:,:,:)
48 real(real64),
allocatable :: prev_vel(:,:,:)
49 real(real64),
allocatable :: hamiltonian_elements(:,:)
50 logical :: initialized = .false.
56 procedure :: propagator_data_copy
57 generic ::
assignment(=) => propagator_data_copy
63 class(propagator_data_t),
intent(inout) :: this
64 type(namespace_t),
intent(in) :: namespace
65 class(algorithm_t),
intent(in) :: prop
67 integer :: restart_file_unit
71 restart_file_unit =
io_open(
'restart/'//
td_dir//
'restart_classical_particles_propagation', &
72 namespace, action=
'write')
76 write(restart_file_unit,*) this%acc(:,:)
77 write(restart_file_unit,*) this%prev_acc(:,:,:)
79 write(restart_file_unit,*) this%acc(:,:)
80 write(restart_file_unit,*) this%prev_acc(:,:,:)
81 if (prop%predictor_corrector)
then
82 write(restart_file_unit,*) this%prev_tot_force(:,:)
83 write(restart_file_unit,*) this%save_vel(:,:)
84 write(restart_file_unit,*) this%save_pos(:,:)
87 write(restart_file_unit,*) this%prev_vel(:,:,:)
88 write(restart_file_unit,*) this%prev_pos(:,:,:)
89 write(restart_file_unit,*) this%save_vel(:,:)
90 write(restart_file_unit,*) this%save_pos(:,:)
100 class(propagator_data_t),
intent(inout) :: this
101 type(namespace_t),
intent(in) :: namespace
102 class(algorithm_t),
intent(in) :: prop
104 integer :: restart_file_unit
109 restart_file_unit =
io_open(
'restart/'//
td_dir//
'restart_classical_particles_propagation', namespace, &
110 action=
'read', die=.false.)
111 if (restart_file_unit > 0)
then
114 read(restart_file_unit,*) this%acc(:,:)
115 read(restart_file_unit,*) this%prev_acc(:,:,:)
118 read(restart_file_unit,*) this%acc(:,:)
119 read(restart_file_unit,*) this%prev_acc(:,:,:)
120 if (prop%predictor_corrector)
then
121 read(restart_file_unit,*) this%prev_tot_force(:,:)
122 read(restart_file_unit,*) this%save_vel(:,:)
123 read(restart_file_unit,*) this%save_pos(:,:)
126 read(restart_file_unit,*) this%prev_vel(:,:,:)
127 read(restart_file_unit,*) this%prev_pos(:,:,:)
128 read(restart_file_unit,*) this%save_vel(:,:)
129 read(restart_file_unit,*) this%save_pos(:,:)
146 integer,
intent(in) :: dim
147 integer,
intent(in) :: np
151 if (.not. this%initialized)
then
154 safe_allocate(this%acc(1:dim, 1:np))
155 safe_allocate(this%prev_acc(1:dim, 1:np, 1))
157 if (prop%predictor_corrector)
then
158 safe_allocate(this%save_pos(1:dim, 1:np))
159 safe_allocate(this%save_vel(1:dim, 1:np))
160 safe_allocate(this%prev_tot_force(1:dim, 1:np))
162 safe_allocate(this%acc(1:dim, 1:np))
163 safe_allocate(this%prev_acc(1:dim, 1:np, 1:2))
165 safe_allocate(this%save_pos(1:dim, 1:np))
166 safe_allocate(this%save_vel(1:dim, 1:np))
167 safe_allocate(this%hamiltonian_elements(1:dim, 1:np))
168 safe_allocate(this%prev_pos(1:dim, 1:np, 1))
169 safe_allocate(this%prev_vel(1:dim, 1:np, 1))
171 this%initialized = .
true.
183 safe_deallocate_a(this%acc)
184 safe_deallocate_a(this%prev_acc)
185 safe_deallocate_a(this%prev_tot_force)
186 safe_deallocate_a(this%save_pos)
187 safe_deallocate_a(this%save_vel)
188 safe_deallocate_a(this%hamiltonian_elements)
189 safe_deallocate_a(this%prev_pos)
190 safe_deallocate_a(this%prev_vel)
202 safe_allocate_source_a(this%acc, prop_data_in%acc)
203 safe_allocate_source_a(this%prev_acc, prop_data_in%prev_acc)
204 safe_allocate_source_a(this%save_pos, prop_data_in%save_pos)
205 safe_allocate_source_a(this%save_vel, prop_data_in%save_vel)
206 safe_allocate_source_a(this%prev_tot_force, prop_data_in%prev_tot_force)
207 safe_allocate_source_a(this%prev_pos, prop_data_in%prev_pos)
208 safe_allocate_source_a(this%prev_vel, prop_data_in%prev_vel)
209 safe_allocate_source_a(this%hamiltonian_elements, prop_data_in%hamiltonian_elements)
This module implements the basic elements defining algorithms.
character(len= *), parameter, public td_dir
subroutine, public io_close(iunit, grp)
subroutine, public io_mkdir(fname, namespace, parents)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
logical function propagator_data_restart_read(this, namespace, prop)
subroutine propagator_data_end(this)
subroutine propagator_data_copy(this, prop_data_in)
subroutine propagator_data_initialize(this, prop, dim, np)
subroutine propagator_data_restart_write(this, namespace, prop)
This module implements the basic propagator framework.
An algorithm is a list of algorithmic operations executed sequentially.
Implements the Beeman propagator (with or without SCF)
Implements the implicit exponential midpoint propagator with predictor-corrector.
Implements a propagator for the velocity Verlet algorithm.