46 #include "../base/base_uses.f90"
52 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'tmc_types'
54 PUBLIC :: tmc_env_type, tmc_comp_set_type, tmc_param_type
58 PUBLIC :: tmc_atom_type
63 TYPE(tmc_comp_set_type),
POINTER :: tmc_comp_set => null()
64 TYPE(tmc_param_type),
POINTER :: params => null()
65 TYPE(rng_stream_type),
ALLOCATABLE :: rng_stream
66 TYPE(master_env_type),
POINTER :: m_env => null()
67 TYPE(worker_env_type),
POINTER :: w_env => null()
74 TYPE tmc_comp_set_type
75 INTEGER :: group_ener_size = 0
76 INTEGER :: group_ener_nr = 0
77 INTEGER :: group_cc_size = 0
78 INTEGER :: group_cc_nr = 0
79 INTEGER :: group_nr = 0
80 INTEGER :: ana_on_the_fly = -1
82 TYPE(mp_para_env_type),
POINTER :: para_env_m_w => null()
83 TYPE(mp_para_env_type),
POINTER :: para_env_sub_group => null()
84 TYPE(mp_para_env_type),
POINTER :: para_env_m_first_w => null()
85 TYPE(mp_para_env_type),
POINTER :: para_env_m_ana => null()
86 TYPE(mp_para_env_type),
POINTER :: para_env_m_only => null()
87 END TYPE tmc_comp_set_type
92 INTEGER :: dim_per_elem = 3
93 INTEGER :: nr_temp = -1
94 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: temp => null()
95 TYPE(cell_type),
POINTER :: cell => null()
96 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: sub_box_size => null()
97 TYPE(tmc_atom_type),
DIMENSION(:),
POINTER :: atoms => null()
99 INTEGER :: nr_elem_mv = -1
100 TYPE(tmc_move_type),
POINTER :: move_types => null()
101 TYPE(tmc_move_type),
POINTER :: nmc_move_types => null()
102 REAL(KIND=
dp) :: pressure = 0.0_dp
103 LOGICAL :: v_isotropic = .false.
104 LOGICAL :: mv_cen_of_mass = .false.
105 LOGICAL :: esimate_acc_prob = .false.
106 LOGICAL :: SPECULATIVE_CANCELING = .false.
107 LOGICAL :: use_scf_energy_info = .false.
108 LOGICAL :: USE_REDUCED_TREE = .false.
109 CHARACTER(LEN=default_path_length) :: energy_inp_file =
""
110 CHARACTER(LEN=default_path_length) :: NMC_inp_file =
""
111 LOGICAL :: DRAW_TREE = .false.
112 CHARACTER(LEN=default_path_length) :: dot_file_name =
""
113 CHARACTER(LEN=default_path_length) :: all_conf_file_name =
""
114 LOGICAL :: print_only_diff_conf = .false.
115 LOGICAL :: print_trajectory = .false.
116 LOGICAL :: print_dipole = .false.
117 LOGICAL :: print_forces = .false.
118 LOGICAL :: print_cell = .false.
119 LOGICAL :: print_energies = .false.
120 TYPE(prior_estimate_acceptance_type),
POINTER :: prior_NMC_acc => null()
121 LOGICAL :: print_test_output = .false.
122 END TYPE tmc_param_type
125 CHARACTER(LEN=default_string_length) :: name =
""
126 REAL(KIND=
dp) :: mass = 0.0_dp
130 TYPE prior_estimate_acceptance_type
131 INTEGER :: counter = 0
132 REAL(KIND=
dp) :: aver = 0.0_dp, aver_2 = 0.0_dp
133 END TYPE prior_estimate_acceptance_type
137 INTEGER :: num_MC_elem = 0
138 CHARACTER(LEN=default_path_length) :: restart_in_file_name =
""
139 CHARACTER(LEN=default_path_length) :: restart_out_file_name =
""
140 INTEGER :: restart_out_step = 0
141 INTEGER :: io_unit = -1
142 INTEGER :: info_out_step_size = 0
143 REAL(KIND=
dp) :: walltime = 0.0_dp
144 INTEGER :: rnd_init = 0
145 REAL(KIND=
dp) :: temp_decrease = 0.0_dp
146 TYPE(elem_list_type),
POINTER :: cancelation_list => null()
147 INTEGER :: count_cancel_ener = 0
148 INTEGER :: count_cancel_NMC = 0
150 TYPE(global_tree_type),
POINTER :: gt_head => null(), gt_act => null()
151 INTEGER,
DIMENSION(:),
POINTER :: tree_node_count => null()
152 INTEGER,
DIMENSION(:),
POINTER :: result_count => null()
153 TYPE(elem_array_type),
DIMENSION(:), &
154 POINTER :: result_list => null(), &
155 st_heads => null(), &
156 st_clean_ends => null()
157 TYPE(global_tree_type),
POINTER :: gt_clean_end => null()
158 INTEGER,
DIMENSION(4) :: estim_corr_wrong = 0
159 TYPE(elem_list_type),
POINTER :: analysis_list => null()
160 END TYPE master_env_type
164 INTEGER :: env_id_ener = -1, env_id_approx = -1
165 INTEGER :: io_unit = -1
166 REAL(KIND=
dp) :: act_temp = 0.0_dp
167 END TYPE worker_env_type
177 TYPE(tmc_env_type),
POINTER :: tmc_env
179 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tmc_env_create'
183 CALL timeset(routinen, handle)
185 cpassert(.NOT.
ASSOCIATED(tmc_env))
189 ALLOCATE (tmc_env%tmc_comp_set)
192 ALLOCATE (tmc_env%params)
194 ALLOCATE (tmc_env%params%sub_box_size(tmc_env%params%dim_per_elem))
195 tmc_env%params%sub_box_size(:) = -1.0_dp
197 CALL timestop(handle)
207 TYPE(tmc_env_type),
POINTER :: tmc_env
209 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tmc_env_release'
213 CALL timeset(routinen, handle)
215 cpassert(
ASSOCIATED(tmc_env))
216 cpassert(
ASSOCIATED(tmc_env%params))
218 DEALLOCATE (tmc_env%params%sub_box_size)
219 IF (
ASSOCIATED(tmc_env%params%Temp)) &
220 DEALLOCATE (tmc_env%params%Temp)
221 IF (
ASSOCIATED(tmc_env%params%cell)) &
222 DEALLOCATE (tmc_env%params%cell)
223 IF (
ASSOCIATED(tmc_env%params%atoms)) &
224 CALL deallocate_tmc_atom_type(tmc_env%params%atoms)
225 DEALLOCATE (tmc_env%params)
229 IF (
ASSOCIATED(tmc_env%tmc_comp_set%para_env_m_first_w)) &
231 IF (
ASSOCIATED(tmc_env%tmc_comp_set%para_env_m_ana)) &
233 IF (
ASSOCIATED(tmc_env%tmc_comp_set%para_env_m_only)) &
236 DEALLOCATE (tmc_env%tmc_comp_set)
240 CALL timestop(handle)
250 TYPE(tmc_env_type),
POINTER :: tmc_env
252 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tmc_master_env_create'
256 CALL timeset(routinen, handle)
258 cpassert(
ASSOCIATED(tmc_env))
259 cpassert(
ASSOCIATED(tmc_env%params))
260 cpassert(tmc_env%params%nr_temp .GT. 0)
262 cpassert(.NOT.
ASSOCIATED(tmc_env%m_env))
264 ALLOCATE (tmc_env%m_env)
265 NULLIFY (tmc_env%m_env%gt_head, tmc_env%m_env%gt_act, tmc_env%m_env%tree_node_count, &
266 tmc_env%m_env%result_count, tmc_env%m_env%result_list, &
267 tmc_env%m_env%st_heads, tmc_env%m_env%st_clean_ends, &
268 tmc_env%m_env%gt_clean_end, tmc_env%m_env%cancelation_list, tmc_env%m_env%analysis_list)
270 tmc_env%m_env%restart_in_file_name =
""
271 tmc_env%m_env%restart_out_file_name =
""
272 ALLOCATE (tmc_env%m_env%tree_node_count(0:tmc_env%params%nr_temp))
273 tmc_env%m_env%tree_node_count(:) = 0
274 ALLOCATE (tmc_env%m_env%result_count(0:tmc_env%params%nr_temp))
275 tmc_env%m_env%result_count(:) = 0
276 ALLOCATE (tmc_env%m_env%st_heads(tmc_env%params%nr_temp))
277 ALLOCATE (tmc_env%m_env%st_clean_ends(tmc_env%params%nr_temp))
279 IF (tmc_env%params%USE_REDUCED_TREE)
ALLOCATE (tmc_env%m_env%result_list(tmc_env%params%nr_temp))
281 DO i = 1, tmc_env%params%nr_temp
282 tmc_env%m_env%st_heads(i)%elem => null()
283 tmc_env%m_env%st_clean_ends(i)%elem => null()
284 IF (tmc_env%params%USE_REDUCED_TREE) &
285 tmc_env%m_env%result_list(i)%elem => null()
287 tmc_env%m_env%gt_head => null()
288 tmc_env%m_env%gt_clean_end => null()
289 tmc_env%m_env%temp_decrease = 1.0_dp
290 tmc_env%m_env%count_cancel_ener = 0
291 tmc_env%m_env%count_cancel_NMC = 0
292 tmc_env%m_env%estim_corr_wrong(:) = 0
294 ALLOCATE (tmc_env%params%prior_NMC_acc)
295 tmc_env%params%prior_NMC_acc%counter = 0
296 tmc_env%params%prior_NMC_acc%aver = 0.0_dp
297 tmc_env%params%prior_NMC_acc%aver_2 = 0.0_dp
299 CALL timestop(handle)
309 TYPE(tmc_env_type),
POINTER :: tmc_env
311 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tmc_master_env_release'
315 CALL timeset(routinen, handle)
317 cpassert(
ASSOCIATED(tmc_env))
318 cpassert(
ASSOCIATED(tmc_env%m_env))
321 CALL clean_list(tmc_env%m_env%cancelation_list)
323 DEALLOCATE (tmc_env%m_env%tree_node_count)
324 DEALLOCATE (tmc_env%m_env%result_count)
325 DEALLOCATE (tmc_env%m_env%st_heads)
326 DEALLOCATE (tmc_env%m_env%st_clean_ends)
327 IF (tmc_env%params%USE_REDUCED_TREE)
DEALLOCATE (tmc_env%m_env%result_list)
328 DEALLOCATE (tmc_env%params%prior_NMC_acc)
330 DEALLOCATE (tmc_env%m_env)
332 CALL timestop(handle)
342 TYPE(tmc_env_type),
POINTER :: tmc_env
344 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tmc_worker_env_create'
348 CALL timeset(routinen, handle)
350 cpassert(
ASSOCIATED(tmc_env))
351 cpassert(.NOT.
ASSOCIATED(tmc_env%w_env))
353 ALLOCATE (tmc_env%w_env)
355 tmc_env%w_env%env_id_ener = -1
356 tmc_env%w_env%env_id_approx = -1
357 tmc_env%w_env%io_unit = -1
358 tmc_env%w_env%act_temp = -1.0_dp
360 CALL timestop(handle)
370 TYPE(tmc_env_type),
POINTER :: tmc_env
372 CHARACTER(LEN=*),
PARAMETER :: routinen =
'tmc_worker_env_release'
376 CALL timeset(routinen, handle)
378 cpassert(
ASSOCIATED(tmc_env))
379 cpassert(
ASSOCIATED(tmc_env%w_env))
381 DEALLOCATE (tmc_env%w_env)
383 CALL timestop(handle)
394 TYPE(tmc_atom_type),
DIMENSION(:),
POINTER :: atoms
395 INTEGER,
INTENT(IN) :: nr_atoms
397 cpassert(.NOT.
ASSOCIATED(atoms))
398 cpassert(nr_atoms .GT. 0)
400 ALLOCATE (atoms(nr_atoms))
402 cpassert(
ASSOCIATED(atoms))
411 SUBROUTINE deallocate_tmc_atom_type(atoms)
412 TYPE(tmc_atom_type),
DIMENSION(:),
POINTER :: atoms
414 cpassert(
ASSOCIATED(atoms))
418 cpassert(.NOT.
ASSOCIATED(atoms))
419 END SUBROUTINE deallocate_tmc_atom_type
Handles all functions related to the CELL.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
Parallel (pseudo)random number generator (RNG) for multiple streams and substreams of random numbers.
tree nodes creation, searching, deallocation, references etc.
tree nodes creation, searching, deallocation, references etc.
integer, parameter, public task_type_mc
module handles definition of the tree nodes for the global and the subtrees binary tree parent elemen...
subroutine, public clean_list(list)
clean a certain element element list
module handles definition of the tree nodes for the global and the subtrees binary tree parent elemen...
subroutine, public allocate_tmc_atom_type(atoms, nr_atoms)
creates a structure for storing the atom informations
subroutine, public tmc_env_release(tmc_env)
releases the structure environment for TMC
subroutine, public tmc_worker_env_create(tmc_env)
creates a new structure environment for TMC master
subroutine, public tmc_master_env_create(tmc_env)
creates a new structure environment for TMC master
subroutine, public tmc_master_env_release(tmc_env)
releases the structure environment for TMC master
subroutine, public tmc_worker_env_release(tmc_env)
releases the structure environment for TMC master
subroutine, public tmc_env_create(tmc_env)
creates a new structure environment for TMC