(git:d3d49ac)
Loading...
Searching...
No Matches
tmc_master.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief module contains the master routine handling the tree creation,
10!> communication with workers and task distribution
11!> For each idle working group the master creates a new global tree
12!> element, and if neccessay a related sub tree element,
13!> OR find the next element to calculate the exact energy.
14!> Goal is to keep at least the exact energy calculation working groups
15!> as busy as possible.
16!> Master also checks for incomming results and update the tree and the
17!> acceptance ratios.
18!> \par History
19!> 11.2012 created [Mandes Schoenherr]
20!> \author Mandes
21! **************************************************************************************************
22
24 USE cell_methods, ONLY: init_cell
28 USE kinds, ONLY: dp,&
29 int_8
30 USE machine, ONLY: m_flush,&
31 m_memory,&
43 recv_msg,&
44 send_msg,&
47 USE tmc_move_handle, ONLY: check_moves,&
49 USE tmc_stati, ONLY: &
68 USE tmc_tree_types, ONLY: &
73 USE tmc_types, ONLY: tmc_env_type
74#include "../base/base_uses.f90"
75
76 IMPLICIT NONE
77
78 PRIVATE
79
80 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'tmc_master'
81
82 PUBLIC :: do_tmc_master
83
84 INTEGER, PARAMETER :: DEBUG = 0
85
86CONTAINS
87
88! **************************************************************************************************
89!> \brief send cancel request to all workers processing elements in the list
90!> \param cancel_list list with elements to cancel
91!> \param work_list list with all elements processed by working groups
92!> \param cancel_count counter of canceled elements
93!> \param para_env communication environment
94!> \param tmc_env ...
95!> \author Mandes 12.2012
96! **************************************************************************************************
97 SUBROUTINE cancel_calculations(cancel_list, work_list, cancel_count, &
98 para_env, tmc_env)
99 TYPE(elem_list_type), POINTER :: cancel_list
100 TYPE(elem_array_type), DIMENSION(:), POINTER :: work_list
101 INTEGER :: cancel_count
102 TYPE(mp_para_env_type), POINTER :: para_env
103 TYPE(tmc_env_type), POINTER :: tmc_env
104
105 INTEGER :: i, stat, wg
106 TYPE(elem_list_type), POINTER :: tmp_element
107
108 IF (.NOT. ASSOCIATED(cancel_list)) RETURN
109 NULLIFY (tmp_element)
110
111 cpassert(ASSOCIATED(tmc_env))
112 cpassert(ASSOCIATED(tmc_env%params))
113 cpassert(ASSOCIATED(tmc_env%m_env))
114 cpassert(ASSOCIATED(work_list))
115 cpassert(ASSOCIATED(para_env))
116
117 stat = tmc_status_failed
118 wg = -1
119 cancel_elem_loop: DO
120 ! find certain working group calculating this element
121 working_elem_loop: DO i = 1, SIZE(work_list)
122 ! in special cases element could be distributed to several working groups,
123 ! but all, except of one, should already be in canceling process
124 IF ((.NOT. work_list(i)%canceled) .AND. &
125 ASSOCIATED(work_list(i)%elem)) THEN
126 IF (ASSOCIATED(cancel_list%elem, work_list(i)%elem)) THEN
128 wg = i
129 EXIT working_elem_loop
130 END IF
131 END IF
132 END DO working_elem_loop
133
134 cpassert(wg >= 0)
135 cpassert(stat /= tmc_status_failed)
136 cpassert(work_list(wg)%elem%stat /= status_calc_approx_ener)
137
138 IF (debug >= 1) THEN
139 WRITE (tmc_env%m_env%io_unit, *) &
140 "TMC|master: cancel group "//cp_to_string(wg)
141 END IF
142 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
143 para_env=para_env, tmc_params=tmc_env%params)
144 work_list(wg)%canceled = .true.
145
146 ! counting the amount of canceled elements
147 cancel_count = cancel_count + 1
148
149 ! delete element from canceling list
150 IF (.NOT. ASSOCIATED(cancel_list%next)) THEN
151 DEALLOCATE (cancel_list)
152 cancel_list => null()
153 EXIT cancel_elem_loop
154 ELSE
155 tmp_element => cancel_list%next
156 DEALLOCATE (cancel_list)
157 cancel_list => tmp_element
158 END IF
159 END DO cancel_elem_loop
160 END SUBROUTINE cancel_calculations
161
162! **************************************************************************************************
163!> \brief send analysis request to a worker
164!> \param ana_list list with elements to be analysed
165!> \param ana_worker_info ...
166!> \param para_env communication environment
167!> \param tmc_env ...
168!> \author Mandes 12.2012
169! **************************************************************************************************
170 SUBROUTINE send_analysis_tasks(ana_list, ana_worker_info, para_env, tmc_env)
171 TYPE(elem_list_type), POINTER :: ana_list
172 TYPE(elem_array_type), DIMENSION(:), POINTER :: ana_worker_info
173 TYPE(mp_para_env_type), POINTER :: para_env
174 TYPE(tmc_env_type), POINTER :: tmc_env
175
176 INTEGER :: dest, stat, wg
177 TYPE(elem_list_type), POINTER :: list_tmp
178
179 NULLIFY (list_tmp)
180
181 cpassert(ASSOCIATED(ana_worker_info))
182 cpassert(ASSOCIATED(para_env))
183
184 wg_loop: DO wg = 1, SIZE(ana_worker_info)
185 IF (.NOT. ASSOCIATED(ana_list)) EXIT wg_loop
186 IF (.NOT. ana_worker_info(wg)%busy) THEN
188 dest = wg
189 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=dest, &
190 para_env=para_env, tmc_params=tmc_env%params, &
191 list_elem=ana_list)
192 IF (.NOT. ASSOCIATED(ana_list%next)) THEN
193 DEALLOCATE (ana_list)
194 ana_list => null()
195 ELSE
196 list_tmp => ana_list%next
197 DEALLOCATE (ana_list)
198 ana_list => list_tmp
199 END IF
200 END IF
201 END DO wg_loop
202 END SUBROUTINE send_analysis_tasks
203
204! **************************************************************************************************
205!> \brief global master handling tree creation and communication/work
206!> distribution with workers
207!> \param tmc_env structure for storing all the tmc parameters
208!> \param globenv global environment for external control
209!> \author Mandes 11.2012
210! **************************************************************************************************
211 SUBROUTINE do_tmc_master(tmc_env, globenv)
212 TYPE(tmc_env_type), POINTER :: tmc_env
213 TYPE(global_environment_type), POINTER :: globenv
214
215 CHARACTER(LEN=*), PARAMETER :: routinen = 'do_tmc_master'
216
217 INTEGER :: cancel_count, handle, last_output, reactivation_cc_count, &
218 reactivation_ener_count, restart_count, restarted_elem_nr, stat, walltime_delay, &
219 walltime_offset, wg, worker_counter
220 INTEGER(KIND=int_8) :: mem
221 INTEGER, DIMENSION(6) :: nr_of_job
222 INTEGER, DIMENSION(:), POINTER :: tree_elem_counters, tree_elem_heads
223 LOGICAL :: external_stop, flag, l_update_tree
224 REAL(kind=dp) :: run_time_start
225 REAL(kind=dp), DIMENSION(4) :: worker_timings_aver
226 REAL(kind=dp), DIMENSION(:), POINTER :: efficiency
227 TYPE(elem_array_type), DIMENSION(:), POINTER :: ana_worker_info, worker_info
228 TYPE(global_tree_type), POINTER :: gt_elem_tmp
229 TYPE(tree_type), POINTER :: init_conf
230
231 external_stop = .false.
232 restarted_elem_nr = 0
233 NULLIFY (init_conf, worker_info, ana_worker_info, gt_elem_tmp, tree_elem_counters)
234
235 cpassert(ASSOCIATED(tmc_env))
236
237 cpassert(tmc_env%tmc_comp_set%group_nr == 0)
238 cpassert(ASSOCIATED(tmc_env%tmc_comp_set))
239 cpassert(ASSOCIATED(tmc_env%tmc_comp_set%para_env_m_w))
240
241 cpassert(ASSOCIATED(tmc_env%m_env))
242
243 !-- run time measurment, to end just in time
244 ! start the timing
245 CALL timeset(routinen, handle)
246 run_time_start = m_walltime()
247 walltime_delay = 0
248 walltime_offset = 20 ! default value the whole program needs to finalize
249
250 ! initialize the different modules
251 IF (tmc_env%params%DRAW_TREE) THEN
252 CALL init_draw_trees(tmc_params=tmc_env%params)
253 END IF
254
255 !-- initialize variables
256 ! nr_of_job: counting the different task send / received
257 ! (1:NMC submitted, 2:energies submitted, 3:NMC finished 4:energy finished, 5:NMC canceled, 6:energy canceled)
258 nr_of_job(:) = 0
259 worker_counter = -1
260 reactivation_ener_count = 0
261 reactivation_cc_count = 0
262 cancel_count = 0
263 tmc_env%m_env%result_count = 0
264 l_update_tree = .false.
265 restart_count = 1
266 last_output = -1
267 ! average timings
268 ! (1:calculated NMC, 2:calculated ener, 3:canceled NMC, 4: canceled ener)
269 worker_timings_aver(:) = 0.0_dp
270 ! remembers state of workers and their actual configurations
271 ! the actual working group, communicating with
272 ALLOCATE (worker_info(tmc_env%tmc_comp_set%para_env_m_w%num_pe - 1))
273 ALLOCATE (ana_worker_info(tmc_env%tmc_comp_set%para_env_m_ana%num_pe - 1))
274
275 ! get the start configuration form the first (exact energy) worker,
276 ! master should/could have no Force environment
278 wg = 1
279 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
280 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
281 tmc_params=tmc_env%params, &
282 wait_for_message=.true.)
283 !-- wait for start configuration results and number of dimensions
284 !-- get start configuration (init_conf element should not be allocated already)
285 CALL tmc_message(msg_type=stat, send_recv=recv_msg, dest=wg, &
286 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
287 tmc_params=tmc_env%params, &
288 elem=init_conf, success=flag, wait_for_message=.true.)
289 IF (stat /= tmc_stat_start_conf_result) THEN
290 CALL cp_abort(__location__, &
291 "receiving start configuration failed, received stat "// &
292 cp_to_string(stat))
293 END IF
294 ! get the atom names from first energy worker
295 CALL communicate_atom_types(atoms=tmc_env%params%atoms, &
296 source=1, &
297 para_env=tmc_env%tmc_comp_set%para_env_m_first_w)
298
299 CALL init_cell(cell=tmc_env%params%cell)
300
301 ! check the configuration consitency with selected moves
302 CALL check_moves(tmc_params=tmc_env%params, &
303 move_types=tmc_env%params%move_types, &
304 mol_array=init_conf%mol)
305 IF (ASSOCIATED(tmc_env%params%nmc_move_types)) THEN
306 CALL check_moves(tmc_params=tmc_env%params, &
307 move_types=tmc_env%params%nmc_move_types, &
308 mol_array=init_conf%mol)
309 END IF
310
311 ! set initial configuration
312 ! set initial random number generator seed (rng seed)
313 ! initialize the tree structure espacially for parallel tmepering,
314 ! seting the subtrees
315 CALL init_tree_mod(start_elem=init_conf, tmc_env=tmc_env, &
316 job_counts=nr_of_job, &
317 worker_timings=worker_timings_aver)
318
319 ! init restart counter (espacially for restart case)
320 IF (tmc_env%m_env%restart_out_step /= 0) THEN
321 restart_count = int(tmc_env%m_env%result_count(0)/ &
322 REAL(tmc_env%m_env%restart_out_step, kind=dp)) + 1
323 END IF
324 restarted_elem_nr = tmc_env%m_env%result_count(0)
325
326!TODO check conf and cell of both input files (cell has to be equal,
327! because it is used as reference cell for scaling the cell)
328 ! communicate the reference cell size
329 DO wg = 1, tmc_env%tmc_comp_set%para_env_m_w%num_pe - 1
331 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
332 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
333 tmc_params=tmc_env%params)
334 END DO
335
336 ! send the atom informations to all analysis workers
337 IF (tmc_env%tmc_comp_set%para_env_m_ana%num_pe > 1) THEN
338 DO wg = 1, tmc_env%tmc_comp_set%para_env_m_ana%num_pe - 1
340 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
341 para_env=tmc_env%tmc_comp_set%para_env_m_ana, &
342 result_count=tmc_env%m_env%result_count, &
343 tmc_params=tmc_env%params, &
344 elem=init_conf, &
345 wait_for_message=.true.)
346 END DO
347 CALL communicate_atom_types(atoms=tmc_env%params%atoms, &
348 source=0, &
349 para_env=tmc_env%tmc_comp_set%para_env_m_ana)
350 END IF
351
352 CALL deallocate_sub_tree_node(tree_elem=init_conf)
353
354 ! regtest output
355 IF (tmc_env%params%print_test_output .OR. debug > 0) THEN
356 WRITE (tmc_env%m_env%io_unit, *) "TMC|first_global_tree_rnd_nr_X= ", &
357 tmc_env%m_env%gt_head%rnd_nr
358 END IF
359
360 ! calculate the approx energy of the first element (later the exact)
361 IF (tmc_env%m_env%gt_head%conf(1)%elem%stat == status_calc_approx_ener) THEN
362 wg = 1
363 IF (tmc_env%tmc_comp_set%group_cc_nr > 0) THEN
364 wg = tmc_env%tmc_comp_set%group_ener_nr + 1
365 END IF
367 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
368 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
369 tmc_params=tmc_env%params, &
370 elem=tmc_env%m_env%gt_head%conf(1)%elem)
371 worker_info(wg)%busy = .true.
372 worker_info(wg)%elem => tmc_env%m_env%gt_head%conf(1)%elem
373 init_conf => tmc_env%m_env%gt_head%conf(1)%elem
374 ELSE IF (tmc_env%m_env%gt_head%conf(1)%elem%stat == status_created) THEN
375 init_conf => tmc_env%m_env%gt_head%conf(1)%elem
376 ! calculation will be done automatically,
377 ! by searching the next conf for energy calculation
378 END IF
379 !-- START WORK --!
380 !-- distributing work:
381 ! 1. receive incoming results
382 ! 2. check new results in tree
383 ! 3. if idle worker, create new tree element and send them to worker
384 task_loop: DO
385 ! =======================================================================
386 !-- RECEIVING ALL incoming messages and handling them
387 ! results of tree node 1 is distributed to all other subtree nodes
388 ! =======================================================================
389 worker_request_loop: DO
390 wg = 1
391 flag = .false.
392 CALL tmc_message(msg_type=stat, send_recv=recv_msg, dest=wg, &
393 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
394 tmc_params=tmc_env%params, &
395 elem_array=worker_info(:), success=flag)
396
397 IF (flag .EQV. .false.) EXIT worker_request_loop
398 ! messages from worker group could be faster then the canceling request
399 IF (worker_info(wg)%canceled .AND. (stat /= tmc_canceling_receipt)) THEN
400 IF (debug >= 1) THEN
401 WRITE (tmc_env%m_env%io_unit, *) &
402 "TMC|master: recv stat "//cp_to_string(stat)// &
403 " of canceled worker group"
404 END IF
405 cycle worker_request_loop
406 END IF
407
408 ! in case of parallel tempering canceled element could be reactivated,
409 ! calculated faster and deleted
410 IF (.NOT. ASSOCIATED(worker_info(wg)%elem)) THEN
411 CALL cp_abort(__location__, &
412 "no tree elem exist when receiving stat "// &
413 cp_to_string(stat)//"of group"//cp_to_string(wg))
414 END IF
415
416 IF (debug >= 1) THEN
417 WRITE (tmc_env%m_env%io_unit, *) &
418 "TMC|master: received stat "//cp_to_string(stat)// &
419 " of sub tree "//cp_to_string(worker_info(wg)%elem%sub_tree_nr)// &
420 " elem"//cp_to_string(worker_info(wg)%elem%nr)// &
421 " with stat"//cp_to_string(worker_info(wg)%elem%stat)// &
422 " of group"//cp_to_string(wg)//" group canceled ", worker_info(wg)%canceled
423 END IF
424 SELECT CASE (stat)
425 ! -- FAILED --------------------------
426 CASE (tmc_status_failed)
427 EXIT task_loop
428 ! -- CANCEL_RECEIPT ------------------
430 ! worker should got cancel message before
431 cpassert(worker_info(wg)%canceled)
432 worker_info(wg)%canceled = .false.
433 worker_info(wg)%busy = .false.
434
435 IF (ASSOCIATED(worker_info(wg)%elem)) THEN
436 SELECT CASE (worker_info(wg)%elem%stat)
437 CASE (status_cancel_ener)
438 !-- timings
439 worker_timings_aver(4) = (worker_timings_aver(4)*nr_of_job(6) + &
440 (m_walltime() - worker_info(wg)%start_time))/real(nr_of_job(6) + 1, kind=dp)
441 nr_of_job(6) = nr_of_job(6) + 1
442
443 worker_info(wg)%elem%stat = status_canceled_ener
444 worker_info(wg)%elem%potential = 8000.0_dp
445 IF (tmc_env%params%DRAW_TREE) THEN
446 CALL create_dot_color(tree_element=worker_info(wg)%elem, &
447 tmc_params=tmc_env%params)
448 END IF
449 CASE (status_cancel_nmc)
450 !-- timings
451 worker_timings_aver(3) = (worker_timings_aver(3)*nr_of_job(5) + &
452 (m_walltime() - worker_info(wg)%start_time))/real(nr_of_job(5) + 1, kind=dp)
453 nr_of_job(5) = nr_of_job(5) + 1
454
455 worker_info(wg)%elem%stat = status_canceled_nmc
456 worker_info(wg)%elem%potential = 8000.0_dp
457 IF (tmc_env%params%DRAW_TREE) THEN
458 CALL create_dot_color(tree_element=worker_info(wg)%elem, &
459 tmc_params=tmc_env%params)
460 END IF
461 CASE DEFAULT
462 ! the subtree element is again in use (reactivated)
463 END SELECT
464 worker_info(wg)%elem => null()
465 END IF
466 ! -- START_CONF_RESULT ---------------
468 ! start configuration should already be handeled
469 cpabort("TMC_STAT_START_CONF_RESULT is invalid")
470 ! -- ENERGY RESULT -----------------
472 nr_of_job(3) = nr_of_job(3) + 1
473 worker_info(wg)%busy = .false.
474 worker_info(wg)%elem%stat = status_created
475 IF (tmc_env%params%DRAW_TREE) THEN
476 CALL create_dot_color(tree_element=worker_info(wg)%elem, &
477 tmc_params=tmc_env%params)
478 END IF
479 worker_info(wg)%elem => null()
480 ! nothing to do, the approximate potential
481 ! should be updated in the message interface
482 ! -- NMC / MD RESULT -----------------
484 IF (.NOT. worker_info(wg)%canceled) worker_info(wg)%busy = .false.
485 !-- timings for Nested Monte Carlo calculation
486 worker_timings_aver(1) = (worker_timings_aver(1)*nr_of_job(3) + &
487 (m_walltime() - worker_info(wg)%start_time))/real(nr_of_job(3) + 1, kind=dp)
488 nr_of_job(3) = nr_of_job(3) + 1
489
490 worker_info(wg)%start_time = m_walltime() - worker_info(wg)%start_time
491 CALL set_walltime_delay(worker_info(wg)%start_time, walltime_delay)
492 worker_info(wg)%elem%stat = status_created
493 IF (tmc_env%params%DRAW_TREE) THEN
494 CALL create_dot_color(tree_element=worker_info(wg)%elem, &
495 tmc_params=tmc_env%params)
496 END IF
497 !-- send energy request
498 ! in case of one singe input file, energy is already calculated
499 IF (tmc_env%params%NMC_inp_file == "") THEN
500 worker_info(wg)%elem%potential = worker_info(wg)%elem%e_pot_approx
501 worker_info(wg)%elem%stat = status_calculated
502 ! check acceptance of depending nodes
503 IF (.NOT. (ASSOCIATED(worker_info(wg)%elem, init_conf))) THEN
504 CALL check_acceptance_of_depending_subtree_nodes(tree_elem=worker_info(wg)%elem, &
505 tmc_env=tmc_env)
506 END IF
507 IF (tmc_env%params%DRAW_TREE) THEN
508 CALL create_dot_color(tree_element=worker_info(wg)%elem, &
509 tmc_params=tmc_env%params)
510 END IF
511 !-- CANCELING the calculations of the elements, which are definetively not needed anymore
512 CALL cancel_calculations(cancel_list=tmc_env%m_env%cancelation_list, &
513 work_list=worker_info, &
514 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
515 tmc_env=tmc_env, &
516 cancel_count=cancel_count)
517 worker_info(wg)%elem => null()
518 ELSE
519 ! if all working groups are equal, the same group calculates the energy
520 IF (tmc_env%tmc_comp_set%group_cc_nr <= 0 &
521 .AND. (.NOT. worker_info(wg)%canceled)) THEN
522 worker_info(wg)%elem%stat = status_calculate_energy
524 ! immediately send energy request
525 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
526 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
527 tmc_params=tmc_env%params, &
528 elem=worker_info(wg)%elem)
529 worker_info(wg)%busy = .true.
530 nr_of_job(2) = nr_of_job(2) + 1
531 IF (tmc_env%params%DRAW_TREE) THEN
532 CALL create_dot_color(tree_element=worker_info(wg)%elem, &
533 tmc_params=tmc_env%params)
534 END IF
535 !-- set start time for energy calculation
536 worker_info(wg)%start_time = m_walltime()
537 ELSE
538 worker_info(wg)%elem => null()
539 END IF
540 END IF
541 ! -- ENERGY RESULT --------------------
543 !-- timings
544 worker_timings_aver(2) = (worker_timings_aver(2)*nr_of_job(4) + &
545 (m_walltime() - worker_info(wg)%start_time))/real(nr_of_job(4) + 1, kind=dp)
546 nr_of_job(4) = nr_of_job(4) + 1
547
548 worker_info(wg)%start_time = m_walltime() - worker_info(wg)%start_time
549 CALL set_walltime_delay(worker_info(wg)%start_time, walltime_delay)
550
551 IF (.NOT. worker_info(wg)%canceled) THEN
552 worker_info(wg)%busy = .false.
553 END IF
554 ! the first node in tree is always accepted.!.
555 IF (ASSOCIATED(worker_info(wg)%elem, init_conf)) THEN
556 !-- distribute energy of first element to all subtrees
557 CALL finalize_init(gt_tree_ptr=tmc_env%m_env%gt_head, &
558 tmc_env=tmc_env)
559 IF (tmc_env%params%DRAW_TREE) THEN
560 CALL create_global_tree_dot_color(gt_tree_element=tmc_env%m_env%gt_act, &
561 tmc_params=tmc_env%params)
562 CALL create_dot_color(tree_element=worker_info(wg)%elem, &
563 tmc_params=tmc_env%params)
564 END IF
565 init_conf => null()
566 ELSE
567 worker_info(wg)%elem%stat = status_calculated
568 IF (tmc_env%params%DRAW_TREE) THEN
569 CALL create_dot_color(worker_info(wg)%elem, &
570 tmc_params=tmc_env%params)
571 END IF
572 ! check acceptance of depending nodes
573 ! first (initial) configuration do not have to be checked
574 CALL check_acceptance_of_depending_subtree_nodes(tree_elem=worker_info(wg)%elem, &
575 tmc_env=tmc_env)
576 END IF
577 !-- write out all configurations (not only Markov Chain) e.g. for fitting
578 IF (tmc_env%params%all_conf_file_name /= "") THEN
579 CALL write_element_in_file(elem=worker_info(wg)%elem, &
580 file_name=tmc_env%params%all_conf_file_name, &
581 tmc_params=tmc_env%params, &
582 conf_nr=nr_of_job(4))
583 END IF
584
585 !-- CANCELING the calculations of the elements,
586 ! which are definetively not needed anymore
587 CALL cancel_calculations(cancel_list=tmc_env%m_env%cancelation_list, &
588 work_list=worker_info, &
589 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
590 tmc_env=tmc_env, &
591 cancel_count=cancel_count)
592 IF (debug >= 9) THEN
593 WRITE (tmc_env%m_env%io_unit, *) &
594 "TMC|master: handled energy result of sub tree ", &
595 worker_info(wg)%elem%sub_tree_nr, " elem ", worker_info(wg)%elem%nr, &
596 " with stat", worker_info(wg)%elem%stat
597 END IF
598 worker_info(wg)%elem => null()
599
600 !-- SCF ENERGY -----------------------
602 IF (.NOT. (ASSOCIATED(worker_info(wg)%elem, init_conf)) .AND. &
603 worker_info(wg)%elem%stat /= status_cancel_ener .AND. &
604 worker_info(wg)%elem%stat /= status_cancel_nmc) THEN
605 ! update the acceptance probability and the canceling list
606 CALL check_elements_for_acc_prob_update(tree_elem=worker_info(wg)%elem, &
607 tmc_env=tmc_env)
608 END IF
609 ! cancel inlikely elements
610 CALL cancel_calculations(cancel_list=tmc_env%m_env%cancelation_list, &
611 work_list=worker_info, &
612 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
613 tmc_env=tmc_env, &
614 cancel_count=cancel_count)
616 ana_worker_info(wg)%busy = .false.
617 ana_worker_info(wg)%elem => null()
618 CASE DEFAULT
619 cpabort("received message with unknown info/stat type")
620 END SELECT
621 END DO worker_request_loop
622 !-- do tree update (check new results)
623 CALL tree_update(tmc_env=tmc_env, result_acc=flag, &
624 something_updated=l_update_tree)
625 IF (debug >= 2 .AND. l_update_tree) THEN
626 WRITE (tmc_env%m_env%io_unit, *) &
627 "TMC|master: tree updated "//cp_to_string(l_update_tree)// &
628 " of with gt elem "//cp_to_string(tmc_env%m_env%gt_act%nr)// &
629 " with stat"//cp_to_string(tmc_env%m_env%gt_act%stat)
630 END IF
631
632 CALL send_analysis_tasks(ana_list=tmc_env%m_env%analysis_list, &
633 ana_worker_info=ana_worker_info, &
634 para_env=tmc_env%tmc_comp_set%para_env_m_ana, &
635 tmc_env=tmc_env)
636
637 ! =======================================================================
638 !-- ALL CALCULATIONS DONE (check) ---
639 ! =======================================================================
640 ! if enough configurations are sampled or walltime is exeeded,
641 ! finish building trees
642!TODO set correct logger para_env to use this
643 CALL external_control(should_stop=external_stop, flag="TMC", globenv=globenv)
644 IF ((any(tmc_env%m_env%result_count(1:) >= tmc_env%m_env%num_MC_elem) &
645 .AND. flag) .OR. &
646 (m_walltime() - run_time_start > &
647 tmc_env%m_env%walltime - walltime_delay - walltime_offset) .OR. &
648 external_stop) THEN
649 WRITE (tmc_env%m_env%io_unit, fmt="(/,T2,A)") repeat("=", 79)
650 ! calculations NOT finished, walltime exceeded
651 IF (.NOT. any(tmc_env%m_env%result_count(1:) &
652 >= tmc_env%m_env%num_MC_elem)) THEN
653 WRITE (tmc_env%m_env%io_unit, *) "Walltime exceeded.", &
654 m_walltime() - run_time_start, " of ", tmc_env%m_env%walltime - walltime_delay - walltime_offset, &
655 "(incl. delay", walltime_delay, "and offset", walltime_offset, ") left"
656 ELSE
657 ! calculations finished
658 IF (tmc_env%params%print_test_output) THEN
659 WRITE (tmc_env%m_env%io_unit, *) "Total energy: ", &
660 tmc_env%m_env%result_list(1)%elem%potential
661 END IF
662 END IF
663 IF (tmc_env%m_env%restart_out_step /= 0) THEN
664 CALL print_restart_file(tmc_env=tmc_env, job_counts=nr_of_job, &
665 timings=worker_timings_aver)
666 END IF
667 EXIT task_loop
668 END IF
669
670 ! =======================================================================
671 ! update the rest of the tree (canceling and deleting elements)
672 ! =======================================================================
673 IF (l_update_tree) THEN
674 IF (debug >= 2) THEN
675 WRITE (tmc_env%m_env%io_unit, *) &
676 "TMC|master: start remove elem and cancel calculation"
677 END IF
678 !-- CLEANING tree nodes beside the path through the tree from
679 ! end_of_clean_tree to tree_ptr
680 ! --> getting back the end of clean tree
681 CALL remove_all_trees(working_elem_list=worker_info, tmc_env=tmc_env)
682 !-- CANCELING the calculations of the elements,
683 ! which are definetively not needed anymore
684 ! elements are added to canceling list if no global tree reference
685 ! exist anymore
686 CALL cancel_calculations(cancel_list=tmc_env%m_env%cancelation_list, &
687 work_list=worker_info, &
688 cancel_count=cancel_count, &
689 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
690 tmc_env=tmc_env)
691 END IF
692
693 ! =====================================================================
694 !-- NEW TASK (if worker not busy submit next task)
695 ! =====================================================================
696 worker_counter = worker_counter + 1
697 wg = modulo(worker_counter, tmc_env%tmc_comp_set%para_env_m_w%num_pe - 1) + 1
698
699 IF (debug >= 16 .AND. all(worker_info(:)%busy)) THEN
700 WRITE (tmc_env%m_env%io_unit, *) "all workers are busy"
701 END IF
702
703 IF (.NOT. worker_info(wg)%busy) THEN
704 IF (debug >= 13) THEN
705 WRITE (tmc_env%m_env%io_unit, *) &
706 "TMC|master: search new task for worker ", wg
707 END IF
708 ! no group separation
709 IF (tmc_env%tmc_comp_set%group_cc_nr <= 0) THEN
710 ! search next element to calculate the energy
711 CALL search_next_energy_calc(gt_head=tmc_env%m_env%gt_act, &
712 new_gt_elem=gt_elem_tmp, stat=stat, &
713 react_count=reactivation_ener_count)
714 IF (stat == tmc_status_wait_for_new_task) THEN
715 CALL create_new_gt_tree_node(tmc_env=tmc_env, stat=stat, &
716 new_elem=gt_elem_tmp, &
717 reactivation_cc_count=reactivation_cc_count)
718 END IF
719 ELSE IF (wg > tmc_env%tmc_comp_set%group_ener_nr) THEN
720 ! specialized groups (groups for exact energy and groups for configurational change)
721 ! creating new element (configurational change group)
722 !-- crate new node, configurational change is handled in tmc_tree module
723 CALL create_new_gt_tree_node(tmc_env=tmc_env, stat=stat, &
724 new_elem=gt_elem_tmp, &
725 reactivation_cc_count=reactivation_cc_count)
726 ! element could be already created, hence CC worker has nothing to do for this element
727 ! in next round he will get a task
728 IF (stat == status_created .OR. stat == status_calculate_energy) THEN
730 END IF
731 ELSE
732 ! search next element to calculate the energy
733 CALL search_next_energy_calc(gt_head=tmc_env%m_env%gt_act, &
734 new_gt_elem=gt_elem_tmp, stat=stat, &
735 react_count=reactivation_ener_count)
736 END IF
737
738 IF (debug >= 10) THEN
739 WRITE (tmc_env%m_env%io_unit, *) &
740 "TMC|master: send task with elem stat "//cp_to_string(stat)// &
741 " to group "//cp_to_string(wg)
742 END IF
743 ! MESSAGE settings: status informations and task for communication
744 SELECT CASE (stat)
746 cycle task_loop
747 CASE (tmc_status_failed)
748 !STOP "in creating new task, status failed should be handled before"
749 cycle task_loop
751 cycle task_loop
753 ! e.g. after volume move, we need the approximate potential for 2 potential check of following NMC nodes
755 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
756 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
757 tmc_params=tmc_env%params, &
758 elem=gt_elem_tmp%conf(gt_elem_tmp%mv_conf)%elem)
759 nr_of_job(1) = nr_of_job(1) + 1
761 ! in case of parallel tempering the node can be already be calculating (related to another global tree node
762 !-- send task to calculate system property
763 gt_elem_tmp%conf(gt_elem_tmp%mv_conf)%elem%stat = status_calculate_energy
764 IF (tmc_env%params%DRAW_TREE) THEN
765 CALL create_dot_color(tree_element=gt_elem_tmp%conf(gt_elem_tmp%mv_conf)%elem, &
766 tmc_params=tmc_env%params)
767 END IF
769 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
770 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
771 tmc_params=tmc_env%params, &
772 elem=gt_elem_tmp%conf(gt_elem_tmp%mv_conf)%elem)
773 nr_of_job(2) = nr_of_job(2) + 1
776 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
777 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
778 tmc_params=tmc_env%params, &
779 elem=gt_elem_tmp%conf(gt_elem_tmp%mv_conf)%elem)
780! temperature=tmc_env%params%Temp(gt_elem_tmp%mv_conf), &
781 nr_of_job(1) = nr_of_job(1) + 1
783 !-- send information of element, which should be calculated
785 CALL tmc_message(msg_type=stat, send_recv=send_msg, dest=wg, &
786 para_env=tmc_env%tmc_comp_set%para_env_m_w, &
787 tmc_params=tmc_env%params, &
788 elem=gt_elem_tmp%conf(gt_elem_tmp%mv_conf)%elem)
789 nr_of_job(1) = nr_of_job(1) + 1
791 ! skip that task until receipt is received
792 ! no status update
793 CASE DEFAULT
794 CALL cp_abort(__location__, &
795 "new task of tree element"// &
796 cp_to_string(gt_elem_tmp%nr)// &
797 "has unknown status"//cp_to_string(stat))
798 END SELECT
799 worker_info(wg)%elem => gt_elem_tmp%conf(gt_elem_tmp%mv_conf)%elem
800 worker_info(wg)%busy = .true.
801 ! set timer for maximum calculation time recognition
802 worker_info(wg)%start_time = m_walltime()
803
804 !===================== write out info after x requested tasks==========
805 IF (nr_of_job(4) > last_output .AND. &
806 (modulo(nr_of_job(4), tmc_env%m_env%info_out_step_size) == 0) .AND. &
807 (stat /= tmc_status_failed)) THEN
808 last_output = nr_of_job(4)
809 WRITE (tmc_env%m_env%io_unit, fmt="(/,T2,A)") repeat("-", 79)
810 WRITE (tmc_env%m_env%io_unit, *) &
811 "Tasks submitted: E ", nr_of_job(2), ", cc", nr_of_job(1)
812 WRITE (tmc_env%m_env%io_unit, *) &
813 "Results received: E ", nr_of_job(4), ", cc", nr_of_job(3)
814 WRITE (tmc_env%m_env%io_unit, *) &
815 "Configurations used:", tmc_env%m_env%result_count(0), &
816 ", sub trees", tmc_env%m_env%result_count(1:)
817
818 CALL print_move_types(init=.false., file_io=tmc_env%m_env%io_unit, &
819 tmc_params=tmc_env%params)
820 ALLOCATE (tree_elem_counters(0:SIZE(tmc_env%params%Temp)))
821 ALLOCATE (tree_elem_heads(0:SIZE(tmc_env%params%Temp)))
822 CALL count_nodes_in_trees(global_tree_ptr=tmc_env%m_env%gt_act, &
823 end_of_clean_trees=tmc_env%m_env%st_clean_ends, &
824 counters=tree_elem_counters, head_elements_nr=tree_elem_heads)
825 WRITE (tmc_env%m_env%io_unit, *) "nodes in trees", tree_elem_counters(:)
826 WRITE (tmc_env%m_env%io_unit, *) "tree heads ", tree_elem_heads(:)
827 IF (tmc_env%params%NMC_inp_file /= "") THEN
828 CALL count_prepared_nodes_in_trees(global_tree_ptr=tmc_env%m_env%gt_act, &
829 counters=tree_elem_counters)
830 WRITE (tmc_env%m_env%io_unit, fmt=*) &
831 "ener prepared ", tree_elem_counters
832 END IF
833 IF (tmc_env%params%SPECULATIVE_CANCELING) THEN
834 WRITE (tmc_env%m_env%io_unit, *) &
835 "canceled cc|E: ", nr_of_job(5:6), &
836 ", reactivated: cc ", &
837 reactivation_cc_count, &
838 ", reactivated: E ", &
839 reactivation_ener_count
840 END IF
841 WRITE (tmc_env%m_env%io_unit, fmt='(A,2F10.2)') &
842 " Average time for cc/ener calc ", &
843 worker_timings_aver(1), worker_timings_aver(2)
844 IF (tmc_env%params%SPECULATIVE_CANCELING) THEN
845 WRITE (tmc_env%m_env%io_unit, fmt='(A,2F10.2)') &
846 " Average time until cancel cc/ener calc ", &
847 worker_timings_aver(3), worker_timings_aver(4)
848 END IF
849 IF (tmc_env%params%esimate_acc_prob) THEN
850 WRITE (tmc_env%m_env%io_unit, *) &
851 "Estimate correct (acc/Nacc) | wrong (acc/nacc)", &
852 tmc_env%m_env%estim_corr_wrong(1), &
853 tmc_env%m_env%estim_corr_wrong(3), " | ", &
854 tmc_env%m_env%estim_corr_wrong(2), &
855 tmc_env%m_env%estim_corr_wrong(4)
856 END IF
857 WRITE (tmc_env%m_env%io_unit, *) &
858 "Time: ", int(m_walltime() - run_time_start), "of", &
859 int(tmc_env%m_env%walltime - walltime_delay - walltime_offset), &
860 "sec needed."
861 CALL m_memory(mem)
862 WRITE (tmc_env%m_env%io_unit, *) &
863 "Memory used: ", int(mem/(1024*1024), kind=kind(0)), "MiBytes"
864 CALL m_flush(tmc_env%m_env%io_unit)
865 DEALLOCATE (tree_elem_heads)
866 DEALLOCATE (tree_elem_counters)
867 END IF
868 !===================== write out restart file after x results============
869 IF (tmc_env%m_env%restart_out_step > 0 .AND. &
870 tmc_env%m_env%result_count(0) > &
871 restart_count*tmc_env%m_env%restart_out_step) THEN
872 CALL print_restart_file(tmc_env=tmc_env, job_counts=nr_of_job, &
873 timings=worker_timings_aver)
874 restart_count = restart_count + 1
875 END IF
876
877 END IF !worker busy?
878 END DO task_loop
879
880 ! -- END OF WORK (enough configurations are calculated or walltime exceeded
881 WRITE (tmc_env%m_env%io_unit, fmt="(/,T2,A)") repeat("=", 79)
882 WRITE (unit=tmc_env%m_env%io_unit, fmt="(T2,A,T35,A,T80,A)") "=", &
883 "finalizing TMC", "="
884 WRITE (tmc_env%m_env%io_unit, *) "acceptance rates:"
885 CALL print_move_types(init=.false., file_io=tmc_env%m_env%io_unit, &
886 tmc_params=tmc_env%params)
887 WRITE (tmc_env%m_env%io_unit, fmt="(/,T2,A)") repeat("-", 79)
888 ! program efficiency result outputs
889 ALLOCATE (efficiency(0:tmc_env%params%nr_temp))
890 CALL get_subtree_efficiency(tmc_env=tmc_env, eff=efficiency)
891 WRITE (tmc_env%m_env%io_unit, *) "Efficiencies:"
892 WRITE (tmc_env%m_env%io_unit, fmt="(A,F5.2,A,1000F5.2)") &
893 " (MC elements/calculated configuration) global:", &
894 efficiency(0), " sub tree(s): ", efficiency(1:)
895 DEALLOCATE (efficiency)
896 IF (tmc_env%tmc_comp_set%group_cc_nr > 0) THEN
897 WRITE (tmc_env%m_env%io_unit, fmt="(A,1000F5.2)") &
898 " (MC elements/created configuration) :", &
899 tmc_env%m_env%result_count(:)/real(nr_of_job(3), kind=dp)
900 END IF
901 WRITE (tmc_env%m_env%io_unit, fmt="(A,1000F5.2)") &
902 " (MC elements/energy calculated configuration):", &
903 tmc_env%m_env%result_count(:)/real(nr_of_job(4), kind=dp)
904 IF (tmc_env%params%NMC_inp_file /= "") THEN
905 WRITE (tmc_env%m_env%io_unit, *) &
906 "Amount of canceled elements (E/cc):", &
907 tmc_env%m_env%count_cancel_ener, tmc_env%m_env%count_cancel_NMC
908 WRITE (tmc_env%m_env%io_unit, *) &
909 " reactivated E ", reactivation_ener_count
910 WRITE (tmc_env%m_env%io_unit, *) &
911 " reactivated cc ", reactivation_cc_count
912 END IF
913 WRITE (tmc_env%m_env%io_unit, fmt="(A,F10.2)") &
914 " computing time of one Markov chain element ", &
915 (m_walltime() - run_time_start)/real(tmc_env%m_env%result_count(0) - &
916 restarted_elem_nr, kind=dp)
917 WRITE (tmc_env%m_env%io_unit, fmt="(A,F10.2)") " TMC run time[s]: ", m_walltime() - run_time_start
918 WRITE (tmc_env%m_env%io_unit, fmt="(/,T2,A)") repeat("=", 79)
919
920 !-- FINALIZE
921 WRITE (tmc_env%m_env%io_unit, *) "stopping workers"
922 CALL stop_whole_group(para_env=tmc_env%tmc_comp_set%para_env_m_w, &
923 worker_info=worker_info, &
924 tmc_params=tmc_env%params)
925 DEALLOCATE (worker_info)
926 CALL stop_whole_group(para_env=tmc_env%tmc_comp_set%para_env_m_ana, &
927 worker_info=ana_worker_info, &
928 tmc_params=tmc_env%params)
929 DEALLOCATE (ana_worker_info)
930
931 !-- deallocating everything in tree module
932 CALL finalize_trees(tmc_env=tmc_env)
933
934 CALL free_cancelation_list(tmc_env%m_env%cancelation_list)
935
936 ! -- write final configuration
937 IF (tmc_env%params%DRAW_TREE) THEN
938 CALL finalize_draw_tree(tmc_params=tmc_env%params)
939 END IF
940
941 WRITE (tmc_env%m_env%io_unit, *) "TMC master: all work done."
942
943 ! end the timing
944 CALL timestop(handle)
945
946 END SUBROUTINE do_tmc_master
947
948! **************************************************************************************************
949!> \brief routine sets the walltime delay, to the maximum calculation time
950!> hence the program can stop with a proper finailze
951!> \param time actual calculation time
952!> \param walltime_delay the actual biggest calculation time
953!> \author Mandes 12.2012
954! **************************************************************************************************
955 SUBROUTINE set_walltime_delay(time, walltime_delay)
956 REAL(kind=dp) :: time
957 INTEGER :: walltime_delay
958
959 cpassert(time >= 0.0_dp)
960
961 IF (time > walltime_delay) THEN
962 walltime_delay = int(time) + 1
963 END IF
964 END SUBROUTINE set_walltime_delay
965
966END MODULE tmc_master
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Handles all functions related to the CELL.
subroutine, public init_cell(cell, hmat, periodic)
Initialise/readjust a simulation cell after hmat has been changed.
Routines to handle the external control of CP2K.
subroutine, public external_control(should_stop, flag, globenv, target_time, start_time, force_check)
External manipulations during a run : when the <PROJECT_NAME>.EXIT_$runtype command is sent the progr...
various routines to log and control the output. The idea is that decisions about where to log should ...
Define type storing the global information of a run. Keep the amount of stored data small....
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public int_8
Definition kinds.F:54
integer, parameter, public dp
Definition kinds.F:34
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_memory(mem)
Returns the total amount of memory [bytes] in use, if known, zero otherwise.
Definition machine.F:440
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:124
real(kind=dp) function, public m_walltime()
returns time from a real-time clock, protected against rolling early/easily
Definition machine.F:141
Interface to the message passing library MPI.
Timing routines for accounting.
Definition timings.F:17
calculation section for TreeMonteCarlo
subroutine, public get_subtree_efficiency(tmc_env, eff)
calculated the rate of used tree elements to created tree elements for every temperature
to decrease the used memory size, just actual needed tree elements should be stored in memory,...
subroutine, public free_cancelation_list(cancel_list)
for correct finalizing deallocate the cancelation list
module for printing tree structures in GraphViz dot files for visualizing the trees
subroutine, public finalize_draw_tree(tmc_params)
close the dot files (write tails)
subroutine, public init_draw_trees(tmc_params)
initializes the dot files (open and write headers)
subroutine, public create_global_tree_dot_color(gt_tree_element, tmc_params)
interfaces the change of color for global tree node on the basis of the element status
subroutine, public create_dot_color(tree_element, tmc_params)
interfaces the change of color for subtree elements on the basis of the element status
writing and printing the files, trajectory (pos, cell, dipoles) as well as restart files
Definition tmc_file_io.F:20
subroutine, public print_restart_file(tmc_env, job_counts, timings)
prints out the TMC restart files with all last configurations and counters etc.
subroutine, public write_element_in_file(elem, tmc_params, temp_index, file_name, conf_nr, conf_info)
writes the trajectory element in a file from sub tree element
module contains the master routine handling the tree creation, communication with workers and task di...
Definition tmc_master.F:23
subroutine, public do_tmc_master(tmc_env, globenv)
global master handling tree creation and communication/work distribution with workers
Definition tmc_master.F:212
set up the different message for different tasks A TMC message consists of 3 parts (messages) 1: firs...
subroutine, public tmc_message(msg_type, send_recv, dest, para_env, tmc_params, elem, elem_array, list_elem, result_count, wait_for_message, success)
tmc message handling, packing messages with integer and real data type. Send first info message with ...
subroutine, public communicate_atom_types(atoms, source, para_env)
routines send atom names to the global master (using broadcast in a specialized group consisting of t...
subroutine, public stop_whole_group(para_env, worker_info, tmc_params)
send stop command to all group participants
logical, parameter, public send_msg
logical, parameter, public recv_msg
acceptance ratio handling of the different Monte Carlo Moves types For each move type and each temper...
subroutine, public check_moves(tmc_params, move_types, mol_array)
checks if the moves are possible
subroutine, public print_move_types(init, file_io, tmc_params)
routine pronts out the probabilities and sized for each type and temperature the output is divided in...
tree nodes creation, searching, deallocation, references etc.
Definition tmc_stati.F:15
integer, parameter, public tmc_status_failed
Definition tmc_stati.F:57
integer, parameter, public tmc_stat_analysis_request
Definition tmc_stati.F:88
integer, parameter, public tmc_status_worker_init
Definition tmc_stati.F:54
integer, parameter, public tmc_stat_md_result
Definition tmc_stati.F:82
integer, parameter, public tmc_stat_md_request
Definition tmc_stati.F:81
integer, parameter, public tmc_stat_approx_energy_result
Definition tmc_stati.F:69
integer, parameter, public tmc_stat_start_conf_result
Definition tmc_stati.F:72
integer, parameter, public tmc_status_wait_for_new_task
Definition tmc_stati.F:52
integer, parameter, public tmc_stat_nmc_result
Definition tmc_stati.F:78
integer, parameter, public tmc_stat_analysis_result
Definition tmc_stati.F:89
integer, parameter, public tmc_stat_init_analysis
Definition tmc_stati.F:87
integer, parameter, public tmc_stat_energy_result
Definition tmc_stati.F:75
integer, parameter, public tmc_stat_scf_step_ener_receive
Definition tmc_stati.F:85
integer, parameter, public tmc_stat_approx_energy_request
Definition tmc_stati.F:68
integer, parameter, public tmc_stat_start_conf_request
Definition tmc_stati.F:71
integer, parameter, public tmc_canceling_receipt
Definition tmc_stati.F:64
integer, parameter, public tmc_stat_energy_request
Definition tmc_stati.F:74
integer, parameter, public tmc_stat_nmc_request
Definition tmc_stati.F:77
integer, parameter, public tmc_canceling_message
Definition tmc_stati.F:63
tree nodes acceptance code is separated in 3 parts, first the acceptance criteria,...
subroutine, public tree_update(tmc_env, result_acc, something_updated)
searching tree nodes to check for Markov Chain, elements are marked and stored in lists ....
subroutine, public check_acceptance_of_depending_subtree_nodes(tree_elem, tmc_env)
check acceptance of energy calculated element and related childs, when ready
subroutine, public check_elements_for_acc_prob_update(tree_elem, tmc_env)
updates the subtree acceptance probability the swap probabilities are handled within the certain chec...
tree nodes creation, deallocation, references etc.
subroutine, public init_tree_mod(start_elem, tmc_env, job_counts, worker_timings)
routine initiate the global and subtrees with the first elements
subroutine, public deallocate_sub_tree_node(tree_elem)
deallocates an elements of the subtree element structure
subroutine, public create_new_gt_tree_node(tmc_env, stat, new_elem, reactivation_cc_count)
creates new global tree element and if needed new subtree element
subroutine, public finalize_init(gt_tree_ptr, tmc_env)
distributes the initial energy to all subtree (if no restart) and call analysis for this element (wri...
subroutine, public remove_all_trees(working_elem_list, tmc_env)
deallocates the no more used tree nodes beside the result nodes from begin_ptr to end_ptr in global a...
subroutine, public finalize_trees(tmc_env)
deallocating every tree node of every trees (clean up)
tree nodes search etc.
subroutine, public search_next_energy_calc(gt_head, new_gt_elem, stat, react_count)
gt_head head of the global tree
subroutine, public count_nodes_in_trees(global_tree_ptr, end_of_clean_trees, counters, head_elements_nr)
counts the number of existing nodes in global and subtrees
subroutine, public count_prepared_nodes_in_trees(global_tree_ptr, counters)
searches for created configurations in all subtrees
module handles definition of the tree nodes for the global and the subtrees binary tree parent elemen...
integer, parameter, public status_accepted
integer, parameter, public status_calculate_energy
integer, parameter, public status_calculate_md
integer, parameter, public status_canceled_ener
integer, parameter, public status_calculated
integer, parameter, public status_cancel_ener
integer, parameter, public status_cancel_nmc
integer, parameter, public status_canceled_nmc
integer, parameter, public status_calc_approx_ener
integer, parameter, public status_rejected
integer, parameter, public status_calculate_nmc_steps
integer, parameter, public status_created
module handles definition of the tree nodes for the global and the subtrees binary tree parent elemen...
Definition tmc_types.F:32
contains the initially parsed file and the initial parallel environment
stores all the informations relevant to an mpi environment