Skip to content

Commit

Permalink
Motion: Use existing printkey for space group output
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Feb 23, 2021
1 parent 9e72863 commit 7b71083
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 193 deletions.
8 changes: 2 additions & 6 deletions src/motion/gopt_f77_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@ RECURSIVE SUBROUTINE cp_eval_at(gopt_env, x, f, gradient, master, &
IF (spgr%keep_space_group) THEN
CALL spgr_apply_rotations_force(spgr, gradient)
CALL spgr_apply_rotations_stress(spgr, cell, av_ptens)
IF (para_env%ionode) THEN
CALL spgr_write_stress_tensor(av_ptens, spgr)
END IF
CALL spgr_write_stress_tensor(av_ptens, spgr)
END IF
cell_gradient => gradient(nsize + 1:nsize + 6)
cell_gradient = 0.0_dp
Expand Down Expand Up @@ -313,9 +311,7 @@ RECURSIVE SUBROUTINE cp_eval_at(gopt_env, x, f, gradient, master, &
CPASSERT(ASSOCIATED(gradient))
IF (spgr%keep_space_group) THEN
CALL spgr_apply_rotations_stress(spgr, cell, av_ptens)
IF (para_env%ionode) THEN
CALL spgr_write_stress_tensor(av_ptens, spgr)
END IF
CALL spgr_write_stress_tensor(av_ptens, spgr)
END IF
! Compute the gradients on the cell
CALL get_dg_dh(gradient, av_ptens, gopt_env%cell_env%pres_ext, cell, gopt_env%cell_env%mtrx, &
Expand Down
5 changes: 2 additions & 3 deletions src/motion/gopt_f_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ MODULE gopt_f_types
USE kinds, ONLY: default_string_length,&
dp
USE particle_list_types, ONLY: particle_list_type
USE space_groups_types, ONLY: init_spgr,&
release_spgr_type,&
USE space_groups_types, ONLY: release_spgr_type,&
spgr_type
#include "../base/base_uses.f90"

Expand Down Expand Up @@ -118,7 +117,7 @@ RECURSIVE SUBROUTINE gopt_f_create(gopt_env, gopt_param, force_env, globenv, geo
gopt_env%id_nr = last_gopt_f_id
gopt_env%dimer_rotation = .FALSE.
gopt_env%do_line_search = .FALSE.
CALL init_spgr(gopt_env%spgr)
ALLOCATE (gopt_env%spgr)
CALL force_env_retain(force_env)
gopt_env%force_env => force_env
gopt_env%motion_section => section_vals_get_subs_vals(force_env%root_section, "MOTION")
Expand Down
197 changes: 80 additions & 117 deletions src/motion/space_groups.F

Large diffs are not rendered by default.

55 changes: 5 additions & 50 deletions src/motion/space_groups_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ MODULE space_groups_types

USE cell_types, ONLY: cell_release,&
cell_type
USE kinds, ONLY: default_path_length,&
dp
USE machine, ONLY: default_output_unit
USE kinds, ONLY: dp
#include "../base/base_uses.f90"

IMPLICIT NONE
Expand All @@ -29,8 +27,8 @@ MODULE space_groups_types
TYPE spgr_type
LOGICAL :: keep_space_group = .FALSE.
LOGICAL :: symlib = .FALSE.
INTEGER :: plevel = -1
INTEGER :: punit = default_output_unit
LOGICAL :: print_atoms = .FALSE.
INTEGER :: iunit = -1
INTEGER :: istriz = -1
REAL(KIND=dp) :: eps_symmetry = 1.0e-4_dp
INTEGER :: nparticle = 0
Expand All @@ -50,17 +48,16 @@ MODULE space_groups_types
CHARACTER(len=11) :: international_symbol = ""
CHARACTER(len=6) :: pointgroup_symbol = ""
CHARACTER(len=7) :: schoenflies = ""
CHARACTER(LEN=default_path_length) :: filename = ""
INTEGER :: n_operations = 0
INTEGER :: n_reduced_operations = 0
INTEGER :: n_operations_subset = 0
INTEGER, DIMENSION(:, :, :), ALLOCATABLE :: rotations
INTEGER, DIMENSION(:, :, :), ALLOCATABLE :: rotations_subset
REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE :: translations
TYPE(cell_type), POINTER :: cell_ref
TYPE(cell_type), POINTER :: cell_ref => NULL()
END TYPE spgr_type

PUBLIC :: spgr_type, init_spgr, release_spgr_type
PUBLIC :: spgr_type, release_spgr_type

CONTAINS

Expand Down Expand Up @@ -109,46 +106,4 @@ SUBROUTINE release_spgr_type(spgr)

END SUBROUTINE release_spgr_type

! **************************************************************************************************
!> \brief Initialize variables in the SPGR type but does not initializa or allocate the arrays.
!> \param spgr The SPGR type
!> \par History
!> 02.2021 created [pcazade]
!> \author Pierre-André Cazade (first version)
! **************************************************************************************************
SUBROUTINE init_spgr(spgr)

TYPE(spgr_type), POINTER :: spgr

CHARACTER(LEN=*), PARAMETER :: routineN = 'init_spgr', routineP = moduleN//':'//routineN

CPASSERT(.NOT. ASSOCIATED(spgr))
ALLOCATE (spgr)

spgr%keep_space_group = .FALSE.
spgr%symlib = .FALSE.
spgr%plevel = -1
spgr%punit = default_output_unit
spgr%istriz = -1
spgr%eps_symmetry = 1.0e-4_dp
spgr%nparticle = 0
spgr%nparticle_sym = 0
spgr%n_atom = 0
spgr%n_core = 0
spgr%n_shell = 0
spgr%n_atom_sym = 0
spgr%n_core_sym = 0
spgr%n_shell_sym = 0
spgr%space_group_number = 0
spgr%international_symbol = ""
spgr%pointgroup_symbol = ""
spgr%schoenflies = ""
spgr%filename = ""
spgr%n_operations = 0
spgr%n_reduced_operations = 0
spgr%n_operations_subset = 0
NULLIFY (spgr%cell_ref)

END SUBROUTINE init_spgr

END MODULE space_groups_types
15 changes: 2 additions & 13 deletions src/start/input_cp2k_motion.F
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ MODULE input_cp2k_motion
section_release,&
section_type
USE input_val_types, ONLY: integer_t,&
lchar_t,&
logical_t,&
real_t
USE kinds, ONLY: dp
Expand Down Expand Up @@ -910,20 +909,10 @@ RECURSIVE SUBROUTINE create_geoopt_section(section, location, label, description
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

! collects keywords related to print SPGR info
CALL keyword_create( &
keyword, __LOCATION__, name="SPGR_FILE_NAME", &
description="Name of output file for detailed space group symmetry information.", &
repeats=.FALSE., usage="SPGR_FILE_NAME {Filename}", default_lc_val="", &
type_of_var=lchar_t, n_var=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create( &
keyword, __LOCATION__, name="SPGR_PRINT_LEVEL", &
keyword, __LOCATION__, name="SPGR_PRINT_ATOMS", &
description="Print equivalent atoms list for each space group symmetry operation.", &
repeats=.FALSE., usage="SPGR_PRINT_LEVEL {Level}", default_i_val=-1, &
type_of_var=integer_t, n_var=1)
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

Expand Down
2 changes: 1 addition & 1 deletion tests/Fist/regtest-spgr/TEST_FILES
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# 1 compares with the space group name and number of operations provied in the SPGR section of the output file
# for details see cp2k/tools/do_regtest
zro.inp 93 0 14
zro-filename.inp 0
zro_print_atoms.inp 0
#EOF
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
&GLOBAL
PROJECT_NAME zro-filename
PROJECT_NAME zro_print_atoms
PRINT_LEVEL medium
RUN_TYPE CELL_OPT
&END GLOBAL
Expand All @@ -11,8 +11,7 @@
KEEP_SYMMETRY T
KEEP_SPACE_GROUP T
EPS_SYMMETRY 1.e-4
SPGR_FILE_NAME zro-sg.dat
SPGR_PRINT_LEVEL 1
SPGR_PRINT_ATOMS
&END CELL_OPT
&END MOTION
&FORCE_EVAL
Expand Down

0 comments on commit 7b71083

Please sign in to comment.