Line data Source code
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 : !> \par History
10 : !> JGH (30.11.2001) : new entries in setup_parameters_type
11 : !> change name from input_file_name to coord_...
12 : !> added topology file
13 : !> added atom_names
14 : !> Teodoro Laino [tlaino] 12.2008 - Preparing for VIRTUAL SITE constraints
15 : !> (patch by Marcel Baer)
16 : !> \author CJM & JGH
17 : ! **************************************************************************************************
18 : MODULE topology_types
19 : USE cell_types, ONLY: cell_release,&
20 : cell_type
21 : USE colvar_types, ONLY: colvar_p_type,&
22 : colvar_release
23 : USE input_constants, ONLY: do_bondparm_covalent,&
24 : do_conn_generate,&
25 : do_constr_none,&
26 : do_skip_13
27 : USE kinds, ONLY: default_path_length,&
28 : default_string_length,&
29 : dp
30 : #include "./base/base_uses.f90"
31 :
32 : IMPLICIT NONE
33 :
34 : ! **************************************************************************************************
35 : TYPE atom_info_type
36 : INTEGER, DIMENSION(:), POINTER :: id_molname => NULL(), &
37 : id_resname => NULL(), &
38 : id_atmname => NULL(), &
39 : id_atom_names => NULL(), &
40 : id_element => NULL()
41 : INTEGER, POINTER :: resid(:) => NULL()
42 : REAL(KIND=dp), DIMENSION(:, :), POINTER :: r => NULL()
43 : INTEGER, POINTER :: map_mol_typ(:) => NULL()
44 : INTEGER, POINTER :: map_mol_num(:) => NULL()
45 : INTEGER, POINTER :: map_mol_res(:) => NULL()
46 : REAL(KIND=dp), POINTER :: atm_charge(:) => NULL()
47 : REAL(KIND=dp), POINTER :: atm_mass(:) => NULL()
48 : REAL(KIND=dp), POINTER :: occup(:) => NULL()
49 : REAL(KIND=dp), POINTER :: beta(:) => NULL()
50 : END TYPE atom_info_type
51 :
52 : ! **************************************************************************************************
53 : TYPE connectivity_info_type
54 : INTEGER, POINTER :: bond_a(:) => NULL(), bond_b(:) => NULL(), bond_type(:) => NULL()
55 : INTEGER, POINTER :: ub_a(:) => NULL(), ub_b(:) => NULL(), ub_c(:) => NULL()
56 : INTEGER, POINTER :: theta_a(:) => NULL(), theta_b(:) => NULL(), theta_c(:) => NULL(), theta_type(:) => NULL()
57 : INTEGER, POINTER :: phi_a(:) => NULL(), phi_b(:) => NULL(), phi_c(:) => NULL(), phi_d(:) => NULL(), phi_type(:) => NULL()
58 : INTEGER, POINTER :: impr_a(:) => NULL(), impr_b(:) => NULL(), impr_c(:) => NULL(), &
59 : impr_d(:) => NULL(), impr_type(:) => NULL()
60 : INTEGER, POINTER :: onfo_a(:) => NULL(), onfo_b(:) => NULL()
61 : INTEGER, POINTER :: c_bond_a(:) => NULL(), c_bond_b(:) => NULL(), c_bond_type(:) => NULL()
62 : END TYPE connectivity_info_type
63 :
64 : ! **************************************************************************************************
65 : TYPE constraint_info_type
66 : ! Bonds involving Hydrogens
67 : LOGICAL :: hbonds_restraint = .FALSE. ! Restraints control
68 : REAL(KIND=dp) :: hbonds_k0 = -1.0_dp ! Restraints control
69 : ! Fixed Atoms
70 : INTEGER :: nfixed_atoms = -1
71 : INTEGER, POINTER :: fixed_atoms(:) => NULL(), fixed_type(:) => NULL(), fixed_mol_type(:) => NULL()
72 : LOGICAL, POINTER :: fixed_restraint(:) => NULL() ! Restraints control
73 : REAL(KIND=dp), POINTER :: fixed_k0(:) => NULL() ! Restraints control
74 : ! Freeze QM or MM
75 : INTEGER :: freeze_qm = -1, freeze_mm = -1, freeze_qm_type = -1, freeze_mm_type = -1
76 : LOGICAL :: fixed_mm_restraint = .FALSE., fixed_qm_restraint = .FALSE. ! Restraints control
77 : REAL(KIND=dp) :: fixed_mm_k0 = -1.0_dp, fixed_qm_k0 = -1.0_dp ! Restraints control
78 : ! Freeze with molnames
79 : LOGICAL, POINTER :: fixed_mol_restraint(:) => NULL() ! Restraints control
80 : REAL(KIND=dp), POINTER :: fixed_mol_k0(:) => NULL() ! Restraints control
81 : CHARACTER(LEN=default_string_length), POINTER :: fixed_molnames(:) => NULL()
82 : LOGICAL, POINTER, DIMENSION(:) :: fixed_exclude_qm => NULL(), fixed_exclude_mm => NULL()
83 : ! Collective constraints
84 : INTEGER :: nconst_colv = -1
85 : INTEGER, POINTER :: const_colv_mol(:) => NULL()
86 : CHARACTER(LEN=default_string_length), POINTER :: const_colv_molname(:) => NULL()
87 : REAL(KIND=dp), POINTER :: const_colv_target(:) => NULL()
88 : REAL(KIND=dp), POINTER :: const_colv_target_growth(:) => NULL()
89 : TYPE(colvar_p_type), POINTER, DIMENSION(:) :: colvar_set => NULL()
90 : LOGICAL, POINTER :: colv_intermolecular(:) => NULL()
91 : LOGICAL, POINTER :: colv_restraint(:) => NULL() ! Restraints control
92 : REAL(KIND=dp), POINTER :: colv_k0(:) => NULL() ! Restraints control
93 : LOGICAL, POINTER, DIMENSION(:) :: colv_exclude_qm => NULL(), colv_exclude_mm => NULL()
94 : ! G3x3
95 : INTEGER :: nconst_g33 = -1
96 : INTEGER, POINTER :: const_g33_mol(:) => NULL()
97 : CHARACTER(LEN=default_string_length), POINTER :: const_g33_molname(:) => NULL()
98 : INTEGER, POINTER :: const_g33_a(:) => NULL()
99 : INTEGER, POINTER :: const_g33_b(:) => NULL()
100 : INTEGER, POINTER :: const_g33_c(:) => NULL()
101 : REAL(KIND=dp), POINTER :: const_g33_dab(:) => NULL()
102 : REAL(KIND=dp), POINTER :: const_g33_dac(:) => NULL()
103 : REAL(KIND=dp), POINTER :: const_g33_dbc(:) => NULL()
104 : LOGICAL, POINTER :: g33_intermolecular(:) => NULL()
105 : LOGICAL, POINTER :: g33_restraint(:) => NULL() ! Restraints control
106 : REAL(KIND=dp), POINTER :: g33_k0(:) => NULL() ! Restraints control
107 : LOGICAL, POINTER, DIMENSION(:) :: g33_exclude_qm => NULL(), g33_exclude_mm => NULL()
108 : ! G4x6
109 : INTEGER :: nconst_g46 = -1
110 : INTEGER, POINTER :: const_g46_mol(:) => NULL()
111 : CHARACTER(LEN=default_string_length), POINTER :: const_g46_molname(:) => NULL()
112 : INTEGER, POINTER :: const_g46_a(:) => NULL()
113 : INTEGER, POINTER :: const_g46_b(:) => NULL()
114 : INTEGER, POINTER :: const_g46_c(:) => NULL()
115 : INTEGER, POINTER :: const_g46_d(:) => NULL()
116 : REAL(KIND=dp), POINTER :: const_g46_dab(:) => NULL()
117 : REAL(KIND=dp), POINTER :: const_g46_dac(:) => NULL()
118 : REAL(KIND=dp), POINTER :: const_g46_dbc(:) => NULL()
119 : REAL(KIND=dp), POINTER :: const_g46_dad(:) => NULL()
120 : REAL(KIND=dp), POINTER :: const_g46_dbd(:) => NULL()
121 : REAL(KIND=dp), POINTER :: const_g46_dcd(:) => NULL()
122 : LOGICAL, POINTER :: g46_intermolecular(:) => NULL()
123 : LOGICAL, POINTER :: g46_restraint(:) => NULL() ! Restraints control
124 : REAL(KIND=dp), POINTER :: g46_k0(:) => NULL() ! Restraints control
125 : LOGICAL, POINTER, DIMENSION(:) :: g46_exclude_qm => NULL(), g46_exclude_mm => NULL()
126 : ! virtual_site
127 : INTEGER :: nconst_vsite = -1
128 : INTEGER, POINTER :: const_vsite_mol(:) => NULL()
129 : CHARACTER(LEN=default_string_length), POINTER :: const_vsite_molname(:) => NULL()
130 : INTEGER, POINTER :: const_vsite_a(:) => NULL()
131 : INTEGER, POINTER :: const_vsite_b(:) => NULL()
132 : INTEGER, POINTER :: const_vsite_c(:) => NULL()
133 : INTEGER, POINTER :: const_vsite_d(:) => NULL()
134 : REAL(KIND=dp), POINTER :: const_vsite_wbc(:) => NULL()
135 : REAL(KIND=dp), POINTER :: const_vsite_wdc(:) => NULL()
136 : LOGICAL, POINTER :: vsite_intermolecular(:) => NULL()
137 : LOGICAL, POINTER :: vsite_restraint(:) => NULL() ! Restraints control
138 : REAL(KIND=dp), POINTER :: vsite_k0(:) => NULL() ! Restraints control
139 : LOGICAL, POINTER, DIMENSION(:) :: vsite_exclude_qm => NULL(), vsite_exclude_mm => NULL()
140 : END TYPE constraint_info_type
141 :
142 : ! **************************************************************************************************
143 : TYPE topology_parameters_type
144 : TYPE(atom_info_type), POINTER :: atom_info => NULL()
145 : TYPE(connectivity_info_type), POINTER :: conn_info => NULL()
146 : TYPE(constraint_info_type), POINTER :: cons_info => NULL()
147 : TYPE(cell_type), POINTER :: cell => NULL(), cell_ref => NULL(), cell_muc => NULL()
148 : TYPE(frag_list_p_type), DIMENSION(:), POINTER:: fragments => NULL()
149 : INTEGER :: conn_type = -1
150 : INTEGER :: coord_type = -1
151 : INTEGER :: exclude_vdw = -1
152 : INTEGER :: exclude_ei = -1
153 : INTEGER :: bondparm_type = -1
154 : !TRY TO REMOVE THIS FIVE VARIABLE IN THE FUTURE
155 : INTEGER :: natoms = -1, natom_type = -1, natom_muc = -1
156 : INTEGER :: nmol = -1, nmol_type = -1, nmol_conn = -1
157 : !TRY TO REMOVE THIS FIVE VARIABLE IN THE FUTURE
158 : LOGICAL :: aa_element = .FALSE.
159 : LOGICAL :: molname_generated = .FALSE.
160 : REAL(KIND=dp) :: bondparm_factor = -1.0_dp
161 : LOGICAL :: create_molecules = .FALSE.
162 : LOGICAL :: reorder_atom = .FALSE.
163 : LOGICAL :: molecules_check = .FALSE.
164 : LOGICAL :: coordinate = .FALSE.
165 : LOGICAL :: use_g96_velocity = .FALSE.
166 : CHARACTER(LEN=default_path_length) :: coord_file_name = ""
167 : CHARACTER(LEN=default_path_length) :: conn_file_name = ""
168 : LOGICAL :: const_atom = .FALSE.
169 : LOGICAL :: const_hydr = .FALSE.
170 : LOGICAL :: const_colv = .FALSE.
171 : LOGICAL :: const_33 = .FALSE.
172 : LOGICAL :: const_46 = .FALSE.
173 : LOGICAL :: const_vsite = .FALSE.
174 : LOGICAL :: charge_occup = .FALSE.
175 : LOGICAL :: charge_beta = .FALSE.
176 : LOGICAL :: charge_extended = .FALSE.
177 : LOGICAL :: para_res = .FALSE.
178 : END TYPE topology_parameters_type
179 :
180 : ! **************************************************************************************************
181 : TYPE constr_list_type
182 : INTEGER, DIMENSION(:), POINTER :: constr => NULL()
183 : END TYPE constr_list_type
184 : ! **************************************************************************************************
185 : TYPE frag_list_p_type
186 : INTEGER :: frag_start = -1
187 : INTEGER :: frag_end = -1
188 : END TYPE frag_list_p_type
189 :
190 : PUBLIC :: atom_info_type, &
191 : connectivity_info_type, &
192 : constraint_info_type, &
193 : topology_parameters_type, &
194 : constr_list_type, frag_list_p_type
195 :
196 : PUBLIC :: init_topology, &
197 : deallocate_topology, &
198 : pre_read_topology
199 :
200 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'topology_types'
201 : PRIVATE
202 :
203 : CONTAINS
204 :
205 : ! **************************************************************************************************
206 : !> \brief 1. Just NULLIFY and zero all the stuff
207 : !> \param topology ...
208 : !> \par History
209 : !> none
210 : ! **************************************************************************************************
211 11264 : SUBROUTINE init_topology(topology)
212 : TYPE(topology_parameters_type), INTENT(INOUT) :: topology
213 :
214 : !-----------------------------------------------------------------------------
215 : ! 1. Nullify and allocate things in topology
216 : !-----------------------------------------------------------------------------
217 :
218 11264 : ALLOCATE (topology%atom_info)
219 11264 : ALLOCATE (topology%conn_info)
220 11264 : ALLOCATE (topology%cons_info)
221 : !-----------------------------------------------------------------------------
222 : ! 2. Initialize and Nullify things in topology
223 : !-----------------------------------------------------------------------------
224 11264 : NULLIFY (topology%cell, topology%cell_ref, topology%cell_muc)
225 11264 : topology%natoms = 0
226 11264 : topology%natom_muc = 0
227 11264 : topology%natom_type = 0
228 11264 : topology%nmol = 0
229 11264 : topology%nmol_type = 0
230 11264 : topology%nmol_conn = 0
231 11264 : topology%bondparm_type = do_bondparm_covalent
232 11264 : topology%reorder_atom = .FALSE.
233 11264 : topology%create_molecules = .FALSE.
234 11264 : topology%molecules_check = .FALSE.
235 11264 : topology%coordinate = .FALSE.
236 11264 : topology%use_g96_velocity = .FALSE.
237 11264 : topology%coord_type = -1
238 11264 : topology%coord_file_name = ''
239 11264 : topology%conn_type = do_conn_generate
240 11264 : topology%conn_file_name = 'OFF'
241 11264 : topology%const_atom = .FALSE.
242 11264 : topology%const_hydr = .FALSE.
243 11264 : topology%const_colv = .FALSE.
244 11264 : topology%const_33 = .FALSE.
245 11264 : topology%const_46 = .FALSE.
246 11264 : topology%const_vsite = .FALSE.
247 11264 : topology%charge_occup = .FALSE.
248 11264 : topology%charge_beta = .FALSE.
249 11264 : topology%charge_extended = .FALSE.
250 11264 : topology%para_res = .FALSE.
251 11264 : topology%molname_generated = .FALSE.
252 11264 : topology%aa_element = .FALSE.
253 11264 : topology%exclude_vdw = do_skip_13
254 11264 : topology%exclude_ei = do_skip_13
255 : !-----------------------------------------------------------------------------
256 : ! 3. Initialize and Nullify things in topology%atom_info
257 : !-----------------------------------------------------------------------------
258 11264 : NULLIFY (topology%atom_info%id_molname)
259 11264 : NULLIFY (topology%atom_info%id_resname)
260 11264 : NULLIFY (topology%atom_info%resid)
261 11264 : NULLIFY (topology%atom_info%id_atmname)
262 11264 : NULLIFY (topology%atom_info%id_atom_names)
263 11264 : NULLIFY (topology%atom_info%r)
264 11264 : NULLIFY (topology%atom_info%map_mol_typ)
265 11264 : NULLIFY (topology%atom_info%map_mol_num)
266 11264 : NULLIFY (topology%atom_info%map_mol_res)
267 11264 : NULLIFY (topology%atom_info%atm_charge)
268 11264 : NULLIFY (topology%atom_info%atm_mass)
269 11264 : NULLIFY (topology%atom_info%occup)
270 11264 : NULLIFY (topology%atom_info%beta)
271 11264 : NULLIFY (topology%atom_info%id_element)
272 : !-----------------------------------------------------------------------------
273 : ! 4. Initialize and Nullify things in topology%conn_info
274 : !-----------------------------------------------------------------------------
275 11264 : NULLIFY (topology%conn_info%bond_a)
276 11264 : NULLIFY (topology%conn_info%bond_b)
277 11264 : NULLIFY (topology%conn_info%bond_type)
278 11264 : NULLIFY (topology%conn_info%ub_a)
279 11264 : NULLIFY (topology%conn_info%ub_b)
280 11264 : NULLIFY (topology%conn_info%ub_c)
281 11264 : NULLIFY (topology%conn_info%theta_a)
282 11264 : NULLIFY (topology%conn_info%theta_b)
283 11264 : NULLIFY (topology%conn_info%theta_c)
284 11264 : NULLIFY (topology%conn_info%theta_type)
285 11264 : NULLIFY (topology%conn_info%phi_a)
286 11264 : NULLIFY (topology%conn_info%phi_b)
287 11264 : NULLIFY (topology%conn_info%phi_c)
288 11264 : NULLIFY (topology%conn_info%phi_d)
289 11264 : NULLIFY (topology%conn_info%phi_type)
290 11264 : NULLIFY (topology%conn_info%impr_a)
291 11264 : NULLIFY (topology%conn_info%impr_b)
292 11264 : NULLIFY (topology%conn_info%impr_c)
293 11264 : NULLIFY (topology%conn_info%impr_d)
294 11264 : NULLIFY (topology%conn_info%impr_type)
295 11264 : NULLIFY (topology%conn_info%onfo_a)
296 11264 : NULLIFY (topology%conn_info%onfo_b)
297 11264 : NULLIFY (topology%conn_info%c_bond_a)
298 11264 : NULLIFY (topology%conn_info%c_bond_b)
299 11264 : NULLIFY (topology%conn_info%c_bond_type)
300 : !-----------------------------------------------------------------------------
301 : ! 5. Initialize and Nullify things in topology%cons_info
302 : !-----------------------------------------------------------------------------
303 11264 : CALL init_constraint(topology%cons_info)
304 11264 : END SUBROUTINE init_topology
305 :
306 : ! **************************************************************************************************
307 : !> \brief 1. Just NULLIFY and zero all the stuff
308 : !> \param constraint_info ...
309 : !> \par History
310 : !> none
311 : ! **************************************************************************************************
312 11264 : SUBROUTINE init_constraint(constraint_info)
313 : TYPE(constraint_info_type), POINTER :: constraint_info
314 :
315 : ! Bonds involving Hydrogens
316 :
317 11264 : constraint_info%hbonds_restraint = .FALSE.
318 : ! Fixed Atoms
319 11264 : constraint_info%nfixed_atoms = 0
320 11264 : constraint_info%freeze_mm = do_constr_none
321 11264 : constraint_info%freeze_qm = do_constr_none
322 11264 : NULLIFY (constraint_info%fixed_atoms)
323 11264 : NULLIFY (constraint_info%fixed_type)
324 11264 : NULLIFY (constraint_info%fixed_mol_type)
325 11264 : NULLIFY (constraint_info%fixed_molnames)
326 11264 : NULLIFY (constraint_info%fixed_restraint)
327 11264 : NULLIFY (constraint_info%fixed_k0)
328 11264 : NULLIFY (constraint_info%fixed_mol_restraint)
329 11264 : NULLIFY (constraint_info%fixed_mol_k0)
330 11264 : NULLIFY (constraint_info%fixed_exclude_qm, constraint_info%fixed_exclude_mm)
331 : ! Collective Constraints
332 11264 : constraint_info%nconst_colv = 0
333 11264 : NULLIFY (constraint_info%colvar_set)
334 11264 : NULLIFY (constraint_info%const_colv_mol)
335 11264 : NULLIFY (constraint_info%const_colv_molname)
336 11264 : NULLIFY (constraint_info%const_colv_target)
337 11264 : NULLIFY (constraint_info%const_colv_target_growth)
338 11264 : NULLIFY (constraint_info%colv_intermolecular)
339 11264 : NULLIFY (constraint_info%colv_restraint)
340 11264 : NULLIFY (constraint_info%colv_k0)
341 11264 : NULLIFY (constraint_info%colv_exclude_qm, constraint_info%colv_exclude_mm)
342 : ! G3x3
343 11264 : constraint_info%nconst_g33 = 0
344 11264 : NULLIFY (constraint_info%const_g33_mol)
345 11264 : NULLIFY (constraint_info%const_g33_molname)
346 11264 : NULLIFY (constraint_info%const_g33_a)
347 11264 : NULLIFY (constraint_info%const_g33_b)
348 11264 : NULLIFY (constraint_info%const_g33_c)
349 11264 : NULLIFY (constraint_info%const_g33_dab)
350 11264 : NULLIFY (constraint_info%const_g33_dac)
351 11264 : NULLIFY (constraint_info%const_g33_dbc)
352 11264 : NULLIFY (constraint_info%g33_intermolecular)
353 11264 : NULLIFY (constraint_info%g33_restraint)
354 11264 : NULLIFY (constraint_info%g33_k0)
355 11264 : NULLIFY (constraint_info%g33_exclude_qm, constraint_info%g33_exclude_mm)
356 : ! G4x6
357 11264 : constraint_info%nconst_g46 = 0
358 11264 : NULLIFY (constraint_info%const_g46_mol)
359 11264 : NULLIFY (constraint_info%const_g46_molname)
360 11264 : NULLIFY (constraint_info%const_g46_a)
361 11264 : NULLIFY (constraint_info%const_g46_b)
362 11264 : NULLIFY (constraint_info%const_g46_c)
363 11264 : NULLIFY (constraint_info%const_g46_d)
364 11264 : NULLIFY (constraint_info%const_g46_dab)
365 11264 : NULLIFY (constraint_info%const_g46_dac)
366 11264 : NULLIFY (constraint_info%const_g46_dbc)
367 11264 : NULLIFY (constraint_info%const_g46_dad)
368 11264 : NULLIFY (constraint_info%const_g46_dbd)
369 11264 : NULLIFY (constraint_info%const_g46_dcd)
370 11264 : NULLIFY (constraint_info%g46_intermolecular)
371 11264 : NULLIFY (constraint_info%g46_restraint)
372 11264 : NULLIFY (constraint_info%g46_k0)
373 11264 : NULLIFY (constraint_info%g46_exclude_qm, constraint_info%g46_exclude_mm)
374 : ! virtual_site
375 11264 : constraint_info%nconst_vsite = 0
376 11264 : NULLIFY (constraint_info%const_vsite_mol)
377 11264 : NULLIFY (constraint_info%const_vsite_molname)
378 11264 : NULLIFY (constraint_info%const_vsite_a)
379 11264 : NULLIFY (constraint_info%const_vsite_b)
380 11264 : NULLIFY (constraint_info%const_vsite_c)
381 11264 : NULLIFY (constraint_info%const_vsite_d)
382 11264 : NULLIFY (constraint_info%const_vsite_wbc)
383 11264 : NULLIFY (constraint_info%const_vsite_wdc)
384 11264 : NULLIFY (constraint_info%vsite_intermolecular)
385 11264 : NULLIFY (constraint_info%vsite_restraint)
386 11264 : NULLIFY (constraint_info%vsite_k0)
387 11264 : NULLIFY (constraint_info%vsite_exclude_qm, constraint_info%vsite_exclude_mm)
388 :
389 11264 : END SUBROUTINE init_constraint
390 :
391 : ! **************************************************************************************************
392 : !> \brief 1. Just DEALLOCATE all the stuff
393 : !> \param topology ...
394 : !> \par History
395 : !> none
396 : ! **************************************************************************************************
397 11264 : SUBROUTINE deallocate_topology(topology)
398 : TYPE(topology_parameters_type), INTENT(INOUT) :: topology
399 :
400 : !-----------------------------------------------------------------------------
401 : ! 1. DEALLOCATE things in topology%atom_info
402 : !-----------------------------------------------------------------------------
403 :
404 11264 : IF (ASSOCIATED(topology%atom_info%id_molname)) THEN
405 11264 : DEALLOCATE (topology%atom_info%id_molname)
406 : END IF
407 11264 : IF (ASSOCIATED(topology%atom_info%id_resname)) THEN
408 11264 : DEALLOCATE (topology%atom_info%id_resname)
409 : END IF
410 11264 : IF (ASSOCIATED(topology%atom_info%resid)) THEN
411 10726 : DEALLOCATE (topology%atom_info%resid)
412 : END IF
413 11264 : IF (ASSOCIATED(topology%atom_info%id_atmname)) THEN
414 11264 : DEALLOCATE (topology%atom_info%id_atmname)
415 : END IF
416 11264 : IF (ASSOCIATED(topology%atom_info%id_atom_names)) THEN
417 11264 : DEALLOCATE (topology%atom_info%id_atom_names)
418 : END IF
419 11264 : IF (ASSOCIATED(topology%atom_info%r)) THEN
420 11264 : DEALLOCATE (topology%atom_info%r)
421 : END IF
422 11264 : IF (ASSOCIATED(topology%atom_info%map_mol_typ)) THEN
423 11264 : DEALLOCATE (topology%atom_info%map_mol_typ)
424 : END IF
425 11264 : IF (ASSOCIATED(topology%atom_info%map_mol_num)) THEN
426 11264 : DEALLOCATE (topology%atom_info%map_mol_num)
427 : END IF
428 11264 : IF (ASSOCIATED(topology%atom_info%map_mol_res)) THEN
429 11264 : DEALLOCATE (topology%atom_info%map_mol_res)
430 : END IF
431 11264 : IF (ASSOCIATED(topology%atom_info%atm_charge)) THEN
432 11264 : DEALLOCATE (topology%atom_info%atm_charge)
433 : END IF
434 11264 : IF (ASSOCIATED(topology%atom_info%atm_mass)) THEN
435 11264 : DEALLOCATE (topology%atom_info%atm_mass)
436 : END IF
437 11264 : IF (ASSOCIATED(topology%atom_info%occup)) THEN
438 2105 : DEALLOCATE (topology%atom_info%occup)
439 : END IF
440 11264 : IF (ASSOCIATED(topology%atom_info%beta)) THEN
441 2105 : DEALLOCATE (topology%atom_info%beta)
442 : END IF
443 11264 : IF (ASSOCIATED(topology%atom_info%id_element)) THEN
444 11264 : DEALLOCATE (topology%atom_info%id_element)
445 : END IF
446 : !-----------------------------------------------------------------------------
447 : ! 2. DEALLOCATE things in topology%conn_info
448 : !-----------------------------------------------------------------------------
449 11264 : IF (ASSOCIATED(topology%conn_info%bond_a)) THEN
450 11264 : DEALLOCATE (topology%conn_info%bond_a)
451 : END IF
452 11264 : IF (ASSOCIATED(topology%conn_info%bond_b)) THEN
453 11264 : DEALLOCATE (topology%conn_info%bond_b)
454 : END IF
455 11264 : IF (ASSOCIATED(topology%conn_info%bond_type)) THEN
456 14 : DEALLOCATE (topology%conn_info%bond_type)
457 : END IF
458 11264 : IF (ASSOCIATED(topology%conn_info%ub_a)) THEN
459 11250 : DEALLOCATE (topology%conn_info%ub_a)
460 : END IF
461 11264 : IF (ASSOCIATED(topology%conn_info%ub_b)) THEN
462 11250 : DEALLOCATE (topology%conn_info%ub_b)
463 : END IF
464 11264 : IF (ASSOCIATED(topology%conn_info%ub_c)) THEN
465 11250 : DEALLOCATE (topology%conn_info%ub_c)
466 : END IF
467 11264 : IF (ASSOCIATED(topology%conn_info%theta_a)) THEN
468 11264 : DEALLOCATE (topology%conn_info%theta_a)
469 : END IF
470 11264 : IF (ASSOCIATED(topology%conn_info%theta_b)) THEN
471 11264 : DEALLOCATE (topology%conn_info%theta_b)
472 : END IF
473 11264 : IF (ASSOCIATED(topology%conn_info%theta_c)) THEN
474 11264 : DEALLOCATE (topology%conn_info%theta_c)
475 : END IF
476 11264 : IF (ASSOCIATED(topology%conn_info%theta_type)) THEN
477 14 : DEALLOCATE (topology%conn_info%theta_type)
478 : END IF
479 11264 : IF (ASSOCIATED(topology%conn_info%phi_a)) THEN
480 11264 : DEALLOCATE (topology%conn_info%phi_a)
481 : END IF
482 11264 : IF (ASSOCIATED(topology%conn_info%phi_b)) THEN
483 11264 : DEALLOCATE (topology%conn_info%phi_b)
484 : END IF
485 11264 : IF (ASSOCIATED(topology%conn_info%phi_c)) THEN
486 11264 : DEALLOCATE (topology%conn_info%phi_c)
487 : END IF
488 11264 : IF (ASSOCIATED(topology%conn_info%phi_d)) THEN
489 11264 : DEALLOCATE (topology%conn_info%phi_d)
490 : END IF
491 11264 : IF (ASSOCIATED(topology%conn_info%phi_type)) THEN
492 14 : DEALLOCATE (topology%conn_info%phi_type)
493 : END IF
494 11264 : IF (ASSOCIATED(topology%conn_info%impr_a)) THEN
495 11264 : DEALLOCATE (topology%conn_info%impr_a)
496 : END IF
497 11264 : IF (ASSOCIATED(topology%conn_info%impr_b)) THEN
498 11264 : DEALLOCATE (topology%conn_info%impr_b)
499 : END IF
500 11264 : IF (ASSOCIATED(topology%conn_info%impr_c)) THEN
501 11264 : DEALLOCATE (topology%conn_info%impr_c)
502 : END IF
503 11264 : IF (ASSOCIATED(topology%conn_info%impr_d)) THEN
504 11264 : DEALLOCATE (topology%conn_info%impr_d)
505 : END IF
506 11264 : IF (ASSOCIATED(topology%conn_info%impr_type)) THEN
507 14 : DEALLOCATE (topology%conn_info%impr_type)
508 : END IF
509 11264 : IF (ASSOCIATED(topology%conn_info%onfo_a)) THEN
510 11258 : DEALLOCATE (topology%conn_info%onfo_a)
511 : END IF
512 11264 : IF (ASSOCIATED(topology%conn_info%onfo_b)) THEN
513 11258 : DEALLOCATE (topology%conn_info%onfo_b)
514 : END IF
515 11264 : IF (ASSOCIATED(topology%conn_info%c_bond_a)) THEN
516 8883 : DEALLOCATE (topology%conn_info%c_bond_a)
517 : END IF
518 11264 : IF (ASSOCIATED(topology%conn_info%c_bond_b)) THEN
519 8883 : DEALLOCATE (topology%conn_info%c_bond_b)
520 : END IF
521 11264 : IF (ASSOCIATED(topology%conn_info%c_bond_type)) THEN
522 0 : DEALLOCATE (topology%conn_info%c_bond_type)
523 : END IF
524 : !-----------------------------------------------------------------------------
525 : ! 3. DEALLOCATE things in topology%cons_info
526 : !-----------------------------------------------------------------------------
527 11264 : IF (ASSOCIATED(topology%cons_info)) &
528 11264 : CALL deallocate_constraint(topology%cons_info)
529 : !-----------------------------------------------------------------------------
530 : ! 4. DEALLOCATE things in topology
531 : !-----------------------------------------------------------------------------
532 11264 : CALL cell_release(topology%cell)
533 11264 : CALL cell_release(topology%cell_ref)
534 11264 : CALL cell_release(topology%cell_muc)
535 11264 : IF (ASSOCIATED(topology%atom_info)) THEN
536 11264 : DEALLOCATE (topology%atom_info)
537 : END IF
538 11264 : IF (ASSOCIATED(topology%conn_info)) THEN
539 11264 : DEALLOCATE (topology%conn_info)
540 : END IF
541 11264 : IF (ASSOCIATED(topology%cons_info)) THEN
542 11264 : DEALLOCATE (topology%cons_info)
543 : END IF
544 : !------------------------------------------------
545 : ! 5. DEALLOCATE fragments
546 : !-----------------------------------------------
547 11264 : IF (ASSOCIATED(topology%fragments)) THEN
548 2 : DEALLOCATE (topology%fragments)
549 : END IF
550 :
551 11264 : END SUBROUTINE deallocate_topology
552 :
553 : ! **************************************************************************************************
554 : !> \brief 1. Just DEALLOCATE all the stuff
555 : !> \param constraint_info ...
556 : !> \par History
557 : !> none
558 : ! **************************************************************************************************
559 11264 : SUBROUTINE deallocate_constraint(constraint_info)
560 : TYPE(constraint_info_type), POINTER :: constraint_info
561 :
562 : INTEGER :: i
563 :
564 : ! Fixed Atoms
565 :
566 11264 : IF (ASSOCIATED(constraint_info%fixed_atoms)) THEN
567 110 : DEALLOCATE (constraint_info%fixed_atoms)
568 : END IF
569 11264 : IF (ASSOCIATED(constraint_info%fixed_type)) THEN
570 110 : DEALLOCATE (constraint_info%fixed_type)
571 : END IF
572 11264 : IF (ASSOCIATED(constraint_info%fixed_molnames)) THEN
573 110 : DEALLOCATE (constraint_info%fixed_molnames)
574 : END IF
575 11264 : IF (ASSOCIATED(constraint_info%fixed_mol_type)) THEN
576 110 : DEALLOCATE (constraint_info%fixed_mol_type)
577 : END IF
578 11264 : IF (ASSOCIATED(constraint_info%fixed_restraint)) THEN
579 110 : DEALLOCATE (constraint_info%fixed_restraint)
580 : END IF
581 11264 : IF (ASSOCIATED(constraint_info%fixed_k0)) THEN
582 110 : DEALLOCATE (constraint_info%fixed_k0)
583 : END IF
584 11264 : IF (ASSOCIATED(constraint_info%fixed_mol_restraint)) THEN
585 110 : DEALLOCATE (constraint_info%fixed_mol_restraint)
586 : END IF
587 11264 : IF (ASSOCIATED(constraint_info%fixed_mol_k0)) THEN
588 110 : DEALLOCATE (constraint_info%fixed_mol_k0)
589 : END IF
590 11264 : IF (ASSOCIATED(constraint_info%fixed_exclude_qm)) THEN
591 110 : DEALLOCATE (constraint_info%fixed_exclude_qm)
592 : END IF
593 11264 : IF (ASSOCIATED(constraint_info%fixed_exclude_mm)) THEN
594 110 : DEALLOCATE (constraint_info%fixed_exclude_mm)
595 : END IF
596 : ! Collective Constraint
597 11264 : IF (ASSOCIATED(constraint_info%colvar_set)) THEN
598 586 : DO i = 1, SIZE(constraint_info%colvar_set)
599 586 : IF (ASSOCIATED(constraint_info%colvar_set(i)%colvar)) THEN
600 450 : CALL colvar_release(constraint_info%colvar_set(i)%colvar)
601 450 : NULLIFY (constraint_info%colvar_set(i)%colvar)
602 : END IF
603 : END DO
604 136 : DEALLOCATE (constraint_info%colvar_set)
605 : END IF
606 11264 : IF (ASSOCIATED(constraint_info%const_colv_mol)) THEN
607 136 : DEALLOCATE (constraint_info%const_colv_mol)
608 : END IF
609 11264 : IF (ASSOCIATED(constraint_info%const_colv_molname)) THEN
610 136 : DEALLOCATE (constraint_info%const_colv_molname)
611 : END IF
612 11264 : IF (ASSOCIATED(constraint_info%const_colv_target)) THEN
613 136 : DEALLOCATE (constraint_info%const_colv_target)
614 : END IF
615 11264 : IF (ASSOCIATED(constraint_info%const_colv_target_growth)) THEN
616 136 : DEALLOCATE (constraint_info%const_colv_target_growth)
617 : END IF
618 11264 : IF (ASSOCIATED(constraint_info%colv_intermolecular)) THEN
619 136 : DEALLOCATE (constraint_info%colv_intermolecular)
620 : END IF
621 11264 : IF (ASSOCIATED(constraint_info%colv_restraint)) THEN
622 136 : DEALLOCATE (constraint_info%colv_restraint)
623 : END IF
624 11264 : IF (ASSOCIATED(constraint_info%colv_k0)) THEN
625 136 : DEALLOCATE (constraint_info%colv_k0)
626 : END IF
627 11264 : IF (ASSOCIATED(constraint_info%colv_exclude_qm)) THEN
628 136 : DEALLOCATE (constraint_info%colv_exclude_qm)
629 : END IF
630 11264 : IF (ASSOCIATED(constraint_info%colv_exclude_mm)) THEN
631 136 : DEALLOCATE (constraint_info%colv_exclude_mm)
632 : END IF
633 : ! G3x3
634 11264 : IF (ASSOCIATED(constraint_info%const_g33_mol)) THEN
635 156 : DEALLOCATE (constraint_info%const_g33_mol)
636 : END IF
637 11264 : IF (ASSOCIATED(constraint_info%const_g33_molname)) THEN
638 156 : DEALLOCATE (constraint_info%const_g33_molname)
639 : END IF
640 11264 : IF (ASSOCIATED(constraint_info%const_g33_a)) THEN
641 156 : DEALLOCATE (constraint_info%const_g33_a)
642 : END IF
643 11264 : IF (ASSOCIATED(constraint_info%const_g33_b)) THEN
644 156 : DEALLOCATE (constraint_info%const_g33_b)
645 : END IF
646 11264 : IF (ASSOCIATED(constraint_info%const_g33_c)) THEN
647 156 : DEALLOCATE (constraint_info%const_g33_c)
648 : END IF
649 11264 : IF (ASSOCIATED(constraint_info%const_g33_dab)) THEN
650 156 : DEALLOCATE (constraint_info%const_g33_dab)
651 : END IF
652 11264 : IF (ASSOCIATED(constraint_info%const_g33_dac)) THEN
653 156 : DEALLOCATE (constraint_info%const_g33_dac)
654 : END IF
655 11264 : IF (ASSOCIATED(constraint_info%const_g33_dbc)) THEN
656 156 : DEALLOCATE (constraint_info%const_g33_dbc)
657 : END IF
658 11264 : IF (ASSOCIATED(constraint_info%g33_intermolecular)) THEN
659 156 : DEALLOCATE (constraint_info%g33_intermolecular)
660 : END IF
661 11264 : IF (ASSOCIATED(constraint_info%g33_restraint)) THEN
662 156 : DEALLOCATE (constraint_info%g33_restraint)
663 : END IF
664 11264 : IF (ASSOCIATED(constraint_info%g33_k0)) THEN
665 156 : DEALLOCATE (constraint_info%g33_k0)
666 : END IF
667 11264 : IF (ASSOCIATED(constraint_info%g33_exclude_qm)) THEN
668 156 : DEALLOCATE (constraint_info%g33_exclude_qm)
669 : END IF
670 11264 : IF (ASSOCIATED(constraint_info%g33_exclude_mm)) THEN
671 156 : DEALLOCATE (constraint_info%g33_exclude_mm)
672 : END IF
673 : ! G4x6
674 11264 : IF (ASSOCIATED(constraint_info%const_g46_mol)) THEN
675 16 : DEALLOCATE (constraint_info%const_g46_mol)
676 : END IF
677 11264 : IF (ASSOCIATED(constraint_info%const_g46_molname)) THEN
678 16 : DEALLOCATE (constraint_info%const_g46_molname)
679 : END IF
680 11264 : IF (ASSOCIATED(constraint_info%const_g46_a)) THEN
681 16 : DEALLOCATE (constraint_info%const_g46_a)
682 : END IF
683 11264 : IF (ASSOCIATED(constraint_info%const_g46_b)) THEN
684 16 : DEALLOCATE (constraint_info%const_g46_b)
685 : END IF
686 11264 : IF (ASSOCIATED(constraint_info%const_g46_c)) THEN
687 16 : DEALLOCATE (constraint_info%const_g46_c)
688 : END IF
689 11264 : IF (ASSOCIATED(constraint_info%const_g46_d)) THEN
690 16 : DEALLOCATE (constraint_info%const_g46_d)
691 : END IF
692 11264 : IF (ASSOCIATED(constraint_info%const_g46_dab)) THEN
693 16 : DEALLOCATE (constraint_info%const_g46_dab)
694 : END IF
695 11264 : IF (ASSOCIATED(constraint_info%const_g46_dac)) THEN
696 16 : DEALLOCATE (constraint_info%const_g46_dac)
697 : END IF
698 11264 : IF (ASSOCIATED(constraint_info%const_g46_dbc)) THEN
699 16 : DEALLOCATE (constraint_info%const_g46_dbc)
700 : END IF
701 11264 : IF (ASSOCIATED(constraint_info%const_g46_dad)) THEN
702 16 : DEALLOCATE (constraint_info%const_g46_dad)
703 : END IF
704 11264 : IF (ASSOCIATED(constraint_info%const_g46_dbd)) THEN
705 16 : DEALLOCATE (constraint_info%const_g46_dbd)
706 : END IF
707 11264 : IF (ASSOCIATED(constraint_info%const_g46_dcd)) THEN
708 16 : DEALLOCATE (constraint_info%const_g46_dcd)
709 : END IF
710 11264 : IF (ASSOCIATED(constraint_info%g46_intermolecular)) THEN
711 16 : DEALLOCATE (constraint_info%g46_intermolecular)
712 : END IF
713 11264 : IF (ASSOCIATED(constraint_info%g46_restraint)) THEN
714 16 : DEALLOCATE (constraint_info%g46_restraint)
715 : END IF
716 11264 : IF (ASSOCIATED(constraint_info%g46_k0)) THEN
717 16 : DEALLOCATE (constraint_info%g46_k0)
718 : END IF
719 11264 : IF (ASSOCIATED(constraint_info%g46_exclude_qm)) THEN
720 16 : DEALLOCATE (constraint_info%g46_exclude_qm)
721 : END IF
722 11264 : IF (ASSOCIATED(constraint_info%g46_exclude_mm)) THEN
723 16 : DEALLOCATE (constraint_info%g46_exclude_mm)
724 : END IF
725 : ! virtual_site
726 11264 : IF (ASSOCIATED(constraint_info%const_vsite_mol)) THEN
727 8 : DEALLOCATE (constraint_info%const_vsite_mol)
728 : END IF
729 11264 : IF (ASSOCIATED(constraint_info%const_vsite_molname)) THEN
730 8 : DEALLOCATE (constraint_info%const_vsite_molname)
731 : END IF
732 11264 : IF (ASSOCIATED(constraint_info%const_vsite_a)) THEN
733 8 : DEALLOCATE (constraint_info%const_vsite_a)
734 : END IF
735 11264 : IF (ASSOCIATED(constraint_info%const_vsite_b)) THEN
736 8 : DEALLOCATE (constraint_info%const_vsite_b)
737 : END IF
738 11264 : IF (ASSOCIATED(constraint_info%const_vsite_c)) THEN
739 8 : DEALLOCATE (constraint_info%const_vsite_c)
740 : END IF
741 11264 : IF (ASSOCIATED(constraint_info%const_vsite_d)) THEN
742 8 : DEALLOCATE (constraint_info%const_vsite_d)
743 : END IF
744 11264 : IF (ASSOCIATED(constraint_info%const_vsite_wbc)) THEN
745 8 : DEALLOCATE (constraint_info%const_vsite_wbc)
746 : END IF
747 11264 : IF (ASSOCIATED(constraint_info%const_vsite_wdc)) THEN
748 8 : DEALLOCATE (constraint_info%const_vsite_wdc)
749 : END IF
750 11264 : IF (ASSOCIATED(constraint_info%vsite_intermolecular)) THEN
751 8 : DEALLOCATE (constraint_info%vsite_intermolecular)
752 : END IF
753 11264 : IF (ASSOCIATED(constraint_info%vsite_restraint)) THEN
754 8 : DEALLOCATE (constraint_info%vsite_restraint)
755 : END IF
756 11264 : IF (ASSOCIATED(constraint_info%vsite_k0)) THEN
757 8 : DEALLOCATE (constraint_info%vsite_k0)
758 : END IF
759 11264 : IF (ASSOCIATED(constraint_info%vsite_exclude_qm)) THEN
760 8 : DEALLOCATE (constraint_info%vsite_exclude_qm)
761 : END IF
762 11264 : IF (ASSOCIATED(constraint_info%vsite_exclude_mm)) THEN
763 8 : DEALLOCATE (constraint_info%vsite_exclude_mm)
764 : END IF
765 11264 : END SUBROUTINE deallocate_constraint
766 :
767 : ! **************************************************************************************************
768 : !> \brief Deallocate possibly allocated arrays before reading topology
769 : !> \param topology ...
770 : !> \par History
771 : !> none
772 : ! **************************************************************************************************
773 797 : SUBROUTINE pre_read_topology(topology)
774 : TYPE(topology_parameters_type), INTENT(INOUT) :: topology
775 :
776 : TYPE(atom_info_type), POINTER :: atom_info
777 :
778 797 : atom_info => topology%atom_info
779 :
780 797 : IF (ASSOCIATED(atom_info%id_molname)) THEN
781 797 : DEALLOCATE (atom_info%id_molname)
782 : END IF
783 :
784 797 : IF (ASSOCIATED(atom_info%resid)) THEN
785 797 : DEALLOCATE (atom_info%resid)
786 : END IF
787 :
788 797 : IF (ASSOCIATED(atom_info%id_resname)) THEN
789 797 : DEALLOCATE (atom_info%id_resname)
790 : END IF
791 :
792 797 : IF (ASSOCIATED(atom_info%id_atmname)) THEN
793 797 : DEALLOCATE (atom_info%id_atmname)
794 : END IF
795 :
796 797 : IF (ASSOCIATED(atom_info%atm_charge)) THEN
797 797 : DEALLOCATE (atom_info%atm_charge)
798 : END IF
799 :
800 797 : IF (ASSOCIATED(atom_info%atm_mass)) THEN
801 797 : DEALLOCATE (atom_info%atm_mass)
802 : END IF
803 :
804 797 : END SUBROUTINE pre_read_topology
805 :
806 0 : END MODULE topology_types
|