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