42#include "../base/base_uses.f90"
48 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'tmc_file_io'
74 FUNCTION expand_file_name_ending(file_name, extra)
RESULT(result_file_name)
75 CHARACTER(LEN=*) :: file_name, extra
76 CHARACTER(LEN=default_path_length) :: result_file_name
80 cpassert(file_name /=
"")
82 ind = index(file_name,
".", back=.true.)
83 IF (.NOT. ind == 0)
THEN
84 WRITE (result_file_name, *) file_name(1:ind - 1),
".", &
87 WRITE (result_file_name, *) trim(file_name),
".", extra
89 result_file_name = trim(adjustl(result_file_name))
90 cpassert(result_file_name /=
"")
91 END FUNCTION expand_file_name_ending
102 CHARACTER(LEN=*) :: file_name, extra
103 CHARACTER(LEN=default_path_length) :: result_file_name
107 cpassert(file_name /=
"")
109 ind = index(file_name,
".", back=.true.)
110 IF (.NOT. ind == 0)
THEN
111 WRITE (result_file_name, *) file_name(1:ind - 1),
"_", &
112 trim(adjustl(extra)), file_name(ind:len_trim(file_name))
114 WRITE (result_file_name, *) trim(file_name),
"_", extra
116 result_file_name = trim(adjustl(result_file_name))
117 cpassert(result_file_name /=
"")
129 CHARACTER(LEN=*) :: file_name
130 REAL(kind=
dp) :: rvalue
131 CHARACTER(LEN=default_path_length) :: result_file_name
133 CHARACTER(LEN=18) :: rval_to_string
136 cpassert(file_name /=
"")
140 WRITE (rval_to_string,
"(F16.2)") rvalue
141 ind = index(file_name,
".", back=.true.)
142 IF (.NOT. ind == 0)
THEN
143 WRITE (result_file_name, *) file_name(1:ind - 1),
"_T", &
144 trim(adjustl(rval_to_string)), file_name(ind:len_trim(file_name))
146 IF (len(file_name) == 0)
THEN
147 WRITE (result_file_name, *) trim(file_name),
"T", trim(adjustl(rval_to_string)), &
148 file_name(ind:len_trim(file_name))
150 WRITE (result_file_name, *) trim(file_name),
"_T", trim(adjustl(rval_to_string))
153 result_file_name = trim(adjustl(result_file_name))
154 cpassert(result_file_name /=
"")
166 CHARACTER(LEN=*) :: file_name
168 CHARACTER(LEN=default_path_length) :: result_file_name
170 CHARACTER(LEN=18) :: rval_to_string
173 cpassert(file_name /=
"")
177 WRITE (rval_to_string, *) ivalue
178 ind = index(file_name,
".", back=.true.)
179 IF (.NOT. ind == 0)
THEN
180 WRITE (result_file_name, *) file_name(1:ind - 1),
"_", &
181 trim(adjustl(rval_to_string)), file_name(ind:len_trim(file_name))
183 IF (len(file_name) == 0)
THEN
184 WRITE (result_file_name, *) trim(file_name),
"", trim(adjustl(rval_to_string)), &
185 file_name(ind:len_trim(file_name))
187 WRITE (result_file_name, *) trim(file_name),
"_", trim(adjustl(rval_to_string)), &
188 file_name(ind:len_trim(file_name))
191 result_file_name = trim(adjustl(result_file_name))
192 cpassert(result_file_name /=
"")
209 INTEGER,
DIMENSION(:) :: job_counts
212 CHARACTER(LEN=default_path_length) :: c_tmp, file_name
216 cpassert(
ASSOCIATED(tmc_env))
217 cpassert(
ASSOCIATED(tmc_env%m_env))
218 cpassert(
ASSOCIATED(tmc_env%params))
219 cpassert(
ASSOCIATED(tmc_env%m_env%gt_act))
221 WRITE (c_tmp, fmt=
'(I9.9)') tmc_env%m_env%result_count(0)
225 CALL open_file(file_name=file_name, file_status=
"REPLACE", &
226 file_action=
"WRITE", file_form=
"UNFORMATTED", &
228 WRITE (f_unit)
SIZE(tmc_env%params%Temp)
229 WRITE (f_unit) tmc_env%params%Temp(:), &
230 tmc_env%m_env%gt_act%nr, &
231 tmc_env%m_env%gt_act%rng_seed, &
232 tmc_env%m_env%gt_act%rnd_nr, &
233 tmc_env%m_env%gt_act%prob_acc, &
234 tmc_env%m_env%gt_act%mv_conf, &
235 tmc_env%m_env%gt_act%mv_next_conf, &
236 tmc_env%m_env%result_count(0:), &
237 tmc_env%params%move_types%mv_weight, &
238 tmc_env%params%move_types%acc_count, &
239 tmc_env%params%move_types%mv_count, &
240 tmc_env%params%move_types%subbox_acc_count, &
241 tmc_env%params%move_types%subbox_count, &
242 tmc_env%params%cell%hmat, &
245 DO i = 1,
SIZE(tmc_env%params%Temp)
246 WRITE (f_unit) tmc_env%m_env%result_list(i)%elem%nr, &
247 tmc_env%m_env%result_list(i)%elem%rng_seed, &
248 tmc_env%m_env%result_list(i)%elem%pos, &
249 tmc_env%m_env%result_list(i)%elem%vel, &
250 tmc_env%m_env%result_list(i)%elem%box_scale, &
251 tmc_env%m_env%result_list(i)%elem%potential, &
252 tmc_env%m_env%result_list(i)%elem%e_pot_approx, &
253 tmc_env%m_env%result_list(i)%elem%ekin, &
254 tmc_env%m_env%result_list(i)%elem%ekin_before_md, &
255 tmc_env%m_env%result_list(i)%elem%temp_created
260 file_action=
"WRITE", file_status=
"REPLACE", &
262 WRITE (f_unit, *) trim(file_name)
278 INTEGER,
DIMENSION(:) :: job_counts
280 CHARACTER(LEN=*) :: file_name
282 REAL(kind=
dp),
PARAMETER :: eps_temp = 5.0e-03_dp
284 INTEGER :: file_ptr, i, temp_size
286 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: tmp_temp
287 REAL(kind=
dp),
DIMENSION(nr_mv_types) :: mv_weight_tmp
289 cpassert(
ASSOCIATED(tmc_env))
290 cpassert(
ASSOCIATED(tmc_env%m_env))
291 cpassert(
ASSOCIATED(tmc_env%params))
292 cpassert(
ASSOCIATED(tmc_env%m_env%gt_act))
298 file_action=
"READ", unit_number=file_ptr)
299 READ (file_ptr, *) file_name
303 CALL open_file(file_name=file_name, file_status=
"OLD", file_form=
"UNFORMATTED", &
304 file_action=
"READ", unit_number=file_ptr)
305 READ (file_ptr) temp_size
306 IF (temp_size /=
SIZE(tmc_env%params%Temp))
THEN
307 CALL cp_abort(__location__, &
308 "the actual specified temperatures does not "// &
309 "fit in amount with the one from restart file ")
311 ALLOCATE (tmp_temp(temp_size))
312 READ (file_ptr) tmp_temp(:), &
313 tmc_env%m_env%gt_act%nr, &
314 tmc_env%m_env%gt_act%rng_seed, &
315 tmc_env%m_env%gt_act%rnd_nr, &
316 tmc_env%m_env%gt_act%prob_acc, &
317 tmc_env%m_env%gt_act%mv_conf, &
318 tmc_env%m_env%gt_act%mv_next_conf, &
319 tmc_env%m_env%result_count(0:), &
321 tmc_env%params%move_types%acc_count, &
322 tmc_env%params%move_types%mv_count, &
323 tmc_env%params%move_types%subbox_acc_count, &
324 tmc_env%params%move_types%subbox_count, &
325 tmc_env%params%cell%hmat, &
329 IF (any(abs(tmc_env%params%Temp(:) - tmp_temp(:)) >= eps_temp))
THEN
330 CALL cp_abort(__location__,
"the temperatures differ from the previous calculation. "// &
331 "There were the following temperatures used:")
333 IF (any(mv_weight_tmp(:) /= tmc_env%params%move_types%mv_weight(:)))
THEN
334 cpwarn(
"The amount of mv types differs between the original and the restart run.")
337 DO i = 1,
SIZE(tmc_env%params%Temp)
338 tmc_env%m_env%gt_act%conf(i)%elem => tmc_env%m_env%result_list(i)%elem
339 READ (file_ptr) tmc_env%m_env%result_list(i)%elem%nr, &
340 tmc_env%m_env%result_list(i)%elem%rng_seed, &
341 tmc_env%m_env%result_list(i)%elem%pos, &
342 tmc_env%m_env%result_list(i)%elem%vel, &
343 tmc_env%m_env%result_list(i)%elem%box_scale, &
344 tmc_env%m_env%result_list(i)%elem%potential, &
345 tmc_env%m_env%result_list(i)%elem%e_pot_approx, &
346 tmc_env%m_env%result_list(i)%elem%ekin, &
347 tmc_env%m_env%result_list(i)%elem%ekin_before_md, &
348 tmc_env%m_env%result_list(i)%elem%temp_created
369 accepted, tmc_params)
371 INTEGER,
DIMENSION(:),
POINTER :: result_count
372 INTEGER :: conf_updated
373 LOGICAL,
INTENT(IN) :: accepted
376 CHARACTER(LEN=*),
PARAMETER :: routinen =
'write_result_list_element'
378 CHARACTER(LEN=default_path_length) :: file_name
383 cpassert(
ASSOCIATED(result_list))
384 cpassert(
ASSOCIATED(result_count))
385 cpassert(
ASSOCIATED(tmc_params))
386 cpassert(
ASSOCIATED(tmc_params%Temp))
387 cpassert(conf_updated >= 0)
388 cpassert(conf_updated <=
SIZE(tmc_params%Temp))
391 CALL timeset(routinen, handle)
393 IF (conf_updated == 0)
THEN
395 DO i = 1,
SIZE(tmc_params%Temp)
398 tmc_params=tmc_params, conf_nr=result_count(0), &
402 IF ((.NOT. tmc_params%print_only_diff_conf) .OR. &
403 (tmc_params%print_only_diff_conf .AND. accepted))
THEN
405 tmc_params=tmc_params, conf_nr=result_count(conf_updated), &
407 rvalue=tmc_params%Temp(conf_updated)))
411 CALL timestop(handle)
428 INTEGER,
OPTIONAL :: temp_index
429 CHARACTER(LEN=*),
OPTIONAL :: file_name
430 INTEGER,
OPTIONAL :: conf_nr
431 CHARACTER(LEN=*),
OPTIONAL :: conf_info
433 CHARACTER(LEN=*),
PARAMETER :: routinen =
'write_element_in_file'
435 CHARACTER(LEN=default_path_length) :: file_name_act, tmp_name
436 CHARACTER(LEN=default_string_length) ::
header
437 INTEGER :: file_ptr, handle, i, nr_atoms
440 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat_scaled
447 cpassert(
ASSOCIATED(elem))
448 cpassert(
ASSOCIATED(tmc_params))
449 cpassert(
ASSOCIATED(tmc_params%atoms))
450 cpassert(
PRESENT(conf_nr) .OR.
PRESENT(conf_info))
454 CALL timeset(routinen, handle)
457 IF (
PRESENT(file_name))
THEN
458 cpassert(file_name /=
"")
459 file_name_act = file_name
461 cpassert(
ASSOCIATED(tmc_params%Temp))
462 cpassert(
PRESENT(temp_index))
464 rvalue=tmc_params%Temp(temp_index))
467 nr_atoms =
SIZE(elem%pos)/tmc_params%dim_per_elem
470 IF (tmc_params%print_trajectory .OR. tmc_params%print_forces)
THEN
471 IF (
PRESENT(conf_info))
THEN
472 WRITE (
header, *) trim(adjustl(conf_info))
475 WRITE (
header, fmt=
"(A,I8,A,F20.10,F20.10,A,I8,I8)")
"i =", conf_nr,
" ,E =", &
476 elem%potential, elem%ekin,
" st elem", elem%sub_tree_nr, elem%nr
481 IF (tmc_params%print_trajectory)
THEN
482 tmp_name = expand_file_name_ending(file_name_act,
"xyz")
483 CALL open_file(file_name=tmp_name, file_status=
"UNKNOWN", &
484 file_action=
"WRITE", file_position=
"APPEND", &
485 unit_number=file_ptr)
486 WRITE (file_ptr, fmt=
"(I8)") nr_atoms
487 WRITE (file_ptr, *) trim(
header)
488 DO i = 1,
SIZE(elem%pos), tmc_params%dim_per_elem
489 WRITE (file_ptr, fmt=
"(A4,1X,1000F20.10)") &
490 trim(tmc_params%atoms((i - 1)/tmc_params%dim_per_elem + 1)%name), &
491 elem%pos(i:i + tmc_params%dim_per_elem - 1)*au2a
497 IF (tmc_params%print_forces)
THEN
498 tmp_name = expand_file_name_ending(file_name_act,
"frc")
499 CALL open_file(file_name=tmp_name, file_status=
"UNKNOWN", &
500 file_action=
"WRITE", file_position=
"APPEND", &
501 unit_number=file_ptr)
502 WRITE (file_ptr, fmt=
"(I8)") nr_atoms
503 WRITE (file_ptr, *) trim(
header)
504 DO i = 1,
SIZE(elem%pos), tmc_params%dim_per_elem
505 WRITE (file_ptr, fmt=
"(A4,1X,1000F20.10)") &
506 trim(tmc_params%atoms((i - 1)/tmc_params%dim_per_elem + 1)%name), &
507 elem%frc(i:i + tmc_params%dim_per_elem - 1)
513 IF (tmc_params%print_dipole)
THEN
515 conf_nr=conf_nr, dip=elem%dipole)
519 IF (tmc_params%print_cell)
THEN
520 tmp_name = expand_file_name_ending(file_name_act,
"cell")
524 CALL open_file(file_name=tmp_name, file_status=
"NEW", &
525 file_action=
"WRITE", unit_number=file_ptr)
526 WRITE (file_ptr, fmt=
'(A,9(7X,A2," [Angstrom]"),6X,A)') &
527 "# MC step ",
"Ax",
"Ay",
"Az",
"Bx",
"By",
"Bz",
"Cx",
"Cy",
"Cz", &
528 "Volume [Angstrom^3]"
530 CALL open_file(file_name=tmp_name, file_status=
"OLD", &
531 file_action=
"WRITE", file_position=
"APPEND", &
532 unit_number=file_ptr)
535 box_scale=elem%box_scale, scaled_hmat=hmat_scaled, &
537 WRITE (file_ptr, fmt=
"(I8,9(1X,F19.10),1X,F24.10)") conf_nr, &
538 hmat_scaled(:, :)*au2a, vol*au2a**3
544 IF (tmc_params%print_energies)
THEN
545 tmp_name = expand_file_name_ending(file_name_act,
"ener")
549 CALL open_file(file_name=tmp_name, file_status=
"NEW", &
550 file_action=
"WRITE", unit_number=file_ptr)
551 WRITE (file_ptr, fmt=
'(A,4A20)') &
552 "# MC step ",
" exact ",
" approx ",
" last SCF ",
" kinetic "
554 CALL open_file(file_name=tmp_name, file_status=
"OLD", &
555 file_action=
"WRITE", file_position=
"APPEND", &
556 unit_number=file_ptr)
558 WRITE (file_ptr, fmt=
"(I8,14F20.10)") conf_nr, elem%potential, elem%e_pot_approx, &
559 elem%scf_energies(mod(elem%scf_energies_count, 4) + 1), elem%ekin
564 CALL timestop(handle)
578 CHARACTER(LEN=default_path_length) :: file_name
580 REAL(kind=
dp),
DIMENSION(:),
POINTER :: dip
581 CHARACTER(LEN=*),
INTENT(in),
OPTIONAL :: file_ext
583 CHARACTER(LEN=default_path_length) :: file_name_tmp
587 cpassert(
ASSOCIATED(dip))
589 IF (
PRESENT(file_ext))
THEN
590 cpassert(file_ext /=
"")
591 file_name_tmp = expand_file_name_ending(file_name, trim(file_ext))
593 file_name_tmp = expand_file_name_ending(file_name,
"dip")
597 CALL open_file(file_name=file_name_tmp, file_status=
"NEW", &
598 file_action=
"WRITE", unit_number=file_ptr)
599 WRITE (file_ptr, fmt=
'(A8,10A20)')
"# conf_nr",
"dip_x [C Angstrom]", &
600 "dip_y [C Angstrom]",
"dip_z [C Angstrom]"
602 CALL open_file(file_name=file_name_tmp, file_status=
"OLD", &
603 file_action=
"WRITE", file_position=
"APPEND", &
604 unit_number=file_ptr)
606 WRITE (file_ptr, fmt=
"(I8,10F20.10)") conf_nr, dip(:)
626 INTEGER :: conf_nr, stat
628 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_element_from_file'
630 INTEGER :: conf_nr_old, handle, i_tmp
631 LOGICAL :: files_conf_missmatch
634 conf_nr_old = conf_nr
635 files_conf_missmatch = .false.
637 cpassert(
ASSOCIATED(elem))
638 cpassert(
ASSOCIATED(tmc_ana))
639 cpassert(
ASSOCIATED(tmc_ana%atoms))
642 CALL timeset(routinen, handle)
645 IF (tmc_ana%id_traj > 0)
THEN
647 CALL read_pos_from_file(elem=elem, tmc_ana=tmc_ana, stat=stat, &
650 CALL cp_warn(__location__, &
651 'end of position file reached at line '// &
652 cp_to_string(real(tmc_ana%lc_traj, kind=
dp))//
", last element "// &
655 cpassert(i_tmp > conf_nr_old)
668 CALL read_dipole_from_file(elem=elem, tmc_ana=tmc_ana, stat=stat, &
671 CALL cp_warn(__location__, &
672 'end of dipole file reached at line'// &
677 IF (tmc_ana%id_traj > 0)
THEN
678 IF (i_tmp == conf_nr)
THEN
679 files_conf_missmatch = .false.
684 files_conf_missmatch = .true.
687 ELSE IF (i_tmp > conf_nr_old)
THEN
692 END DO search_conf_dip
698 CALL read_cell_from_file(elem=elem, tmc_ana=tmc_ana, stat=stat, &
701 CALL cp_warn(__location__, &
702 'end of cell file reached at line at line'// &
704 EXIT search_conf_cell
707 IF (tmc_ana%id_traj > 0)
THEN
708 IF (i_tmp == conf_nr)
THEN
709 files_conf_missmatch = .false.
710 EXIT search_conf_cell
714 files_conf_missmatch = .true.
717 ELSE IF (i_tmp > conf_nr_old)
THEN
720 EXIT search_conf_cell
722 END DO search_conf_cell
729 IF (files_conf_missmatch)
THEN
730 CALL cp_warn(__location__, &
731 'there is a missmatch in the configuration numbering. '// &
732 "Read number of lines (pos|cell|dip)"// &
739 CALL timestop(handle)
752 SUBROUTINE read_pos_from_file(elem, tmc_ana, stat, conf_nr, header_info)
755 INTEGER :: stat, conf_nr
756 CHARACTER(LEN=*),
OPTIONAL :: header_info
758 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_pos_from_file'
760 CHARACTER(LEN=default_string_length) :: c_tmp
761 INTEGER :: handle, i, i_tmp, status
765 cpassert(
ASSOCIATED(elem))
766 cpassert(
ASSOCIATED(elem%pos))
767 cpassert(
ASSOCIATED(tmc_ana))
768 cpassert(tmc_ana%id_traj > 0)
771 CALL timeset(routinen, handle)
775 tmc_ana%lc_traj = tmc_ana%lc_traj + 1
776 READ (tmc_ana%id_traj,
'(A)', iostat=status) c_tmp(:)
778 CALL cp_abort(__location__, &
779 "configuration header read error at line: "// &
784 EXIT search_next_conf
786 IF (index(c_tmp,
"=") > 0)
THEN
787 READ (c_tmp(index(c_tmp,
"=") + 1:), *, iostat=status) i_tmp
788 IF (status /= 0)
THEN
789 CALL cp_abort(__location__, &
790 "configuration header read error (for conf nr) at line: "// &
793 IF (i_tmp > conf_nr)
THEN
796 IF (
PRESENT(header_info)) header_info = c_tmp
798 EXIT search_next_conf
801 END DO search_next_conf
804 pos_loop:
DO i = 1,
SIZE(elem%pos), tmc_ana%dim_per_elem
805 tmc_ana%lc_traj = tmc_ana%lc_traj + 1
806 READ (tmc_ana%id_traj, fmt=
"(A4,1X,1000F20.10)", iostat=status) &
807 c_tmp, elem%pos(i:i + tmc_ana%dim_per_elem - 1)
808 IF (status /= 0)
THEN
809 CALL cp_abort(__location__, &
810 "configuration pos read error at line: "// &
814 elem%pos(:) = elem%pos(:)/au2a
818 CALL timestop(handle)
819 END SUBROUTINE read_pos_from_file
830 SUBROUTINE read_dipole_from_file(elem, tmc_ana, stat, conf_nr)
833 INTEGER :: stat, conf_nr
835 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_dipole_from_file'
837 CHARACTER(LEN=250) :: c_tmp
838 INTEGER :: handle, status
842 cpassert(
ASSOCIATED(elem))
843 cpassert(
ASSOCIATED(elem%dipole))
844 cpassert(
ASSOCIATED(tmc_ana))
845 cpassert(tmc_ana%id_dip > 0)
848 CALL timeset(routinen, handle)
849 tmc_ana%lc_dip = tmc_ana%lc_dip + 1
850 READ (tmc_ana%id_dip, fmt=
"(A)", iostat=status) c_tmp
851 IF (status == 0)
THEN
853 IF (index(c_tmp,
"#") > 0)
THEN
854 tmc_ana%lc_dip = tmc_ana%lc_dip + 1
855 READ (tmc_ana%id_dip, fmt=
"(A)", iostat=status) c_tmp
858 IF (status == 0)
THEN
859 READ (c_tmp, fmt=
"(I8,10F20.10)", iostat=status) &
860 conf_nr, elem%dipole(:)
862 IF (status == 0)
THEN
864 ELSE IF (status < 0)
THEN
867 IF (status /= 0)
THEN
868 cpwarn(
"configuration dipole read error at line: "//
cp_to_string(tmc_ana%lc_dip))
874 CALL timestop(handle)
875 END SUBROUTINE read_dipole_from_file
886 SUBROUTINE read_cell_from_file(elem, tmc_ana, stat, conf_nr)
889 INTEGER :: stat, conf_nr
891 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_cell_from_file'
893 CHARACTER(LEN=250) :: c_tmp
894 INTEGER :: handle, status
895 REAL(kind=
dp) :: r_tmp
896 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat
900 cpassert(
ASSOCIATED(elem))
901 cpassert(
ASSOCIATED(tmc_ana))
902 cpassert(
ASSOCIATED(tmc_ana%cell))
903 cpassert(tmc_ana%id_cell > 0)
906 CALL timeset(routinen, handle)
908 tmc_ana%lc_cell = tmc_ana%lc_cell + 1
909 READ (tmc_ana%id_cell, fmt=
"(A)", iostat=status) c_tmp
910 IF (status == 0)
THEN
912 IF (index(c_tmp,
"#") > 0)
THEN
913 tmc_ana%lc_cell = tmc_ana%lc_cell + 1
914 READ (tmc_ana%id_cell, fmt=
"(A)", iostat=status) c_tmp
917 IF (status == 0)
THEN
918 READ (c_tmp, fmt=
"(I8,9(1X,F19.10),1X,F24.10)", iostat=status) conf_nr, &
923 ELSE IF (status > 0)
THEN
924 IF (status /= 0)
THEN
925 cpabort(
"configuration cell read error at line: "//
cp_to_string(tmc_ana%lc_cell))
929 IF (elem%nr < 0) elem%nr = conf_nr
930 hmat(:, :) = hmat(:, :)/au2a
933 box_scale=elem%box_scale)
937 CALL timestop(handle)
938 END SUBROUTINE read_cell_from_file
955 INTEGER,
OPTIONAL :: dir_ind
957 CHARACTER(LEN=*),
PARAMETER :: routinen =
'analyse_files_open'
959 CHARACTER(LEN=default_path_length) :: dir_name, file_name_act, file_name_temp
963 cpassert(
ASSOCIATED(tmc_ana))
968 CALL timeset(routinen, handle)
970 IF (
PRESENT(dir_ind))
THEN
971 cpassert(
ASSOCIATED(tmc_ana%dirs))
972 cpassert(dir_ind > 0)
973 cpassert(dir_ind <=
SIZE(tmc_ana%dirs))
975 IF (index(tmc_ana%dirs(dir_ind),
"/", back=.true.) == &
976 len_trim(tmc_ana%dirs(dir_ind)))
THEN
977 dir_name = trim(tmc_ana%dirs(dir_ind))
979 dir_name = trim(tmc_ana%dirs(dir_ind))//
"/"
988 rvalue=tmc_ana%temperature)
990 IF (tmc_ana%costum_pos_file_name /=
"")
THEN
991 file_name_act = trim(dir_name)//tmc_ana%costum_pos_file_name
993 file_name_act = trim(dir_name)// &
994 expand_file_name_ending(file_name_temp,
"xyz")
998 CALL open_file(file_name=file_name_act, file_status=
"OLD", &
999 file_action=
"READ", unit_number=tmc_ana%id_traj)
1000 WRITE (tmc_ana%io_unit, fmt=
'(T2,A,"| ",A,T41,A40)')
"TMC_ANA", &
1001 "read xyz file", trim(file_name_act)
1005 IF (tmc_ana%costum_cell_file_name /=
"")
THEN
1006 file_name_act = trim(dir_name)//tmc_ana%costum_cell_file_name
1008 file_name_act = trim(dir_name)// &
1009 expand_file_name_ending(file_name_temp,
"cell")
1013 CALL open_file(file_name=file_name_act, file_status=
"OLD", &
1014 file_action=
"READ", unit_number=tmc_ana%id_cell)
1015 WRITE (tmc_ana%io_unit, fmt=
'(T2,A,"| ",A,T41,A40)')
"TMC_ANA", &
1016 "read cell file", trim(file_name_act)
1020 IF (tmc_ana%costum_dip_file_name /=
"")
THEN
1021 file_name_act = trim(dir_name)//tmc_ana%costum_dip_file_name
1023 file_name_act = trim(dir_name)// &
1024 expand_file_name_ending(file_name_temp,
"dip")
1028 CALL open_file(file_name=file_name_act, file_status=
"OLD", &
1029 file_action=
"READ", unit_number=tmc_ana%id_dip)
1030 WRITE (tmc_ana%io_unit, fmt=
'(T2,A,"| ",A,T41,A40)')
"TMC_ANA", &
1031 "read dip file", trim(file_name_act)
1034 IF (tmc_ana%id_traj > 0 .OR. tmc_ana%id_cell > 0 .OR. &
1035 tmc_ana%id_dip > 0)
THEN
1038 CALL cp_warn(__location__, &
1039 "There is no file to open for temperature "//
cp_to_string(tmc_ana%temperature)// &
1040 "K in directory "//trim(dir_name))
1043 CALL timestop(handle)
1055 CHARACTER(LEN=*),
PARAMETER :: routinen =
'analyse_files_close'
1059 cpassert(
ASSOCIATED(tmc_ana))
1062 CALL timeset(routinen, handle)
1065 IF (tmc_ana%id_traj > 0)
CALL close_file(unit_number=tmc_ana%id_traj)
1068 IF (tmc_ana%id_cell > 0)
CALL close_file(unit_number=tmc_ana%id_cell)
1071 IF (tmc_ana%id_dip > 0)
CALL close_file(unit_number=tmc_ana%id_dip)
1074 CALL timestop(handle)
Utility routines to open and close files.
logical function, public file_exists(file_name)
Checks if a file exists, considering also the file discovery mechanism.
subroutine, public open_file(file_name, unit_number, file_status, file_form, file_action, file_position, file_pad, file_access, debug)
Opens a file and returns its logical unit number.
subroutine, public close_file(unit_number, file_status)
Closes an open file given by its logical unit number.
various routines to log and control the output. The idea is that decisions about where to log should ...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Definition of physical constants:
real(kind=dp), parameter, public angstrom
Timing routines for accounting.
module provides variables for the TMC analysis tool
calculation section for TreeMonteCarlo
subroutine, public get_scaled_cell(cell, box_scale, scaled_hmat, scaled_cell, vol, abc, vec)
handles properties and calculations of a scaled cell
subroutine, public get_cell_scaling(cell, scaled_hmat, box_scale)
handles properties and calculations of a scaled cell
writing and printing the files, trajectory (pos, cell, dipoles) as well as restart files
subroutine, public analyse_files_close(tmc_ana)
close the files for reading configurations data to analyze
subroutine, public write_result_list_element(result_list, result_count, conf_updated, accepted, tmc_params)
select the correct configuration to print out the (coordinates, forces, cell ...)
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_dipoles_in_file(file_name, conf_nr, dip, file_ext)
writes the cell dipoles in dipole trajectory file
subroutine, public read_element_from_file(elem, tmc_ana, conf_nr, stat)
read the trajectory element from a file from sub tree element
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
subroutine, public analyse_files_open(tmc_ana, stat, dir_ind)
opens the files for reading configurations data to analyze
character(len=default_path_length) function, public expand_file_name_char(file_name, extra)
placing a character string at the end of a file name (before the file extension)
character(len=default_path_length) function, public expand_file_name_temp(file_name, rvalue)
placing the temperature at the end of a file name (before the file extension)
character(len=default_path_length) function, public expand_file_name_int(file_name, ivalue)
placing an integer at the end of a file name (before the file extension)
subroutine, public read_restart_file(tmc_env, job_counts, timings, file_name)
reads the TMC restart file with all last configurations and counters etc.
tree nodes creation, searching, deallocation, references etc.
integer, parameter, public nr_mv_types
tree nodes creation, searching, deallocation, references etc.
integer, parameter, public tmc_status_failed
character(len= *), parameter, public tmc_default_trajectory_file_name
integer, parameter, public tmc_status_wait_for_new_task
character(len= *), parameter, public tmc_default_restart_in_file_name
character(len= *), parameter, public tmc_default_restart_out_file_name
integer, parameter, public tmc_status_ok
module handles definition of the tree nodes for the global and
module handles definition of the tree nodes for the global and