(git:27c966b)
Loading...
Searching...
No Matches
barostat_types.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 Barostat structure: module containing barostat available for MD
10!> \author teo [tlaino] - University of Zurich - 09.2007
11! **************************************************************************************************
13 USE cell_types, ONLY: cell_type
30 USE kinds, ONLY: dp
31 USE simpar_types, ONLY: simpar_type
32#include "../../base/base_uses.f90"
33
34 IMPLICIT NONE
35
36 INTEGER, PARAMETER, PUBLIC :: do_clv_geo_center = 0, &
37 do_clv_fix_point = 1, &
38 do_clv_xyz = 0, &
39 do_clv_x = 1, &
40 do_clv_y = 2, &
41 do_clv_z = 3, &
42 do_clv_xy = 4, &
43 do_clv_xz = 5, &
44 do_clv_yz = 6
45
46 PRIVATE
47 PUBLIC :: barostat_type, &
50
51! **************************************************************************************************
53 INTEGER :: virial_components = do_clv_geo_center
54 REAL(kind=dp) :: temp_ext = 0.0_dp
55 TYPE(npt_info_type), POINTER :: npt(:, :) => null()
56 TYPE(section_vals_type), POINTER :: section => null()
57 END TYPE barostat_type
58
59! *** Global parameters ***
60
61 CHARACTER(len=*), PARAMETER, PRIVATE :: modulen = 'barostat_types'
62
63CONTAINS
64
65! **************************************************************************************************
66!> \brief ...
67!> \param barostat ...
68!> \param md_section ...
69!> \param force_env ...
70!> \param simpar ...
71!> \param globenv ...
72!> \par History
73!> 09.2007 created [tlaino]
74!> \author Teodoro Laino
75! **************************************************************************************************
76 SUBROUTINE create_barostat_type(barostat, md_section, force_env, simpar, &
77 globenv)
78 TYPE(barostat_type), POINTER :: barostat
79 TYPE(section_vals_type), POINTER :: md_section
80 TYPE(force_env_type), POINTER :: force_env
81 TYPE(simpar_type), POINTER :: simpar
82 TYPE(global_environment_type), POINTER :: globenv
83
84 LOGICAL :: check, explicit
85 TYPE(cell_type), POINTER :: cell
86 TYPE(section_vals_type), POINTER :: barostat_section
87
88 check = .NOT. ASSOCIATED(barostat)
89 cpassert(check)
90 barostat_section => section_vals_get_subs_vals(md_section, "BAROSTAT")
91 CALL section_vals_get(barostat_section, explicit=explicit)
92 IF (simpar%ensemble == npt_i_ensemble .OR. &
93 simpar%ensemble == npt_ia_ensemble .OR. &
94 simpar%ensemble == npt_f_ensemble .OR. &
95 simpar%ensemble == npe_f_ensemble .OR. &
96 simpar%ensemble == npe_i_ensemble .OR. &
97 simpar%ensemble == nph_uniaxial_ensemble .OR. &
98 simpar%ensemble == nph_uniaxial_damped_ensemble) THEN
99 ALLOCATE (barostat)
100 barostat%section => barostat_section
101 NULLIFY (barostat%npt)
102 CALL force_env_get(force_env, cell=cell)
103
104 barostat%temp_ext = simpar%temp_baro_ext
105 CALL section_vals_val_get(barostat_section, "TEMP_TOL", r_val=simpar%temp_baro_tol)
106 ! Initialize or possibly restart Barostat
107 CALL initialize_npt(simpar, globenv, barostat%npt, &
108 cell, work_section=barostat_section)
109
110 ! If none of the possible barostat has been allocated let's deallocate
111 ! the full structure
112 IF (.NOT. ASSOCIATED(barostat%npt)) THEN
113 CALL release_barostat_type(barostat)
114 END IF
115
116 ! User defined virial screening
117 CALL section_vals_val_get(barostat_section, "VIRIAL", i_val=barostat%virial_components)
118 check = barostat%virial_components == do_clv_xyz .OR. simpar%ensemble == npt_f_ensemble
119 IF (.NOT. check) THEN
120 CALL cp_abort(__location__, "The screening of the components of "// &
121 "the virial is available only with the NPT_F ensemble!")
122 END IF
123 ELSE
124 IF (explicit) THEN
125 CALL cp_warn(__location__, &
126 "A barostat has been defined with an MD ensemble which does not support barostat! "// &
127 "Its definition will be ignored!")
128 END IF
129 END IF
130
131 END SUBROUTINE create_barostat_type
132
133! **************************************************************************************************
134!> \brief ...
135!> \param barostat ...
136!> \par History
137!> 09.2007 created [tlaino]
138!> \author Teodoro Laino
139! **************************************************************************************************
140 SUBROUTINE release_barostat_type(barostat)
141 TYPE(barostat_type), POINTER :: barostat
142
143 IF (ASSOCIATED(barostat)) THEN
144 IF (ASSOCIATED(barostat%npt)) THEN
145 DEALLOCATE (barostat%npt)
146 END IF
147 NULLIFY (barostat%section)
148 DEALLOCATE (barostat)
149 END IF
150
151 END SUBROUTINE release_barostat_type
152
153END MODULE barostat_types
Barostat structure: module containing barostat available for MD.
integer, parameter, public do_clv_y
integer, parameter, public do_clv_xyz
integer, parameter, public do_clv_yz
subroutine, public create_barostat_type(barostat, md_section, force_env, simpar, globenv)
...
subroutine, public release_barostat_type(barostat)
...
integer, parameter, public do_clv_xy
integer, parameter, public do_clv_geo_center
integer, parameter, public do_clv_z
integer, parameter, public do_clv_fix_point
integer, parameter, public do_clv_xz
integer, parameter, public do_clv_x
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public initialize_npt(simpar, globenv, npt_info, cell, work_section)
...
Lumps all possible extended system variables into one type for easy access and passing.
Interface for the force calculations.
recursive subroutine, public force_env_get(force_env, in_use, fist_env, qs_env, meta_env, fp_env, subsys, para_env, potential_energy, additional_potential, kinetic_energy, harmonic_shell, kinetic_shell, cell, sub_force_env, qmmm_env, qmmmx_env, eip_env, pwdft_env, globenv, input, force_env_section, method_name_id, root_section, mixed_env, nnp_env, embed_env, ipi_env)
returns various attributes about the force environment
Define type storing the global information of a run. Keep the amount of stored data small....
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public nph_uniaxial_ensemble
integer, parameter, public npt_i_ensemble
integer, parameter, public nph_uniaxial_damped_ensemble
integer, parameter, public npe_f_ensemble
integer, parameter, public npe_i_ensemble
integer, parameter, public npt_ia_ensemble
integer, parameter, public npt_f_ensemble
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Type for storing MD parameters.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
wrapper to abstract the force evaluation of the various methods
contains the initially parsed file and the initial parallel environment
Simulation parameter type for molecular dynamics.