(git:d02dd26)
Loading...
Searching...
No Matches
topology_types.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \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! **************************************************************************************************
19 USE cell_types, ONLY: cell_release,&
21 USE colvar_types, ONLY: colvar_p_type,&
27 USE kinds, ONLY: default_path_length,&
29 dp
30#include "./base/base_uses.f90"
31
32 IMPLICIT NONE
33
34! **************************************************************************************************
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! **************************************************************************************************
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()
63
64! **************************************************************************************************
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! **************************************************************************************************
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.
180
181! **************************************************************************************************
183 INTEGER, DIMENSION(:), POINTER :: constr => null()
184 END TYPE constr_list_type
185! **************************************************************************************************
187 INTEGER :: frag_start = -1
188 INTEGER :: frag_end = -1
189 END TYPE frag_list_p_type
190
191 PUBLIC :: atom_info_type, &
196
197 PUBLIC :: init_topology, &
200
201 CHARACTER(len=*), PARAMETER, PRIVATE :: modulen = 'topology_types'
202 PRIVATE
203
204CONTAINS
205
206! **************************************************************************************************
207!> \brief 1. Just NULLIFY and zero all the stuff
208!> \param topology ...
209!> \par History
210!> none
211! **************************************************************************************************
212 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 ALLOCATE (topology%atom_info)
220 ALLOCATE (topology%conn_info)
221 ALLOCATE (topology%cons_info)
222 !-----------------------------------------------------------------------------
223 ! 2. Initialize and Nullify things in topology
224 !-----------------------------------------------------------------------------
225 NULLIFY (topology%cell, topology%cell_ref, topology%cell_muc)
226 topology%natoms = 0
227 topology%natom_muc = 0
228 topology%natom_type = 0
229 topology%nmol = 0
230 topology%nmol_type = 0
231 topology%nmol_conn = 0
232 topology%bondparm_type = do_bondparm_covalent
233 topology%reorder_atom = .false.
234 topology%create_molecules = .false.
235 topology%molecules_check = .false.
236 topology%coordinate = .false.
237 topology%use_g96_velocity = .false.
238 topology%coord_type = -1
239 topology%coord_file_name = ''
240 topology%conn_type = do_conn_generate
241 topology%conn_file_name = 'OFF'
242 topology%const_atom = .false.
243 topology%const_hydr = .false.
244 topology%const_colv = .false.
245 topology%const_33 = .false.
246 topology%const_46 = .false.
247 topology%const_vsite = .false.
248 topology%charge_occup = .false.
249 topology%charge_beta = .false.
250 topology%charge_extended = .false.
251 topology%para_res = .false.
252 topology%molname_generated = .false.
253 topology%aa_element = .false.
254 topology%exclude_vdw = do_skip_13
255 topology%exclude_ei = do_skip_13
256 !-----------------------------------------------------------------------------
257 ! 3. Initialize and Nullify things in topology%atom_info
258 !-----------------------------------------------------------------------------
259 NULLIFY (topology%atom_info%id_molname)
260 NULLIFY (topology%atom_info%id_resname)
261 NULLIFY (topology%atom_info%resid)
262 NULLIFY (topology%atom_info%id_atmname)
263 NULLIFY (topology%atom_info%id_atom_names)
264 NULLIFY (topology%atom_info%r)
265 NULLIFY (topology%atom_info%map_mol_typ)
266 NULLIFY (topology%atom_info%map_mol_num)
267 NULLIFY (topology%atom_info%map_mol_res)
268 NULLIFY (topology%atom_info%atm_charge)
269 NULLIFY (topology%atom_info%atm_mass)
270 NULLIFY (topology%atom_info%occup)
271 NULLIFY (topology%atom_info%beta)
272 NULLIFY (topology%atom_info%id_element)
273 !-----------------------------------------------------------------------------
274 ! 4. Initialize and Nullify things in topology%conn_info
275 !-----------------------------------------------------------------------------
276 NULLIFY (topology%conn_info%bond_a)
277 NULLIFY (topology%conn_info%bond_b)
278 NULLIFY (topology%conn_info%bond_type)
279 NULLIFY (topology%conn_info%ub_a)
280 NULLIFY (topology%conn_info%ub_b)
281 NULLIFY (topology%conn_info%ub_c)
282 NULLIFY (topology%conn_info%theta_a)
283 NULLIFY (topology%conn_info%theta_b)
284 NULLIFY (topology%conn_info%theta_c)
285 NULLIFY (topology%conn_info%theta_type)
286 NULLIFY (topology%conn_info%phi_a)
287 NULLIFY (topology%conn_info%phi_b)
288 NULLIFY (topology%conn_info%phi_c)
289 NULLIFY (topology%conn_info%phi_d)
290 NULLIFY (topology%conn_info%phi_type)
291 NULLIFY (topology%conn_info%impr_a)
292 NULLIFY (topology%conn_info%impr_b)
293 NULLIFY (topology%conn_info%impr_c)
294 NULLIFY (topology%conn_info%impr_d)
295 NULLIFY (topology%conn_info%impr_type)
296 NULLIFY (topology%conn_info%onfo_a)
297 NULLIFY (topology%conn_info%onfo_b)
298 NULLIFY (topology%conn_info%c_bond_a)
299 NULLIFY (topology%conn_info%c_bond_b)
300 NULLIFY (topology%conn_info%c_bond_type)
301 !-----------------------------------------------------------------------------
302 ! 5. Initialize and Nullify things in topology%cons_info
303 !-----------------------------------------------------------------------------
304 CALL init_constraint(topology%cons_info)
305 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 SUBROUTINE init_constraint(constraint_info)
314 TYPE(constraint_info_type), POINTER :: constraint_info
315
316! Bonds involving Hydrogens
317
318 constraint_info%hbonds_restraint = .false.
319 ! Fixed Atoms
320 constraint_info%nfixed_atoms = 0
321 constraint_info%freeze_mm = do_constr_none
322 constraint_info%freeze_qm = do_constr_none
323 NULLIFY (constraint_info%fixed_atoms)
324 NULLIFY (constraint_info%fixed_type)
325 NULLIFY (constraint_info%fixed_mol_type)
326 NULLIFY (constraint_info%fixed_molnames)
327 NULLIFY (constraint_info%fixed_restraint)
328 NULLIFY (constraint_info%fixed_k0)
329 NULLIFY (constraint_info%fixed_mol_restraint)
330 NULLIFY (constraint_info%fixed_mol_k0)
331 NULLIFY (constraint_info%fixed_exclude_qm, constraint_info%fixed_exclude_mm)
332 ! Collective Constraints
333 constraint_info%nconst_colv = 0
334 NULLIFY (constraint_info%colvar_set)
335 NULLIFY (constraint_info%const_colv_mol)
336 NULLIFY (constraint_info%const_colv_molname)
337 NULLIFY (constraint_info%const_colv_target)
338 NULLIFY (constraint_info%const_colv_target_growth)
339 NULLIFY (constraint_info%colv_intermolecular)
340 NULLIFY (constraint_info%colv_restraint)
341 NULLIFY (constraint_info%colv_k0)
342 NULLIFY (constraint_info%colv_exclude_qm, constraint_info%colv_exclude_mm)
343 ! G3x3
344 constraint_info%nconst_g33 = 0
345 NULLIFY (constraint_info%const_g33_mol)
346 NULLIFY (constraint_info%const_g33_molname)
347 NULLIFY (constraint_info%const_g33_a)
348 NULLIFY (constraint_info%const_g33_b)
349 NULLIFY (constraint_info%const_g33_c)
350 NULLIFY (constraint_info%const_g33_dab)
351 NULLIFY (constraint_info%const_g33_dac)
352 NULLIFY (constraint_info%const_g33_dbc)
353 NULLIFY (constraint_info%g33_intermolecular)
354 NULLIFY (constraint_info%g33_restraint)
355 NULLIFY (constraint_info%g33_k0)
356 NULLIFY (constraint_info%g33_exclude_qm, constraint_info%g33_exclude_mm)
357 ! G4x6
358 constraint_info%nconst_g46 = 0
359 NULLIFY (constraint_info%const_g46_mol)
360 NULLIFY (constraint_info%const_g46_molname)
361 NULLIFY (constraint_info%const_g46_a)
362 NULLIFY (constraint_info%const_g46_b)
363 NULLIFY (constraint_info%const_g46_c)
364 NULLIFY (constraint_info%const_g46_d)
365 NULLIFY (constraint_info%const_g46_dab)
366 NULLIFY (constraint_info%const_g46_dac)
367 NULLIFY (constraint_info%const_g46_dbc)
368 NULLIFY (constraint_info%const_g46_dad)
369 NULLIFY (constraint_info%const_g46_dbd)
370 NULLIFY (constraint_info%const_g46_dcd)
371 NULLIFY (constraint_info%g46_intermolecular)
372 NULLIFY (constraint_info%g46_restraint)
373 NULLIFY (constraint_info%g46_k0)
374 NULLIFY (constraint_info%g46_exclude_qm, constraint_info%g46_exclude_mm)
375 ! virtual_site
376 constraint_info%nconst_vsite = 0
377 NULLIFY (constraint_info%const_vsite_mol)
378 NULLIFY (constraint_info%const_vsite_molname)
379 NULLIFY (constraint_info%const_vsite_a)
380 NULLIFY (constraint_info%const_vsite_b)
381 NULLIFY (constraint_info%const_vsite_c)
382 NULLIFY (constraint_info%const_vsite_d)
383 NULLIFY (constraint_info%const_vsite_wbc)
384 NULLIFY (constraint_info%const_vsite_wdc)
385 NULLIFY (constraint_info%vsite_intermolecular)
386 NULLIFY (constraint_info%vsite_restraint)
387 NULLIFY (constraint_info%vsite_k0)
388 NULLIFY (constraint_info%vsite_exclude_qm, constraint_info%vsite_exclude_mm)
389
390 END SUBROUTINE init_constraint
391
392! **************************************************************************************************
393!> \brief 1. Just DEALLOCATE all the stuff
394!> \param topology ...
395!> \par History
396!> none
397! **************************************************************************************************
398 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 IF (ASSOCIATED(topology%atom_info%id_molname)) THEN
406 DEALLOCATE (topology%atom_info%id_molname)
407 END IF
408 IF (ASSOCIATED(topology%atom_info%id_resname)) THEN
409 DEALLOCATE (topology%atom_info%id_resname)
410 END IF
411 IF (ASSOCIATED(topology%atom_info%resid)) THEN
412 DEALLOCATE (topology%atom_info%resid)
413 END IF
414 IF (ASSOCIATED(topology%atom_info%id_atmname)) THEN
415 DEALLOCATE (topology%atom_info%id_atmname)
416 END IF
417 IF (ASSOCIATED(topology%atom_info%id_atom_names)) THEN
418 DEALLOCATE (topology%atom_info%id_atom_names)
419 END IF
420 IF (ASSOCIATED(topology%atom_info%r)) THEN
421 DEALLOCATE (topology%atom_info%r)
422 END IF
423 IF (ASSOCIATED(topology%atom_info%map_mol_typ)) THEN
424 DEALLOCATE (topology%atom_info%map_mol_typ)
425 END IF
426 IF (ASSOCIATED(topology%atom_info%map_mol_num)) THEN
427 DEALLOCATE (topology%atom_info%map_mol_num)
428 END IF
429 IF (ASSOCIATED(topology%atom_info%map_mol_res)) THEN
430 DEALLOCATE (topology%atom_info%map_mol_res)
431 END IF
432 IF (ASSOCIATED(topology%atom_info%atm_charge)) THEN
433 DEALLOCATE (topology%atom_info%atm_charge)
434 END IF
435 IF (ASSOCIATED(topology%atom_info%atm_mass)) THEN
436 DEALLOCATE (topology%atom_info%atm_mass)
437 END IF
438 IF (ASSOCIATED(topology%atom_info%occup)) THEN
439 DEALLOCATE (topology%atom_info%occup)
440 END IF
441 IF (ASSOCIATED(topology%atom_info%beta)) THEN
442 DEALLOCATE (topology%atom_info%beta)
443 END IF
444 IF (ASSOCIATED(topology%atom_info%id_element)) THEN
445 DEALLOCATE (topology%atom_info%id_element)
446 END IF
447 !-----------------------------------------------------------------------------
448 ! 2. DEALLOCATE things in topology%conn_info
449 !-----------------------------------------------------------------------------
450 IF (ASSOCIATED(topology%conn_info%bond_a)) THEN
451 DEALLOCATE (topology%conn_info%bond_a)
452 END IF
453 IF (ASSOCIATED(topology%conn_info%bond_b)) THEN
454 DEALLOCATE (topology%conn_info%bond_b)
455 END IF
456 IF (ASSOCIATED(topology%conn_info%bond_type)) THEN
457 DEALLOCATE (topology%conn_info%bond_type)
458 END IF
459 IF (ASSOCIATED(topology%conn_info%ub_a)) THEN
460 DEALLOCATE (topology%conn_info%ub_a)
461 END IF
462 IF (ASSOCIATED(topology%conn_info%ub_b)) THEN
463 DEALLOCATE (topology%conn_info%ub_b)
464 END IF
465 IF (ASSOCIATED(topology%conn_info%ub_c)) THEN
466 DEALLOCATE (topology%conn_info%ub_c)
467 END IF
468 IF (ASSOCIATED(topology%conn_info%theta_a)) THEN
469 DEALLOCATE (topology%conn_info%theta_a)
470 END IF
471 IF (ASSOCIATED(topology%conn_info%theta_b)) THEN
472 DEALLOCATE (topology%conn_info%theta_b)
473 END IF
474 IF (ASSOCIATED(topology%conn_info%theta_c)) THEN
475 DEALLOCATE (topology%conn_info%theta_c)
476 END IF
477 IF (ASSOCIATED(topology%conn_info%theta_type)) THEN
478 DEALLOCATE (topology%conn_info%theta_type)
479 END IF
480 IF (ASSOCIATED(topology%conn_info%phi_a)) THEN
481 DEALLOCATE (topology%conn_info%phi_a)
482 END IF
483 IF (ASSOCIATED(topology%conn_info%phi_b)) THEN
484 DEALLOCATE (topology%conn_info%phi_b)
485 END IF
486 IF (ASSOCIATED(topology%conn_info%phi_c)) THEN
487 DEALLOCATE (topology%conn_info%phi_c)
488 END IF
489 IF (ASSOCIATED(topology%conn_info%phi_d)) THEN
490 DEALLOCATE (topology%conn_info%phi_d)
491 END IF
492 IF (ASSOCIATED(topology%conn_info%phi_type)) THEN
493 DEALLOCATE (topology%conn_info%phi_type)
494 END IF
495 IF (ASSOCIATED(topology%conn_info%impr_a)) THEN
496 DEALLOCATE (topology%conn_info%impr_a)
497 END IF
498 IF (ASSOCIATED(topology%conn_info%impr_b)) THEN
499 DEALLOCATE (topology%conn_info%impr_b)
500 END IF
501 IF (ASSOCIATED(topology%conn_info%impr_c)) THEN
502 DEALLOCATE (topology%conn_info%impr_c)
503 END IF
504 IF (ASSOCIATED(topology%conn_info%impr_d)) THEN
505 DEALLOCATE (topology%conn_info%impr_d)
506 END IF
507 IF (ASSOCIATED(topology%conn_info%impr_type)) THEN
508 DEALLOCATE (topology%conn_info%impr_type)
509 END IF
510 IF (ASSOCIATED(topology%conn_info%onfo_a)) THEN
511 DEALLOCATE (topology%conn_info%onfo_a)
512 END IF
513 IF (ASSOCIATED(topology%conn_info%onfo_b)) THEN
514 DEALLOCATE (topology%conn_info%onfo_b)
515 END IF
516 IF (ASSOCIATED(topology%conn_info%c_bond_a)) THEN
517 DEALLOCATE (topology%conn_info%c_bond_a)
518 END IF
519 IF (ASSOCIATED(topology%conn_info%c_bond_b)) THEN
520 DEALLOCATE (topology%conn_info%c_bond_b)
521 END IF
522 IF (ASSOCIATED(topology%conn_info%c_bond_type)) THEN
523 DEALLOCATE (topology%conn_info%c_bond_type)
524 END IF
525 !-----------------------------------------------------------------------------
526 ! 3. DEALLOCATE things in topology%cons_info
527 !-----------------------------------------------------------------------------
528 IF (ASSOCIATED(topology%cons_info)) THEN
529 CALL deallocate_constraint(topology%cons_info)
530 END IF
531 !-----------------------------------------------------------------------------
532 ! 4. DEALLOCATE things in topology
533 !-----------------------------------------------------------------------------
534 CALL cell_release(topology%cell)
535 CALL cell_release(topology%cell_ref)
536 CALL cell_release(topology%cell_muc)
537 IF (ASSOCIATED(topology%atom_info)) THEN
538 DEALLOCATE (topology%atom_info)
539 END IF
540 IF (ASSOCIATED(topology%conn_info)) THEN
541 DEALLOCATE (topology%conn_info)
542 END IF
543 IF (ASSOCIATED(topology%cons_info)) THEN
544 DEALLOCATE (topology%cons_info)
545 END IF
546 !------------------------------------------------
547 ! 5. DEALLOCATE fragments
548 !-----------------------------------------------
549 IF (ASSOCIATED(topology%fragments)) THEN
550 DEALLOCATE (topology%fragments)
551 END IF
552
553 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 SUBROUTINE deallocate_constraint(constraint_info)
562 TYPE(constraint_info_type), POINTER :: constraint_info
563
564 INTEGER :: i
565
566! Fixed Atoms
567
568 IF (ASSOCIATED(constraint_info%fixed_atoms)) THEN
569 DEALLOCATE (constraint_info%fixed_atoms)
570 END IF
571 IF (ASSOCIATED(constraint_info%fixed_type)) THEN
572 DEALLOCATE (constraint_info%fixed_type)
573 END IF
574 IF (ASSOCIATED(constraint_info%fixed_molnames)) THEN
575 DEALLOCATE (constraint_info%fixed_molnames)
576 END IF
577 IF (ASSOCIATED(constraint_info%fixed_mol_type)) THEN
578 DEALLOCATE (constraint_info%fixed_mol_type)
579 END IF
580 IF (ASSOCIATED(constraint_info%fixed_restraint)) THEN
581 DEALLOCATE (constraint_info%fixed_restraint)
582 END IF
583 IF (ASSOCIATED(constraint_info%fixed_k0)) THEN
584 DEALLOCATE (constraint_info%fixed_k0)
585 END IF
586 IF (ASSOCIATED(constraint_info%fixed_mol_restraint)) THEN
587 DEALLOCATE (constraint_info%fixed_mol_restraint)
588 END IF
589 IF (ASSOCIATED(constraint_info%fixed_mol_k0)) THEN
590 DEALLOCATE (constraint_info%fixed_mol_k0)
591 END IF
592 IF (ASSOCIATED(constraint_info%fixed_exclude_qm)) THEN
593 DEALLOCATE (constraint_info%fixed_exclude_qm)
594 END IF
595 IF (ASSOCIATED(constraint_info%fixed_exclude_mm)) THEN
596 DEALLOCATE (constraint_info%fixed_exclude_mm)
597 END IF
598 ! Collective Constraint
599 IF (ASSOCIATED(constraint_info%colvar_set)) THEN
600 DO i = 1, SIZE(constraint_info%colvar_set)
601 IF (ASSOCIATED(constraint_info%colvar_set(i)%colvar)) THEN
602 CALL colvar_release(constraint_info%colvar_set(i)%colvar)
603 NULLIFY (constraint_info%colvar_set(i)%colvar)
604 END IF
605 END DO
606 DEALLOCATE (constraint_info%colvar_set)
607 END IF
608 IF (ASSOCIATED(constraint_info%const_colv_mol)) THEN
609 DEALLOCATE (constraint_info%const_colv_mol)
610 END IF
611 IF (ASSOCIATED(constraint_info%const_colv_molname)) THEN
612 DEALLOCATE (constraint_info%const_colv_molname)
613 END IF
614 IF (ASSOCIATED(constraint_info%const_colv_target)) THEN
615 DEALLOCATE (constraint_info%const_colv_target)
616 END IF
617 IF (ASSOCIATED(constraint_info%const_colv_target_growth)) THEN
618 DEALLOCATE (constraint_info%const_colv_target_growth)
619 END IF
620 IF (ASSOCIATED(constraint_info%colv_intermolecular)) THEN
621 DEALLOCATE (constraint_info%colv_intermolecular)
622 END IF
623 IF (ASSOCIATED(constraint_info%colv_restraint)) THEN
624 DEALLOCATE (constraint_info%colv_restraint)
625 END IF
626 IF (ASSOCIATED(constraint_info%colv_k0)) THEN
627 DEALLOCATE (constraint_info%colv_k0)
628 END IF
629 IF (ASSOCIATED(constraint_info%colv_exclude_qm)) THEN
630 DEALLOCATE (constraint_info%colv_exclude_qm)
631 END IF
632 IF (ASSOCIATED(constraint_info%colv_exclude_mm)) THEN
633 DEALLOCATE (constraint_info%colv_exclude_mm)
634 END IF
635 ! G3x3
636 IF (ASSOCIATED(constraint_info%const_g33_mol)) THEN
637 DEALLOCATE (constraint_info%const_g33_mol)
638 END IF
639 IF (ASSOCIATED(constraint_info%const_g33_molname)) THEN
640 DEALLOCATE (constraint_info%const_g33_molname)
641 END IF
642 IF (ASSOCIATED(constraint_info%const_g33_a)) THEN
643 DEALLOCATE (constraint_info%const_g33_a)
644 END IF
645 IF (ASSOCIATED(constraint_info%const_g33_b)) THEN
646 DEALLOCATE (constraint_info%const_g33_b)
647 END IF
648 IF (ASSOCIATED(constraint_info%const_g33_c)) THEN
649 DEALLOCATE (constraint_info%const_g33_c)
650 END IF
651 IF (ASSOCIATED(constraint_info%const_g33_dab)) THEN
652 DEALLOCATE (constraint_info%const_g33_dab)
653 END IF
654 IF (ASSOCIATED(constraint_info%const_g33_dac)) THEN
655 DEALLOCATE (constraint_info%const_g33_dac)
656 END IF
657 IF (ASSOCIATED(constraint_info%const_g33_dbc)) THEN
658 DEALLOCATE (constraint_info%const_g33_dbc)
659 END IF
660 IF (ASSOCIATED(constraint_info%g33_intermolecular)) THEN
661 DEALLOCATE (constraint_info%g33_intermolecular)
662 END IF
663 IF (ASSOCIATED(constraint_info%g33_restraint)) THEN
664 DEALLOCATE (constraint_info%g33_restraint)
665 END IF
666 IF (ASSOCIATED(constraint_info%g33_k0)) THEN
667 DEALLOCATE (constraint_info%g33_k0)
668 END IF
669 IF (ASSOCIATED(constraint_info%g33_exclude_qm)) THEN
670 DEALLOCATE (constraint_info%g33_exclude_qm)
671 END IF
672 IF (ASSOCIATED(constraint_info%g33_exclude_mm)) THEN
673 DEALLOCATE (constraint_info%g33_exclude_mm)
674 END IF
675 ! G4x6
676 IF (ASSOCIATED(constraint_info%const_g46_mol)) THEN
677 DEALLOCATE (constraint_info%const_g46_mol)
678 END IF
679 IF (ASSOCIATED(constraint_info%const_g46_molname)) THEN
680 DEALLOCATE (constraint_info%const_g46_molname)
681 END IF
682 IF (ASSOCIATED(constraint_info%const_g46_a)) THEN
683 DEALLOCATE (constraint_info%const_g46_a)
684 END IF
685 IF (ASSOCIATED(constraint_info%const_g46_b)) THEN
686 DEALLOCATE (constraint_info%const_g46_b)
687 END IF
688 IF (ASSOCIATED(constraint_info%const_g46_c)) THEN
689 DEALLOCATE (constraint_info%const_g46_c)
690 END IF
691 IF (ASSOCIATED(constraint_info%const_g46_d)) THEN
692 DEALLOCATE (constraint_info%const_g46_d)
693 END IF
694 IF (ASSOCIATED(constraint_info%const_g46_dab)) THEN
695 DEALLOCATE (constraint_info%const_g46_dab)
696 END IF
697 IF (ASSOCIATED(constraint_info%const_g46_dac)) THEN
698 DEALLOCATE (constraint_info%const_g46_dac)
699 END IF
700 IF (ASSOCIATED(constraint_info%const_g46_dbc)) THEN
701 DEALLOCATE (constraint_info%const_g46_dbc)
702 END IF
703 IF (ASSOCIATED(constraint_info%const_g46_dad)) THEN
704 DEALLOCATE (constraint_info%const_g46_dad)
705 END IF
706 IF (ASSOCIATED(constraint_info%const_g46_dbd)) THEN
707 DEALLOCATE (constraint_info%const_g46_dbd)
708 END IF
709 IF (ASSOCIATED(constraint_info%const_g46_dcd)) THEN
710 DEALLOCATE (constraint_info%const_g46_dcd)
711 END IF
712 IF (ASSOCIATED(constraint_info%g46_intermolecular)) THEN
713 DEALLOCATE (constraint_info%g46_intermolecular)
714 END IF
715 IF (ASSOCIATED(constraint_info%g46_restraint)) THEN
716 DEALLOCATE (constraint_info%g46_restraint)
717 END IF
718 IF (ASSOCIATED(constraint_info%g46_k0)) THEN
719 DEALLOCATE (constraint_info%g46_k0)
720 END IF
721 IF (ASSOCIATED(constraint_info%g46_exclude_qm)) THEN
722 DEALLOCATE (constraint_info%g46_exclude_qm)
723 END IF
724 IF (ASSOCIATED(constraint_info%g46_exclude_mm)) THEN
725 DEALLOCATE (constraint_info%g46_exclude_mm)
726 END IF
727 ! virtual_site
728 IF (ASSOCIATED(constraint_info%const_vsite_mol)) THEN
729 DEALLOCATE (constraint_info%const_vsite_mol)
730 END IF
731 IF (ASSOCIATED(constraint_info%const_vsite_molname)) THEN
732 DEALLOCATE (constraint_info%const_vsite_molname)
733 END IF
734 IF (ASSOCIATED(constraint_info%const_vsite_a)) THEN
735 DEALLOCATE (constraint_info%const_vsite_a)
736 END IF
737 IF (ASSOCIATED(constraint_info%const_vsite_b)) THEN
738 DEALLOCATE (constraint_info%const_vsite_b)
739 END IF
740 IF (ASSOCIATED(constraint_info%const_vsite_c)) THEN
741 DEALLOCATE (constraint_info%const_vsite_c)
742 END IF
743 IF (ASSOCIATED(constraint_info%const_vsite_d)) THEN
744 DEALLOCATE (constraint_info%const_vsite_d)
745 END IF
746 IF (ASSOCIATED(constraint_info%const_vsite_wbc)) THEN
747 DEALLOCATE (constraint_info%const_vsite_wbc)
748 END IF
749 IF (ASSOCIATED(constraint_info%const_vsite_wdc)) THEN
750 DEALLOCATE (constraint_info%const_vsite_wdc)
751 END IF
752 IF (ASSOCIATED(constraint_info%vsite_intermolecular)) THEN
753 DEALLOCATE (constraint_info%vsite_intermolecular)
754 END IF
755 IF (ASSOCIATED(constraint_info%vsite_restraint)) THEN
756 DEALLOCATE (constraint_info%vsite_restraint)
757 END IF
758 IF (ASSOCIATED(constraint_info%vsite_k0)) THEN
759 DEALLOCATE (constraint_info%vsite_k0)
760 END IF
761 IF (ASSOCIATED(constraint_info%vsite_exclude_qm)) THEN
762 DEALLOCATE (constraint_info%vsite_exclude_qm)
763 END IF
764 IF (ASSOCIATED(constraint_info%vsite_exclude_mm)) THEN
765 DEALLOCATE (constraint_info%vsite_exclude_mm)
766 END IF
767 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 SUBROUTINE pre_read_topology(topology)
776 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
777
778 TYPE(atom_info_type), POINTER :: atom_info
779
780 atom_info => topology%atom_info
781
782 IF (ASSOCIATED(atom_info%id_molname)) THEN
783 DEALLOCATE (atom_info%id_molname)
784 END IF
785
786 IF (ASSOCIATED(atom_info%resid)) THEN
787 DEALLOCATE (atom_info%resid)
788 END IF
789
790 IF (ASSOCIATED(atom_info%id_resname)) THEN
791 DEALLOCATE (atom_info%id_resname)
792 END IF
793
794 IF (ASSOCIATED(atom_info%id_atmname)) THEN
795 DEALLOCATE (atom_info%id_atmname)
796 END IF
797
798 IF (ASSOCIATED(atom_info%atm_charge)) THEN
799 DEALLOCATE (atom_info%atm_charge)
800 END IF
801
802 IF (ASSOCIATED(atom_info%atm_mass)) THEN
803 DEALLOCATE (atom_info%atm_mass)
804 END IF
805
806 END SUBROUTINE pre_read_topology
807
808END MODULE topology_types
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:668
Initialize the collective variables types.
recursive subroutine, public colvar_release(colvar)
releases the memory that might have been allocated by the colvar
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_skip_13
integer, parameter, public do_bondparm_covalent
integer, parameter, public do_conn_generate
integer, parameter, public do_constr_none
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
subroutine, public deallocate_topology(topology)
Just DEALLOCATE all the stuff
subroutine, public pre_read_topology(topology)
Deallocate possibly allocated arrays before reading topology.
subroutine, public init_topology(topology)
Just NULLIFY and zero all the stuff
Control for reading in different topologies and coordinates.
Definition topology.F:13
Type defining parameters related to the simulation cell.
Definition cell_types.F:60