(git:9a1f30a)
Loading...
Searching...
No Matches
topology_constraint_util.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!> \brief Collection of subroutine needed for topology related things
10!> \par History
11!> jgh (23-05-2004) Last atom of molecule information added
12! **************************************************************************************************
26 USE colvar_types, ONLY: &
43 USE kinds, ONLY: default_string_length,&
44 dp
46 USE molecule_kind_types, ONLY: &
50 USE molecule_types, ONLY: get_molecule,&
64#include "./base/base_uses.f90"
65
66 IMPLICIT NONE
67
68 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'topology_constraint_util'
69
70 PRIVATE
72
73CONTAINS
74
75! **************************************************************************************************
76!> \brief Pack in all the information needed for the constraints
77!> \param molecule_kind_set ...
78!> \param molecule_set ...
79!> \param topology ...
80!> \param qmmm_env ...
81!> \param particle_set ...
82!> \param input_file ...
83!> \param subsys_section ...
84!> \param gci ...
85! **************************************************************************************************
86 SUBROUTINE topology_constraint_pack(molecule_kind_set, molecule_set, &
87 topology, qmmm_env, particle_set, input_file, subsys_section, gci)
88 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
89 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
90 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
91 TYPE(qmmm_env_mm_type), OPTIONAL, POINTER :: qmmm_env
92 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
93 TYPE(section_vals_type), POINTER :: input_file, subsys_section
94 TYPE(global_constraint_type), POINTER :: gci
95
96 CHARACTER(len=*), PARAMETER :: routinen = 'topology_constraint_pack'
97
98 CHARACTER(LEN=2) :: element_symbol
99 CHARACTER(LEN=default_string_length) :: molname, name
100 CHARACTER(LEN=default_string_length), &
101 DIMENSION(:), POINTER :: atom_typeh, cnds
102 INTEGER :: cind, first, first_atom, gind, handle, handle2, i, ii, itype, iw, j, k, k1loc, &
103 k2loc, kk, last, last_atom, m, n_start_colv, natom, nbond, ncolv_glob, ncolv_mol, &
104 nfixd_list_gci, nfixd_restart, nfixd_restraint, nfixed_atoms, ng3x3, ng3x3_restraint, &
105 ng4x6, ng4x6_restraint, nhdist, nmolecule, nrep, nvsite, nvsite_restraint, offset
106 INTEGER, DIMENSION(:), POINTER :: constr_x_glob, inds, molecule_list
107 LOGICAL :: exclude_mm, exclude_qm, fix_atom_mm, fix_atom_molname, fix_atom_qm, &
108 fix_atom_qmmm, fix_fixed_atom, found_molname, is_qm, ishbond, ldummy, &
109 restart_restraint_clv, restart_restraint_pos, use_clv_info
110 LOGICAL, ALLOCATABLE, DIMENSION(:) :: missed_molname
111 REAL(kind=dp) :: rmod, rvec(3)
112 REAL(kind=dp), DIMENSION(:), POINTER :: hdist, r
113 TYPE(atom_type), DIMENSION(:), POINTER :: atom_list
114 TYPE(atomic_kind_type), POINTER :: atomic_kind
115 TYPE(bond_type), DIMENSION(:), POINTER :: bond_list
116 TYPE(colvar_constraint_type), DIMENSION(:), &
117 POINTER :: colv_list
118 TYPE(colvar_counters) :: ncolv
119 TYPE(constr_list_type), DIMENSION(:), POINTER :: constr_x_mol
120 TYPE(constraint_info_type), POINTER :: cons_info
121 TYPE(cp_logger_type), POINTER :: logger
122 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list, fixd_list_gci
123 TYPE(g3x3_constraint_type), DIMENSION(:), POINTER :: g3x3_list
124 TYPE(g4x6_constraint_type), DIMENSION(:), POINTER :: g4x6_list
125 TYPE(local_colvar_constraint_type), DIMENSION(:), &
126 POINTER :: lcolv
127 TYPE(local_constraint_type), POINTER :: lci
128 TYPE(local_g3x3_constraint_type), DIMENSION(:), &
129 POINTER :: lg3x3
130 TYPE(local_g4x6_constraint_type), DIMENSION(:), &
131 POINTER :: lg4x6
132 TYPE(molecule_kind_type), POINTER :: molecule_kind
133 TYPE(molecule_type), POINTER :: molecule
134 TYPE(section_vals_type), POINTER :: colvar_func_info, colvar_rest, &
135 fixd_restr_rest, hbonds_section
136 TYPE(vsite_constraint_type), DIMENSION(:), POINTER :: vsite_list
137
138 NULLIFY (logger, constr_x_mol, constr_x_glob)
139 logger => cp_get_default_logger()
140 iw = cp_print_key_unit_nr(logger, subsys_section, "PRINT%TOPOLOGY_INFO/UTIL_INFO", &
141 extension=".subsysLog")
142 CALL timeset(routinen, handle)
143 CALL timeset(routinen//"_1", handle2)
144
145 cons_info => topology%cons_info
146 hbonds_section => section_vals_get_subs_vals(input_file, &
147 "MOTION%CONSTRAINT%HBONDS")
148 fixd_restr_rest => section_vals_get_subs_vals(input_file, &
149 "MOTION%CONSTRAINT%FIX_ATOM_RESTART")
150 CALL section_vals_get(fixd_restr_rest, explicit=restart_restraint_pos)
151 colvar_rest => section_vals_get_subs_vals(input_file, &
152 "MOTION%CONSTRAINT%COLVAR_RESTART")
153 CALL section_vals_get(colvar_rest, explicit=restart_restraint_clv)
154 colvar_func_info => section_vals_get_subs_vals(subsys_section, &
155 "COLVAR%COLVAR_FUNC_INFO")
156 CALL section_vals_get(colvar_func_info, explicit=use_clv_info)
157 !-----------------------------------------------------------------------------
158 !-----------------------------------------------------------------------------
159 ! 1. NULLIFY the molecule_set(imol)%lci via set_molecule_set
160 !-----------------------------------------------------------------------------
161 DO i = 1, topology%nmol
162 molecule => molecule_set(i)
163 NULLIFY (lci)
164 ! only allocate the lci if constraints are active. Can this stuff be distributed ?
165 IF (topology%const_atom .OR. topology%const_hydr .OR. &
166 topology%const_33 .OR. topology%const_46 .OR. &
167 topology%const_colv .OR. topology%const_vsite) THEN
168 ALLOCATE (lci)
169 NULLIFY (lci%lcolv)
170 NULLIFY (lci%lg3x3)
171 NULLIFY (lci%lg4x6)
172 END IF
173 CALL set_molecule(molecule, lci=lci)
174 END DO
175 ALLOCATE (gci)
176 NULLIFY (gci%lcolv, &
177 gci%lg3x3, &
178 gci%lg4x6, &
179 gci%fixd_list, &
180 gci%colv_list, &
181 gci%g3x3_list, &
182 gci%g4x6_list, &
183 gci%vsite_list)
184 gci%ntot = 0
185 gci%ng3x3 = 0
186 gci%ng4x6 = 0
187 gci%nvsite = 0
188 gci%ng3x3_restraint = 0
189 gci%ng4x6_restraint = 0
190 gci%nvsite_restraint = 0
191 CALL setup_colvar_counters(gci%colv_list, gci%ncolv)
192 gci%nrestraint = gci%ng3x3_restraint + &
193 gci%ng4x6_restraint + &
194 gci%nvsite_restraint + &
195 gci%ncolv%nrestraint
196 CALL timestop(handle2)
197 CALL timeset(routinen//"_2", handle2)
198 !-----------------------------------------------------------------------------
199 !-----------------------------------------------------------------------------
200 ! 2. Add more stuff to COLVAR constraint if constraint hydrogen is on
201 !-----------------------------------------------------------------------------
202 IF (topology%const_hydr) THEN
203 topology%const_colv = .true.
204 NULLIFY (atom_typeh, hdist)
205 ALLOCATE (constr_x_mol(SIZE(molecule_kind_set)))
206 DO i = 1, SIZE(molecule_kind_set)
207 ALLOCATE (constr_x_mol(i)%constr(1))
208 constr_x_mol(i)%constr(1) = 1
209 END DO
210 CALL section_vals_val_get(hbonds_section, "MOLECULE", n_rep_val=nrep)
211 IF (nrep /= 0) THEN
212 NULLIFY (inds)
213 DO i = 1, SIZE(molecule_kind_set)
214 constr_x_mol(i)%constr(1) = 0
215 END DO
216 CALL section_vals_val_get(hbonds_section, "MOLECULE", i_vals=inds)
217 DO i = 1, SIZE(inds)
218 constr_x_mol(inds(i))%constr(1) = 1
219 END DO
220 ELSE
221 CALL section_vals_val_get(hbonds_section, "MOLNAME", n_rep_val=nrep)
222 IF (nrep /= 0) THEN
223 NULLIFY (cnds)
224 DO i = 1, SIZE(molecule_kind_set)
225 constr_x_mol(i)%constr(1) = 0
226 END DO
227 CALL section_vals_val_get(hbonds_section, "MOLNAME", c_vals=cnds)
228 DO i = 1, SIZE(cnds)
229 found_molname = .false.
230 DO k = 1, SIZE(molecule_kind_set)
231 molecule_kind => molecule_kind_set(k)
232 name = molecule_kind%name
233 ldummy = qmmm_ff_precond_only_qm(id1=name)
234 IF (cnds(i) == name) THEN
235 constr_x_mol(k)%constr(1) = 1
236 found_molname = .true.
237 END IF
238 END DO
239 CALL print_warning_molname(found_molname, cnds(i))
240 END DO
241 END IF
242 END IF
243 CALL section_vals_val_get(hbonds_section, "ATOM_TYPE", n_rep_val=nrep)
244 IF (nrep /= 0) &
245 CALL section_vals_val_get(hbonds_section, "ATOM_TYPE", c_vals=atom_typeh)
246 CALL section_vals_val_get(hbonds_section, "TARGETS", n_rep_val=nrep)
247 IF (nrep /= 0) &
248 CALL section_vals_val_get(hbonds_section, "TARGETS", r_vals=hdist)
249 IF (ASSOCIATED(hdist)) THEN
250 cpassert(SIZE(hdist) == SIZE(atom_typeh))
251 END IF
252 CALL section_vals_val_get(hbonds_section, "exclude_qm", l_val=exclude_qm)
253 CALL section_vals_val_get(hbonds_section, "exclude_mm", l_val=exclude_mm)
254 nhdist = 0
255 DO i = 1, SIZE(molecule_kind_set)
256 molecule_kind => molecule_kind_set(i)
257 IF (constr_x_mol(i)%constr(1) == 0) cycle
258 CALL get_molecule_kind(molecule_kind=molecule_kind, &
259 bond_list=bond_list, nbond=nbond, atom_list=atom_list, &
260 molecule_list=molecule_list)
261 ! Let's tag all requested atoms involving Hydrogen
262 ! on the first molecule of this kind
263 molecule => molecule_set(molecule_list(1))
264 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
265 natom = last_atom - first_atom + 1
266 DO k = 1, nbond
267 ishbond = .false.
268 j = bond_list(k)%a
269 IF (j < 1 .OR. j > natom) cycle
270 atomic_kind => atom_list(j)%atomic_kind
271 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name)
272 is_qm = qmmm_ff_precond_only_qm(id1=name)
273 IF ((name(1:1) == "H") .OR. is_hydrogen(atomic_kind)) ishbond = .true.
274 IF (is_qm .AND. exclude_qm) ishbond = .false.
275 IF (.NOT. (is_qm) .AND. exclude_mm) ishbond = .false.
276 IF (.NOT. ishbond) THEN
277 j = bond_list(k)%b
278 IF (j < 1 .OR. j > natom) cycle
279 atomic_kind => atom_list(j)%atomic_kind
280 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name)
281 is_qm = qmmm_ff_precond_only_qm(id1=name)
282 IF ((name(1:1) == "H") .OR. is_hydrogen(atomic_kind)) ishbond = .true.
283 IF (is_qm .AND. exclude_qm) ishbond = .false.
284 IF (.NOT. (is_qm) .AND. exclude_mm) ishbond = .false.
285 END IF
286 IF (ishbond) THEN
287 nhdist = nhdist + 1
288 END IF
289 END DO
290 END DO
291 n_start_colv = cons_info%nconst_colv
292 cons_info%nconst_colv = nhdist + n_start_colv
293 CALL reallocate(cons_info%const_colv_mol, 1, cons_info%nconst_colv)
294 CALL reallocate(cons_info%const_colv_molname, 1, cons_info%nconst_colv)
295 CALL reallocate(cons_info%const_colv_target, 1, cons_info%nconst_colv)
296 CALL reallocate(cons_info%const_colv_target_growth, 1, cons_info%nconst_colv)
297 CALL colvar_p_reallocate(cons_info%colvar_set, 1, cons_info%nconst_colv)
298 ! Fill in Restraints info
299 CALL reallocate(cons_info%colv_intermolecular, 1, cons_info%nconst_colv)
300 CALL reallocate(cons_info%colv_restraint, 1, cons_info%nconst_colv)
301 CALL reallocate(cons_info%colv_k0, 1, cons_info%nconst_colv)
302 CALL reallocate(cons_info%colv_exclude_qm, 1, cons_info%nconst_colv)
303 CALL reallocate(cons_info%colv_exclude_mm, 1, cons_info%nconst_colv)
304 ! Bonds involving hydrogens are by their nature only intramolecular
305 cons_info%colv_intermolecular(n_start_colv + 1:cons_info%nconst_colv) = .false.
306 cons_info%colv_exclude_qm(n_start_colv + 1:cons_info%nconst_colv) = .false.
307 cons_info%colv_exclude_mm(n_start_colv + 1:cons_info%nconst_colv) = .false.
308 cons_info%colv_restraint(n_start_colv + 1:cons_info%nconst_colv) = cons_info%hbonds_restraint
309 cons_info%colv_k0(n_start_colv + 1:cons_info%nconst_colv) = cons_info%hbonds_k0
310 !
311 nhdist = 0
312 DO i = 1, SIZE(molecule_kind_set)
313 IF (constr_x_mol(i)%constr(1) == 0) cycle
314 molecule_kind => molecule_kind_set(i)
315 CALL get_molecule_kind(molecule_kind=molecule_kind, &
316 bond_list=bond_list, nbond=nbond, atom_list=atom_list, &
317 molecule_list=molecule_list)
318 molecule => molecule_set(molecule_list(1))
319 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
320 natom = last_atom - first_atom + 1
321 offset = first_atom - 1
322 DO k = 1, nbond
323 ishbond = .false.
324 j = bond_list(k)%a
325 IF (j < 1 .OR. j > natom) cycle
326 atomic_kind => atom_list(j)%atomic_kind
327 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name)
328 is_qm = qmmm_ff_precond_only_qm(id1=name)
329 IF ((name(1:1) == "H") .OR. is_hydrogen(atomic_kind)) ishbond = .true.
330 IF (is_qm .AND. exclude_qm) ishbond = .false.
331 IF (.NOT. (is_qm) .AND. exclude_mm) ishbond = .false.
332 IF (.NOT. ishbond) THEN
333 j = bond_list(k)%b
334 IF (j < 1 .OR. j > natom) cycle
335 atomic_kind => atom_list(j)%atomic_kind
336 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name)
337 is_qm = qmmm_ff_precond_only_qm(id1=name)
338 IF ((name(1:1) == "H") .OR. is_hydrogen(atomic_kind)) ishbond = .true.
339 IF (is_qm .AND. exclude_qm) ishbond = .false.
340 IF (.NOT. (is_qm) .AND. exclude_mm) ishbond = .false.
341 END IF
342 IF (ishbond) THEN
343 nhdist = nhdist + 1
344 rvec = particle_set(offset + bond_list(k)%a)%r - particle_set(offset + bond_list(k)%b)%r
345 rmod = sqrt(dot_product(rvec, rvec))
346 IF (ASSOCIATED(hdist)) THEN
347 IF (SIZE(hdist) > 0) THEN
348 IF (bond_list(k)%a == j) atomic_kind => atom_list(bond_list(k)%b)%atomic_kind
349 IF (bond_list(k)%b == j) atomic_kind => atom_list(bond_list(k)%a)%atomic_kind
350 CALL get_atomic_kind(atomic_kind=atomic_kind, &
351 name=name, element_symbol=element_symbol)
352 ldummy = qmmm_ff_precond_only_qm(id1=name)
353 DO m = 1, SIZE(hdist)
354 IF (trim(name) == trim(atom_typeh(m))) EXIT
355 IF (trim(element_symbol) == trim(atom_typeh(m))) EXIT
356 END DO
357 IF (m <= SIZE(hdist)) THEN
358 rmod = hdist(m)
359 END IF
360 END IF
361 END IF
362 cons_info%const_colv_mol(nhdist + n_start_colv) = i
363 cons_info%const_colv_molname(nhdist + n_start_colv) = "UNDEF"
364 cons_info%const_colv_target(nhdist + n_start_colv) = rmod
365 cons_info%const_colv_target_growth(nhdist + n_start_colv) = 0.0_dp
366 CALL colvar_create(cons_info%colvar_set(nhdist + n_start_colv)%colvar, &
368 cons_info%colvar_set(nhdist + n_start_colv)%colvar%dist_param%i_at = bond_list(k)%a
369 cons_info%colvar_set(nhdist + n_start_colv)%colvar%dist_param%j_at = bond_list(k)%b
370 CALL colvar_setup(cons_info%colvar_set(nhdist + n_start_colv)%colvar)
371 END IF
372 END DO
373 END DO
374 DO j = 1, SIZE(constr_x_mol)
375 DEALLOCATE (constr_x_mol(j)%constr)
376 END DO
377 DEALLOCATE (constr_x_mol)
378 END IF
379
380 CALL timestop(handle2)
381 CALL timeset(routinen//"_3", handle2)
382 !-----------------------------------------------------------------------------
383 !-----------------------------------------------------------------------------
384 ! 3. Set the COLVAR constraint molecule_kind_set(ikind)%colv_list
385 !-----------------------------------------------------------------------------
386 IF (topology%const_colv) THEN
387 ! Post Process of COLVARS..
388 DO ii = 1, SIZE(cons_info%colvar_set)
389 CALL post_process_colvar(cons_info%colvar_set(ii)%colvar, particle_set)
390 END DO
391 ! Real constraint/restraint part..
392 CALL give_constraint_array(cons_info%const_colv_mol, &
393 cons_info%const_colv_molname, &
394 cons_info%colv_intermolecular, &
395 constr_x_mol, &
396 constr_x_glob, &
397 molecule_kind_set, &
398 cons_info%colv_exclude_qm, &
399 cons_info%colv_exclude_mm)
400 ! Intramolecular constraints
401 gind = 0
402 cind = 0
403 DO ii = 1, SIZE(molecule_kind_set)
404 molecule_kind => molecule_kind_set(ii)
405 CALL get_molecule_kind(molecule_kind=molecule_kind, &
406 nmolecule=nmolecule, molecule_list=molecule_list)
407 ncolv_mol = SIZE(constr_x_mol(ii)%constr)
408 ALLOCATE (colv_list(ncolv_mol))
409 ! Starting index of the first molecule of this kind.
410 ! We need the index if no target is provided in the input file
411 ! for the collective variable.. The target will be computed on the
412 ! first molecule of the kind...
413 molecule => molecule_set(molecule_list(1))
414 CALL get_molecule(molecule, first_atom=first_atom)
415 CALL setup_colv_list(colv_list, constr_x_mol(ii)%constr, gind, &
416 cons_info, topology, particle_set, restart_restraint_clv, &
417 colvar_rest, first_atom)
418 CALL setup_colvar_counters(colv_list, ncolv)
419 CALL set_molecule_kind(molecule_kind, colv_list=colv_list, ncolv=ncolv)
420 DO j = 1, nmolecule
421 molecule => molecule_set(molecule_list(j))
422 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
423 ALLOCATE (lcolv(ncolv_mol))
424 CALL setup_lcolv(lcolv, constr_x_mol(ii)%constr, first_atom, last_atom, &
425 cons_info, particle_set, colvar_func_info, use_clv_info, cind)
426 CALL set_molecule(molecule=molecule, lcolv=lcolv)
427 END DO
428 END DO
429 DO j = 1, SIZE(constr_x_mol)
430 DEALLOCATE (constr_x_mol(j)%constr)
431 END DO
432 DEALLOCATE (constr_x_mol)
433 ! Intermolecular constraints
434 ncolv_glob = 0
435 IF (ASSOCIATED(constr_x_glob)) THEN
436 ncolv_glob = SIZE(constr_x_glob)
437 ALLOCATE (colv_list(ncolv_glob))
438 CALL setup_colv_list(colv_list, constr_x_glob, gind, cons_info, &
439 topology, particle_set, restart_restraint_clv, colvar_rest, &
440 first_atom=1)
441 CALL setup_colvar_counters(colv_list, ncolv)
442 ALLOCATE (lcolv(ncolv_glob))
443 CALL setup_lcolv(lcolv, constr_x_glob, 1, SIZE(particle_set), cons_info, &
444 particle_set, colvar_func_info, use_clv_info, cind)
445 gci%colv_list => colv_list
446 gci%lcolv => lcolv
447 gci%ncolv = ncolv
448 ! Total number of Intermolecular constraints
449 gci%ntot = gci%ncolv%ntot + gci%ntot
450 DEALLOCATE (constr_x_glob)
451 END IF
452 END IF
453
454 CALL timestop(handle2)
455 CALL timeset(routinen//"_4", handle2)
456 !-----------------------------------------------------------------------------
457 !-----------------------------------------------------------------------------
458 ! 4. Set the group 3x3 constraint g3x3_list
459 !-----------------------------------------------------------------------------
460 IF (topology%const_33) THEN
461 CALL give_constraint_array(cons_info%const_g33_mol, &
462 cons_info%const_g33_molname, &
463 cons_info%g33_intermolecular, &
464 constr_x_mol, &
465 constr_x_glob, &
466 molecule_kind_set, &
467 cons_info%g33_exclude_qm, &
468 cons_info%g33_exclude_mm)
469 ! Intramolecular constraints
470 DO ii = 1, SIZE(molecule_kind_set)
471 molecule_kind => molecule_kind_set(ii)
472 CALL get_molecule_kind(molecule_kind=molecule_kind, &
473 nmolecule=nmolecule, &
474 molecule_list=molecule_list)
475 ng3x3 = SIZE(constr_x_mol(ii)%constr)
476 ALLOCATE (g3x3_list(ng3x3))
477 CALL setup_g3x3_list(g3x3_list, constr_x_mol(ii)%constr, cons_info, ng3x3_restraint)
478 CALL set_molecule_kind(molecule_kind, ng3x3=ng3x3, ng3x3_restraint=ng3x3_restraint, g3x3_list=g3x3_list)
479 DO j = 1, nmolecule
480 molecule => molecule_set(molecule_list(j))
481 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
482 ALLOCATE (lg3x3(ng3x3))
483 CALL setup_lg3x3(lg3x3, g3x3_list, first_atom, last_atom)
484 CALL set_molecule(molecule=molecule, lg3x3=lg3x3)
485 END DO
486 END DO
487 DO j = 1, SIZE(constr_x_mol)
488 DEALLOCATE (constr_x_mol(j)%constr)
489 END DO
490 DEALLOCATE (constr_x_mol)
491 ! Intermolecular constraints
492 IF (ASSOCIATED(constr_x_glob)) THEN
493 ng3x3 = SIZE(constr_x_glob)
494 ALLOCATE (g3x3_list(ng3x3))
495 CALL setup_g3x3_list(g3x3_list, constr_x_glob, cons_info, ng3x3_restraint)
496 ALLOCATE (lg3x3(ng3x3))
497 CALL setup_lg3x3(lg3x3, g3x3_list, first_atom, last_atom)
498 gci%g3x3_list => g3x3_list
499 gci%lg3x3 => lg3x3
500 gci%ng3x3 = ng3x3
501 gci%ng3x3_restraint = ng3x3_restraint
502 ! Total number of Intermolecular constraints
503 gci%ntot = 3*gci%ng3x3 + gci%ntot
504 DEALLOCATE (constr_x_glob)
505 END IF
506 END IF
507
508 CALL timestop(handle2)
509 CALL timeset(routinen//"_5", handle2)
510 !-----------------------------------------------------------------------------
511 !-----------------------------------------------------------------------------
512 ! 5. Set the group 4x6 constraint g4x6_list
513 !-----------------------------------------------------------------------------
514 IF (topology%const_46) THEN
515 CALL give_constraint_array(cons_info%const_g46_mol, &
516 cons_info%const_g46_molname, &
517 cons_info%g46_intermolecular, &
518 constr_x_mol, &
519 constr_x_glob, &
520 molecule_kind_set, &
521 cons_info%g46_exclude_qm, &
522 cons_info%g46_exclude_mm)
523 ! Intramolecular constraints
524 DO ii = 1, SIZE(molecule_kind_set)
525 molecule_kind => molecule_kind_set(ii)
526 CALL get_molecule_kind(molecule_kind=molecule_kind, &
527 nmolecule=nmolecule, molecule_list=molecule_list)
528 ng4x6 = SIZE(constr_x_mol(ii)%constr)
529 ALLOCATE (g4x6_list(ng4x6))
530 CALL setup_g4x6_list(g4x6_list, constr_x_mol(ii)%constr, cons_info, ng4x6_restraint)
531 CALL set_molecule_kind(molecule_kind, ng4x6=ng4x6, ng4x6_restraint=ng4x6_restraint, g4x6_list=g4x6_list)
532 DO j = 1, nmolecule
533 molecule => molecule_set(molecule_list(j))
534 CALL get_molecule(molecule, first_atom=first_atom, last_atom=last_atom)
535 ALLOCATE (lg4x6(ng4x6))
536 CALL setup_lg4x6(lg4x6, g4x6_list, first_atom, last_atom)
537 CALL set_molecule(molecule=molecule, lg4x6=lg4x6)
538 END DO
539 END DO
540 DO j = 1, SIZE(constr_x_mol)
541 DEALLOCATE (constr_x_mol(j)%constr)
542 END DO
543 DEALLOCATE (constr_x_mol)
544 ! Intermolecular constraints
545 IF (ASSOCIATED(constr_x_glob)) THEN
546 ng4x6 = SIZE(constr_x_glob)
547 ALLOCATE (g4x6_list(ng4x6))
548 CALL setup_g4x6_list(g4x6_list, constr_x_glob, cons_info, ng4x6_restraint)
549 ALLOCATE (lg4x6(ng4x6))
550 CALL setup_lg4x6(lg4x6, g4x6_list, first_atom, last_atom)
551 gci%g4x6_list => g4x6_list
552 gci%lg4x6 => lg4x6
553 gci%ng4x6 = ng4x6
554 gci%ng4x6_restraint = ng4x6_restraint
555 ! Total number of Intermolecular constraints
556 gci%ntot = 6*gci%ng4x6 + gci%ntot
557 DEALLOCATE (constr_x_glob)
558 END IF
559 END IF
560
561 CALL timestop(handle2)
562 CALL timeset(routinen//"_6", handle2)
563 !-----------------------------------------------------------------------------
564 !-----------------------------------------------------------------------------
565 ! 6. Set the group vsite constraint vsite_list
566 !-----------------------------------------------------------------------------
567 IF (topology%const_vsite) THEN
568 CALL give_constraint_array(cons_info%const_vsite_mol, &
569 cons_info%const_vsite_molname, &
570 cons_info%vsite_intermolecular, &
571 constr_x_mol, &
572 constr_x_glob, &
573 molecule_kind_set, &
574 cons_info%vsite_exclude_qm, &
575 cons_info%vsite_exclude_mm)
576 ! Intramolecular constraints
577 DO ii = 1, SIZE(molecule_kind_set)
578 molecule_kind => molecule_kind_set(ii)
579 CALL get_molecule_kind(molecule_kind=molecule_kind, &
580 nmolecule=nmolecule, molecule_list=molecule_list)
581 nvsite = SIZE(constr_x_mol(ii)%constr)
582 ALLOCATE (vsite_list(nvsite))
583 CALL setup_vsite_list(vsite_list, constr_x_mol(ii)%constr, cons_info, nvsite_restraint)
584 CALL set_molecule_kind(molecule_kind, nvsite=nvsite, nvsite_restraint=nvsite_restraint, &
585 vsite_list=vsite_list)
586 END DO
587 DO j = 1, SIZE(constr_x_mol)
588 DEALLOCATE (constr_x_mol(j)%constr)
589 END DO
590 DEALLOCATE (constr_x_mol)
591 ! Intermolecular constraints
592 IF (ASSOCIATED(constr_x_glob)) THEN
593 nvsite = SIZE(constr_x_glob)
594 ALLOCATE (vsite_list(nvsite))
595 CALL setup_vsite_list(vsite_list, constr_x_glob, cons_info, nvsite_restraint)
596 gci%vsite_list => vsite_list
597 gci%nvsite = nvsite
598 gci%nvsite_restraint = nvsite_restraint
599 ! Total number of Intermolecular constraints
600 gci%ntot = gci%nvsite + gci%ntot
601 DEALLOCATE (constr_x_glob)
602 END IF
603 END IF
604 CALL timestop(handle2)
605 CALL timeset(routinen//"_7", handle2)
606 !-----------------------------------------------------------------------------
607 !-----------------------------------------------------------------------------
608 ! 7. Set the group fixed_atom constraint fixd_list
609 !-----------------------------------------------------------------------------
610 IF (topology%const_atom) THEN
611 ALLOCATE (fixd_list_gci(SIZE(particle_set)))
612 nfixd_list_gci = 0
613 ALLOCATE (missed_molname(SIZE(cons_info%fixed_molnames, 1)))
614 missed_molname = .true.
615 nfixd_restart = 0
616 DO i = 1, SIZE(molecule_kind_set)
617 molecule_kind => molecule_kind_set(i)
618 CALL get_molecule_kind(molecule_kind=molecule_kind, &
619 nmolecule=nmolecule, molecule_list=molecule_list, name=molname)
620 is_qm = qmmm_ff_precond_only_qm(id1=molname)
621 WHERE (molname == cons_info%fixed_molnames)
622 missed_molname = .false.
623 END WHERE
624 ! Try to figure out how many atoms of the list belong to this molecule_kind
625 nfixed_atoms = 0
626 DO j = 1, nmolecule
627 molecule => molecule_set(molecule_list(j))
628 CALL get_molecule(molecule, first_atom=first, last_atom=last)
629 fix_atom_molname = .false.
630 IF (ASSOCIATED(cons_info%fixed_molnames)) THEN
631 DO k = 1, SIZE(cons_info%fixed_molnames)
632 IF (cons_info%fixed_molnames(k) == molname) THEN
633 fix_atom_molname = .true.
634 IF (is_qm .AND. cons_info%fixed_exclude_qm(k)) fix_atom_molname = .false.
635 IF ((.NOT. is_qm) .AND. cons_info%fixed_exclude_mm(k)) fix_atom_molname = .false.
636 END IF
637 END DO
638 END IF
639 DO k = first, last
640 fix_atom_qmmm = .false.
641 IF (PRESENT(qmmm_env)) THEN
642 SELECT CASE (cons_info%freeze_qm)
643 CASE (do_constr_atomic)
644 IF (any(qmmm_env%qm_atom_index == k)) fix_atom_qmmm = .true.
645 CASE (do_constr_molec)
646 IF (any(qmmm_env%qm_molecule_index == molecule_list(j))) fix_atom_qmmm = .true.
647 END SELECT
648 SELECT CASE (cons_info%freeze_mm)
649 CASE (do_constr_atomic)
650 IF (all(qmmm_env%qm_atom_index /= k)) fix_atom_qmmm = .true.
651 CASE (do_constr_molec)
652 IF (all(qmmm_env%qm_molecule_index /= molecule_list(j))) fix_atom_qmmm = .true.
653 END SELECT
654 END IF
655 IF (any(cons_info%fixed_atoms == k) .OR. fix_atom_qmmm .OR. fix_atom_molname) THEN
656 nfixed_atoms = nfixed_atoms + 1
657 END IF
658 END DO
659 END DO
660 ALLOCATE (fixd_list(nfixed_atoms))
661 kk = 0
662 nfixd_restraint = 0
663 IF (nfixed_atoms /= 0) THEN
664 DO j = 1, nmolecule
665 molecule => molecule_set(molecule_list(j))
666 CALL get_molecule(molecule, first_atom=first, last_atom=last)
667 fix_atom_molname = .false.
668 IF (ASSOCIATED(cons_info%fixed_molnames)) THEN
669 DO k1loc = 1, SIZE(cons_info%fixed_molnames)
670 IF (cons_info%fixed_molnames(k1loc) == molname) THEN
671 fix_atom_molname = .true.
672 itype = cons_info%fixed_mol_type(k1loc)
673 EXIT
674 END IF
675 END DO
676 END IF
677 DO k = first, last
678 ! FIXED LIST ATOMS
679 fix_fixed_atom = .false.
680 DO k2loc = 1, SIZE(cons_info%fixed_atoms)
681 IF (cons_info%fixed_atoms(k2loc) == k) THEN
682 fix_fixed_atom = .true.
683 itype = cons_info%fixed_type(k2loc)
684 EXIT
685 END IF
686 END DO
687 ! QMMM FIXED ATOMS (QM OR MM)
688 fix_atom_qmmm = .false.
689 fix_atom_mm = .false.
690 fix_atom_qm = .false.
691 IF (PRESENT(qmmm_env)) THEN
692 SELECT CASE (cons_info%freeze_qm)
693 CASE (do_constr_atomic)
694 IF (any(qmmm_env%qm_atom_index == k)) THEN
695 fix_atom_qmmm = .true.
696 fix_atom_qm = .true.
697 itype = cons_info%freeze_qm_type
698 END IF
699 CASE (do_constr_molec)
700 IF (any(qmmm_env%qm_molecule_index == molecule_list(j))) THEN
701 fix_atom_qmmm = .true.
702 fix_atom_qm = .true.
703 itype = cons_info%freeze_qm_type
704 END IF
705 END SELECT
706 SELECT CASE (cons_info%freeze_mm)
707 CASE (do_constr_atomic)
708 IF (all(qmmm_env%qm_atom_index /= k)) THEN
709 fix_atom_qmmm = .true.
710 fix_atom_mm = .true.
711 itype = cons_info%freeze_mm_type
712 END IF
713 CASE (do_constr_molec)
714 IF (all(qmmm_env%qm_molecule_index /= molecule_list(j))) THEN
715 fix_atom_qmmm = .true.
716 fix_atom_mm = .true.
717 itype = cons_info%freeze_mm_type
718 END IF
719 END SELECT
720 ! We should never reach this point but let's check it anyway
721 IF (fix_atom_qm .AND. fix_atom_mm) THEN
722 CALL cp_abort(__location__, &
723 "Atom number: "//cp_to_string(k)// &
724 " has been defined both QM and MM. General Error!")
725 END IF
726 END IF
727 ! Check that the fixed atom constraint/restraint is unique
728 IF ((fix_fixed_atom .AND. fix_atom_qmmm) .OR. (fix_fixed_atom .AND. fix_atom_molname) &
729 .OR. (fix_atom_qmmm .AND. fix_atom_molname)) THEN
730 CALL cp_abort(__location__, &
731 "Atom number: "//cp_to_string(k)// &
732 " has been constrained/restrained to be fixed in more than one"// &
733 " input section. Check and correct your input file!")
734 END IF
735 ! Let's store the atom index
736 IF (fix_fixed_atom .OR. fix_atom_qmmm .OR. fix_atom_molname) THEN
737 IF (ASSOCIATED(topology%cell_muc)) THEN
738 IF (topology%cell_muc%input_cell_canonicalized .AND. itype /= use_perd_xyz) THEN
739 CALL cp_abort(__location__, &
740 "Partial FIXED_ATOMS components cannot be transformed "// &
741 "after CELL%CANONICALIZE. Use COMPONENTS_TO_FIX XYZ or "// &
742 "disable CELL%CANONICALIZE for this input.")
743 END IF
744 END IF
745 kk = kk + 1
746 fixd_list(kk)%fixd = k
747 fixd_list(kk)%coord = particle_set(k)%r
748 fixd_list(kk)%itype = itype
749 ! Possibly Restraint
750 IF (fix_fixed_atom) THEN
751 fixd_list(kk)%restraint%active = cons_info%fixed_restraint(k2loc)
752 fixd_list(kk)%restraint%k0 = cons_info%fixed_k0(k2loc)
753 ELSEIF (fix_atom_qm) THEN
754 fixd_list(kk)%restraint%active = cons_info%fixed_qm_restraint
755 fixd_list(kk)%restraint%k0 = cons_info%fixed_qm_k0
756 ELSEIF (fix_atom_mm) THEN
757 fixd_list(kk)%restraint%active = cons_info%fixed_mm_restraint
758 fixd_list(kk)%restraint%k0 = cons_info%fixed_mm_k0
759 ELSEIF (fix_atom_molname) THEN
760 fixd_list(kk)%restraint%active = cons_info%fixed_mol_restraint(k1loc)
761 fixd_list(kk)%restraint%k0 = cons_info%fixed_mol_k0(k1loc)
762 ELSE
763 ! Should never reach this point
764 cpabort("")
765 END IF
766 IF (fixd_list(kk)%restraint%active) THEN
767 nfixd_restraint = nfixd_restraint + 1
768 nfixd_restart = nfixd_restart + 1
769 ! Check that we use the components that we really want..
770 SELECT CASE (itype)
771 CASE (use_perd_x)
772 fixd_list(kk)%coord(2) = huge(0.0_dp)
773 fixd_list(kk)%coord(3) = huge(0.0_dp)
774 CASE (use_perd_y)
775 fixd_list(kk)%coord(1) = huge(0.0_dp)
776 fixd_list(kk)%coord(3) = huge(0.0_dp)
777 CASE (use_perd_z)
778 fixd_list(kk)%coord(1) = huge(0.0_dp)
779 fixd_list(kk)%coord(2) = huge(0.0_dp)
780 CASE (use_perd_xy)
781 fixd_list(kk)%coord(3) = huge(0.0_dp)
782 CASE (use_perd_xz)
783 fixd_list(kk)%coord(2) = huge(0.0_dp)
784 CASE (use_perd_yz)
785 fixd_list(kk)%coord(1) = huge(0.0_dp)
786 END SELECT
787 IF (restart_restraint_pos) THEN
788 ! Read coord0 value for restraint
789 CALL section_vals_val_get(fixd_restr_rest, "_DEFAULT_KEYWORD_", &
790 i_rep_val=nfixd_restart, r_vals=r)
791 SELECT CASE (itype)
792 CASE (use_perd_x)
793 cpassert(SIZE(r) == 1)
794 fixd_list(kk)%coord(1) = r(1)
795 CASE (use_perd_y)
796 cpassert(SIZE(r) == 1)
797 fixd_list(kk)%coord(2) = r(1)
798 CASE (use_perd_z)
799 cpassert(SIZE(r) == 1)
800 fixd_list(kk)%coord(3) = r(1)
801 CASE (use_perd_xy)
802 cpassert(SIZE(r) == 2)
803 fixd_list(kk)%coord(1) = r(1)
804 fixd_list(kk)%coord(2) = r(2)
805 CASE (use_perd_xz)
806 cpassert(SIZE(r) == 2)
807 fixd_list(kk)%coord(1) = r(1)
808 fixd_list(kk)%coord(3) = r(2)
809 CASE (use_perd_yz)
810 cpassert(SIZE(r) == 2)
811 fixd_list(kk)%coord(2) = r(1)
812 fixd_list(kk)%coord(3) = r(2)
813 CASE (use_perd_xyz)
814 cpassert(SIZE(r) == 3)
815 fixd_list(kk)%coord(1:3) = r(1:3)
816 IF (ASSOCIATED(topology%cell_muc)) &
817 CALL cell_transform_input_cartesian(topology%cell_muc, fixd_list(kk)%coord)
818 END SELECT
819 ELSE
820 ! Write coord0 value for restraint
821 SELECT CASE (itype)
822 CASE (use_perd_x)
823 ALLOCATE (r(1))
824 r(1) = fixd_list(kk)%coord(1)
825 CASE (use_perd_y)
826 ALLOCATE (r(1))
827 r(1) = fixd_list(kk)%coord(2)
828 CASE (use_perd_z)
829 ALLOCATE (r(1))
830 r(1) = fixd_list(kk)%coord(3)
831 CASE (use_perd_xy)
832 ALLOCATE (r(2))
833 r(1) = fixd_list(kk)%coord(1)
834 r(2) = fixd_list(kk)%coord(2)
835 CASE (use_perd_xz)
836 ALLOCATE (r(2))
837 r(1) = fixd_list(kk)%coord(1)
838 r(2) = fixd_list(kk)%coord(3)
839 CASE (use_perd_yz)
840 ALLOCATE (r(2))
841 r(1) = fixd_list(kk)%coord(1)
842 r(2) = fixd_list(kk)%coord(3)
843 CASE (use_perd_xyz)
844 ALLOCATE (r(3))
845 r(1:3) = fixd_list(kk)%coord(1:3)
846 END SELECT
847 CALL section_vals_val_set(fixd_restr_rest, "_DEFAULT_KEYWORD_", &
848 i_rep_val=nfixd_restart, r_vals_ptr=r)
849 END IF
850 END IF
851 END IF
852 END DO
853 END DO
854 END IF
855 IF (iw > 0) THEN
856 WRITE (iw, *) "MOLECULE KIND:", i, " NR. FIXED ATOMS:", SIZE(fixd_list(:)%fixd), " LIST::", fixd_list(:)%fixd
857 END IF
858 CALL set_molecule_kind(molecule_kind, nfixd=nfixed_atoms, nfixd_restraint=nfixd_restraint, &
859 fixd_list=fixd_list)
860 fixd_list_gci(nfixd_list_gci + 1:nfixd_list_gci + nfixed_atoms) = fixd_list
861 nfixd_list_gci = nfixd_list_gci + nfixed_atoms
862 END DO
863 IF (iw > 0) THEN
864 WRITE (iw, *) "TOTAL NUMBER OF FIXED ATOMS:", nfixd_list_gci
865 END IF
866 cpassert(count(missed_molname) == 0)
867 DEALLOCATE (missed_molname)
868 ! Intermolecular constraints
869 IF (gci%ntot /= 0) THEN
870 ALLOCATE (fixd_list(nfixd_list_gci))
871 fixd_list(1:nfixd_list_gci) = fixd_list_gci(1:nfixd_list_gci)
872 gci%fixd_list => fixd_list
873 END IF
874 DEALLOCATE (fixd_list_gci)
875 END IF
876 ! Final setup of the number of possible restraints
877 gci%nrestraint = gci%ng3x3_restraint + &
878 gci%ng4x6_restraint + &
879 gci%nvsite_restraint + &
880 gci%ncolv%nrestraint
881 CALL cp_print_key_finished_output(iw, logger, subsys_section, &
882 "PRINT%TOPOLOGY_INFO/UTIL_INFO")
883 CALL timestop(handle2)
884 CALL timestop(handle)
885 END SUBROUTINE topology_constraint_pack
886
887! **************************************************************************************************
888!> \brief Setup the colv_list for the packing of constraints
889!> \param colv_list ...
890!> \param ilist ...
891!> \param gind ...
892!> \param cons_info ...
893!> \param topology ...
894!> \param particle_set ...
895!> \param restart_restraint_clv ...
896!> \param colvar_rest ...
897!> \param first_atom ...
898!> \par History
899!> Updated 2007 for intermolecular constraints
900!> \author Teodoro Laino [2007]
901! **************************************************************************************************
902 SUBROUTINE setup_colv_list(colv_list, ilist, gind, cons_info, topology, &
903 particle_set, restart_restraint_clv, colvar_rest, first_atom)
904
905 TYPE(colvar_constraint_type), DIMENSION(:), &
906 POINTER :: colv_list
907 INTEGER, DIMENSION(:), POINTER :: ilist
908 INTEGER, INTENT(INOUT) :: gind
909 TYPE(constraint_info_type), POINTER :: cons_info
910 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
911 TYPE(particle_type), DIMENSION(:), OPTIONAL, &
912 POINTER :: particle_set
913 LOGICAL, INTENT(IN) :: restart_restraint_clv
914 TYPE(section_vals_type), POINTER :: colvar_rest
915 INTEGER, INTENT(IN) :: first_atom
916
917 INTEGER :: j, kdim, kk, ncolv_mol
918 REAL(kind=dp) :: rmod
919 TYPE(colvar_type), POINTER :: local_colvar
920
921 ncolv_mol = 0
922 DO kk = 1, SIZE(ilist)
923 j = ilist(kk)
924 ncolv_mol = ncolv_mol + 1
925 kdim = SIZE(cons_info%colvar_set(j)%colvar%i_atom)
926 ALLOCATE (colv_list(ncolv_mol)%i_atoms(kdim))
927 colv_list(ncolv_mol)%inp_seq_num = j
928 colv_list(ncolv_mol)%type_id = cons_info%colvar_set(j)%colvar%type_id
929 colv_list(ncolv_mol)%i_atoms = cons_info%colvar_set(j)%colvar%i_atom
930 colv_list(ncolv_mol)%use_points = cons_info%colvar_set(j)%colvar%use_points
931 ! Restraint
932 colv_list(ncolv_mol)%restraint%active = cons_info%colv_restraint(j)
933 colv_list(ncolv_mol)%restraint%k0 = cons_info%colv_k0(j)
934 IF (cons_info%const_colv_target(j) == -huge(0.0_dp)) THEN
935 ! Let's compute the value..
936 NULLIFY (local_colvar)
937 CALL colvar_clone(local_colvar, cons_info%colvar_set(j)%colvar, &
938 i_atom_offset=first_atom - 1)
939 CALL colvar_eval_mol_f(local_colvar, topology%cell, particle_set)
940 colv_list(ncolv_mol)%expected_value = local_colvar%ss
941 CALL colvar_release(local_colvar)
942 ELSE
943 colv_list(ncolv_mol)%expected_value = cons_info%const_colv_target(j)
944 END IF
945 colv_list(ncolv_mol)%expected_value_growth_speed = cons_info%const_colv_target_growth(j)
946 ! In case of Restraint let's check for possible restart values
947 IF (colv_list(ncolv_mol)%restraint%active .AND. &
948 (colv_list(ncolv_mol)%expected_value_growth_speed == 0.0_dp)) THEN
949 gind = gind + 1
950 IF (restart_restraint_clv) THEN
951 CALL section_vals_val_get(colvar_rest, "_DEFAULT_KEYWORD_", &
952 i_rep_val=gind, r_val=rmod)
953 colv_list(ncolv_mol)%expected_value = rmod
954 ELSE
955 rmod = colv_list(ncolv_mol)%expected_value
956 CALL section_vals_val_set(colvar_rest, "_DEFAULT_KEYWORD_", &
957 i_rep_val=gind, r_val=rmod)
958 END IF
959 END IF
960 ! Only if torsion let's take into account the singularity in the definition
961 ! of the dihedral
962 IF (cons_info%colvar_set(j)%colvar%type_id == torsion_colvar_id) THEN
963 cons_info%colvar_set(j)%colvar%torsion_param%o0 = colv_list(ncolv_mol)%expected_value
964 END IF
965 END DO
966 END SUBROUTINE setup_colv_list
967
968! **************************************************************************************************
969!> \brief Setup the g3x3_list for the packing of constraints
970!> \param g3x3_list ...
971!> \param ilist ...
972!> \param cons_info ...
973!> \param ng3x3_restraint ...
974!> \par History
975!> Updated 2007 for intermolecular constraints
976!> \author Teodoro Laino [2007]
977! **************************************************************************************************
978 SUBROUTINE setup_g3x3_list(g3x3_list, ilist, cons_info, ng3x3_restraint)
979 TYPE(g3x3_constraint_type), DIMENSION(:), POINTER :: g3x3_list
980 INTEGER, DIMENSION(:), POINTER :: ilist
981 TYPE(constraint_info_type), POINTER :: cons_info
982 INTEGER, INTENT(OUT) :: ng3x3_restraint
983
984 INTEGER :: j, ng3x3
985
986 ng3x3_restraint = 0
987 DO ng3x3 = 1, SIZE(ilist)
988 j = ilist(ng3x3)
989 g3x3_list(ng3x3)%a = cons_info%const_g33_a(j)
990 g3x3_list(ng3x3)%b = cons_info%const_g33_b(j)
991 g3x3_list(ng3x3)%c = cons_info%const_g33_c(j)
992 g3x3_list(ng3x3)%dab = cons_info%const_g33_dab(j)
993 g3x3_list(ng3x3)%dac = cons_info%const_g33_dac(j)
994 g3x3_list(ng3x3)%dbc = cons_info%const_g33_dbc(j)
995 ! Restraint
996 g3x3_list(ng3x3)%restraint%active = cons_info%g33_restraint(j)
997 g3x3_list(ng3x3)%restraint%k0 = cons_info%g33_k0(j)
998 IF (g3x3_list(ng3x3)%restraint%active) ng3x3_restraint = ng3x3_restraint + 1
999 END DO
1000
1001 END SUBROUTINE setup_g3x3_list
1002
1003! **************************************************************************************************
1004!> \brief Setup the g4x6_list for the packing of constraints
1005!> \param g4x6_list ...
1006!> \param ilist ...
1007!> \param cons_info ...
1008!> \param ng4x6_restraint ...
1009!> \par History
1010!> Updated 2007 for intermolecular constraints
1011!> \author Teodoro Laino [2007]
1012! **************************************************************************************************
1013 SUBROUTINE setup_g4x6_list(g4x6_list, ilist, cons_info, ng4x6_restraint)
1014 TYPE(g4x6_constraint_type), DIMENSION(:), POINTER :: g4x6_list
1015 INTEGER, DIMENSION(:), POINTER :: ilist
1016 TYPE(constraint_info_type), POINTER :: cons_info
1017 INTEGER, INTENT(OUT) :: ng4x6_restraint
1018
1019 INTEGER :: j, ng4x6
1020
1021 ng4x6 = 0
1022 ng4x6_restraint = 0
1023 DO ng4x6 = 1, SIZE(ilist)
1024 j = ilist(ng4x6)
1025 g4x6_list(ng4x6)%a = cons_info%const_g46_a(j)
1026 g4x6_list(ng4x6)%b = cons_info%const_g46_b(j)
1027 g4x6_list(ng4x6)%c = cons_info%const_g46_c(j)
1028 g4x6_list(ng4x6)%d = cons_info%const_g46_d(j)
1029 g4x6_list(ng4x6)%dab = cons_info%const_g46_dab(j)
1030 g4x6_list(ng4x6)%dac = cons_info%const_g46_dac(j)
1031 g4x6_list(ng4x6)%dbc = cons_info%const_g46_dbc(j)
1032 g4x6_list(ng4x6)%dad = cons_info%const_g46_dad(j)
1033 g4x6_list(ng4x6)%dbd = cons_info%const_g46_dbd(j)
1034 g4x6_list(ng4x6)%dcd = cons_info%const_g46_dcd(j)
1035 ! Restraint
1036 g4x6_list(ng4x6)%restraint%active = cons_info%g46_restraint(j)
1037 g4x6_list(ng4x6)%restraint%k0 = cons_info%g46_k0(j)
1038 IF (g4x6_list(ng4x6)%restraint%active) ng4x6_restraint = ng4x6_restraint + 1
1039 END DO
1040
1041 END SUBROUTINE setup_g4x6_list
1042
1043! **************************************************************************************************
1044!> \brief Setup the vsite_list for the packing of constraints
1045!> \param vsite_list ...
1046!> \param ilist ...
1047!> \param cons_info ...
1048!> \param nvsite_restraint ...
1049!> \par History
1050!> \author Marcel Baer [2008]
1051! **************************************************************************************************
1052 SUBROUTINE setup_vsite_list(vsite_list, ilist, cons_info, nvsite_restraint)
1053 TYPE(vsite_constraint_type), DIMENSION(:), POINTER :: vsite_list
1054 INTEGER, DIMENSION(:), POINTER :: ilist
1055 TYPE(constraint_info_type), POINTER :: cons_info
1056 INTEGER, INTENT(OUT) :: nvsite_restraint
1057
1058 INTEGER :: j, nvsite
1059
1060 nvsite = 0
1061 nvsite_restraint = 0
1062 DO nvsite = 1, SIZE(ilist)
1063 j = ilist(nvsite)
1064 vsite_list(nvsite)%a = cons_info%const_vsite_a(j)
1065 vsite_list(nvsite)%b = cons_info%const_vsite_b(j)
1066 vsite_list(nvsite)%c = cons_info%const_vsite_c(j)
1067 vsite_list(nvsite)%d = cons_info%const_vsite_d(j)
1068 vsite_list(nvsite)%wbc = cons_info%const_vsite_wbc(j)
1069 vsite_list(nvsite)%wdc = cons_info%const_vsite_wdc(j)
1070 ! Restraint
1071 vsite_list(nvsite)%restraint%active = cons_info%vsite_restraint(j)
1072 vsite_list(nvsite)%restraint%k0 = cons_info%vsite_k0(j)
1073 IF (vsite_list(nvsite)%restraint%active) nvsite_restraint = nvsite_restraint + 1
1074 END DO
1075
1076 END SUBROUTINE setup_vsite_list
1077! **************************************************************************************************
1078!> \brief Setup the lcolv for the packing of constraints
1079!> \param lcolv ...
1080!> \param ilist ...
1081!> \param first_atom ...
1082!> \param last_atom ...
1083!> \param cons_info ...
1084!> \param particle_set ...
1085!> \param colvar_func_info ...
1086!> \param use_clv_info ...
1087!> \param cind ...
1088!> \par History
1089!> Updated 2007 for intermolecular constraints
1090!> \author Teodoro Laino [2007]
1091! **************************************************************************************************
1092 SUBROUTINE setup_lcolv(lcolv, ilist, first_atom, last_atom, cons_info, &
1093 particle_set, colvar_func_info, use_clv_info, &
1094 cind)
1095 TYPE(local_colvar_constraint_type), DIMENSION(:), &
1096 POINTER :: lcolv
1097 INTEGER, DIMENSION(:), POINTER :: ilist
1098 INTEGER, INTENT(IN) :: first_atom, last_atom
1099 TYPE(constraint_info_type), POINTER :: cons_info
1100 TYPE(particle_type), DIMENSION(:), OPTIONAL, &
1101 POINTER :: particle_set
1102 TYPE(section_vals_type), POINTER :: colvar_func_info
1103 LOGICAL, INTENT(IN) :: use_clv_info
1104 INTEGER, INTENT(INOUT) :: cind
1105
1106 INTEGER :: ind, k, kk
1107 REAL(kind=dp), DIMENSION(:), POINTER :: r_vals
1108
1109 DO kk = 1, SIZE(ilist)
1110 k = ilist(kk)
1111 lcolv(kk)%init = .false.
1112 lcolv(kk)%lambda = 0.0_dp
1113 lcolv(kk)%sigma = 0.0_dp
1114
1115 ! Set Up colvar variable
1116 NULLIFY (lcolv(kk)%colvar, lcolv(kk)%colvar_old)
1117 ! Colvar
1118 CALL colvar_clone(lcolv(kk)%colvar, cons_info%colvar_set(k)%colvar, &
1119 i_atom_offset=first_atom - 1)
1120
1121 ! Some COLVARS may need additional information for evaluating the
1122 ! functional form: this is the case for COLVARS which depend on the
1123 ! initial position of the atoms: This information is stored in a proper
1124 ! container in the COLVAR_RESTART section..
1125 IF ((lcolv(kk)%colvar%type_id == xyz_diag_colvar_id) .OR. &
1126 (lcolv(kk)%colvar%type_id == xyz_outerdiag_colvar_id)) THEN
1127 cind = cind + 1
1128 IF (use_clv_info) THEN
1129 CALL section_vals_val_get(colvar_func_info, "_DEFAULT_KEYWORD_", &
1130 i_rep_val=cind, r_vals=r_vals)
1131 SELECT CASE (lcolv(kk)%colvar%type_id)
1132 CASE (xyz_diag_colvar_id)
1133 cpassert(SIZE(r_vals) == 3)
1134 lcolv(kk)%colvar%xyz_diag_param%r0 = r_vals
1136 cpassert(SIZE(r_vals) == 6)
1137 lcolv(kk)%colvar%xyz_outerdiag_param%r0(:, 1) = r_vals(1:3)
1138 lcolv(kk)%colvar%xyz_outerdiag_param%r0(:, 2) = r_vals(4:6)
1139 END SELECT
1140 ELSE
1141 SELECT CASE (lcolv(kk)%colvar%type_id)
1142 CASE (xyz_diag_colvar_id)
1143 ALLOCATE (r_vals(3))
1144 ind = first_atom - 1 + lcolv(kk)%colvar%xyz_diag_param%i_atom
1145 r_vals = particle_set(ind)%r
1146 lcolv(kk)%colvar%xyz_diag_param%r0 = r_vals
1148 ALLOCATE (r_vals(6))
1149 ind = first_atom - 1 + lcolv(kk)%colvar%xyz_outerdiag_param%i_atoms(1)
1150 r_vals(1:3) = particle_set(ind)%r
1151 ind = first_atom - 1 + lcolv(kk)%colvar%xyz_outerdiag_param%i_atoms(2)
1152 r_vals(4:6) = particle_set(ind)%r
1153 lcolv(kk)%colvar%xyz_outerdiag_param%r0(:, 1) = r_vals(1:3)
1154 lcolv(kk)%colvar%xyz_outerdiag_param%r0(:, 2) = r_vals(4:6)
1155 END SELECT
1156 CALL section_vals_val_set(colvar_func_info, "_DEFAULT_KEYWORD_", &
1157 i_rep_val=cind, r_vals_ptr=r_vals)
1158 END IF
1159 END IF
1160
1161 ! Setup Colvar_old
1162 CALL colvar_clone(lcolv(kk)%colvar_old, lcolv(kk)%colvar)
1163
1164 ! Check for consistency in the constraint definition
1165 IF (any(lcolv(kk)%colvar%i_atom > last_atom) .OR. &
1166 any(lcolv(kk)%colvar%i_atom < first_atom)) THEN
1167 WRITE (*, '(T5,"|",T8,A)') "Error in constraints setup!"
1168 WRITE (*, '(T5,"|",T8,A)') "A constraint has been defined for a molecule type", &
1169 " but the atoms specified in the constraint and the atoms defined for", &
1170 " the molecule DO NOT match!", &
1171 "This could be very probable due to a wrong connectivity, or an error", &
1172 " in the constraint specification in the input file.", &
1173 " Please check it carefully!"
1174 cpabort("")
1175 END IF
1176 END DO
1177 END SUBROUTINE setup_lcolv
1178
1179! **************************************************************************************************
1180!> \brief Setup the lg3x3 for the packing of constraints
1181!> \param lg3x3 ...
1182!> \param g3x3_list ...
1183!> \param first_atom ...
1184!> \param last_atom ...
1185!> \par History
1186!> Updated 2007 for intermolecular constraints
1187!> \author Teodoro Laino [2007]
1188! **************************************************************************************************
1189 SUBROUTINE setup_lg3x3(lg3x3, g3x3_list, first_atom, last_atom)
1190 TYPE(local_g3x3_constraint_type), DIMENSION(:), &
1191 POINTER :: lg3x3
1192 TYPE(g3x3_constraint_type), DIMENSION(:), POINTER :: g3x3_list
1193 INTEGER, INTENT(IN) :: first_atom, last_atom
1194
1195 INTEGER :: kk
1196
1197 DO kk = 1, SIZE(lg3x3)
1198 lg3x3(kk)%init = .false.
1199 lg3x3(kk)%scale = 0.0_dp
1200 lg3x3(kk)%scale_old = 0.0_dp
1201 lg3x3(kk)%fa = 0.0_dp
1202 lg3x3(kk)%fb = 0.0_dp
1203 lg3x3(kk)%fc = 0.0_dp
1204 lg3x3(kk)%ra_old = 0.0_dp
1205 lg3x3(kk)%rb_old = 0.0_dp
1206 lg3x3(kk)%rc_old = 0.0_dp
1207 lg3x3(kk)%va = 0.0_dp
1208 lg3x3(kk)%vb = 0.0_dp
1209 lg3x3(kk)%vc = 0.0_dp
1210 lg3x3(kk)%lambda = 0.0_dp
1211 IF ((g3x3_list(kk)%a + first_atom - 1 < first_atom) .OR. &
1212 (g3x3_list(kk)%b + first_atom - 1 < first_atom) .OR. &
1213 (g3x3_list(kk)%c + first_atom - 1 < first_atom) .OR. &
1214 (g3x3_list(kk)%a + first_atom - 1 > last_atom) .OR. &
1215 (g3x3_list(kk)%b + first_atom - 1 > last_atom) .OR. &
1216 (g3x3_list(kk)%c + first_atom - 1 > last_atom)) THEN
1217 WRITE (*, '(T5,"|",T8,A)') "Error in constraints setup!"
1218 WRITE (*, '(T5,"|",T8,A)') "A constraint has been defined for a molecule type", &
1219 " but the atoms specified in the constraint and the atoms defined for", &
1220 " the molecule DO NOT match!", &
1221 "This could be very probable due to a wrong connectivity, or an error", &
1222 " in the constraint specification in the input file.", &
1223 " Please check it carefully!"
1224 cpabort("")
1225 END IF
1226 END DO
1227
1228 END SUBROUTINE setup_lg3x3
1229
1230! **************************************************************************************************
1231!> \brief Setup the lg4x6 for the packing of constraints
1232!> \param lg4x6 ...
1233!> \param g4x6_list ...
1234!> \param first_atom ...
1235!> \param last_atom ...
1236!> \par History
1237!> Updated 2007 for intermolecular constraints
1238!> \author Teodoro Laino [2007]
1239! **************************************************************************************************
1240 SUBROUTINE setup_lg4x6(lg4x6, g4x6_list, first_atom, last_atom)
1241 TYPE(local_g4x6_constraint_type), DIMENSION(:), &
1242 POINTER :: lg4x6
1243 TYPE(g4x6_constraint_type), DIMENSION(:), POINTER :: g4x6_list
1244 INTEGER, INTENT(IN) :: first_atom, last_atom
1245
1246 INTEGER :: kk
1247
1248 DO kk = 1, SIZE(lg4x6)
1249 lg4x6(kk)%init = .false.
1250 lg4x6(kk)%scale = 0.0_dp
1251 lg4x6(kk)%scale_old = 0.0_dp
1252 lg4x6(kk)%fa = 0.0_dp
1253 lg4x6(kk)%fb = 0.0_dp
1254 lg4x6(kk)%fc = 0.0_dp
1255 lg4x6(kk)%fd = 0.0_dp
1256 lg4x6(kk)%fe = 0.0_dp
1257 lg4x6(kk)%ff = 0.0_dp
1258 lg4x6(kk)%ra_old = 0.0_dp
1259 lg4x6(kk)%rb_old = 0.0_dp
1260 lg4x6(kk)%rc_old = 0.0_dp
1261 lg4x6(kk)%rd_old = 0.0_dp
1262 lg4x6(kk)%re_old = 0.0_dp
1263 lg4x6(kk)%rf_old = 0.0_dp
1264 lg4x6(kk)%va = 0.0_dp
1265 lg4x6(kk)%vb = 0.0_dp
1266 lg4x6(kk)%vc = 0.0_dp
1267 lg4x6(kk)%vd = 0.0_dp
1268 lg4x6(kk)%ve = 0.0_dp
1269 lg4x6(kk)%vf = 0.0_dp
1270 lg4x6(kk)%lambda = 0.0_dp
1271 IF ((g4x6_list(kk)%a + first_atom - 1 < first_atom) .OR. &
1272 (g4x6_list(kk)%b + first_atom - 1 < first_atom) .OR. &
1273 (g4x6_list(kk)%c + first_atom - 1 < first_atom) .OR. &
1274 (g4x6_list(kk)%d + first_atom - 1 < first_atom) .OR. &
1275 (g4x6_list(kk)%a + first_atom - 1 > last_atom) .OR. &
1276 (g4x6_list(kk)%b + first_atom - 1 > last_atom) .OR. &
1277 (g4x6_list(kk)%c + first_atom - 1 > last_atom) .OR. &
1278 (g4x6_list(kk)%d + first_atom - 1 > last_atom)) THEN
1279 WRITE (*, '(T5,"|",T8,A)') "Error in constraints setup!"
1280 WRITE (*, '(T5,"|",T8,A)') "A constrained has been defined for a molecule type", &
1281 " but the atoms specified in the constraint and the atoms defined for", &
1282 " the molecule DO NOT match!", &
1283 "This could be very probable due to a wrong connectivity, or an error", &
1284 " in the constraint specification in the input file.", &
1285 " Please check it carefully!"
1286 cpabort("")
1287 END IF
1288 END DO
1289
1290 END SUBROUTINE setup_lg4x6
1291
1292! **************************************************************************************************
1293!> \brief Gives back a list of molecule to which apply the constraint
1294!> \param const_mol ...
1295!> \param const_molname ...
1296!> \param const_intermolecular ...
1297!> \param constr_x_mol ...
1298!> \param constr_x_glob ...
1299!> \param molecule_kind_set ...
1300!> \param exclude_qm ...
1301!> \param exclude_mm ...
1302!> \par History
1303!> Updated 2007 for intermolecular constraints
1304!> \author Teodoro Laino [2006]
1305! **************************************************************************************************
1306 SUBROUTINE give_constraint_array(const_mol, const_molname, const_intermolecular, &
1307 constr_x_mol, constr_x_glob, molecule_kind_set, exclude_qm, exclude_mm)
1308
1309 INTEGER, DIMENSION(:), POINTER :: const_mol
1310 CHARACTER(LEN=default_string_length), &
1311 DIMENSION(:), POINTER :: const_molname
1312 LOGICAL, DIMENSION(:), POINTER :: const_intermolecular
1313 TYPE(constr_list_type), DIMENSION(:), POINTER :: constr_x_mol
1314 INTEGER, DIMENSION(:), POINTER :: constr_x_glob
1315 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
1316 LOGICAL, DIMENSION(:), POINTER :: exclude_qm, exclude_mm
1317
1318 CHARACTER(len=*), PARAMETER :: routinen = 'give_constraint_array'
1319
1320 CHARACTER(LEN=default_string_length) :: myname, name
1321 INTEGER :: handle, i, iglob, isize, k
1322 LOGICAL :: found_molname, is_qm
1323 TYPE(molecule_kind_type), POINTER :: molecule_kind
1324
1325 CALL timeset(routinen, handle)
1326 NULLIFY (molecule_kind)
1327 ALLOCATE (constr_x_mol(SIZE(molecule_kind_set)))
1328 DO i = 1, SIZE(constr_x_mol)
1329 NULLIFY (constr_x_mol(i)%constr)
1330 ALLOCATE (constr_x_mol(i)%constr(0))
1331 END DO
1332 cpassert(SIZE(const_mol) == SIZE(const_molname))
1333 iglob = 0
1334 DO i = 1, SIZE(const_mol)
1335 IF (const_intermolecular(i)) THEN
1336 ! Intermolecular constraint
1337 iglob = iglob + 1
1338 CALL reallocate(constr_x_glob, 1, iglob)
1339 constr_x_glob(iglob) = i
1340 ELSE
1341 ! Intramolecular constraint
1342 IF (const_mol(i) /= 0) THEN
1343 k = const_mol(i)
1344 IF (k > SIZE(molecule_kind_set)) &
1345 CALL cp_abort(__location__, &
1346 "A constraint has been specified providing the molecule index. But the"// &
1347 " molecule index ("//cp_to_string(k)//") is out of range of the possible"// &
1348 " molecule kinds ("//cp_to_string(SIZE(molecule_kind_set))//").")
1349 isize = SIZE(constr_x_mol(k)%constr)
1350 CALL reallocate(constr_x_mol(k)%constr, 1, isize + 1)
1351 constr_x_mol(k)%constr(isize + 1) = i
1352 ELSE
1353 myname = const_molname(i)
1354 found_molname = .false.
1355 DO k = 1, SIZE(molecule_kind_set)
1356 molecule_kind => molecule_kind_set(k)
1357 name = molecule_kind%name
1358 is_qm = qmmm_ff_precond_only_qm(id1=name)
1359 IF (is_qm .AND. exclude_qm(i)) cycle
1360 IF (.NOT. is_qm .AND. exclude_mm(i)) cycle
1361 IF (name == myname) THEN
1362 isize = SIZE(constr_x_mol(k)%constr)
1363 CALL reallocate(constr_x_mol(k)%constr, 1, isize + 1)
1364 constr_x_mol(k)%constr(isize + 1) = i
1365 found_molname = .true.
1366 END IF
1367 END DO
1368 CALL print_warning_molname(found_molname, myname)
1369 END IF
1370 END IF
1371 END DO
1372 CALL timestop(handle)
1373 END SUBROUTINE give_constraint_array
1374
1375! **************************************************************************************************
1376!> \brief Prints a warning message if undefined molnames are used to define constraints
1377!> \param found ...
1378!> \param name ...
1379!> \author Teodoro Laino [2007] - Zurich University
1380! **************************************************************************************************
1381 SUBROUTINE print_warning_molname(found, name)
1382 LOGICAL, INTENT(IN) :: found
1383 CHARACTER(LEN=*), INTENT(IN) :: name
1384
1385 IF (.NOT. found) &
1386 CALL cp_warn(__location__, &
1387 " MOLNAME ("//trim(name)//") was defined for constraints, but this molecule name "// &
1388 "is not defined. Please check carefully your PDB, PSF (has priority over PDB) or "// &
1389 "input driven CP2K coordinates. In case you may not find the reason for this warning "// &
1390 "it may be a good idea to print all molecule information (including kind name) activating "// &
1391 "the print_key MOLECULES specific of the SUBSYS%PRINT section. ")
1392
1393 END SUBROUTINE print_warning_molname
1394
1395END MODULE topology_constraint_util
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
elemental logical function, public is_hydrogen(atomic_kind)
Determines if the atomic_kind is HYDROGEN.
Handles all functions related to the CELL.
Definition cell_types.F:15
integer, parameter, public use_perd_xyz
Definition cell_types.F:42
integer, parameter, public use_perd_y
Definition cell_types.F:42
integer, parameter, public use_perd_xz
Definition cell_types.F:42
integer, parameter, public use_perd_x
Definition cell_types.F:42
integer, parameter, public use_perd_z
Definition cell_types.F:42
integer, parameter, public use_perd_yz
Definition cell_types.F:42
integer, parameter, public use_perd_xy
Definition cell_types.F:42
subroutine, public cell_transform_input_cartesian(cell, vector)
Transform a Cartesian real-space vector from the user input cell frame into CP2K's canonical internal...
Definition cell_types.F:261
defines collective variables s({R}) and the derivative of this variable wrt R these can then be used ...
subroutine, public colvar_eval_mol_f(colvar, cell, particles, pos, fixd_list)
evaluates the derivatives (dsdr) given and due to the given colvar variables in a molecular environme...
Initialize the collective variables types.
recursive subroutine, public colvar_release(colvar)
releases the memory that might have been allocated by the colvar
integer, parameter, public xyz_outerdiag_colvar_id
subroutine, public colvar_create(colvar, colvar_id)
initializes a colvar_param type
recursive subroutine, public colvar_clone(colvar_out, colvar_in, i_atom_offset)
Clone a colvar type.
subroutine, public colvar_p_reallocate(colvar_set, lb1_new, ub1_new)
Change the dimension of a colvar_p_type.
integer, parameter, public dist_colvar_id
subroutine, public colvar_setup(colvar)
Finalize the setup of the collective variable.
integer, parameter, public torsion_colvar_id
integer, parameter, public xyz_diag_colvar_id
evaluations of colvar for internal coordinates schemes
subroutine, public post_process_colvar(colvar, particles)
Complete the description of the COORDINATION colvar when defined using KINDS.
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_constr_atomic
integer, parameter, public do_constr_molec
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
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
Utility routines for the memory handling.
Define the molecule kind structure types and the corresponding functionality.
subroutine, public get_molecule_kind(molecule_kind, atom_list, bond_list, bend_list, ub_list, impr_list, opbend_list, colv_list, fixd_list, g3x3_list, g4x6_list, vsite_list, torsion_list, shell_list, name, mass, charge, kind_number, natom, nbend, nbond, nub, nimpr, nopbend, nconstraint, nconstraint_fixd, nfixd, ncolv, ng3x3, ng4x6, nvsite, nfixd_restraint, ng3x3_restraint, ng4x6_restraint, nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion, molecule_list, nelectron, nelectron_alpha, nelectron_beta, bond_kind_set, bend_kind_set, ub_kind_set, impr_kind_set, opbend_kind_set, torsion_kind_set, molname_generated)
Get informations about a molecule kind.
subroutine, public setup_colvar_counters(colv_list, ncolv)
...
subroutine, public set_molecule_kind(molecule_kind, name, mass, charge, kind_number, molecule_list, atom_list, nbond, bond_list, nbend, bend_list, nub, ub_list, nimpr, impr_list, nopbend, opbend_list, ntorsion, torsion_list, fixd_list, ncolv, colv_list, ng3x3, g3x3_list, ng4x6, nfixd, g4x6_list, nvsite, vsite_list, ng3x3_restraint, ng4x6_restraint, nfixd_restraint, nshell, shell_list, nvsite_restraint, bond_kind_set, bend_kind_set, ub_kind_set, torsion_kind_set, impr_kind_set, opbend_kind_set, nelectron, nsgf, molname_generated)
Set the components of a molecule kind.
Define the data structure for the molecule information.
subroutine, public get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, first_atom, last_atom, first_shell, last_shell)
Get components from a molecule data set.
subroutine, public set_molecule(molecule, molecule_kind, lmi, lci, lcolv, lg3x3, lg4x6)
Set a molecule data set.
Define the data structure for the particle information.
logical function, public qmmm_ff_precond_only_qm(id1, id2, id3, id4, is_link)
This function handles the atom names and modifies the "_QM_" prefix, in order to find the parameters ...
Collection of subroutine needed for topology related things.
subroutine, public topology_constraint_pack(molecule_kind_set, molecule_set, topology, qmmm_env, particle_set, input_file, subsys_section, gci)
Pack in all the information needed for the constraints.
Control for reading in different topologies and coordinates.
Definition topology.F:13
Provides all information about an atomic kind.
parameters for a collective variable
type of a logger, at the moment it contains just a print level starting at which level it should be l...