(git:a0df33d)
Loading...
Searching...
No Matches
molecule_kind_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!> \brief Define the molecule kind structure types and the corresponding
10!> functionality
11!> \par History
12!> Teodoro Laino [tlaino] 12.2008 - Preparing for VIRTUAL SITE constraints
13!> (patch by Marcel Baer)
14!> \author Matthias Krack (22.08.2003)
15! **************************************************************************************************
27 USE colvar_types, ONLY: &
40 USE force_field_kind_types, ONLY: &
45 USE kinds, ONLY: default_string_length,&
46 dp
48#include "../base/base_uses.f90"
49
50 IMPLICIT NONE
51
52 PRIVATE
53
54 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'molecule_kind_types'
55
56 ! Define the derived structure types
57
59 TYPE(atomic_kind_type), POINTER :: atomic_kind => null()
60 INTEGER :: id_name = 0
61 END TYPE atom_type
62
64 INTEGER :: a = 0
65 CHARACTER(LEN=default_string_length) :: name = ""
66 TYPE(shell_kind_type), POINTER :: shell_kind => null()
67 END TYPE shell_type
68
70 INTEGER :: a = 0, b = 0
71 INTEGER :: id_type = do_ff_undef, itype = 0
72 TYPE(bond_kind_type), POINTER :: bond_kind => null()
73 END TYPE bond_type
74
76 INTEGER :: a = 0, b = 0, c = 0
77 INTEGER :: id_type = do_ff_undef, itype = 0
78 TYPE(bend_kind_type), POINTER :: bend_kind => null()
79 END TYPE bend_type
80
82 INTEGER :: a = 0, b = 0, c = 0
83 INTEGER :: id_type = do_ff_undef, itype = 0
84 TYPE(ub_kind_type), POINTER :: ub_kind => null()
85 END TYPE ub_type
86
88 INTEGER :: a = 0, b = 0, c = 0, d = 0
89 INTEGER :: id_type = do_ff_undef, itype = 0
90 TYPE(torsion_kind_type), POINTER :: torsion_kind => null()
91 END TYPE torsion_type
92
94 INTEGER :: a = 0, b = 0, c = 0, d = 0
95 INTEGER :: id_type = do_ff_undef, itype = 0
96 TYPE(impr_kind_type), POINTER :: impr_kind => null()
97 END TYPE impr_type
98
100 INTEGER :: a = 0, b = 0, c = 0, d = 0
101 INTEGER :: id_type = do_ff_undef, itype = 0
102 TYPE(opbend_kind_type), POINTER :: opbend_kind => null()
103 END TYPE opbend_type
104
105 TYPE restraint_type
106 LOGICAL :: active = .false.
107 REAL(kind=dp) :: k0 = 0.0_dp
108 END TYPE restraint_type
109
110 ! Constraint types
112 INTEGER :: type_id = no_colvar_id
113 INTEGER :: inp_seq_num = 0
114 LOGICAL :: use_points = .false.
115 REAL(kind=dp) :: expected_value = 0.0_dp
116 REAL(kind=dp) :: expected_value_growth_speed = 0.0_dp
117 INTEGER, POINTER, DIMENSION(:) :: i_atoms => null()
118 TYPE(restraint_type) :: restraint = restraint_type()
120
122 INTEGER :: a = 0, b = 0, c = 0
123 REAL(kind=dp) :: dab = 0.0_dp, dac = 0.0_dp, dbc = 0.0_dp
124 TYPE(restraint_type) :: restraint = restraint_type()
125 END TYPE g3x3_constraint_type
126
128 INTEGER :: a = 0, b = 0, c = 0, d = 0
129 REAL(kind=dp) :: dab = 0.0_dp, dac = 0.0_dp, dbc = 0.0_dp, &
130 dad = 0.0_dp, dbd = 0.0_dp, dcd = 0.0_dp
131 TYPE(restraint_type) :: restraint = restraint_type()
132 END TYPE g4x6_constraint_type
133
135 INTEGER :: a = 0, b = 0, c = 0, d = 0
136 REAL(kind=dp) :: wbc = 0.0_dp, wdc = 0.0_dp
137 TYPE(restraint_type) :: restraint = restraint_type()
138 END TYPE vsite_constraint_type
139
141 TYPE(restraint_type) :: restraint = restraint_type()
142 INTEGER :: fixd = 0, itype = 0
143 REAL(kind=dp), DIMENSION(3) :: coord = 0.0_dp
144 END TYPE fixd_constraint_type
145
147 INTEGER :: ifixd_index = 0, ikind = 0
149
150 ! Molecule kind type
152 TYPE(atom_type), DIMENSION(:), POINTER :: atom_list => null()
153 TYPE(bond_kind_type), DIMENSION(:), POINTER :: bond_kind_set => null()
154 TYPE(bond_type), DIMENSION(:), POINTER :: bond_list => null()
155 TYPE(bend_kind_type), DIMENSION(:), POINTER :: bend_kind_set => null()
156 TYPE(bend_type), DIMENSION(:), POINTER :: bend_list => null()
157 TYPE(ub_kind_type), DIMENSION(:), POINTER :: ub_kind_set => null()
158 TYPE(ub_type), DIMENSION(:), POINTER :: ub_list => null()
159 TYPE(torsion_kind_type), DIMENSION(:), POINTER :: torsion_kind_set => null()
160 TYPE(torsion_type), DIMENSION(:), POINTER :: torsion_list => null()
161 TYPE(impr_kind_type), DIMENSION(:), POINTER :: impr_kind_set => null()
162 TYPE(impr_type), DIMENSION(:), POINTER :: impr_list => null()
163 TYPE(opbend_kind_type), DIMENSION(:), POINTER :: opbend_kind_set => null()
164 TYPE(opbend_type), DIMENSION(:), POINTER :: opbend_list => null()
165 TYPE(colvar_constraint_type), DIMENSION(:), &
166 POINTER :: colv_list => null()
167 TYPE(g3x3_constraint_type), DIMENSION(:), POINTER :: g3x3_list => null()
168 TYPE(g4x6_constraint_type), DIMENSION(:), POINTER :: g4x6_list => null()
169 TYPE(vsite_constraint_type), DIMENSION(:), POINTER :: vsite_list => null()
170 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list => null()
171 TYPE(shell_type), DIMENSION(:), POINTER :: shell_list => null()
172 CHARACTER(LEN=default_string_length) :: name = ""
173 REAL(kind=dp) :: charge = 0.0_dp, &
174 mass = 0.0_dp
175 INTEGER :: kind_number = 0, &
176 natom = 0, &
177 nbond = 0, &
178 nbend = 0, &
179 nimpr = 0, &
180 nopbend = 0, &
181 ntorsion = 0, &
182 nub = 0, &
183 ng3x3 = 0, &
184 ng3x3_restraint = 0, &
185 ng4x6 = 0, &
186 ng4x6_restraint = 0, &
187 nvsite = 0, &
188 nvsite_restraint = 0, &
189 nfixd = 0, &
190 nfixd_restraint = 0, &
191 nmolecule = 0, &
192 nshell = 0
194 INTEGER :: nsgf = 0, &
195 nelectron = 0, &
196 nelectron_alpha = 0, &
197 nelectron_beta = 0
198 INTEGER, DIMENSION(:), POINTER :: molecule_list => null()
199 LOGICAL :: molname_generated = .false.
200 END TYPE molecule_kind_type
201
202 ! Public subroutines
203 PUBLIC :: allocate_molecule_kind_set, &
215
216 ! Public data types
217 PUBLIC :: atom_type, &
218 bend_type, &
219 bond_type, &
220 ub_type, &
221 torsion_type, &
222 impr_type, &
223 opbend_type, &
232
233CONTAINS
234
235! **************************************************************************************************
236!> \brief ...
237!> \param colv_list ...
238!> \param ncolv ...
239! **************************************************************************************************
240 SUBROUTINE setup_colvar_counters(colv_list, ncolv)
241 TYPE(colvar_constraint_type), DIMENSION(:), &
242 POINTER :: colv_list
243 TYPE(colvar_counters), INTENT(OUT) :: ncolv
244
245 INTEGER :: k
246
247 IF (ASSOCIATED(colv_list)) THEN
248 DO k = 1, SIZE(colv_list)
249 IF (colv_list(k)%restraint%active) ncolv%nrestraint = ncolv%nrestraint + 1
250 SELECT CASE (colv_list(k)%type_id)
251 CASE (angle_colvar_id)
252 ncolv%nangle = ncolv%nangle + 1
253 CASE (coord_colvar_id)
254 ncolv%ncoord = ncolv%ncoord + 1
256 ncolv%npopulation = ncolv%npopulation + 1
257 CASE (gyration_colvar_id)
258 ncolv%ngyration = ncolv%ngyration + 1
259 CASE (rotation_colvar_id)
260 ncolv%nrot = ncolv%nrot + 1
261 CASE (dist_colvar_id)
262 ncolv%ndist = ncolv%ndist + 1
263 CASE (dfunct_colvar_id)
264 ncolv%ndfunct = ncolv%ndfunct + 1
266 ncolv%nplane_dist = ncolv%nplane_dist + 1
268 ncolv%nplane_angle = ncolv%nplane_angle + 1
269 CASE (torsion_colvar_id)
270 ncolv%ntorsion = ncolv%ntorsion + 1
271 CASE (qparm_colvar_id)
272 ncolv%nqparm = ncolv%nqparm + 1
273 CASE (xyz_diag_colvar_id)
274 ncolv%nxyz_diag = ncolv%nxyz_diag + 1
276 ncolv%nxyz_outerdiag = ncolv%nxyz_outerdiag + 1
278 ncolv%nhydronium_shell = ncolv%nhydronium_shell + 1
280 ncolv%nhydronium_dist = ncolv%nhydronium_dist + 1
282 ncolv%nacid_hyd_dist = ncolv%nacid_hyd_dist + 1
284 ncolv%nacid_hyd_shell = ncolv%nacid_hyd_shell + 1
286 ncolv%nreactionpath = ncolv%nreactionpath + 1
287 CASE (combine_colvar_id)
288 ncolv%ncombinecvs = ncolv%ncombinecvs + 1
289 CASE DEFAULT
290 cpabort("Unknown colvar type")
291 END SELECT
292 END DO
293 END IF
294 ncolv%ntot = ncolv%ndist + &
295 ncolv%nangle + &
296 ncolv%ntorsion + &
297 ncolv%ncoord + &
298 ncolv%nplane_dist + &
299 ncolv%nplane_angle + &
300 ncolv%ndfunct + &
301 ncolv%nrot + &
302 ncolv%nqparm + &
303 ncolv%nxyz_diag + &
304 ncolv%nxyz_outerdiag + &
305 ncolv%nhydronium_shell + &
306 ncolv%nhydronium_dist + &
307 ncolv%nacid_hyd_dist + &
308 ncolv%nacid_hyd_shell + &
309 ncolv%nreactionpath + &
310 ncolv%ncombinecvs + &
311 ncolv%npopulation + &
312 ncolv%ngyration
313
314 END SUBROUTINE setup_colvar_counters
315
316! **************************************************************************************************
317!> \brief Allocate and initialize a molecule kind set.
318!> \param molecule_kind_set ...
319!> \param nmolecule_kind ...
320!> \date 22.08.2003
321!> \author Matthias Krack
322!> \version 1.0
323! **************************************************************************************************
324 SUBROUTINE allocate_molecule_kind_set(molecule_kind_set, nmolecule_kind)
325 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
326 INTEGER, INTENT(IN) :: nmolecule_kind
327
328 INTEGER :: imolecule_kind
329
330 IF (ASSOCIATED(molecule_kind_set)) THEN
331 CALL deallocate_molecule_kind_set(molecule_kind_set)
332 END IF
333
334 ALLOCATE (molecule_kind_set(nmolecule_kind))
335
336 DO imolecule_kind = 1, nmolecule_kind
337 molecule_kind_set(imolecule_kind)%kind_number = imolecule_kind
338 CALL setup_colvar_counters(molecule_kind_set(imolecule_kind)%colv_list, &
339 molecule_kind_set(imolecule_kind)%ncolv)
340 END DO
341
342 END SUBROUTINE allocate_molecule_kind_set
343
344! **************************************************************************************************
345!> \brief Deallocate a molecule kind set.
346!> \param molecule_kind_set ...
347!> \date 22.08.2003
348!> \author Matthias Krack
349!> \version 1.0
350! **************************************************************************************************
351 SUBROUTINE deallocate_molecule_kind_set(molecule_kind_set)
352
353 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
354
355 INTEGER :: i, imolecule_kind, j, nmolecule_kind
356
357 IF (ASSOCIATED(molecule_kind_set)) THEN
358
359 nmolecule_kind = SIZE(molecule_kind_set)
360
361 DO imolecule_kind = 1, nmolecule_kind
362
363 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%atom_list)) THEN
364 DEALLOCATE (molecule_kind_set(imolecule_kind)%atom_list)
365 END IF
366 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%bend_kind_set)) THEN
367 DO i = 1, SIZE(molecule_kind_set(imolecule_kind)%bend_kind_set)
368 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%bend_kind_set(i)%legendre%coeffs)) THEN
369 DEALLOCATE (molecule_kind_set(imolecule_kind)%bend_kind_set(i)%legendre%coeffs)
370 END IF
371 END DO
372 DEALLOCATE (molecule_kind_set(imolecule_kind)%bend_kind_set)
373 END IF
374 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%bend_list)) THEN
375 DEALLOCATE (molecule_kind_set(imolecule_kind)%bend_list)
376 END IF
377 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%ub_list)) THEN
378 DEALLOCATE (molecule_kind_set(imolecule_kind)%ub_list)
379 END IF
380 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%ub_kind_set)) THEN
381 CALL ub_kind_dealloc_ref(molecule_kind_set(imolecule_kind)%ub_kind_set)
382 END IF
383 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%impr_list)) THEN
384 DEALLOCATE (molecule_kind_set(imolecule_kind)%impr_list)
385 END IF
386 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%impr_kind_set)) THEN
387 DO i = 1, SIZE(molecule_kind_set(imolecule_kind)%impr_kind_set)
388 CALL impr_kind_dealloc_ref() !This Subroutine doesn't deallocate anything, maybe needs to be implemented
389 END DO
390 DEALLOCATE (molecule_kind_set(imolecule_kind)%impr_kind_set)
391 END IF
392 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%opbend_list)) THEN
393 DEALLOCATE (molecule_kind_set(imolecule_kind)%opbend_list)
394 END IF
395 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%opbend_kind_set)) THEN
396 DEALLOCATE (molecule_kind_set(imolecule_kind)%opbend_kind_set)
397 END IF
398 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%bond_kind_set)) THEN
399 DEALLOCATE (molecule_kind_set(imolecule_kind)%bond_kind_set)
400 END IF
401 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%bond_list)) THEN
402 DEALLOCATE (molecule_kind_set(imolecule_kind)%bond_list)
403 END IF
404 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%colv_list)) THEN
405 DO j = 1, SIZE(molecule_kind_set(imolecule_kind)%colv_list)
406 DEALLOCATE (molecule_kind_set(imolecule_kind)%colv_list(j)%i_atoms)
407 END DO
408 DEALLOCATE (molecule_kind_set(imolecule_kind)%colv_list)
409 END IF
410 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%g3x3_list)) THEN
411 DEALLOCATE (molecule_kind_set(imolecule_kind)%g3x3_list)
412 END IF
413 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%g4x6_list)) THEN
414 DEALLOCATE (molecule_kind_set(imolecule_kind)%g4x6_list)
415 END IF
416 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%vsite_list)) THEN
417 DEALLOCATE (molecule_kind_set(imolecule_kind)%vsite_list)
418 END IF
419 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%fixd_list)) THEN
420 DEALLOCATE (molecule_kind_set(imolecule_kind)%fixd_list)
421 END IF
422 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%torsion_kind_set)) THEN
423 DO i = 1, SIZE(molecule_kind_set(imolecule_kind)%torsion_kind_set)
424 CALL torsion_kind_dealloc_ref(molecule_kind_set(imolecule_kind)%torsion_kind_set(i))
425 END DO
426 DEALLOCATE (molecule_kind_set(imolecule_kind)%torsion_kind_set)
427 END IF
428 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%shell_list)) THEN
429 DEALLOCATE (molecule_kind_set(imolecule_kind)%shell_list)
430 END IF
431 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%torsion_list)) THEN
432 DEALLOCATE (molecule_kind_set(imolecule_kind)%torsion_list)
433 END IF
434 IF (ASSOCIATED(molecule_kind_set(imolecule_kind)%molecule_list)) THEN
435 DEALLOCATE (molecule_kind_set(imolecule_kind)%molecule_list)
436 END IF
437 END DO
438
439 DEALLOCATE (molecule_kind_set)
440 END IF
441 NULLIFY (molecule_kind_set)
442
443 END SUBROUTINE deallocate_molecule_kind_set
444
445! **************************************************************************************************
446!> \brief Get informations about a molecule kind.
447!> \param molecule_kind ...
448!> \param atom_list ...
449!> \param bond_list ...
450!> \param bend_list ...
451!> \param ub_list ...
452!> \param impr_list ...
453!> \param opbend_list ...
454!> \param colv_list ...
455!> \param fixd_list ...
456!> \param g3x3_list ...
457!> \param g4x6_list ...
458!> \param vsite_list ...
459!> \param torsion_list ...
460!> \param shell_list ...
461!> \param name ...
462!> \param mass ...
463!> \param charge ...
464!> \param kind_number ...
465!> \param natom ...
466!> \param nbend ...
467!> \param nbond ...
468!> \param nub ...
469!> \param nimpr ...
470!> \param nopbend ...
471!> \param nconstraint ...
472!> \param nconstraint_fixd ...
473!> \param nfixd ...
474!> \param ncolv ...
475!> \param ng3x3 ...
476!> \param ng4x6 ...
477!> \param nvsite ...
478!> \param nfixd_restraint ...
479!> \param ng3x3_restraint ...
480!> \param ng4x6_restraint ...
481!> \param nvsite_restraint ...
482!> \param nrestraints ...
483!> \param nmolecule ...
484!> \param nsgf ...
485!> \param nshell ...
486!> \param ntorsion ...
487!> \param molecule_list ...
488!> \param nelectron ...
489!> \param nelectron_alpha ...
490!> \param nelectron_beta ...
491!> \param bond_kind_set ...
492!> \param bend_kind_set ...
493!> \param ub_kind_set ...
494!> \param impr_kind_set ...
495!> \param opbend_kind_set ...
496!> \param torsion_kind_set ...
497!> \param molname_generated ...
498!> \date 27.08.2003
499!> \author Matthias Krack
500!> \version 1.0
501! **************************************************************************************************
502 SUBROUTINE get_molecule_kind(molecule_kind, atom_list, bond_list, bend_list, &
503 ub_list, impr_list, opbend_list, colv_list, fixd_list, &
504 g3x3_list, g4x6_list, vsite_list, torsion_list, shell_list, &
505 name, mass, charge, kind_number, natom, nbend, nbond, nub, &
506 nimpr, nopbend, nconstraint, nconstraint_fixd, nfixd, ncolv, ng3x3, ng4x6, &
507 nvsite, nfixd_restraint, ng3x3_restraint, ng4x6_restraint, &
508 nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion, &
509 molecule_list, nelectron, nelectron_alpha, nelectron_beta, &
510 bond_kind_set, bend_kind_set, &
511 ub_kind_set, impr_kind_set, opbend_kind_set, torsion_kind_set, &
512 molname_generated)
513
514 TYPE(molecule_kind_type), INTENT(IN) :: molecule_kind
515 TYPE(atom_type), DIMENSION(:), OPTIONAL, POINTER :: atom_list
516 TYPE(bond_type), DIMENSION(:), OPTIONAL, POINTER :: bond_list
517 TYPE(bend_type), DIMENSION(:), OPTIONAL, POINTER :: bend_list
518 TYPE(ub_type), DIMENSION(:), OPTIONAL, POINTER :: ub_list
519 TYPE(impr_type), DIMENSION(:), OPTIONAL, POINTER :: impr_list
520 TYPE(opbend_type), DIMENSION(:), OPTIONAL, POINTER :: opbend_list
521 TYPE(colvar_constraint_type), DIMENSION(:), &
522 OPTIONAL, POINTER :: colv_list
523 TYPE(fixd_constraint_type), DIMENSION(:), &
524 OPTIONAL, POINTER :: fixd_list
525 TYPE(g3x3_constraint_type), DIMENSION(:), &
526 OPTIONAL, POINTER :: g3x3_list
527 TYPE(g4x6_constraint_type), DIMENSION(:), &
528 OPTIONAL, POINTER :: g4x6_list
529 TYPE(vsite_constraint_type), DIMENSION(:), &
530 OPTIONAL, POINTER :: vsite_list
531 TYPE(torsion_type), DIMENSION(:), OPTIONAL, &
532 POINTER :: torsion_list
533 TYPE(shell_type), DIMENSION(:), OPTIONAL, POINTER :: shell_list
534 CHARACTER(LEN=default_string_length), &
535 INTENT(OUT), OPTIONAL :: name
536 REAL(kind=dp), OPTIONAL :: mass, charge
537 INTEGER, INTENT(OUT), OPTIONAL :: kind_number, natom, nbend, nbond, nub, &
538 nimpr, nopbend, nconstraint, &
539 nconstraint_fixd, nfixd
540 TYPE(colvar_counters), INTENT(out), OPTIONAL :: ncolv
541 INTEGER, INTENT(OUT), OPTIONAL :: ng3x3, ng4x6, nvsite, nfixd_restraint, ng3x3_restraint, &
542 ng4x6_restraint, nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion
543 INTEGER, DIMENSION(:), OPTIONAL, POINTER :: molecule_list
544 INTEGER, INTENT(OUT), OPTIONAL :: nelectron, nelectron_alpha, &
545 nelectron_beta
546 TYPE(bond_kind_type), DIMENSION(:), OPTIONAL, &
547 POINTER :: bond_kind_set
548 TYPE(bend_kind_type), DIMENSION(:), OPTIONAL, &
549 POINTER :: bend_kind_set
550 TYPE(ub_kind_type), DIMENSION(:), OPTIONAL, &
551 POINTER :: ub_kind_set
552 TYPE(impr_kind_type), DIMENSION(:), OPTIONAL, &
553 POINTER :: impr_kind_set
554 TYPE(opbend_kind_type), DIMENSION(:), OPTIONAL, &
555 POINTER :: opbend_kind_set
556 TYPE(torsion_kind_type), DIMENSION(:), OPTIONAL, &
557 POINTER :: torsion_kind_set
558 LOGICAL, INTENT(OUT), OPTIONAL :: molname_generated
559
560 INTEGER :: i
561
562 IF (PRESENT(atom_list)) atom_list => molecule_kind%atom_list
563 IF (PRESENT(bend_list)) bend_list => molecule_kind%bend_list
564 IF (PRESENT(bond_list)) bond_list => molecule_kind%bond_list
565 IF (PRESENT(impr_list)) impr_list => molecule_kind%impr_list
566 IF (PRESENT(opbend_list)) opbend_list => molecule_kind%opbend_list
567 IF (PRESENT(ub_list)) ub_list => molecule_kind%ub_list
568 IF (PRESENT(bond_kind_set)) bond_kind_set => molecule_kind%bond_kind_set
569 IF (PRESENT(bend_kind_set)) bend_kind_set => molecule_kind%bend_kind_set
570 IF (PRESENT(ub_kind_set)) ub_kind_set => molecule_kind%ub_kind_set
571 IF (PRESENT(impr_kind_set)) impr_kind_set => molecule_kind%impr_kind_set
572 IF (PRESENT(opbend_kind_set)) opbend_kind_set => molecule_kind%opbend_kind_set
573 IF (PRESENT(torsion_kind_set)) torsion_kind_set => molecule_kind%torsion_kind_set
574 IF (PRESENT(colv_list)) colv_list => molecule_kind%colv_list
575 IF (PRESENT(g3x3_list)) g3x3_list => molecule_kind%g3x3_list
576 IF (PRESENT(g4x6_list)) g4x6_list => molecule_kind%g4x6_list
577 IF (PRESENT(vsite_list)) vsite_list => molecule_kind%vsite_list
578 IF (PRESENT(fixd_list)) fixd_list => molecule_kind%fixd_list
579 IF (PRESENT(torsion_list)) torsion_list => molecule_kind%torsion_list
580 IF (PRESENT(shell_list)) shell_list => molecule_kind%shell_list
581 IF (PRESENT(name)) name = molecule_kind%name
582 IF (PRESENT(molname_generated)) molname_generated = molecule_kind%molname_generated
583 IF (PRESENT(mass)) mass = molecule_kind%mass
584 IF (PRESENT(charge)) charge = molecule_kind%charge
585 IF (PRESENT(kind_number)) kind_number = molecule_kind%kind_number
586 IF (PRESENT(natom)) natom = molecule_kind%natom
587 IF (PRESENT(nbend)) nbend = molecule_kind%nbend
588 IF (PRESENT(nbond)) nbond = molecule_kind%nbond
589 IF (PRESENT(nub)) nub = molecule_kind%nub
590 IF (PRESENT(nimpr)) nimpr = molecule_kind%nimpr
591 IF (PRESENT(nopbend)) nopbend = molecule_kind%nopbend
592 IF (PRESENT(nconstraint)) nconstraint = (molecule_kind%ncolv%ntot - molecule_kind%ncolv%nrestraint) + &
593 3*(molecule_kind%ng3x3 - molecule_kind%ng3x3_restraint) + &
594 6*(molecule_kind%ng4x6 - molecule_kind%ng4x6_restraint) + &
595 3*(molecule_kind%nvsite - molecule_kind%nvsite_restraint)
596 IF (PRESENT(ncolv)) ncolv = molecule_kind%ncolv
597 IF (PRESENT(ng3x3)) ng3x3 = molecule_kind%ng3x3
598 IF (PRESENT(ng4x6)) ng4x6 = molecule_kind%ng4x6
599 IF (PRESENT(nvsite)) nvsite = molecule_kind%nvsite
600 ! Number of atoms that have one or more components fixed
601 IF (PRESENT(nfixd)) nfixd = molecule_kind%nfixd
602 ! Number of degrees of freedom fixed
603 IF (PRESENT(nconstraint_fixd)) THEN
604 nconstraint_fixd = 0
605 IF (molecule_kind%nfixd /= 0) THEN
606 DO i = 1, SIZE(molecule_kind%fixd_list)
607 IF (molecule_kind%fixd_list(i)%restraint%active) cycle
608 SELECT CASE (molecule_kind%fixd_list(i)%itype)
610 nconstraint_fixd = nconstraint_fixd + 1
612 nconstraint_fixd = nconstraint_fixd + 2
613 CASE (use_perd_xyz)
614 nconstraint_fixd = nconstraint_fixd + 3
615 END SELECT
616 END DO
617 END IF
618 END IF
619 IF (PRESENT(ng3x3_restraint)) ng3x3_restraint = molecule_kind%ng3x3_restraint
620 IF (PRESENT(ng4x6_restraint)) ng4x6_restraint = molecule_kind%ng4x6_restraint
621 IF (PRESENT(nvsite_restraint)) nvsite_restraint = molecule_kind%nvsite_restraint
622 IF (PRESENT(nfixd_restraint)) nfixd_restraint = molecule_kind%nfixd_restraint
623 IF (PRESENT(nrestraints)) nrestraints = molecule_kind%ncolv%nrestraint + &
624 molecule_kind%ng3x3_restraint + &
625 molecule_kind%ng4x6_restraint + &
626 molecule_kind%nvsite_restraint
627 IF (PRESENT(nmolecule)) nmolecule = molecule_kind%nmolecule
628 IF (PRESENT(nshell)) nshell = molecule_kind%nshell
629 IF (PRESENT(ntorsion)) ntorsion = molecule_kind%ntorsion
630 IF (PRESENT(nsgf)) nsgf = molecule_kind%nsgf
631 IF (PRESENT(nelectron)) nelectron = molecule_kind%nelectron
632 IF (PRESENT(nelectron_alpha)) nelectron_alpha = molecule_kind%nelectron_beta
633 IF (PRESENT(nelectron_beta)) nelectron_beta = molecule_kind%nelectron_alpha
634 IF (PRESENT(molecule_list)) molecule_list => molecule_kind%molecule_list
635
636 END SUBROUTINE get_molecule_kind
637
638! **************************************************************************************************
639!> \brief Get informations about a molecule kind set.
640!> \param molecule_kind_set ...
641!> \param maxatom ...
642!> \param natom ...
643!> \param nbond ...
644!> \param nbend ...
645!> \param nub ...
646!> \param ntorsion ...
647!> \param nimpr ...
648!> \param nopbend ...
649!> \param nconstraint ...
650!> \param nconstraint_fixd ...
651!> \param nmolecule ...
652!> \param nrestraints ...
653!> \date 27.08.2003
654!> \author Matthias Krack
655!> \version 1.0
656! **************************************************************************************************
657 SUBROUTINE get_molecule_kind_set(molecule_kind_set, maxatom, natom, &
658 nbond, nbend, nub, ntorsion, nimpr, nopbend, &
659 nconstraint, nconstraint_fixd, nmolecule, &
660 nrestraints)
661
662 TYPE(molecule_kind_type), DIMENSION(:), INTENT(IN) :: molecule_kind_set
663 INTEGER, INTENT(OUT), OPTIONAL :: maxatom, natom, nbond, nbend, nub, &
664 ntorsion, nimpr, nopbend, nconstraint, &
665 nconstraint_fixd, nmolecule, &
666 nrestraints
667
668 INTEGER :: ibend, ibond, iimpr, imolecule_kind, iopbend, itorsion, iub, na, nc, nc_fixd, &
669 nfixd_restraint, nm, nmolecule_kind, nrestraints_tot
670
671 IF (PRESENT(maxatom)) maxatom = 0
672 IF (PRESENT(natom)) natom = 0
673 IF (PRESENT(nbond)) nbond = 0
674 IF (PRESENT(nbend)) nbend = 0
675 IF (PRESENT(nub)) nub = 0
676 IF (PRESENT(ntorsion)) ntorsion = 0
677 IF (PRESENT(nimpr)) nimpr = 0
678 IF (PRESENT(nopbend)) nopbend = 0
679 IF (PRESENT(nconstraint)) nconstraint = 0
680 IF (PRESENT(nconstraint_fixd)) nconstraint_fixd = 0
681 IF (PRESENT(nrestraints)) nrestraints = 0
682 IF (PRESENT(nmolecule)) nmolecule = 0
683
684 nmolecule_kind = SIZE(molecule_kind_set)
685
686 DO imolecule_kind = 1, nmolecule_kind
687 associate(molecule_kind => molecule_kind_set(imolecule_kind))
688
689 CALL get_molecule_kind(molecule_kind=molecule_kind, &
690 natom=na, &
691 nbond=ibond, &
692 nbend=ibend, &
693 nub=iub, &
694 ntorsion=itorsion, &
695 nimpr=iimpr, &
696 nopbend=iopbend, &
697 nconstraint=nc, &
698 nconstraint_fixd=nc_fixd, &
699 nfixd_restraint=nfixd_restraint, &
700 nrestraints=nrestraints_tot, &
701 nmolecule=nm)
702 IF (PRESENT(maxatom)) maxatom = max(maxatom, na)
703 IF (PRESENT(natom)) natom = natom + na*nm
704 IF (PRESENT(nbond)) nbond = nbond + ibond*nm
705 IF (PRESENT(nbend)) nbend = nbend + ibend*nm
706 IF (PRESENT(nub)) nub = nub + iub*nm
707 IF (PRESENT(ntorsion)) ntorsion = ntorsion + itorsion*nm
708 IF (PRESENT(nimpr)) nimpr = nimpr + iimpr*nm
709 IF (PRESENT(nopbend)) nopbend = nopbend + iopbend*nm
710 IF (PRESENT(nconstraint)) nconstraint = nconstraint + nc*nm + nc_fixd
711 IF (PRESENT(nconstraint_fixd)) nconstraint_fixd = nconstraint_fixd + nc_fixd
712 IF (PRESENT(nmolecule)) nmolecule = nmolecule + nm
713 IF (PRESENT(nrestraints)) nrestraints = nrestraints + nm*nrestraints_tot + nfixd_restraint
714
715 END associate
716 END DO
717
718 END SUBROUTINE get_molecule_kind_set
719
720! **************************************************************************************************
721!> \brief Set the components of a molecule kind.
722!> \param molecule_kind ...
723!> \param name ...
724!> \param mass ...
725!> \param charge ...
726!> \param kind_number ...
727!> \param molecule_list ...
728!> \param atom_list ...
729!> \param nbond ...
730!> \param bond_list ...
731!> \param nbend ...
732!> \param bend_list ...
733!> \param nub ...
734!> \param ub_list ...
735!> \param nimpr ...
736!> \param impr_list ...
737!> \param nopbend ...
738!> \param opbend_list ...
739!> \param ntorsion ...
740!> \param torsion_list ...
741!> \param fixd_list ...
742!> \param ncolv ...
743!> \param colv_list ...
744!> \param ng3x3 ...
745!> \param g3x3_list ...
746!> \param ng4x6 ...
747!> \param nfixd ...
748!> \param g4x6_list ...
749!> \param nvsite ...
750!> \param vsite_list ...
751!> \param ng3x3_restraint ...
752!> \param ng4x6_restraint ...
753!> \param nfixd_restraint ...
754!> \param nshell ...
755!> \param shell_list ...
756!> \param nvsite_restraint ...
757!> \param bond_kind_set ...
758!> \param bend_kind_set ...
759!> \param ub_kind_set ...
760!> \param torsion_kind_set ...
761!> \param impr_kind_set ...
762!> \param opbend_kind_set ...
763!> \param nelectron ...
764!> \param nsgf ...
765!> \param molname_generated ...
766!> \date 27.08.2003
767!> \author Matthias Krack
768!> \version 1.0
769! **************************************************************************************************
770 SUBROUTINE set_molecule_kind(molecule_kind, name, mass, charge, kind_number, &
771 molecule_list, atom_list, nbond, bond_list, &
772 nbend, bend_list, nub, ub_list, nimpr, impr_list, &
773 nopbend, opbend_list, ntorsion, &
774 torsion_list, fixd_list, ncolv, colv_list, ng3x3, &
775 g3x3_list, ng4x6, nfixd, g4x6_list, nvsite, &
776 vsite_list, ng3x3_restraint, ng4x6_restraint, &
777 nfixd_restraint, nshell, shell_list, &
778 nvsite_restraint, bond_kind_set, bend_kind_set, &
779 ub_kind_set, torsion_kind_set, impr_kind_set, &
780 opbend_kind_set, nelectron, nsgf, &
781 molname_generated)
782
783 TYPE(molecule_kind_type), INTENT(INOUT) :: molecule_kind
784 CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: name
785 REAL(kind=dp), OPTIONAL :: mass, charge
786 INTEGER, INTENT(IN), OPTIONAL :: kind_number
787 INTEGER, DIMENSION(:), OPTIONAL, POINTER :: molecule_list
788 TYPE(atom_type), DIMENSION(:), OPTIONAL, POINTER :: atom_list
789 INTEGER, INTENT(IN), OPTIONAL :: nbond
790 TYPE(bond_type), DIMENSION(:), OPTIONAL, POINTER :: bond_list
791 INTEGER, INTENT(IN), OPTIONAL :: nbend
792 TYPE(bend_type), DIMENSION(:), OPTIONAL, POINTER :: bend_list
793 INTEGER, INTENT(IN), OPTIONAL :: nub
794 TYPE(ub_type), DIMENSION(:), OPTIONAL, POINTER :: ub_list
795 INTEGER, INTENT(IN), OPTIONAL :: nimpr
796 TYPE(impr_type), DIMENSION(:), OPTIONAL, POINTER :: impr_list
797 INTEGER, INTENT(IN), OPTIONAL :: nopbend
798 TYPE(opbend_type), DIMENSION(:), OPTIONAL, POINTER :: opbend_list
799 INTEGER, INTENT(IN), OPTIONAL :: ntorsion
800 TYPE(torsion_type), DIMENSION(:), OPTIONAL, &
801 POINTER :: torsion_list
802 TYPE(fixd_constraint_type), DIMENSION(:), &
803 OPTIONAL, POINTER :: fixd_list
804 TYPE(colvar_counters), INTENT(IN), OPTIONAL :: ncolv
805 TYPE(colvar_constraint_type), DIMENSION(:), &
806 OPTIONAL, POINTER :: colv_list
807 INTEGER, INTENT(IN), OPTIONAL :: ng3x3
808 TYPE(g3x3_constraint_type), DIMENSION(:), &
809 OPTIONAL, POINTER :: g3x3_list
810 INTEGER, INTENT(IN), OPTIONAL :: ng4x6, nfixd
811 TYPE(g4x6_constraint_type), DIMENSION(:), &
812 OPTIONAL, POINTER :: g4x6_list
813 INTEGER, INTENT(IN), OPTIONAL :: nvsite
814 TYPE(vsite_constraint_type), DIMENSION(:), &
815 OPTIONAL, POINTER :: vsite_list
816 INTEGER, INTENT(IN), OPTIONAL :: ng3x3_restraint, ng4x6_restraint, &
817 nfixd_restraint, nshell
818 TYPE(shell_type), DIMENSION(:), OPTIONAL, POINTER :: shell_list
819 INTEGER, INTENT(IN), OPTIONAL :: nvsite_restraint
820 TYPE(bond_kind_type), DIMENSION(:), OPTIONAL, &
821 POINTER :: bond_kind_set
822 TYPE(bend_kind_type), DIMENSION(:), OPTIONAL, &
823 POINTER :: bend_kind_set
824 TYPE(ub_kind_type), DIMENSION(:), OPTIONAL, &
825 POINTER :: ub_kind_set
826 TYPE(torsion_kind_type), DIMENSION(:), OPTIONAL, &
827 POINTER :: torsion_kind_set
828 TYPE(impr_kind_type), DIMENSION(:), OPTIONAL, &
829 POINTER :: impr_kind_set
830 TYPE(opbend_kind_type), DIMENSION(:), OPTIONAL, &
831 POINTER :: opbend_kind_set
832 INTEGER, INTENT(IN), OPTIONAL :: nelectron, nsgf
833 LOGICAL, INTENT(IN), OPTIONAL :: molname_generated
834
835 INTEGER :: n
836
837 IF (PRESENT(atom_list)) THEN
838 n = SIZE(atom_list)
839 molecule_kind%natom = n
840 molecule_kind%atom_list => atom_list
841 END IF
842 IF (PRESENT(molname_generated)) molecule_kind%molname_generated = molname_generated
843 IF (PRESENT(name)) molecule_kind%name = name
844 IF (PRESENT(mass)) molecule_kind%mass = mass
845 IF (PRESENT(charge)) molecule_kind%charge = charge
846 IF (PRESENT(kind_number)) molecule_kind%kind_number = kind_number
847 IF (PRESENT(nbond)) molecule_kind%nbond = nbond
848 IF (PRESENT(bond_list)) molecule_kind%bond_list => bond_list
849 IF (PRESENT(nbend)) molecule_kind%nbend = nbend
850 IF (PRESENT(nelectron)) molecule_kind%nelectron = nelectron
851 IF (PRESENT(nsgf)) molecule_kind%nsgf = nsgf
852 IF (PRESENT(bend_list)) molecule_kind%bend_list => bend_list
853 IF (PRESENT(nub)) molecule_kind%nub = nub
854 IF (PRESENT(ub_list)) molecule_kind%ub_list => ub_list
855 IF (PRESENT(ntorsion)) molecule_kind%ntorsion = ntorsion
856 IF (PRESENT(torsion_list)) molecule_kind%torsion_list => torsion_list
857 IF (PRESENT(nimpr)) molecule_kind%nimpr = nimpr
858 IF (PRESENT(impr_list)) molecule_kind%impr_list => impr_list
859 IF (PRESENT(nopbend)) molecule_kind%nopbend = nopbend
860 IF (PRESENT(opbend_list)) molecule_kind%opbend_list => opbend_list
861 IF (PRESENT(ncolv)) molecule_kind%ncolv = ncolv
862 IF (PRESENT(colv_list)) molecule_kind%colv_list => colv_list
863 IF (PRESENT(ng3x3)) molecule_kind%ng3x3 = ng3x3
864 IF (PRESENT(g3x3_list)) molecule_kind%g3x3_list => g3x3_list
865 IF (PRESENT(ng4x6)) molecule_kind%ng4x6 = ng4x6
866 IF (PRESENT(nvsite)) molecule_kind%nvsite = nvsite
867 IF (PRESENT(nfixd)) molecule_kind%nfixd = nfixd
868 IF (PRESENT(nfixd_restraint)) molecule_kind%nfixd_restraint = nfixd_restraint
869 IF (PRESENT(ng3x3_restraint)) molecule_kind%ng3x3_restraint = ng3x3_restraint
870 IF (PRESENT(ng4x6_restraint)) molecule_kind%ng4x6_restraint = ng4x6_restraint
871 IF (PRESENT(nvsite_restraint)) molecule_kind%nvsite_restraint = nvsite_restraint
872 IF (PRESENT(g4x6_list)) molecule_kind%g4x6_list => g4x6_list
873 IF (PRESENT(vsite_list)) molecule_kind%vsite_list => vsite_list
874 IF (PRESENT(fixd_list)) molecule_kind%fixd_list => fixd_list
875 IF (PRESENT(bond_kind_set)) molecule_kind%bond_kind_set => bond_kind_set
876 IF (PRESENT(bend_kind_set)) molecule_kind%bend_kind_set => bend_kind_set
877 IF (PRESENT(ub_kind_set)) molecule_kind%ub_kind_set => ub_kind_set
878 IF (PRESENT(torsion_kind_set)) molecule_kind%torsion_kind_set => torsion_kind_set
879 IF (PRESENT(impr_kind_set)) molecule_kind%impr_kind_set => impr_kind_set
880 IF (PRESENT(opbend_kind_set)) molecule_kind%opbend_kind_set => opbend_kind_set
881 IF (PRESENT(nshell)) molecule_kind%nshell = nshell
882 IF (PRESENT(shell_list)) molecule_kind%shell_list => shell_list
883 IF (PRESENT(molecule_list)) THEN
884 n = SIZE(molecule_list)
885 molecule_kind%nmolecule = n
886 molecule_kind%molecule_list => molecule_list
887 END IF
888 END SUBROUTINE set_molecule_kind
889
890! **************************************************************************************************
891!> \brief Write a molecule kind data set to the output unit.
892!> \param molecule_kind ...
893!> \param output_unit ...
894!> \date 24.09.2003
895!> \author Matthias Krack
896!> \version 1.0
897! **************************************************************************************************
898 SUBROUTINE write_molecule_kind(molecule_kind, output_unit)
899 TYPE(molecule_kind_type), INTENT(IN) :: molecule_kind
900 INTEGER, INTENT(in) :: output_unit
901
902 CHARACTER(LEN=default_string_length) :: name
903 INTEGER :: iatom, imolecule, natom, nmolecule
904 TYPE(atomic_kind_type), POINTER :: atomic_kind
905
906 IF (output_unit > 0) THEN
907 natom = SIZE(molecule_kind%atom_list)
908 nmolecule = SIZE(molecule_kind%molecule_list)
909
910 IF (natom == 1) THEN
911 atomic_kind => molecule_kind%atom_list(1)%atomic_kind
912 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name)
913 WRITE (unit=output_unit, fmt="(/,T2,I5,A,T36,A,A,T64,A)") &
914 molecule_kind%kind_number, &
915 ". Molecule kind: "//trim(molecule_kind%name), &
916 "Atomic kind name: ", trim(name)
917 WRITE (unit=output_unit, fmt="(T9,A,L1,T55,A,T75,I6)") &
918 "Automatic name: ", molecule_kind%molname_generated, &
919 "Number of molecules:", nmolecule
920 ELSE
921 WRITE (unit=output_unit, fmt="(/,T2,I5,A,T50,A,T75,I6,/,T22,A)") &
922 molecule_kind%kind_number, &
923 ". Molecule kind: "//trim(molecule_kind%name), &
924 "Number of atoms: ", natom, &
925 "Atom Atomic kind name"
926 DO iatom = 1, natom
927 atomic_kind => molecule_kind%atom_list(iatom)%atomic_kind
928 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name)
929 WRITE (unit=output_unit, fmt="(T20,I6,(7X,A18))") &
930 iatom, trim(name)
931 END DO
932 WRITE (unit=output_unit, fmt="(/,T9,A,L1)") &
933 "The name was automatically generated: ", &
934 molecule_kind%molname_generated
935 WRITE (unit=output_unit, fmt="(T9,A,I6,/,T9,A,(T30,5I10))") &
936 "Number of molecules: ", nmolecule, "Molecule list:", &
937 (molecule_kind%molecule_list(imolecule), imolecule=1, nmolecule)
938 IF (molecule_kind%nbond > 0) THEN
939 WRITE (unit=output_unit, fmt="(1X,A30,I6)") &
940 "Number of bonds: ", molecule_kind%nbond
941 END IF
942 IF (molecule_kind%nbend > 0) THEN
943 WRITE (unit=output_unit, fmt="(1X,A30,I6)") &
944 "Number of bends: ", molecule_kind%nbend
945 END IF
946 IF (molecule_kind%nub > 0) THEN
947 WRITE (unit=output_unit, fmt="(1X,A30,I6)") &
948 "Number of Urey-Bradley:", molecule_kind%nub
949 END IF
950 IF (molecule_kind%ntorsion > 0) THEN
951 WRITE (unit=output_unit, fmt="(1X,A30,I6)") &
952 "Number of torsions: ", molecule_kind%ntorsion
953 END IF
954 IF (molecule_kind%nimpr > 0) THEN
955 WRITE (unit=output_unit, fmt="(1X,A30,I6)") &
956 "Number of improper: ", molecule_kind%nimpr
957 END IF
958 IF (molecule_kind%nopbend > 0) THEN
959 WRITE (unit=output_unit, fmt="(1X,A30,I6)") &
960 "Number of out opbends: ", molecule_kind%nopbend
961 END IF
962 END IF
963 END IF
964 END SUBROUTINE write_molecule_kind
965
966! **************************************************************************************************
967!> \brief Write a moleculeatomic kind set data set to the output unit.
968!> \param molecule_kind_set ...
969!> \param subsys_section ...
970!> \date 24.09.2003
971!> \author Matthias Krack
972!> \version 1.0
973! **************************************************************************************************
974 SUBROUTINE write_molecule_kind_set(molecule_kind_set, subsys_section)
975 TYPE(molecule_kind_type), DIMENSION(:), INTENT(IN) :: molecule_kind_set
976 TYPE(section_vals_type), INTENT(IN) :: subsys_section
977
978 CHARACTER(len=*), PARAMETER :: routinen = 'write_molecule_kind_set'
979
980 INTEGER :: handle, imolecule_kind, natom, nbend, &
981 nbond, nimpr, nmolecule, &
982 nmolecule_kind, nopbend, ntors, &
983 ntotal, nub, output_unit
984 LOGICAL :: all_single_atoms
985 TYPE(cp_logger_type), POINTER :: logger
986
987 CALL timeset(routinen, handle)
988
989 NULLIFY (logger)
990 logger => cp_get_default_logger()
991 output_unit = cp_print_key_unit_nr(logger, subsys_section, &
992 "PRINT%MOLECULES", extension=".Log")
993 IF (output_unit > 0) THEN
994 WRITE (unit=output_unit, fmt="(/,/,T2,A)") "MOLECULE KIND INFORMATION"
995
996 nmolecule_kind = SIZE(molecule_kind_set)
997
998 all_single_atoms = .true.
999 DO imolecule_kind = 1, nmolecule_kind
1000 natom = SIZE(molecule_kind_set(imolecule_kind)%atom_list)
1001 nmolecule = SIZE(molecule_kind_set(imolecule_kind)%molecule_list)
1002 IF (natom*nmolecule > 1) all_single_atoms = .false.
1003 END DO
1004
1005 IF (all_single_atoms) THEN
1006 WRITE (unit=output_unit, fmt="(/,/,T2,A)") &
1007 "All atoms are their own molecule, skipping detailed information"
1008 ELSE
1009 DO imolecule_kind = 1, nmolecule_kind
1010 CALL write_molecule_kind(molecule_kind_set(imolecule_kind), output_unit)
1011 END DO
1012 END IF
1013
1014 CALL get_molecule_kind_set(molecule_kind_set=molecule_kind_set, &
1015 nbond=nbond, &
1016 nbend=nbend, &
1017 nub=nub, &
1018 ntorsion=ntors, &
1019 nimpr=nimpr, &
1020 nopbend=nopbend)
1021 ntotal = nbond + nbend + nub + ntors + nimpr + nopbend
1022 IF (ntotal > 0) THEN
1023 WRITE (unit=output_unit, fmt="(/,/,T2,A,T45,A30,I6)") &
1024 "MOLECULE KIND SET INFORMATION", &
1025 "Total Number of bonds: ", nbond
1026 WRITE (unit=output_unit, fmt="(T45,A30,I6)") &
1027 "Total Number of bends: ", nbend
1028 WRITE (unit=output_unit, fmt="(T45,A30,I6)") &
1029 "Total Number of Urey-Bradley:", nub
1030 WRITE (unit=output_unit, fmt="(T45,A30,I6)") &
1031 "Total Number of torsions: ", ntors
1032 WRITE (unit=output_unit, fmt="(T45,A30,I6)") &
1033 "Total Number of improper: ", nimpr
1034 WRITE (unit=output_unit, fmt="(T45,A30,I6)") &
1035 "Total Number of opbends: ", nopbend
1036 END IF
1037 END IF
1038 CALL cp_print_key_finished_output(output_unit, logger, subsys_section, &
1039 "PRINT%MOLECULES")
1040
1041 CALL timestop(handle)
1042
1043 END SUBROUTINE write_molecule_kind_set
1044
1045! **************************************************************************************************
1046!> \brief Write collective variable constraint information to output unit
1047!> \param colvar_constraint Data set of the collective variable constraint
1048!> \param icolv Collective variable number (index)
1049!> \param iw Logical unit number of the output unit
1050!> \author Matthias Krack (25.11.2025)
1051! **************************************************************************************************
1052 SUBROUTINE write_colvar_constraint(colvar_constraint, icolv, iw)
1053
1054 TYPE(colvar_constraint_type), INTENT(IN), POINTER :: colvar_constraint
1055 INTEGER, INTENT(IN) :: icolv, iw
1056
1057 CHARACTER(LEN=30) :: type_string
1058
1059 IF (iw > 0) THEN
1060 cpassert(ASSOCIATED(colvar_constraint))
1061 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1062 "COLVAR| Number", icolv
1063 SELECT CASE (colvar_constraint%type_id)
1064 CASE (no_colvar_id)
1065 type_string = "Undefined"
1066 CASE (dist_colvar_id)
1067 type_string = "Distance"
1068 CASE (coord_colvar_id)
1069 type_string = "Coordination number"
1070 CASE (torsion_colvar_id)
1071 type_string = "Torsion"
1072 CASE (angle_colvar_id)
1073 type_string = "Angle"
1074 CASE (plane_distance_colvar_id)
1075 type_string = "Plane distance"
1076 CASE (rotation_colvar_id)
1077 type_string = "Rotation"
1078 CASE (dfunct_colvar_id)
1079 type_string = "Distance function"
1080 CASE (qparm_colvar_id)
1081 type_string = "Q parameter"
1082 CASE (hydronium_shell_colvar_id)
1083 type_string = "Hydronium shell"
1084 CASE (reaction_path_colvar_id)
1085 type_string = "Reaction path"
1086 CASE (combine_colvar_id)
1087 type_string = "Combine"
1088 CASE (population_colvar_id)
1089 type_string = "Population"
1090 CASE (plane_plane_angle_colvar_id)
1091 type_string = "Angle plane-plane"
1092 CASE (gyration_colvar_id)
1093 type_string = "Gyration radius"
1094 CASE (rmsd_colvar_id)
1095 type_string = "RMSD"
1096 CASE (distance_from_path_colvar_id)
1097 type_string = "Distance from path"
1098 CASE (xyz_diag_colvar_id)
1099 type_string = "XYZ diag"
1100 CASE (xyz_outerdiag_colvar_id)
1101 type_string = "XYZ outerdiag"
1102 CASE (u_colvar_id)
1103 type_string = "U"
1104 CASE (wc_colvar_id)
1105 type_string = "WC"
1106 CASE (hbp_colvar_id)
1107 type_string = "HBP"
1108 CASE (ring_puckering_colvar_id)
1109 type_string = "Ring puckering"
1110 CASE (mindist_colvar_id)
1111 type_string = "Distance point-plane"
1112 CASE (acid_hyd_dist_colvar_id)
1113 type_string = "Acid hydronium distance"
1114 CASE (acid_hyd_shell_colvar_id)
1115 type_string = "Acid hydronium shell"
1116 CASE (hydronium_dist_colvar_id)
1117 type_string = "Hydronium distance"
1118 CASE DEFAULT
1119 cpabort("Invalid collective variable ID specified. Check the code!")
1120 END SELECT
1121 IF (colvar_constraint%restraint%active) THEN
1122 WRITE (unit=iw, fmt="(T2,A,T51,A30)") &
1123 "COLVAR| Restraint type", adjustr(trim(type_string))
1124 WRITE (unit=iw, fmt="(T2,A,T66,ES15.6)") &
1125 "COLVAR| Restraint constant k [a.u.]", colvar_constraint%restraint%k0
1126 ELSE
1127 WRITE (unit=iw, fmt="(T2,A,T51,A30)") &
1128 "COLVAR| Constraint type", adjustr(trim(type_string))
1129 END IF
1130 WRITE (unit=iw, fmt="(T2,A,T66,ES15.6)") &
1131 "COLVAR| Target value", colvar_constraint%expected_value, &
1132 "COLVAR| Target value growth speed", colvar_constraint%expected_value_growth_speed
1133 IF (colvar_constraint%use_points) THEN
1134 WRITE (unit=iw, fmt="(T2,A,T78,A3)") "COLVAR| Use points", "Yes"
1135 ELSE
1136 WRITE (unit=iw, fmt="(T2,A,T79,A2)") "COLVAR| Use points", "No"
1137 END IF
1138 END IF
1139
1140 END SUBROUTINE write_colvar_constraint
1141
1142! **************************************************************************************************
1143!> \brief Write fix atom constraint information to output unit
1144!> \param fixd_constraint Data set of the fix atom constraint
1145!> \param ifixd Fix atom constraint/restraint number (index)
1146!> \param iw Logical unit number of the output unit
1147!> \author Matthias Krack (26.11.2025)
1148! **************************************************************************************************
1149 SUBROUTINE write_fixd_constraint(fixd_constraint, ifixd, iw)
1150
1151 TYPE(fixd_constraint_type), INTENT(IN), POINTER :: fixd_constraint
1152 INTEGER, INTENT(IN) :: ifixd, iw
1153
1154 IF (iw > 0) THEN
1155 cpassert(ASSOCIATED(fixd_constraint))
1156 IF (fixd_constraint%restraint%active) THEN
1157 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1158 "FIX_ATOM| Number (restraint)", ifixd
1159 WRITE (unit=iw, fmt="(T2,A,T66,ES15.6)") &
1160 "FIX_ATOM| Restraint constant k [a.u.]", fixd_constraint%restraint%k0
1161 ELSE
1162 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1163 "FIX_ATOM| Number (constraint)", ifixd
1164 END IF
1165 WRITE (unit=iw, fmt="(T2,A,T71,I10)") &
1166 "FIX_ATOM| Atom index", fixd_constraint%fixd
1167 WRITE (unit=iw, fmt="(T2,A,T78,A3)") &
1168 "FIX_ATOM| Fixed Cartesian components", periodicity_string(fixd_constraint%itype)
1169 IF (index(periodicity_string(fixd_constraint%itype), "X") > 0) THEN
1170 WRITE (unit=iw, fmt="(T2,A,T66,F15.8)") &
1171 "FIX_ATOM| X coordinate [Angstrom]", cp_unit_from_cp2k(fixd_constraint%coord(1), "Angstrom")
1172 END IF
1173 IF (index(periodicity_string(fixd_constraint%itype), "Y") > 0) THEN
1174 WRITE (unit=iw, fmt="(T2,A,T66,F15.8)") &
1175 "FIX_ATOM| Y coordinate [Angstrom]", cp_unit_from_cp2k(fixd_constraint%coord(2), "Angstrom")
1176 END IF
1177 IF (index(periodicity_string(fixd_constraint%itype), "Z") > 0) THEN
1178 WRITE (unit=iw, fmt="(T2,A,T66,F15.8)") &
1179 "FIX_ATOM| Z coordinate [Angstrom]", cp_unit_from_cp2k(fixd_constraint%coord(3), "Angstrom")
1180 END IF
1181 END IF
1182
1183 END SUBROUTINE write_fixd_constraint
1184
1185! **************************************************************************************************
1186!> \brief Write G3x3 constraint information to output unit
1187!> \param g3x3_constraint Data set of the g3x3 constraint
1188!> \param ig3x3 G3x3 constraint/restraint number (index)
1189!> \param iw Logical unit number of the output unit
1190!> \author Matthias Krack (26.11.2025)
1191! **************************************************************************************************
1192 SUBROUTINE write_g3x3_constraint(g3x3_constraint, ig3x3, iw)
1193
1194 TYPE(g3x3_constraint_type), INTENT(IN), POINTER :: g3x3_constraint
1195 INTEGER, INTENT(IN) :: ig3x3, iw
1196
1197 IF (iw > 0) THEN
1198 cpassert(ASSOCIATED(g3x3_constraint))
1199 IF (g3x3_constraint%restraint%active) THEN
1200 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1201 "G3X3| Number (restraint)", ig3x3
1202 WRITE (unit=iw, fmt="(T2,A,T66,ES15.6)") &
1203 "G3X3| Restraint constant k [a.u.]", g3x3_constraint%restraint%k0
1204 ELSE
1205 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1206 "G3X3| Number (constraint)", ig3x3
1207 END IF
1208 WRITE (unit=iw, fmt="(T2,A,T71,I10)") &
1209 "G3X3| Atom index a", g3x3_constraint%a, &
1210 "G3X3| Atom index b", g3x3_constraint%b, &
1211 "G3X3| Atom index c", g3x3_constraint%c
1212 WRITE (unit=iw, fmt="(T2,A,T66,F15.8)") &
1213 "G3X3| Distance (a,b) [Angstrom]", cp_unit_from_cp2k(g3x3_constraint%dab, "Angstrom"), &
1214 "G3X3| Distance (a,c) [Angstrom]", cp_unit_from_cp2k(g3x3_constraint%dac, "Angstrom"), &
1215 "G3X3| Distance (b,c) [Angstrom]", cp_unit_from_cp2k(g3x3_constraint%dbc, "Angstrom")
1216 END IF
1217
1218 END SUBROUTINE write_g3x3_constraint
1219
1220! **************************************************************************************************
1221!> \brief Write G4x6 constraint information to output unit
1222!> \param g4x6_constraint Data set of the g4x6 constraint
1223!> \param ig4x6 G4x6 constraint/restraint number (index)
1224!> \param iw Logical unit number of the output unit
1225!> \author Matthias Krack (26.11.2025)
1226! **************************************************************************************************
1227 SUBROUTINE write_g4x6_constraint(g4x6_constraint, ig4x6, iw)
1228
1229 TYPE(g4x6_constraint_type), INTENT(IN), POINTER :: g4x6_constraint
1230 INTEGER, INTENT(IN) :: ig4x6, iw
1231
1232 IF (iw > 0) THEN
1233 cpassert(ASSOCIATED(g4x6_constraint))
1234 IF (g4x6_constraint%restraint%active) THEN
1235 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1236 "G4X6| Number (restraint)", ig4x6
1237 WRITE (unit=iw, fmt="(T2,A,T66,ES15.6)") &
1238 "G4X6| Restraint constant k [a.u.]", g4x6_constraint%restraint%k0
1239 ELSE
1240 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1241 "G4X6| Number (constraint)", ig4x6
1242 END IF
1243 WRITE (unit=iw, fmt="(T2,A,T71,I10)") &
1244 "G4X6| Atom index a", g4x6_constraint%a, &
1245 "G4X6| Atom index b", g4x6_constraint%b, &
1246 "G4X6| Atom index c", g4x6_constraint%c, &
1247 "G4X6| Atom index d", g4x6_constraint%d
1248 WRITE (unit=iw, fmt="(T2,A,T66,F15.8)") &
1249 "G4X6| Distance (a,b) [Angstrom]", cp_unit_from_cp2k(g4x6_constraint%dab, "Angstrom"), &
1250 "G4X6| Distance (a,c) [Angstrom]", cp_unit_from_cp2k(g4x6_constraint%dac, "Angstrom"), &
1251 "G4X6| Distance (a,d) [Angstrom]", cp_unit_from_cp2k(g4x6_constraint%dad, "Angstrom"), &
1252 "G4X6| Distance (b,c) [Angstrom]", cp_unit_from_cp2k(g4x6_constraint%dbc, "Angstrom"), &
1253 "G4X6| Distance (b,d) [Angstrom]", cp_unit_from_cp2k(g4x6_constraint%dbd, "Angstrom"), &
1254 "G4X6| Distance (c,d) [Angstrom]", cp_unit_from_cp2k(g4x6_constraint%dcd, "Angstrom")
1255 END IF
1256
1257 END SUBROUTINE write_g4x6_constraint
1258
1259! **************************************************************************************************
1260!> \brief Write virtual site constraint information to output unit
1261!> \param vsite_constraint Data set of the vsite constraint
1262!> \param ivsite Virtual site constraint/restraint number (index)
1263!> \param iw Logical unit number of the output unit
1264!> \author Matthias Krack (01.12.2025)
1265! **************************************************************************************************
1266 SUBROUTINE write_vsite_constraint(vsite_constraint, ivsite, iw)
1267
1268 TYPE(vsite_constraint_type), INTENT(IN), POINTER :: vsite_constraint
1269 INTEGER, INTENT(IN) :: ivsite, iw
1270
1271 IF (iw > 0) THEN
1272 cpassert(ASSOCIATED(vsite_constraint))
1273 IF (vsite_constraint%restraint%active) THEN
1274 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1275 "VSITE| Number (restraint)", ivsite
1276 WRITE (unit=iw, fmt="(T2,A,T66,ES15.6)") &
1277 "VSITE| Restraint constant k [a.u.]", vsite_constraint%restraint%k0
1278 ELSE
1279 WRITE (unit=iw, fmt="(/,T2,A,T71,I10)") &
1280 "VSITE| Number (constraint)", ivsite
1281 END IF
1282 WRITE (unit=iw, fmt="(T2,A,T71,I10)") &
1283 "VSITE| Atom index of virtual site", vsite_constraint%a, &
1284 "VSITE| Atom index b", vsite_constraint%b, &
1285 "VSITE| Atom index c", vsite_constraint%c, &
1286 "VSITE| Atom index d", vsite_constraint%d
1287 WRITE (unit=iw, fmt="(T2,A,T66,F15.8)") &
1288 "VSITE| Distance (b,c) [Angstrom]", cp_unit_from_cp2k(vsite_constraint%wbc, "Angstrom"), &
1289 "VSITE| Distance (d,c) [Angstrom]", cp_unit_from_cp2k(vsite_constraint%wdc, "Angstrom")
1290 END IF
1291
1292 END SUBROUTINE write_vsite_constraint
1293
1294END MODULE molecule_kind_types
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.
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
character(len=3), dimension(7), parameter, public periodicity_string
Definition cell_types.F:51
integer, parameter, public use_perd_xy
Definition cell_types.F:42
Initialize the collective variables types.
integer, parameter, public ring_puckering_colvar_id
integer, parameter, public population_colvar_id
integer, parameter, public distance_from_path_colvar_id
integer, parameter, public rmsd_colvar_id
integer, parameter, public mindist_colvar_id
integer, parameter, public wc_colvar_id
integer, parameter, public acid_hyd_dist_colvar_id
integer, parameter, public xyz_outerdiag_colvar_id
integer, parameter, public plane_plane_angle_colvar_id
integer, parameter, public plane_distance_colvar_id
integer, parameter, public combine_colvar_id
integer, parameter, public gyration_colvar_id
integer, parameter, public hbp_colvar_id
integer, parameter, public rotation_colvar_id
integer, parameter, public hydronium_dist_colvar_id
integer, parameter, public coord_colvar_id
integer, parameter, public dfunct_colvar_id
integer, parameter, public no_colvar_id
integer, parameter, public angle_colvar_id
integer, parameter, public qparm_colvar_id
integer, parameter, public dist_colvar_id
integer, parameter, public u_colvar_id
integer, parameter, public hydronium_shell_colvar_id
integer, parameter, public torsion_colvar_id
integer, parameter, public xyz_diag_colvar_id
integer, parameter, public reaction_path_colvar_id
integer, parameter, public acid_hyd_shell_colvar_id
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,...
unit conversion facility
Definition cp_units.F:30
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Definition cp_units.F:1251
Define all structure types related to force field kinds.
integer, parameter, public do_ff_undef
pure subroutine, public torsion_kind_dealloc_ref(torsion_kind)
Deallocate a torsion kind element.
pure subroutine, public ub_kind_dealloc_ref(ub_kind_set)
Deallocate a ub kind set.
pure subroutine, public impr_kind_dealloc_ref()
Deallocate a impr kind element.
objects that represent the structure of input sections and the data contained in an input section
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
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 write_g4x6_constraint(g4x6_constraint, ig4x6, iw)
Write G4x6 constraint information to output unit.
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.
subroutine, public deallocate_molecule_kind_set(molecule_kind_set)
Deallocate a molecule kind set.
subroutine, public get_molecule_kind_set(molecule_kind_set, maxatom, natom, nbond, nbend, nub, ntorsion, nimpr, nopbend, nconstraint, nconstraint_fixd, nmolecule, nrestraints)
Get informations about a molecule kind set.
subroutine, public write_g3x3_constraint(g3x3_constraint, ig3x3, iw)
Write G3x3 constraint information to output unit.
subroutine, public write_molecule_kind_set(molecule_kind_set, subsys_section)
Write a moleculeatomic kind set data set to the output unit.
subroutine, public write_fixd_constraint(fixd_constraint, ifixd, iw)
Write fix atom constraint information to output unit.
subroutine, public write_colvar_constraint(colvar_constraint, icolv, iw)
Write collective variable constraint information to output unit.
subroutine, public allocate_molecule_kind_set(molecule_kind_set, nmolecule_kind)
Allocate and initialize a molecule kind set.
subroutine, public write_vsite_constraint(vsite_constraint, ivsite, iw)
Write virtual site constraint information to output unit.
Handles all possible kinds of restraints in CP2K.
Definition restraint.F:14
Provides all information about an atomic kind.
type of a logger, at the moment it contains just a print level starting at which level it should be l...