34 #include "../base/base_uses.f90"
40 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'tmc_tree_types'
42 PUBLIC :: tree_type, global_tree_type
43 PUBLIC :: elem_list_type, elem_array_type, gt_elem_list_type
76 TYPE(tree_type),
POINTER :: parent => null()
79 TYPE(tree_type),
POINTER :: acc => null(), nacc => null()
81 INTEGER :: move_type = -1
84 REAL(kind=
dp),
DIMENSION(:),
POINTER :: subbox_center => null()
85 REAL(kind=
dp),
DIMENSION(:),
POINTER :: pos => null()
86 INTEGER,
DIMENSION(:),
POINTER :: mol => null()
87 REAL(kind=
dp),
DIMENSION(:),
POINTER :: vel => null()
88 REAL(kind=
dp),
DIMENSION(:),
POINTER :: frc => null()
89 REAL(kind=
dp),
DIMENSION(:),
POINTER :: dipole => null()
90 INTEGER,
DIMENSION(:),
POINTER :: elem_stat => null()
92 REAL(kind=
dp),
DIMENSION(3, 2, 3) :: rng_seed = 0
94 INTEGER :: sub_tree_nr = -1
96 INTEGER :: temp_created = 0
98 INTEGER,
POINTER :: next_elem_nr => null()
100 REAL(kind=
dp),
DIMENSION(:),
POINTER :: box_scale => null()
101 REAL(kind=
dp) :: potential = 0.0_dp
103 REAL(kind=
dp) :: e_pot_approx = 0.0_dp
105 REAL(kind=
dp) :: ekin = 0.0_dp
107 REAL(kind=
dp) :: ekin_before_md = 0.0_dp
109 REAL(kind=
dp),
DIMENSION(4) :: scf_energies = 0.0_dp
111 INTEGER :: scf_energies_count = 0
114 TYPE(gt_elem_list_type),
POINTER :: gt_nodes_references => null()
118 TYPE gt_elem_list_type
119 TYPE(global_tree_type),
POINTER :: gt_elem => null()
120 TYPE(gt_elem_list_type),
POINTER :: next => null()
121 END TYPE gt_elem_list_type
124 TYPE(tree_type),
POINTER :: elem => null()
125 TYPE(elem_list_type),
POINTER :: next => null()
126 INTEGER :: temp_ind = 0
128 END TYPE elem_list_type
132 TYPE(tree_type),
POINTER :: elem => null()
133 LOGICAL :: busy = .false.
134 LOGICAL :: canceled = .false.
135 REAL(kind=
dp) :: start_time = 0.0_dp
136 END TYPE elem_array_type
139 TYPE global_tree_type
140 TYPE(global_tree_type),
POINTER :: parent => null()
143 TYPE(global_tree_type),
POINTER :: acc => null(), nacc => null()
145 INTEGER :: stat = -99
147 LOGICAL :: swaped = .false.
150 INTEGER :: mv_conf = -54321
152 INTEGER :: mv_next_conf = -2345
154 TYPE(elem_array_type),
DIMENSION(:),
ALLOCATABLE :: conf
159 LOGICAL,
DIMENSION(:),
ALLOCATABLE :: conf_n_acc
161 REAL(kind=
dp),
DIMENSION(3, 2, 3) :: rng_seed = 0.0_dp
163 REAL(kind=
dp) :: rnd_nr = 0.0_dp
165 REAL(kind=
dp) :: prob_acc = 0.0_dp
166 REAL(kind=
dp) :: temp = 0.0_dp
167 END TYPE global_tree_type
180 TYPE(tree_type),
POINTER :: elem
181 TYPE(elem_list_type),
POINTER ::
list
182 INTEGER,
OPTIONAL :: temp_ind, nr
184 TYPE(elem_list_type),
POINTER :: last, list_elem_tmp
186 NULLIFY (list_elem_tmp, last)
188 cpassert(
ASSOCIATED(elem))
190 ALLOCATE (list_elem_tmp)
191 list_elem_tmp%elem => elem
192 list_elem_tmp%next => null()
193 IF (
PRESENT(temp_ind))
THEN
194 list_elem_tmp%temp_ind = temp_ind
196 list_elem_tmp%temp_ind = -1
199 IF (
PRESENT(nr))
THEN
200 list_elem_tmp%nr = nr
202 list_elem_tmp%nr = -1
205 IF (
ASSOCIATED(
list) .EQV. .false.)
THEN
206 list => list_elem_tmp
209 DO WHILE (
ASSOCIATED(last%next))
212 last%next => list_elem_tmp
223 TYPE(elem_list_type),
POINTER ::
list
225 TYPE(elem_list_type),
POINTER :: list_elem_tmp
227 NULLIFY (list_elem_tmp)
229 DO WHILE (
ASSOCIATED(
list))
230 list_elem_tmp =>
list%next
232 list => list_elem_tmp
244 TYPE(tree_type),
POINTER :: elem
247 cpassert(
ASSOCIATED(elem))
248 cpassert(io_unit .GT. 0)
249 WRITE (io_unit) elem%nr, &
259 CALL write_subtree_elem_darray(elem%pos, io_unit)
260 CALL write_subtree_elem_darray(elem%vel, io_unit)
261 CALL write_subtree_elem_darray(elem%frc, io_unit)
262 CALL write_subtree_elem_darray(elem%box_scale, io_unit)
263 CALL write_subtree_elem_darray(elem%dipole, io_unit)
274 TYPE(tree_type),
POINTER :: elem
277 cpassert(
ASSOCIATED(elem))
278 cpassert(io_unit .GT. 0)
280 READ (io_unit) elem%nr, &
290 CALL read_subtree_elem_darray(elem%pos, io_unit)
291 CALL read_subtree_elem_darray(elem%vel, io_unit)
292 CALL read_subtree_elem_darray(elem%frc, io_unit)
293 CALL read_subtree_elem_darray(elem%box_scale, io_unit)
294 CALL read_subtree_elem_darray(elem%dipole, io_unit)
302 SUBROUTINE write_subtree_elem_darray(array, io_unit)
303 REAL(kind=
dp),
DIMENSION(:),
POINTER :: array
306 WRITE (io_unit)
ASSOCIATED(array)
307 IF (
ASSOCIATED(array))
THEN
308 WRITE (io_unit)
SIZE(array)
309 WRITE (io_unit) array
311 END SUBROUTINE write_subtree_elem_darray
318 SUBROUTINE read_subtree_elem_darray(array, io_unit)
319 REAL(kind=
dp),
DIMENSION(:),
POINTER :: array
328 IF (
ASSOCIATED(array))
THEN
329 cpassert(
SIZE(array) .EQ. i_tmp)
331 ALLOCATE (array(i_tmp))
335 END SUBROUTINE read_subtree_elem_darray
Defines the basic variable types.
integer, parameter, public dp
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
module handles definition of the tree nodes for the global and the subtrees binary tree parent elemen...
integer, parameter, public status_deleted
integer, parameter, public status_accepted
integer, parameter, public status_calculate_energy
integer, parameter, public status_calculate_md
subroutine, public add_to_list(elem, list, temp_ind, nr)
add a certain element to the specified element list at the beginning
subroutine, public read_subtree_elem_unformated(elem, io_unit)
reads the TMC sub tree structure element unformated in file
integer, parameter, public status_canceled_ener
integer, parameter, public status_proton_disorder
integer, parameter, public status_calculated
integer, parameter, public status_cancel_ener
integer, parameter, public status_cancel_nmc
integer, parameter, public status_canceled_nmc
subroutine, public clean_list(list)
clean a certain element element list
integer, parameter, public status_calc_approx_ener
integer, parameter, public status_ok
integer, parameter, public status_rejected
integer, parameter, public status_frozen
integer, parameter, public status_calculate_nmc_steps
subroutine, public write_subtree_elem_unformated(elem, io_unit)
prints out the TMC sub tree structure element unformated in file
integer, parameter, public status_accepted_result
integer, parameter, public status_deleted_result
integer, parameter, public status_created
integer, parameter, public status_rejected_result