(git:0341268)
Loading...
Searching...
No Matches
qs_subsys_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 types that represent a quickstep subsys
10!> \author Ole Schuett
11! **************************************************************************************************
15 USE atprop_types, ONLY: atprop_type
16 USE cell_types, ONLY: cell_release,&
42 USE virial_types, ONLY: virial_type
43#include "./base/base_uses.f90"
44
45 IMPLICIT NONE
46 PRIVATE
47
48 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_subsys_types'
49
50 PUBLIC :: qs_subsys_type
51
52 PUBLIC :: qs_subsys_release, &
55
57 PRIVATE
58 INTEGER :: nelectron_total = -1
59 INTEGER :: nelectron_spin(2) = -1
60 TYPE(cp_subsys_type), POINTER :: cp_subsys => null()
61 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set => null()
62 TYPE(cell_type), POINTER :: cell_ref => null()
63 LOGICAL :: use_ref_cell = .false.
64 TYPE(qs_energy_type), POINTER :: energy => null()
65 TYPE(qs_force_type), DIMENSION(:), POINTER :: force => null()
66 END TYPE qs_subsys_type
67
68CONTAINS
69
70! **************************************************************************************************
71!> \brief releases a subsys (see doc/ReferenceCounting.html)
72!> \param subsys the subsys to release
73!> \author Ole Schuett
74! **************************************************************************************************
75 SUBROUTINE qs_subsys_release(subsys)
76 TYPE(qs_subsys_type), INTENT(INOUT) :: subsys
77
78 CALL cp_subsys_release(subsys%cp_subsys)
79 CALL cell_release(subsys%cell_ref)
80 IF (ASSOCIATED(subsys%qs_kind_set)) THEN
81 CALL deallocate_qs_kind_set(subsys%qs_kind_set)
82 END IF
83 IF (ASSOCIATED(subsys%energy)) THEN
84 CALL deallocate_qs_energy(subsys%energy)
85 END IF
86 IF (ASSOCIATED(subsys%force)) THEN
87 CALL deallocate_qs_force(subsys%force)
88 END IF
89
90 END SUBROUTINE qs_subsys_release
91
92! **************************************************************************************************
93!> \brief ...
94!> \param subsys ...
95!> \param atomic_kinds ...
96!> \param atomic_kind_set ...
97!> \param particles ...
98!> \param particle_set ...
99!> \param local_particles ...
100!> \param molecules ...
101!> \param molecule_set ...
102!> \param molecule_kinds ...
103!> \param molecule_kind_set ...
104!> \param local_molecules ...
105!> \param para_env ...
106!> \param colvar_p ...
107!> \param shell_particles ...
108!> \param core_particles ...
109!> \param gci ...
110!> \param multipoles ...
111!> \param natom ...
112!> \param nparticle ...
113!> \param ncore ...
114!> \param nshell ...
115!> \param nkind ...
116!> \param atprop ...
117!> \param virial ...
118!> \param results ...
119!> \param cell ...
120!> \param cell_ref ...
121!> \param use_ref_cell ...
122!> \param energy ...
123!> \param force ...
124!> \param qs_kind_set ...
125!> \param cp_subsys ...
126!> \param nelectron_total ...
127!> \param nelectron_spin ...
128! **************************************************************************************************
129 SUBROUTINE qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, &
130 local_particles, molecules, molecule_set, &
131 molecule_kinds, molecule_kind_set, &
132 local_molecules, para_env, colvar_p, &
133 shell_particles, core_particles, gci, multipoles, &
134 natom, nparticle, ncore, nshell, nkind, atprop, virial, &
135 results, cell, cell_ref, use_ref_cell, energy, force, &
136 qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
137 TYPE(qs_subsys_type), INTENT(IN) :: subsys
138 TYPE(atomic_kind_list_type), OPTIONAL, POINTER :: atomic_kinds
139 TYPE(atomic_kind_type), DIMENSION(:), OPTIONAL, &
140 POINTER :: atomic_kind_set
141 TYPE(particle_list_type), OPTIONAL, POINTER :: particles
142 TYPE(particle_type), DIMENSION(:), OPTIONAL, &
143 POINTER :: particle_set
144 TYPE(distribution_1d_type), OPTIONAL, POINTER :: local_particles
145 TYPE(molecule_list_type), OPTIONAL, POINTER :: molecules
146 TYPE(molecule_type), DIMENSION(:), OPTIONAL, &
147 POINTER :: molecule_set
148 TYPE(molecule_kind_list_type), OPTIONAL, POINTER :: molecule_kinds
149 TYPE(molecule_kind_type), DIMENSION(:), OPTIONAL, &
150 POINTER :: molecule_kind_set
151 TYPE(distribution_1d_type), OPTIONAL, POINTER :: local_molecules
152 TYPE(mp_para_env_type), OPTIONAL, POINTER :: para_env
153 TYPE(colvar_p_type), DIMENSION(:), OPTIONAL, &
154 POINTER :: colvar_p
155 TYPE(particle_list_type), OPTIONAL, POINTER :: shell_particles, core_particles
156 TYPE(global_constraint_type), OPTIONAL, POINTER :: gci
157 TYPE(multipole_type), OPTIONAL, POINTER :: multipoles
158 INTEGER, INTENT(out), OPTIONAL :: natom, nparticle, ncore, nshell, nkind
159 TYPE(atprop_type), OPTIONAL, POINTER :: atprop
160 TYPE(virial_type), OPTIONAL, POINTER :: virial
161 TYPE(cp_result_type), OPTIONAL, POINTER :: results
162 TYPE(cell_type), OPTIONAL, POINTER :: cell, cell_ref
163 LOGICAL, OPTIONAL :: use_ref_cell
164 TYPE(qs_energy_type), OPTIONAL, POINTER :: energy
165 TYPE(qs_force_type), DIMENSION(:), OPTIONAL, &
166 POINTER :: force
167 TYPE(qs_kind_type), DIMENSION(:), OPTIONAL, &
168 POINTER :: qs_kind_set
169 TYPE(cp_subsys_type), OPTIONAL, POINTER :: cp_subsys
170 INTEGER, OPTIONAL :: nelectron_total
171 INTEGER, DIMENSION(2), OPTIONAL :: nelectron_spin
172
173 CALL cp_subsys_get(subsys%cp_subsys, &
174 atomic_kinds=atomic_kinds, &
175 atomic_kind_set=atomic_kind_set, &
176 particles=particles, &
177 particle_set=particle_set, &
178 local_particles=local_particles, &
179 molecules=molecules, &
180 molecule_set=molecule_set, &
181 molecule_kinds=molecule_kinds, &
182 molecule_kind_set=molecule_kind_set, &
183 local_molecules=local_molecules, &
184 para_env=para_env, &
185 colvar_p=colvar_p, &
186 shell_particles=shell_particles, &
187 core_particles=core_particles, &
188 gci=gci, &
189 multipoles=multipoles, &
190 natom=natom, &
191 nkind=nkind, &
192 nparticle=nparticle, &
193 ncore=ncore, &
194 nshell=nshell, &
195 atprop=atprop, &
196 virial=virial, &
197 results=results, &
198 cell=cell)
199
200 IF (PRESENT(cell_ref)) cell_ref => subsys%cell_ref
201 IF (PRESENT(use_ref_cell)) use_ref_cell = subsys%use_ref_cell
202 IF (PRESENT(energy)) energy => subsys%energy
203 IF (PRESENT(force)) force => subsys%force
204 IF (PRESENT(qs_kind_set)) qs_kind_set => subsys%qs_kind_set
205 IF (PRESENT(cp_subsys)) cp_subsys => subsys%cp_subsys
206 IF (PRESENT(nelectron_total)) nelectron_total = subsys%nelectron_total
207 IF (PRESENT(nelectron_spin)) nelectron_spin = subsys%nelectron_spin
208 END SUBROUTINE qs_subsys_get
209
210! **************************************************************************************************
211!> \brief ...
212!> \param subsys ...
213!> \param cp_subsys ...
214!> \param local_particles ...
215!> \param local_molecules ...
216!> \param cell ...
217!> \param cell_ref ...
218!> \param use_ref_cell ...
219!> \param energy ...
220!> \param force ...
221!> \param qs_kind_set ...
222!> \param nelectron_total ...
223!> \param nelectron_spin ...
224! **************************************************************************************************
225 SUBROUTINE qs_subsys_set(subsys, cp_subsys, &
226 local_particles, local_molecules, cell, &
227 cell_ref, use_ref_cell, energy, force, &
228 qs_kind_set, nelectron_total, nelectron_spin)
229 TYPE(qs_subsys_type), INTENT(INOUT) :: subsys
230 TYPE(cp_subsys_type), OPTIONAL, POINTER :: cp_subsys
231 TYPE(distribution_1d_type), OPTIONAL, POINTER :: local_particles, local_molecules
232 TYPE(cell_type), OPTIONAL, POINTER :: cell, cell_ref
233 LOGICAL, OPTIONAL :: use_ref_cell
234 TYPE(qs_energy_type), OPTIONAL, POINTER :: energy
235 TYPE(qs_force_type), DIMENSION(:), OPTIONAL, &
236 POINTER :: force
237 TYPE(qs_kind_type), DIMENSION(:), OPTIONAL, &
238 POINTER :: qs_kind_set
239 INTEGER, OPTIONAL :: nelectron_total
240 INTEGER, DIMENSION(2), OPTIONAL :: nelectron_spin
241
242 IF (PRESENT(cp_subsys)) THEN
243 CALL cp_subsys_retain(cp_subsys)
244 CALL cp_subsys_release(subsys%cp_subsys)
245 subsys%cp_subsys => cp_subsys
246 END IF
247
248 CALL cp_subsys_set(subsys%cp_subsys, &
249 local_particles=local_particles, &
250 local_molecules=local_molecules, &
251 cell=cell)
252
253 IF (PRESENT(cell_ref)) THEN
254 CALL cell_retain(cell_ref)
255 CALL cell_release(subsys%cell_ref)
256 subsys%cell_ref => cell_ref
257 END IF
258
259 IF (PRESENT(use_ref_cell)) subsys%use_ref_cell = use_ref_cell
260 IF (PRESENT(energy)) subsys%energy => energy
261 ! if intels checking (-C) complains here, you have rediscovered a bug in the intel
262 ! compiler (present in at least 10.0.025). A testcase has been submitted to intel.
263 IF (PRESENT(force)) subsys%force => force
264 IF (PRESENT(qs_kind_set)) subsys%qs_kind_set => qs_kind_set
265 IF (PRESENT(nelectron_total)) subsys%nelectron_total = nelectron_total
266 IF (PRESENT(nelectron_spin)) subsys%nelectron_spin = nelectron_spin
267 END SUBROUTINE qs_subsys_set
268
269END MODULE qs_subsys_types
represent a simple array based list of the given type
Define the atomic kind types and their sub types.
Holds information on atomic properties.
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:668
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:651
Initialize the collective variables types.
set of type/routines to handle the storage of results in force_envs
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell, cell_ref, use_ref_cell)
sets various propreties of the subsys
subroutine, public cp_subsys_release(subsys)
releases a subsys (see doc/ReferenceCounting.html)
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell)
returns information about various attributes of the given subsys
subroutine, public cp_subsys_retain(subsys)
retains a subsys (see doc/ReferenceCounting.html)
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Interface to the message passing library MPI.
represent a simple array based list of the given type
Define the molecule kind structure types and the corresponding functionality.
represent a simple array based list of the given type
Define the data structure for the molecule information.
Multipole structure: for multipole (fixed and induced) in FF based MD.
represent a simple array based list of the given type
Define the data structure for the particle information.
subroutine, public deallocate_qs_energy(qs_energy)
Deallocate a Quickstep energy data structure.
subroutine, public deallocate_qs_force(qs_force)
Deallocate a Quickstep force data structure.
Define the quickstep kind type and their sub types.
subroutine, public deallocate_qs_kind_set(qs_kind_set)
Destructor routine for a set of qs kinds.
types that represent a quickstep subsys
subroutine, public qs_subsys_release(subsys)
releases a subsys (see doc/ReferenceCounting.html)
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
subroutine, public qs_subsys_set(subsys, cp_subsys, local_particles, local_molecules, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, nelectron_total, nelectron_spin)
...
Provides all information about an atomic kind.
type for the atomic properties
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
contains arbitrary information which need to be stored
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.