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