58#include "./base/base_uses.f90"
64 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cell_methods'
93 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(IN), &
95 INTEGER,
DIMENSION(3),
INTENT(IN),
OPTIONAL :: periodic
96 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: tag
98 cpassert(.NOT.
ASSOCIATED(cell))
101 IF (
PRESENT(periodic))
THEN
106 cell%orthorhombic = .false.
108 IF (
PRESENT(hmat))
CALL init_cell(cell, hmat)
109 IF (
PRESENT(tag)) cell%tag = tag
125 REAL(kind=
dp),
DIMENSION(3, 3),
INTENT(IN), &
127 INTEGER,
DIMENSION(3),
INTENT(IN),
OPTIONAL :: periodic
129 REAL(kind=
dp),
PARAMETER :: eps_hmat = 1.0e-14_dp
132 REAL(kind=
dp) :: a, acosa, acosah, acosg, alpha, asina, &
133 asinah, asing, beta,
gamma, norm, &
135 REAL(kind=
dp),
DIMENSION(3) :: abc
137 cpassert(
ASSOCIATED(cell))
139 IF (
PRESENT(hmat)) cell%hmat(:, :) = hmat(:, :)
140 IF (
PRESENT(periodic)) cell%perd(:) = periodic(:)
142 cell%deth = abs(
det_3x3(cell%hmat))
144 IF (cell%deth < 1.0e-10_dp)
THEN
146 CALL cp_abort(__location__, &
147 "An invalid set of cell vectors was specified. "// &
148 "The cell volume is too small")
151 SELECT CASE (cell%symmetry_id)
160 SELECT CASE (cell%symmetry_id)
162 abc(1:3) = sum(abc(1:3))/3.0_dp
166 SELECT CASE (cell%symmetry_id)
168 a = 0.5_dp*(abc(1) + abc(2))
172 a = 0.5_dp*(abc(1) + abc(3))
176 a = 0.5_dp*(abc(2) + abc(3))
181 cell%hmat(1, 1) = abc(1); cell%hmat(1, 2) = 0.0_dp; cell%hmat(1, 3) = 0.0_dp
182 cell%hmat(2, 1) = 0.0_dp; cell%hmat(2, 2) = abc(2); cell%hmat(2, 3) = 0.0_dp
183 cell%hmat(3, 1) = 0.0_dp; cell%hmat(3, 2) = 0.0_dp; cell%hmat(3, 3) = abc(3)
186 a = 0.5_dp*(abc(1) + abc(2))
190 cell%hmat(1, 1) = a; cell%hmat(1, 2) = acosg; cell%hmat(1, 3) = 0.0_dp
191 cell%hmat(2, 1) = 0.0_dp; cell%hmat(2, 2) = asing; cell%hmat(2, 3) = 0.0_dp
192 cell%hmat(3, 1) = 0.0_dp; cell%hmat(3, 2) = 0.0_dp; cell%hmat(3, 3) = abc(3)
195 a = sum(abc(1:3))/3.0_dp
196 alpha = (
angle(cell%hmat(:, 3), cell%hmat(:, 2)) + &
197 angle(cell%hmat(:, 1), cell%hmat(:, 3)) + &
198 angle(cell%hmat(:, 1), cell%hmat(:, 2)))/3.0_dp
201 acosah = a*cos(0.5_dp*alpha)
202 asinah = a*sin(0.5_dp*alpha)
204 norm_c = sqrt(1.0_dp - norm*norm)
205 cell%hmat(1, 1) = a; cell%hmat(1, 2) = acosa; cell%hmat(1, 3) = acosah*norm
206 cell%hmat(2, 1) = 0.0_dp; cell%hmat(2, 2) = asina; cell%hmat(2, 3) = asinah*norm
207 cell%hmat(3, 1) = 0.0_dp; cell%hmat(3, 2) = 0.0_dp; cell%hmat(3, 3) = a*norm_c
210 beta =
angle(cell%hmat(:, 1), cell%hmat(:, 3))
211 cell%hmat(1, 1) = abc(1); cell%hmat(1, 2) = 0.0_dp; cell%hmat(1, 3) = abc(3)*cos(beta)
212 cell%hmat(2, 1) = 0.0_dp; cell%hmat(2, 2) = abc(2); cell%hmat(2, 3) = 0.0_dp
213 cell%hmat(3, 1) = 0.0_dp; cell%hmat(3, 2) = 0.0_dp; cell%hmat(3, 3) = abc(3)*sin(beta)
217 a = 0.5_dp*(abc(1) + abc(2))
218 gamma =
angle(cell%hmat(:, 1), cell%hmat(:, 2))
221 cell%hmat(1, 1) = a; cell%hmat(1, 2) = acosg; cell%hmat(1, 3) = 0.0_dp
222 cell%hmat(2, 1) = 0.0_dp; cell%hmat(2, 2) = asing; cell%hmat(2, 3) = 0.0_dp
223 cell%hmat(3, 1) = 0.0_dp; cell%hmat(3, 2) = 0.0_dp; cell%hmat(3, 3) = abc(3)
229 IF ((abs(cell%hmat(1, 2)) < eps_hmat) .AND. (abs(cell%hmat(1, 3)) < eps_hmat) .AND. &
230 (abs(cell%hmat(2, 1)) < eps_hmat) .AND. (abs(cell%hmat(2, 3)) < eps_hmat) .AND. &
231 (abs(cell%hmat(3, 1)) < eps_hmat) .AND. (abs(cell%hmat(3, 2)) < eps_hmat))
THEN
232 cell%orthorhombic = .true.
234 cell%orthorhombic = .false.
239 IF (cell%orthorhombic)
THEN
240 cell%hmat(1, 2) = 0.0_dp
241 cell%hmat(1, 3) = 0.0_dp
242 cell%hmat(2, 1) = 0.0_dp
243 cell%hmat(2, 3) = 0.0_dp
244 cell%hmat(3, 1) = 0.0_dp
245 cell%hmat(3, 2) = 0.0_dp
248 dim = count(cell%perd == 1)
249 IF ((dim == 1) .AND. (.NOT. cell%orthorhombic))
THEN
250 cpabort(
"Non-orthorhombic and not periodic")
254 cell%deth = abs(
det_3x3(cell%hmat))
255 IF (cell%deth < 1.0e-10_dp)
THEN
256 CALL cp_abort(__location__, &
257 "An invalid set of cell vectors was obtained after applying "// &
258 "the requested cell symmetry. The cell volume is too small")
260 cell%h_inv =
inv_3x3(cell%hmat)
278 RECURSIVE SUBROUTINE read_cell(cell, cell_ref, use_ref_cell, cell_section, &
279 topology_section, check_for_ref, para_env)
281 TYPE(
cell_type),
POINTER :: cell, cell_ref
282 LOGICAL,
INTENT(INOUT),
OPTIONAL :: use_ref_cell
284 LOGICAL,
INTENT(IN),
OPTIONAL :: check_for_ref
287 REAL(kind=
dp),
PARAMETER :: eps = 1.0e-14_dp
289 CHARACTER(LEN=default_path_length) :: cell_file_name, coord_file_name, &
291 INTEGER :: cell_file_format, coord_file_format, &
293 INTEGER,
DIMENSION(:),
POINTER :: multiple_unit_cell
294 LOGICAL :: cell_read_a, cell_read_abc, cell_read_alpha_beta_gamma, cell_read_b, cell_read_c, &
295 cell_read_file, my_check_ref, tmp_comb_abc, tmp_comb_cell, tmp_comb_top, topo_read_coord
296 REAL(kind=
dp),
DIMENSION(3) :: read_ang, read_len
297 REAL(kind=
dp),
DIMENSION(3, 3) :: read_mat
298 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cell_par
302 my_check_ref = .true.
303 NULLIFY (cell_ref_section, cell_par, cell_tmp, multiple_unit_cell)
311 IF (.NOT.
ASSOCIATED(cell))
CALL cell_create(cell, tag=
"CELL")
312 IF (.NOT.
ASSOCIATED(cell_ref))
CALL cell_create(cell_ref, tag=
"CELL_REF")
313 IF (
PRESENT(check_for_ref)) my_check_ref = check_for_ref
316 cell%orthorhombic = .false.
319 cell%hmat(:, :) = 0.0_dp
320 cell%h_inv(:, :) = 0.0_dp
321 cell_read_file = .false.
322 cell_read_a = .false.
323 cell_read_b = .false.
324 cell_read_c = .false.
325 cell_read_abc = .false.
326 cell_read_alpha_beta_gamma = .false.
327 read_mat(:, :) = 0.0_dp
344 CALL section_vals_val_get(cell_section,
"ALPHA_BETA_GAMMA", explicit=cell_read_alpha_beta_gamma)
348 tmp_comb_top = (.NOT. (cell_read_file .OR. cell_read_abc))
349 tmp_comb_top = (tmp_comb_top .AND. (.NOT. cell_read_a))
350 tmp_comb_top = (tmp_comb_top .AND. (.NOT. cell_read_b))
351 tmp_comb_top = (tmp_comb_top .AND. (.NOT. cell_read_c))
352 IF (tmp_comb_top)
THEN
353 CALL cp_warn(__location__, &
354 "None of the keywords CELL_FILE_NAME, ABC, or A, B, C "// &
355 "are specified in CELL section. CP2K will now attempt to read "// &
356 "TOPOLOGY/COORD_FILE_NAME if its format can be parsed for "// &
358 IF (
ASSOCIATED(topology_section))
THEN
360 IF (topo_read_coord)
THEN
363 SELECT CASE (coord_file_format)
377 CALL cp_abort(__location__, &
378 "COORD_FILE_FORMAT is not set to one of the implemented "// &
379 "CELL_FILE_FORMAT options and cannot be parsed for cell information!")
382 CALL cp_abort(__location__, &
383 "COORD_FILE_NAME is not set, so no cell information is available!")
386 CALL cp_warn(__location__, &
387 "TOPOLOGY section is not available, so COORD_FILE_NAME cannot "// &
388 "be parsed for cell information in lieu of missing CELL settings.")
393 IF (cell_read_file)
THEN
394 tmp_comb_cell = (cell_read_abc .OR. (cell_read_a .OR. (cell_read_b .OR. cell_read_c)))
396 CALL cp_warn(__location__, &
397 "Cell Information provided through A, B, C, or ABC in conjunction "// &
398 "with CELL_FILE_NAME. The definition in external file will override "// &
402 SELECT CASE (cell_file_format)
414 CALL cp_abort(__location__, &
415 "CELL_FILE_FORMAT is not set to one of the implemented "// &
416 "options and cannot be parsed for cell information!")
418 read_mat = cell_tmp%hmat
420 IF (cell_read_abc)
THEN
425 IF (cell_read_a .OR. cell_read_b .OR. cell_read_c) &
426 CALL cp_warn(__location__, &
427 "Cell information provided through vectors A, B or C in conjunction with ABC. "// &
428 "The definition of the ABC keyword will override the one provided by A, B and C.")
430 tmp_comb_abc = ((cell_read_a .EQV. cell_read_b) .AND. (cell_read_b .EQV. cell_read_c))
431 IF (tmp_comb_abc)
THEN
433 read_mat(:, 1) = cell_par(:)
435 read_mat(:, 2) = cell_par(:)
437 read_mat(:, 3) = cell_par(:)
438 IF (cell_read_alpha_beta_gamma) &
439 CALL cp_warn(__location__, &
440 "The keyword ALPHA_BETA_GAMMA is ignored because it was used without the "// &
443 CALL cp_abort(__location__, &
444 "Neither of the keywords CELL_FILE_NAME or ABC are specified, "// &
445 "and cell vector settings in A, B, C are incomplete!")
451 IF (any(read_mat(:, :) > eps))
THEN
454 IF ((abs(read_mat(2, 1)) > eps) .OR. &
455 (abs(read_mat(3, 1)) > eps) .OR. &
456 (abs(read_mat(3, 2)) > eps)) &
457 CALL cp_warn(__location__, &
458 "Cell vectors are read but cell matrix is not "// &
459 "a lower triangle, not conforming to the program "// &
460 "convention that A lies along the X-axis and "// &
461 "B is in the XY plane.")
464 IF (any(read_ang(:) > eps) .AND. any(read_len(:) > eps))
THEN
465 CALL set_cell_param(cell, cell_length=read_len, cell_angle=read_ang, &
466 do_init_cell=.false.)
468 CALL cp_abort(__location__, &
469 "No meaningful cell information is read from parser!")
473 CALL reset_cell_section_by_cell_mat(cell, cell_section)
477 IF (any(multiple_unit_cell /= 1))
CALL set_multiple_unit_cell(cell, multiple_unit_cell)
482 cell%perd = [1, 0, 0]
484 cell%perd = [0, 1, 0]
486 cell%perd = [0, 0, 1]
488 cell%perd = [1, 1, 0]
490 cell%perd = [1, 0, 1]
492 cell%perd = [0, 1, 1]
494 cell%perd = [1, 1, 1]
496 cell%perd = [0, 0, 0]
507 IF (any(abs(cell_tmp%hmat - cell%hmat) > eps))
THEN
508 WRITE (unit=error_msg, fmt=
"(A)") &
509 "When initializing cell vectors with requested symmetry, one "// &
510 "or more elements of the cell matrix has varied significantly. "// &
511 "The input parameters are either deviating from the symmetry, "// &
512 "or not conforming to the program convention that cell matrix "// &
513 "is a lower triangle. The symmetrized cell vectors will be used "// &
514 "anyway with the input atomic coordinates."
515 CALL cp_warn(__location__, error_msg)
520 IF (my_check_ref)
THEN
523 IF (parsed_cp2k_input(cell_ref_section, check_this_section=.true.))
THEN
524 IF (
PRESENT(use_ref_cell)) use_ref_cell = .true.
525 CALL read_cell(cell_ref, cell_ref, use_ref_cell=use_ref_cell, &
526 cell_section=cell_ref_section, check_for_ref=.false., &
529 CALL cell_clone(cell, cell_ref, tag=
"CELL_REF")
530 IF (
PRESENT(use_ref_cell)) use_ref_cell = .false.
544 FUNCTION parsed_cp2k_input(input_file, check_this_section)
RESULT(res)
547 LOGICAL,
INTENT(IN),
OPTIONAL :: check_this_section
554 IF (
PRESENT(check_this_section)) my_check = check_this_section
555 res =
ASSOCIATED(input_file)
557 cpassert(input_file%ref_count > 0)
558 IF (.NOT. my_check)
THEN
566 END FUNCTION parsed_cp2k_input
584 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: cell_length, cell_angle
585 INTEGER,
DIMENSION(3),
INTENT(IN),
OPTIONAL :: periodic
586 LOGICAL,
INTENT(IN) :: do_init_cell
588 REAL(kind=
dp),
PARAMETER :: eps = epsilon(0.0_dp)
590 REAL(kind=
dp) :: cos_alpha, cos_beta, cos_gamma, sin_gamma
592 cpassert(
ASSOCIATED(cell))
593 cpassert(all(cell_angle /= 0.0_dp))
595 cos_gamma = cos(cell_angle(3));
IF (abs(cos_gamma) < eps) cos_gamma = 0.0_dp
596 IF (abs(abs(cos_gamma) - 1.0_dp) < eps) cos_gamma = sign(1.0_dp, cos_gamma)
597 sin_gamma = sin(cell_angle(3));
IF (abs(sin_gamma) < eps) sin_gamma = 0.0_dp
598 IF (abs(abs(sin_gamma) - 1.0_dp) < eps) sin_gamma = sign(1.0_dp, sin_gamma)
599 cos_beta = cos(cell_angle(2));
IF (abs(cos_beta) < eps) cos_beta = 0.0_dp
600 IF (abs(abs(cos_beta) - 1.0_dp) < eps) cos_beta = sign(1.0_dp, cos_beta)
601 cos_alpha = cos(cell_angle(1));
IF (abs(cos_alpha) < eps) cos_alpha = 0.0_dp
602 IF (abs(abs(cos_alpha) - 1.0_dp) < eps) cos_alpha = sign(1.0_dp, cos_alpha)
604 cell%hmat(:, 1) = [1.0_dp, 0.0_dp, 0.0_dp]
605 cell%hmat(:, 2) = [cos_gamma, sin_gamma, 0.0_dp]
606 cell%hmat(:, 3) = [cos_beta, (cos_alpha - cos_gamma*cos_beta)/sin_gamma, 0.0_dp]
607 cell%hmat(3, 3) = sqrt(1.0_dp - cell%hmat(1, 3)**2 - cell%hmat(2, 3)**2)
609 cell%hmat(:, 1) = cell%hmat(:, 1)*cell_length(1)
610 cell%hmat(:, 2) = cell%hmat(:, 2)*cell_length(2)
611 cell%hmat(:, 3) = cell%hmat(:, 3)*cell_length(3)
613 IF (do_init_cell)
THEN
614 IF (
PRESENT(periodic))
THEN
615 CALL init_cell(cell=cell, periodic=periodic)
631 SUBROUTINE set_multiple_unit_cell(cell, multiple_unit_cell)
634 INTEGER,
DIMENSION(:),
POINTER :: multiple_unit_cell
636 cpassert(
ASSOCIATED(cell))
639 IF (any(multiple_unit_cell <= 0)) &
640 CALL cp_abort(__location__, &
641 "CELL%MULTIPLE_UNIT_CELL accepts only integer values larger than 0! "// &
642 "A value of 0 or negative is meaningless!")
645 cell%hmat(:, 1) = cell%hmat(:, 1)*multiple_unit_cell(1)
646 cell%hmat(:, 2) = cell%hmat(:, 2)*multiple_unit_cell(2)
647 cell%hmat(:, 3) = cell%hmat(:, 3)*multiple_unit_cell(3)
649 END SUBROUTINE set_multiple_unit_cell
670 CHARACTER(len=*) :: cif_file_name
674 CHARACTER(len=*),
PARAMETER :: routinen =
'read_cell_cif'
677 INTEGER,
DIMENSION(3) :: periodic
679 REAL(kind=
dp),
DIMENSION(3) :: cell_angles, cell_lengths
682 CALL timeset(routinen, handle)
685 para_env=para_env, apply_preprocessing=.false.)
691 begin_line=.false., search_from_begin_of_file=.true.)
692 IF (.NOT. found)
THEN
694 begin_line=.false., search_from_begin_of_file=.true.)
696 cpabort(
"The field _cell_length_a or _cell.length_a was not found in CIF file! ")
698 CALL cif_get_real(parser, cell_lengths(1))
703 begin_line=.false., search_from_begin_of_file=.true.)
704 IF (.NOT. found)
THEN
706 begin_line=.false., search_from_begin_of_file=.true.)
708 cpabort(
"The field _cell_length_b or _cell.length_b was not found in CIF file! ")
710 CALL cif_get_real(parser, cell_lengths(2))
715 begin_line=.false., search_from_begin_of_file=.true.)
716 IF (.NOT. found)
THEN
718 begin_line=.false., search_from_begin_of_file=.true.)
720 cpabort(
"The field _cell_length_c or _cell.length_c was not found in CIF file! ")
722 CALL cif_get_real(parser, cell_lengths(3))
727 begin_line=.false., search_from_begin_of_file=.true.)
728 IF (.NOT. found)
THEN
730 begin_line=.false., search_from_begin_of_file=.true.)
732 cpabort(
"The field _cell_angle_alpha or _cell.angle_alpha was not found in CIF file! ")
734 CALL cif_get_real(parser, cell_angles(1))
739 begin_line=.false., search_from_begin_of_file=.true.)
740 IF (.NOT. found)
THEN
742 begin_line=.false., search_from_begin_of_file=.true.)
744 cpabort(
"The field _cell_angle_beta or _cell.angle_beta was not found in CIF file! ")
746 CALL cif_get_real(parser, cell_angles(2))
751 begin_line=.false., search_from_begin_of_file=.true.)
752 IF (.NOT. found)
THEN
754 begin_line=.false., search_from_begin_of_file=.true.)
756 cpabort(
"The field _cell_angle_gamma or _cell.angle_gamma was not found in CIF file! ")
758 CALL cif_get_real(parser, cell_angles(3))
762 CALL set_cell_param(cell, cell_lengths, cell_angles, periodic=periodic, &
767 CALL timestop(handle)
779 SUBROUTINE cif_get_real(parser, r)
782 REAL(kind=
dp),
INTENT(OUT) :: r
784 CHARACTER(LEN=default_string_length) :: s_tag
788 iln = len_trim(s_tag)
789 IF (index(s_tag,
"(") /= 0) iln = index(s_tag,
"(") - 1
790 READ (s_tag(1:iln), *) r
792 END SUBROUTINE cif_get_real
808 CHARACTER(len=*) :: extxyz_file_name
812 CHARACTER(len=*),
PARAMETER :: routinen =
'read_cell_extxyz'
814 INTEGER :: handle, i, id1, id2, j
815 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat
818 CALL timeset(routinen, handle)
821 para_env=para_env, apply_preprocessing=.false.)
824 id1 = index(parser%input_line,
"LATTICE=")
826 id2 = index(parser%input_line(id1 + 9:),
'"')
827 READ (parser%input_line(id1 + 9:id1 + id2 + 7), *) hmat(:, 1), hmat(:, 2), hmat(:, 3)
835 CALL cp_abort(__location__, &
836 "The field (lattice=) was not found on comment line "// &
837 "of XYZ file, so cell information cannot be set via "// &
838 "extended XYZ specification! ")
843 CALL timestop(handle)
867 CHARACTER(len=*) :: pdb_file_name
871 CHARACTER(len=*),
PARAMETER :: routinen =
'read_cell_pdb'
873 CHARACTER(LEN=default_string_length) :: cryst
875 INTEGER,
DIMENSION(3) :: periodic
877 REAL(kind=
dp),
DIMENSION(3) :: cell_angles, cell_lengths
880 CALL timeset(routinen, handle)
883 para_env=para_env, apply_preprocessing=.false.)
886 begin_line=.true., search_from_begin_of_file=.true.)
888 cpabort(
"The field (CRYST1) was not found in PDB file! ")
891 READ (parser%input_line, *) cryst, cell_lengths(:), cell_angles(:)
896 CALL set_cell_param(cell, cell_lengths, cell_angles, periodic=periodic, &
901 CALL timestop(handle)
915 CHARACTER(len=*) :: cp2k_file_name
919 CHARACTER(len=*),
PARAMETER :: routinen =
'read_cell_cp2k'
921 INTEGER :: handle, i, idum, j
923 REAL(kind=
dp) :: xdum
924 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat
927 CALL timeset(routinen, handle)
930 para_env=para_env, apply_preprocessing=.false.)
934 DO WHILE (.NOT. my_end)
935 READ (parser%input_line, *) idum, xdum, hmat(:, 1), hmat(:, 2), hmat(:, 3)
946 CALL timestop(handle)
960 CHARACTER(len=*) :: xsc_file_name
964 CHARACTER(len=*),
PARAMETER :: routinen =
'read_cell_xsc'
966 INTEGER :: handle, i, idum, j
967 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat
970 CALL timeset(routinen, handle)
973 para_env=para_env, apply_preprocessing=.false.)
976 READ (parser%input_line, *) idum, hmat(:, 1), hmat(:, 2), hmat(:, 3)
985 CALL timestop(handle)
997 SUBROUTINE reset_cell_section_by_cell_mat(cell, cell_section)
1002 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cell_par
1011 ALLOCATE (cell_par(3))
1012 cell_par = cell%hmat(:, 1)
1014 ALLOCATE (cell_par(3))
1015 cell_par = cell%hmat(:, 2)
1017 ALLOCATE (cell_par(3))
1018 cell_par = cell%hmat(:, 3)
1021 END SUBROUTINE reset_cell_section_by_cell_mat
1038 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: tag
1040 CHARACTER(LEN=default_string_length) :: label, unit_str
1041 INTEGER :: output_unit
1046 IF (
PRESENT(tag))
THEN
1047 label = trim(tag)//
"|"
1049 label = trim(cell%tag)//
"|"
1073 CHARACTER(LEN=*),
INTENT(IN) :: unit_str
1074 INTEGER,
INTENT(IN) :: output_unit
1075 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: label
1077 CHARACTER(LEN=12) :: tag
1078 CHARACTER(LEN=3) :: string
1079 CHARACTER(LEN=default_string_length) :: my_label
1080 REAL(kind=
dp) :: alpha, beta,
gamma, val
1081 REAL(kind=
dp),
DIMENSION(3) :: abc
1090 IF (output_unit > 0)
THEN
1092 IF (
PRESENT(label))
THEN
1095 my_label = trim(tag)//
"|"
1098 WRITE (unit=output_unit, fmt=
"(/,T2,A,T61,F20.6)") &
1099 trim(my_label)//
" Volume ["//trim(unit_str)//
"^3]:", val
1101 WRITE (unit=output_unit, fmt=
"(T2,A,T30,3F10.3,3X,A6,F12.6)") &
1102 trim(my_label)//
" Vector a ["//trim(unit_str)//
"]:", cell%hmat(:, 1)*val, &
1103 "|a| = ", abc(1)*val, &
1104 trim(my_label)//
" Vector b ["//trim(unit_str)//
"]:", cell%hmat(:, 2)*val, &
1105 "|b| = ", abc(2)*val, &
1106 trim(my_label)//
" Vector c ["//trim(unit_str)//
"]:", cell%hmat(:, 3)*val, &
1107 "|c| = ", abc(3)*val
1108 WRITE (unit=output_unit, fmt=
"(T2,A,T69,F12.6)") &
1109 trim(my_label)//
" Angle (b,c), alpha [degree]: ", alpha, &
1110 trim(my_label)//
" Angle (a,c), beta [degree]: ", beta, &
1111 trim(my_label)//
" Angle (a,b), gamma [degree]: ",
gamma
1116 WRITE (unit=output_unit, fmt=
"(T2,A,T61,A20)") &
1117 trim(my_label)//
" Requested initial symmetry: ", &
1118 adjustr(trim(
enum_i2c(enum, cell%symmetry_id)))
1121 IF (cell%orthorhombic)
THEN
1122 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
1123 trim(my_label)//
" Numerically orthorhombic: ",
"YES"
1125 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
1126 trim(my_label)//
" Numerically orthorhombic: ",
" NO"
1128 IF (sum(cell%perd(1:3)) == 0)
THEN
1129 WRITE (unit=output_unit, fmt=
"(T2,A,T77,A4)") &
1130 trim(my_label)//
" Periodicity",
"NONE"
1133 IF (cell%perd(1) == 1) string = trim(string)//
"X"
1134 IF (cell%perd(2) == 1) string = trim(string)//
"Y"
1135 IF (cell%perd(3) == 1) string = trim(string)//
"Z"
1136 WRITE (unit=output_unit, fmt=
"(T2,A,T78,A3)") &
1137 trim(my_label)//
" Periodicity", adjustr(string)
Handles all functions related to the CELL.
subroutine, public write_cell_low(cell, unit_str, output_unit, label)
Write the cell parameters to the output unit.
subroutine, public write_cell(cell, subsys_section, tag)
Write the cell parameters to the output unit.
subroutine, public read_cell_cp2k(cp2k_file_name, cell, para_env)
Reads cell information from cp2k file.
subroutine, public read_cell_cif(cif_file_name, cell, para_env)
Reads cell information from CIF file.
subroutine, public set_cell_param(cell, cell_length, cell_angle, periodic, do_init_cell)
Sets the cell using the internal parameters (a,b,c) (alpha,beta,gamma) using the convention: a parall...
subroutine, public read_cell_pdb(pdb_file_name, cell, para_env)
Reads cell information from CRYST1 record of PDB file.
subroutine, public read_cell_extxyz(extxyz_file_name, cell, para_env)
Reads cell information from comment line of extended xyz file.
recursive subroutine, public read_cell(cell, cell_ref, use_ref_cell, cell_section, topology_section, check_for_ref, para_env)
...
subroutine, public read_cell_xsc(xsc_file_name, cell, para_env)
Reads cell information from xsc file.
subroutine, public init_cell(cell, hmat, periodic)
Initialise/readjust a simulation cell after hmat has been changed.
subroutine, public cell_create(cell, hmat, periodic, tag)
allocates and initializes a cell
Handles all functions related to the CELL.
integer, parameter, public use_perd_xyz
integer, parameter, public cell_sym_monoclinic
integer, parameter, public use_perd_y
integer, parameter, public cell_sym_triclinic
integer, parameter, public cell_sym_tetragonal_ab
integer, parameter, public use_perd_xz
integer, parameter, public cell_sym_rhombohedral
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
integer, parameter, public use_perd_x
subroutine, public cell_clone(cell_in, cell_out, tag)
Clone cell variable.
integer, parameter, public cell_sym_tetragonal_ac
integer, parameter, public use_perd_z
integer, parameter, public use_perd_yz
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
integer, parameter, public use_perd_none
integer, parameter, public cell_sym_hexagonal_gamma_60
integer, parameter, public cell_sym_orthorhombic
integer, parameter, public cell_sym_none
integer, parameter, public cell_sym_hexagonal_gamma_120
integer, parameter, public cell_sym_monoclinic_gamma_ab
integer, parameter, public cell_sym_cubic
integer, parameter, public use_perd_xy
integer, parameter, public cell_sym_tetragonal_bc
real(kind=dp) function, public plane_distance(h, k, l, cell)
Calculate the distance between two lattice planes as defined by a triple of Miller indices (hkl).
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_get_next_line(parser, nline, at_end)
Read the next input line and broadcast the input information. Skip (nline-1) lines and skip also all ...
subroutine, public parser_search_string(parser, string, ignore_case, found, line, begin_line, search_from_begin_of_file)
Search a string pattern in a file defined by its logical unit number "unit". A case sensitive search ...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_release(parser)
releases the parser
subroutine, public parser_create(parser, file_name, unit_nr, para_env, end_section_label, separator_chars, comment_char, continuation_char, quote_char, section_char, parse_white_lines, initial_variables, apply_preprocessing)
Start a parser run. Initial variables allow to @SET stuff before opening the file.
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Machine interface based on Fortran 2003 and POSIX.
integer, parameter, public default_output_unit
Definition of mathematical constants and functions.
real(kind=dp), parameter, public degree
real(kind=dp), parameter, public sqrt3
Collection of simple mathematical functions and subroutines.
pure real(kind=dp) function, public angle(a, b)
Calculation of the angle between the vectors a and b. The angle is returned in radians.
pure real(kind=dp) function, dimension(3, 3), public inv_3x3(a)
Returns the inverse of the 3 x 3 matrix a.
Interface to the message passing library MPI.
Utilities for string manipulations.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment