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