(git:b17b328)
Loading...
Searching...
No Matches
force_fields_util.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \par History
10!> Subroutine input_torsions changed (DG) 05-Dec-2000
11!> Output formats changed (DG) 05-Dec-2000
12!> JGH (26-01-2002) : force field parameters stored in tables, not in
13!> matrices. Input changed to have parameters labeled by the position
14!> and not atom pairs (triples etc)
15!> Teo (11.2005) : Moved all information on force field pair_potential to
16!> a much lighter memory structure
17!> \author CJM
18! **************************************************************************************************
20
23 USE cell_types, ONLY: cell_type
30 USE cp_units, ONLY: cp_unit_to_cp2k
36 USE force_field_kind_types, ONLY: &
47 USE force_fields_all, ONLY: &
60 USE kinds, ONLY: default_path_length,&
62 dp
64 USE molecule_kind_types, ONLY: &
68 USE molecule_types, ONLY: get_molecule,&
74 USE string_utilities, ONLY: compress
75#include "./base/base_uses.f90"
76
77 IMPLICIT NONE
78
79 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'force_fields_util'
80
81 PRIVATE
82 PUBLIC :: force_field_pack, &
86
87CONTAINS
88
89! **************************************************************************************************
90!> \brief Pack in all the information needed for the force_field
91!> \param particle_set ...
92!> \param atomic_kind_set ...
93!> \param molecule_kind_set ...
94!> \param molecule_set ...
95!> \param ewald_env ...
96!> \param fist_nonbond_env ...
97!> \param ff_type ...
98!> \param root_section ...
99!> \param qmmm ...
100!> \param qmmm_env ...
101!> \param mm_section ...
102!> \param subsys_section ...
103!> \param shell_particle_set ...
104!> \param core_particle_set ...
105!> \param cell ...
106! **************************************************************************************************
107 SUBROUTINE force_field_pack(particle_set, atomic_kind_set, molecule_kind_set, &
108 molecule_set, ewald_env, fist_nonbond_env, ff_type, root_section, qmmm, &
109 qmmm_env, mm_section, subsys_section, shell_particle_set, core_particle_set, &
110 cell)
111
112 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
113 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
114 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
115 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
116 TYPE(ewald_environment_type), POINTER :: ewald_env
117 TYPE(fist_nonbond_env_type), POINTER :: fist_nonbond_env
118 TYPE(force_field_type), INTENT(INOUT) :: ff_type
119 TYPE(section_vals_type), POINTER :: root_section
120 LOGICAL, INTENT(IN), OPTIONAL :: qmmm
121 TYPE(qmmm_env_mm_type), OPTIONAL, POINTER :: qmmm_env
122 TYPE(section_vals_type), POINTER :: mm_section, subsys_section
123 TYPE(particle_type), DIMENSION(:), POINTER :: shell_particle_set, core_particle_set
124 TYPE(cell_type), POINTER :: cell
125
126 CHARACTER(len=*), PARAMETER :: routinen = 'force_field_pack'
127
128 CHARACTER(LEN=default_string_length), &
129 DIMENSION(:), POINTER :: ainfo
130 INTEGER :: handle, iw, iw2, iw3, iw4, output_unit
131 LOGICAL :: do_zbl, explicit, fatal, ignore_fatal, &
132 my_qmmm
133 REAL(kind=dp) :: ewald_rcut, verlet_skin
134 REAL(kind=dp), DIMENSION(:), POINTER :: charges
135 TYPE(amber_info_type), POINTER :: amb_info
136 TYPE(charmm_info_type), POINTER :: chm_info
137 TYPE(cp_logger_type), POINTER :: logger
138 TYPE(gromos_info_type), POINTER :: gro_info
139 TYPE(input_info_type), POINTER :: inp_info
140 TYPE(pair_potential_pp_type), POINTER :: potparm_nonbond, potparm_nonbond14
141 TYPE(section_vals_type), POINTER :: charges_section
142
143 CALL timeset(routinen, handle)
144 fatal = .false.
145 ignore_fatal = ff_type%ignore_missing_critical
146 NULLIFY (logger, ainfo, charges_section, charges)
147 logger => cp_get_default_logger()
148 ! Error unit
149 output_unit = cp_logger_get_default_io_unit(logger)
150
151 iw = cp_print_key_unit_nr(logger, mm_section, "PRINT%FF_INFO", &
152 extension=".mmLog")
153 iw2 = cp_print_key_unit_nr(logger, mm_section, "PRINT%FF_INFO/SPLINE_INFO", &
154 extension=".mmLog")
155 iw3 = cp_print_key_unit_nr(logger, mm_section, "PRINT%FF_INFO/SPLINE_DATA", &
156 extension=".mmLog")
157 iw4 = cp_print_key_unit_nr(logger, mm_section, "PRINT%PROGRAM_RUN_INFO", &
158 extension=".mmLog")
159 NULLIFY (potparm_nonbond14, potparm_nonbond)
160 my_qmmm = .false.
161 IF (PRESENT(qmmm) .AND. PRESENT(qmmm_env)) my_qmmm = qmmm
162 inp_info => ff_type%inp_info
163 chm_info => ff_type%chm_info
164 gro_info => ff_type%gro_info
165 amb_info => ff_type%amb_info
166 !-----------------------------------------------------------------------------
167 ! 1. Determine the number of unique bond kind and allocate bond_kind_set
168 !-----------------------------------------------------------------------------
169 CALL force_field_unique_bond(particle_set, molecule_kind_set, molecule_set, &
170 ff_type, iw)
171 !-----------------------------------------------------------------------------
172 ! 2. Determine the number of unique bend kind and allocate bend_kind_set
173 !-----------------------------------------------------------------------------
174 CALL force_field_unique_bend(particle_set, molecule_kind_set, molecule_set, &
175 ff_type, iw)
176 !-----------------------------------------------------------------------------
177 ! 3. Determine the number of unique Urey-Bradley kind and allocate ub_kind_set
178 !-----------------------------------------------------------------------------
179 CALL force_field_unique_ub(particle_set, molecule_kind_set, molecule_set, iw)
180 !-----------------------------------------------------------------------------
181 ! 4. Determine the number of unique torsion kind and allocate torsion_kind_set
182 !-----------------------------------------------------------------------------
183 CALL force_field_unique_tors(particle_set, molecule_kind_set, molecule_set, &
184 ff_type, iw)
185 !-----------------------------------------------------------------------------
186 ! 5. Determine the number of unique impr kind and allocate impr_kind_set
187 !-----------------------------------------------------------------------------
188 CALL force_field_unique_impr(particle_set, molecule_kind_set, molecule_set, &
189 ff_type, iw)
190 !-----------------------------------------------------------------------------
191 ! 6. Determine the number of unique opbend kind and allocate opbend_kind_set
192 !-----------------------------------------------------------------------------
193 CALL force_field_unique_opbend(particle_set, molecule_kind_set, molecule_set, &
194 ff_type, iw)
195 !-----------------------------------------------------------------------------
196 ! 7. Bonds
197 !-----------------------------------------------------------------------------
198 CALL force_field_pack_bond(particle_set, molecule_kind_set, molecule_set, &
199 fatal, ainfo, chm_info, inp_info, gro_info, &
200 amb_info, iw)
201 !-----------------------------------------------------------------------------
202 ! 8. Bends
203 !-----------------------------------------------------------------------------
204 CALL force_field_pack_bend(particle_set, molecule_kind_set, molecule_set, &
205 fatal, ainfo, chm_info, inp_info, gro_info, &
206 amb_info, iw)
207 ! Give information and abort if any bond or angle parameter is missing..
208 CALL release_ff_missing_par(fatal, ignore_fatal, ainfo, output_unit, iw)
209 !-----------------------------------------------------------------------------
210 ! 9. Urey-Bradley
211 !-----------------------------------------------------------------------------
212 CALL force_field_pack_ub(particle_set, molecule_kind_set, molecule_set, &
213 ainfo, chm_info, inp_info, iw)
214 !-----------------------------------------------------------------------------
215 ! 10. Torsions
216 !-----------------------------------------------------------------------------
217 CALL force_field_pack_tors(particle_set, molecule_kind_set, molecule_set, &
218 ainfo, chm_info, inp_info, gro_info, amb_info, iw)
219 !-----------------------------------------------------------------------------
220 ! 11. Impropers
221 !-----------------------------------------------------------------------------
222 CALL force_field_pack_impr(particle_set, molecule_kind_set, molecule_set, &
223 ainfo, chm_info, inp_info, gro_info, iw)
224 !-----------------------------------------------------------------------------
225 ! 12. Out of plane bends
226 !-----------------------------------------------------------------------------
227 CALL force_field_pack_opbend(particle_set, molecule_kind_set, molecule_set, &
228 ainfo, inp_info, iw)
229 ! Give information only if any Urey-Bradley, Torsion, improper or opbend is missing
230 ! continue calculation
231 CALL release_ff_missing_par(fatal, ignore_fatal, ainfo, output_unit, iw)
232
233 charges_section => section_vals_get_subs_vals(mm_section, "FORCEFIELD%CHARGES")
234 CALL section_vals_get(charges_section, explicit=explicit)
235 IF (.NOT. explicit) THEN
236 !-----------------------------------------------------------------------------
237 ! 13.a Set up atomic_kind_set()%fist_potentail%[qeff] and shell
238 ! potential parameters
239 !-----------------------------------------------------------------------------
240 CALL force_field_pack_charge(atomic_kind_set, qmmm_env, fatal, iw, iw4, &
241 ainfo, my_qmmm, inp_info)
242 ! Give information only if charge is missing and abort..
243 CALL release_ff_missing_par(fatal, ignore_fatal, ainfo, output_unit, iw)
244 ELSE
245 !-----------------------------------------------------------------------------
246 ! 13.b Setup a global array of classical charges - this avoids the packing and
247 ! allows the usage of different charges for same atomic types
248 !-----------------------------------------------------------------------------
249 CALL force_field_pack_charges(charges, charges_section, particle_set, my_qmmm, &
250 qmmm_env, inp_info, iw4)
251 END IF
252 !-----------------------------------------------------------------------------
253 ! 14. Set up the radius of the electrostatic multipole in Fist
254 !-----------------------------------------------------------------------------
255 CALL force_field_pack_radius(atomic_kind_set, iw, subsys_section)
256 !-----------------------------------------------------------------------------
257 ! 15. Set up the polarizable FF parameters
258 !-----------------------------------------------------------------------------
259 CALL force_field_pack_pol(atomic_kind_set, iw, inp_info)
260 CALL force_field_pack_damp(atomic_kind_set, iw, inp_info)
261 !-----------------------------------------------------------------------------
262 ! 16. Set up Shell potential
263 !-----------------------------------------------------------------------------
264 CALL force_field_pack_shell(particle_set, atomic_kind_set, &
265 molecule_kind_set, molecule_set, root_section, subsys_section, &
266 shell_particle_set, core_particle_set, cell, iw, inp_info)
267 IF (ff_type%do_nonbonded) THEN
268 !-----------------------------------------------------------------------------
269 ! 17. Set up potparm_nonbond14
270 !-----------------------------------------------------------------------------
271 ! Move the data from the info structures to potparm_nonbond
272 CALL force_field_pack_nonbond14(atomic_kind_set, ff_type, qmmm_env, iw, ainfo, &
273 chm_info, inp_info, gro_info, amb_info, potparm_nonbond14, ewald_env)
274 ! Give information if any 1-4 is missing.. continue calculation..
275 CALL release_ff_missing_par(fatal, ignore_fatal, ainfo, output_unit, iw)
276 ! Create the spline data
277 CALL section_vals_val_get(mm_section, "FORCEFIELD%ZBL_SCATTERING", l_val=do_zbl)
278 CALL force_field_pack_splines(atomic_kind_set, ff_type, iw2, iw3, iw4, &
279 potparm_nonbond14, do_zbl, nonbonded_type="NONBONDED14")
280 !-----------------------------------------------------------------------------
281 ! 18. Set up potparm_nonbond
282 !-----------------------------------------------------------------------------
283 ! Move the data from the info structures to potparm_nonbond
284 CALL force_field_pack_nonbond(atomic_kind_set, ff_type, qmmm_env, &
285 fatal, iw, ainfo, chm_info, inp_info, gro_info, amb_info, &
286 potparm_nonbond, ewald_env)
287 ! Give information and abort if any pair potential spline is missing..
288 CALL release_ff_missing_par(fatal, ignore_fatal, ainfo, output_unit, iw)
289 ! Create the spline data
290 CALL section_vals_val_get(mm_section, "FORCEFIELD%ZBL_SCATTERING", l_val=do_zbl)
291 CALL force_field_pack_splines(atomic_kind_set, ff_type, iw2, iw3, iw4, &
292 potparm_nonbond, do_zbl, nonbonded_type="NONBONDED")
293 END IF
294 !-----------------------------------------------------------------------------
295 ! 19. Create nonbond environment
296 !-----------------------------------------------------------------------------
297 CALL ewald_env_get(ewald_env, rcut=ewald_rcut)
298 CALL section_vals_val_get(mm_section, "NEIGHBOR_LISTS%VERLET_SKIN", &
299 r_val=verlet_skin)
300 ALLOCATE (fist_nonbond_env)
301 CALL fist_nonbond_env_create(fist_nonbond_env, atomic_kind_set, &
302 potparm_nonbond14, potparm_nonbond, ff_type%do_nonbonded, &
303 ff_type%do_electrostatics, verlet_skin, ewald_rcut, ff_type%ei_scale14, &
304 ff_type%vdw_scale14, ff_type%shift_cutoff)
305 CALL fist_nonbond_env_set(fist_nonbond_env, charges=charges)
306 ! Compute the electrostatic interaction cutoffs.
307 CALL force_field_pack_eicut(atomic_kind_set, ff_type, potparm_nonbond, &
308 ewald_env, iw)
309
310 CALL cp_print_key_finished_output(iw4, logger, mm_section, "PRINT%PROGRAM_RUN_INFO")
311 CALL cp_print_key_finished_output(iw3, logger, mm_section, "PRINT%FF_INFO/SPLINE_DATA")
312 CALL cp_print_key_finished_output(iw2, logger, mm_section, "PRINT%FF_INFO/SPLINE_INFO")
313 CALL cp_print_key_finished_output(iw, logger, mm_section, "PRINT%FF_INFO")
314
315 CALL timestop(handle)
316
317 END SUBROUTINE force_field_pack
318
319! **************************************************************************************************
320!> \brief Store informations on possible missing ForceFields parameters
321!> \param fatal ...
322!> \param ignore_fatal ...
323!> \param array ...
324!> \param output_unit ...
325!> \param iw ...
326! **************************************************************************************************
327 SUBROUTINE release_ff_missing_par(fatal, ignore_fatal, array, output_unit, iw)
328 LOGICAL, INTENT(INOUT) :: fatal, ignore_fatal
329 CHARACTER(LEN=default_string_length), &
330 DIMENSION(:), POINTER :: array
331 INTEGER, INTENT(IN) :: output_unit, iw
332
333 INTEGER :: i
334
335 IF (ASSOCIATED(array)) THEN
336 IF (output_unit > 0) THEN
337 WRITE (output_unit, *)
338 WRITE (output_unit, '(T2,"FORCEFIELD|",A)') &
339 " WARNING: A non Critical ForceField parameter is missing! CP2K GOES!", &
340 " Non critical parameters are:Urey-Bradley,Torsions,Impropers, Opbends and 1-4", &
341 " All missing parameters will not contribute to the potential energy!"
342 IF (fatal .OR. iw > 0) THEN
343 WRITE (output_unit, *)
344 DO i = 1, SIZE(array)
345 WRITE (output_unit, '(A)') array(i)
346 END DO
347 END IF
348 IF (.NOT. fatal .AND. iw < 0) THEN
349 WRITE (output_unit, '(T2,"FORCEFIELD|",A)') &
350 " Activate the print key FF_INFO to have a list of missing parameters"
351 WRITE (output_unit, *)
352 END IF
353 END IF
354 DEALLOCATE (array)
355 END IF
356 IF (fatal) THEN
357 IF (ignore_fatal) THEN
358 IF (output_unit > 0) THEN
359 WRITE (output_unit, *)
360 WRITE (output_unit, '(T2,"FORCEFIELD|",A)') &
361 " WARNING: Ignoring missing critical FF parameters! CP2K GOES!", &
362 " Critical parameters are: Bonds, Bends and Charges", &
363 " All missing parameters will not contribute to the potential energy!"
364 END IF
365 ELSE
366 cpabort("Missing critical ForceField parameters!")
367 END IF
368 END IF
369 END SUBROUTINE release_ff_missing_par
370
371! **************************************************************************************************
372!> \brief Compute the total qeff charges for each molecule kind and total system
373!> \param particle_set ...
374!> \param molecule_kind_set ...
375!> \param molecule_set ...
376!> \param mm_section ...
377!> \param charges ...
378! **************************************************************************************************
379 SUBROUTINE force_field_qeff_output(particle_set, molecule_kind_set, &
380 molecule_set, mm_section, charges)
381
382 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
383 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
384 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
385 TYPE(section_vals_type), POINTER :: mm_section
386 REAL(kind=dp), DIMENSION(:), POINTER :: charges
387
388 CHARACTER(len=*), PARAMETER :: routinen = 'force_field_qeff_output'
389
390 CHARACTER(LEN=default_string_length) :: atmname, molname
391 INTEGER :: first, handle, iatom, imol, iw, j, jatom
392 LOGICAL :: shell_active
393 REAL(kind=dp) :: mass, mass_mol, mass_sum, qeff, &
394 qeff_mol, qeff_sum
395 TYPE(atom_type), DIMENSION(:), POINTER :: atom_list
396 TYPE(atomic_kind_type), POINTER :: atomic_kind
397 TYPE(cp_logger_type), POINTER :: logger
398 TYPE(molecule_kind_type), POINTER :: molecule_kind
399 TYPE(molecule_type), POINTER :: molecule
400 TYPE(shell_kind_type), POINTER :: shell
401
402 CALL timeset(routinen, handle)
403
404 NULLIFY (logger)
405 logger => cp_get_default_logger()
406 iw = cp_print_key_unit_nr(logger, mm_section, "PRINT%FF_INFO", &
407 extension=".mmLog")
408
409 qeff = 0.0_dp
410 qeff_mol = 0.0_dp
411 qeff_sum = 0.0_dp
412 mass_sum = 0.0_dp
413 !-----------------------------------------------------------------------------
414 ! 1. Sum of [qeff,mass] for each molecule_kind
415 !-----------------------------------------------------------------------------
416 DO imol = 1, SIZE(molecule_kind_set)
417 qeff_mol = 0.0_dp
418 mass_mol = 0.0_dp
419 molecule_kind => molecule_kind_set(imol)
420
421 j = molecule_kind_set(imol)%molecule_list(1)
422 molecule => molecule_set(j)
423 CALL get_molecule(molecule=molecule, first_atom=first)
424
425 CALL get_molecule_kind(molecule_kind=molecule_kind, &
426 name=molname, atom_list=atom_list)
427 DO iatom = 1, SIZE(atom_list)
428 atomic_kind => atom_list(iatom)%atomic_kind
429 CALL get_atomic_kind(atomic_kind=atomic_kind, &
430 name=atmname, qeff=qeff, mass=mass, shell_active=shell_active, shell=shell)
431 IF (shell_active) qeff = shell%charge_core + shell%charge_shell
432 IF (ASSOCIATED(charges)) THEN
433 jatom = first - 1 + iatom
434 qeff = charges(jatom)
435 END IF
436 IF (iw > 0) WRITE (iw, *) " atom ", iatom, " ", trim(atmname), " charge = ", qeff
437 qeff_mol = qeff_mol + qeff
438 mass_mol = mass_mol + mass
439 END DO
440 CALL set_molecule_kind(molecule_kind=molecule_kind, charge=qeff_mol, mass=mass_mol)
441 IF (iw > 0) WRITE (iw, *) " Mol Kind ", trim(molname), " charge = ", qeff_mol
442 END DO
443 !-----------------------------------------------------------------------------
444 ! 2. Sum of [qeff,mass] for particle_set
445 !-----------------------------------------------------------------------------
446 DO iatom = 1, SIZE(particle_set)
447 atomic_kind => particle_set(iatom)%atomic_kind
448 CALL get_atomic_kind(atomic_kind=atomic_kind, &
449 name=atmname, qeff=qeff, mass=mass, shell_active=shell_active, shell=shell)
450 IF (shell_active) qeff = shell%charge_core + shell%charge_shell
451 IF (ASSOCIATED(charges)) THEN
452 qeff = charges(iatom)
453 END IF
454 IF (iw > 0) WRITE (iw, *) " atom ", iatom, " ", trim(atmname), &
455 " charge = ", qeff
456 qeff_sum = qeff_sum + qeff
457 mass_sum = mass_sum + mass
458 END DO
459 IF (iw > 0) WRITE (iw, '(A,F20.10)') " Total system charge = ", qeff_sum
460 IF (iw > 0) WRITE (iw, '(A,F20.10)') " Total system mass = ", mass_sum
461
462 CALL cp_print_key_finished_output(iw, logger, mm_section, &
463 "PRINT%FF_INFO")
464
465 CALL timestop(handle)
466
467 END SUBROUTINE force_field_qeff_output
468
469! **************************************************************************************************
470!> \brief Removes UNSET force field types
471!> \param molecule_kind_set ...
472!> \param mm_section ...
473! **************************************************************************************************
474 SUBROUTINE clean_intra_force_kind(molecule_kind_set, mm_section)
475
476 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
477 TYPE(section_vals_type), POINTER :: mm_section
478
479 CHARACTER(len=*), PARAMETER :: routinen = 'clean_intra_force_kind'
480
481 INTEGER :: atm2_a, atm2_b, atm2_c, atm_a, atm_b, atm_c, atm_d, counter, handle, i, ibend, &
482 ibond, icolv, ig3x3, ig4x6, iimpr, ikind, iopbend, itorsion, iub, iw, j, k, nbend, nbond, &
483 newkind, ng3x3, ng4x6, nimpr, nopbend, ntorsion, nub
484 INTEGER, POINTER :: bad1(:), bad2(:)
485 LOGICAL :: unsetme, valid_kind
486 TYPE(bend_kind_type), DIMENSION(:), POINTER :: bend_kind_set, new_bend_kind_set
487 TYPE(bend_type), DIMENSION(:), POINTER :: bend_list, new_bend_list
488 TYPE(bond_kind_type), DIMENSION(:), POINTER :: bond_kind_set, new_bond_kind_set
489 TYPE(bond_type), DIMENSION(:), POINTER :: bond_list, new_bond_list
490 TYPE(colvar_constraint_type), DIMENSION(:), &
491 POINTER :: colv_list
492 TYPE(cp_logger_type), POINTER :: logger
493 TYPE(g3x3_constraint_type), DIMENSION(:), POINTER :: g3x3_list
494 TYPE(g4x6_constraint_type), DIMENSION(:), POINTER :: g4x6_list
495 TYPE(impr_kind_type), DIMENSION(:), POINTER :: impr_kind_set, new_impr_kind_set
496 TYPE(impr_type), DIMENSION(:), POINTER :: impr_list, new_impr_list
497 TYPE(molecule_kind_type), POINTER :: molecule_kind
498 TYPE(opbend_kind_type), DIMENSION(:), POINTER :: new_opbend_kind_set, opbend_kind_set
499 TYPE(opbend_type), DIMENSION(:), POINTER :: new_opbend_list, opbend_list
500 TYPE(torsion_kind_type), DIMENSION(:), POINTER :: new_torsion_kind_set, torsion_kind_set
501 TYPE(torsion_type), DIMENSION(:), POINTER :: new_torsion_list, torsion_list
502 TYPE(ub_kind_type), DIMENSION(:), POINTER :: new_ub_kind_set, ub_kind_set
503 TYPE(ub_type), DIMENSION(:), POINTER :: new_ub_list, ub_list
504
505 CALL timeset(routinen, handle)
506 NULLIFY (logger)
507 logger => cp_get_default_logger()
508 iw = cp_print_key_unit_nr(logger, mm_section, "PRINT%FF_INFO", &
509 extension=".mmLog")
510 !-----------------------------------------------------------------------------
511 ! 1. Lets Tag the unwanted bonds due to the use of distance constraint
512 !-----------------------------------------------------------------------------
513 DO ikind = 1, SIZE(molecule_kind_set)
514 molecule_kind => molecule_kind_set(ikind)
515 CALL get_molecule_kind(molecule_kind=molecule_kind, &
516 colv_list=colv_list, &
517 nbond=nbond, &
518 bond_list=bond_list)
519 IF (ASSOCIATED(colv_list)) THEN
520 DO icolv = 1, SIZE(colv_list)
521 IF ((colv_list(icolv)%type_id == dist_colvar_id) .AND. &
522 ((.NOT. colv_list(icolv)%use_points) .OR. (SIZE(colv_list(icolv)%i_atoms) == 2))) THEN
523 atm_a = colv_list(icolv)%i_atoms(1)
524 atm_b = colv_list(icolv)%i_atoms(2)
525 DO ibond = 1, nbond
526 unsetme = .false.
527 atm2_a = bond_list(ibond)%a
528 atm2_b = bond_list(ibond)%b
529 IF (atm2_a == atm_a .AND. atm2_b == atm_b) unsetme = .true.
530 IF (atm2_a == atm_b .AND. atm2_b == atm_a) unsetme = .true.
531 IF (unsetme) bond_list(ibond)%id_type = do_ff_undef
532 END DO
533 END IF
534 END DO
535 END IF
536 END DO
537 !-----------------------------------------------------------------------------
538 ! 2. Lets Tag the unwanted bends due to the use of distance constraint
539 !-----------------------------------------------------------------------------
540 DO ikind = 1, SIZE(molecule_kind_set)
541 molecule_kind => molecule_kind_set(ikind)
542 CALL get_molecule_kind(molecule_kind=molecule_kind, &
543 colv_list=colv_list, &
544 nbend=nbend, &
545 bend_list=bend_list)
546 IF (ASSOCIATED(colv_list)) THEN
547 DO ibend = 1, nbend
548 unsetme = .false.
549 atm_a = bend_list(ibend)%a
550 atm_b = bend_list(ibend)%b
551 atm_c = bend_list(ibend)%c
552 DO icolv = 1, SIZE(colv_list)
553 IF ((colv_list(icolv)%type_id == dist_colvar_id) .AND. &
554 ((.NOT. colv_list(icolv)%use_points) .OR. (SIZE(colv_list(icolv)%i_atoms) == 2))) THEN
555 atm2_a = colv_list(icolv)%i_atoms(1)
556 atm2_b = colv_list(icolv)%i_atoms(2)
557 ! Check that the bonds we're constraining does not involve atoms defining
558 ! a bend..
559 IF (((atm2_a == atm_a) .AND. (atm2_b == atm_c)) .OR. &
560 ((atm2_a == atm_c) .AND. (atm2_b == atm_a))) THEN
561 unsetme = .true.
562 EXIT
563 END IF
564 END IF
565 END DO
566 IF (unsetme) bend_list(ibend)%id_type = do_ff_undef
567 END DO
568 END IF
569 END DO
570 !-----------------------------------------------------------------------------
571 ! 3. Lets Tag the unwanted bonds due to the use of 3x3
572 !-----------------------------------------------------------------------------
573 DO ikind = 1, SIZE(molecule_kind_set)
574 molecule_kind => molecule_kind_set(ikind)
575 CALL get_molecule_kind(molecule_kind=molecule_kind, &
576 ng3x3=ng3x3, &
577 g3x3_list=g3x3_list, &
578 nbond=nbond, &
579 bond_list=bond_list)
580 DO ig3x3 = 1, ng3x3
581 atm_a = g3x3_list(ig3x3)%a
582 atm_b = g3x3_list(ig3x3)%b
583 atm_c = g3x3_list(ig3x3)%c
584 DO ibond = 1, nbond
585 unsetme = .false.
586 atm2_a = bond_list(ibond)%a
587 atm2_b = bond_list(ibond)%b
588 IF (atm2_a == atm_a .AND. atm2_b == atm_b) unsetme = .true.
589 IF (atm2_a == atm_a .AND. atm2_b == atm_c) unsetme = .true.
590 IF (atm2_a == atm_c .AND. atm2_b == atm_c) unsetme = .true.
591 IF (unsetme) bond_list(ibond)%id_type = do_ff_undef
592 END DO
593 END DO
594 END DO
595 !-----------------------------------------------------------------------------
596 ! 4. Lets Tag the unwanted bends due to the use of 3x3
597 !-----------------------------------------------------------------------------
598 DO ikind = 1, SIZE(molecule_kind_set)
599 molecule_kind => molecule_kind_set(ikind)
600 CALL get_molecule_kind(molecule_kind=molecule_kind, &
601 ng3x3=ng3x3, &
602 g3x3_list=g3x3_list, &
603 nbend=nbend, &
604 bend_list=bend_list)
605 DO ig3x3 = 1, ng3x3
606 atm_a = g3x3_list(ig3x3)%a
607 atm_b = g3x3_list(ig3x3)%b
608 atm_c = g3x3_list(ig3x3)%c
609 DO ibend = 1, nbend
610 unsetme = .false.
611 atm2_a = bend_list(ibend)%a
612 atm2_b = bend_list(ibend)%b
613 atm2_c = bend_list(ibend)%c
614 IF (atm2_a == atm_a .AND. atm2_b == atm_b .AND. atm2_c == atm_c) unsetme = .true.
615 IF (atm2_a == atm_a .AND. atm2_b == atm_c .AND. atm2_c == atm_b) unsetme = .true.
616 IF (atm2_a == atm_b .AND. atm2_b == atm_a .AND. atm2_c == atm_c) unsetme = .true.
617 IF (atm2_a == atm_b .AND. atm2_b == atm_c .AND. atm2_c == atm_a) unsetme = .true.
618 IF (unsetme) bend_list(ibend)%id_type = do_ff_undef
619 END DO
620 END DO
621 END DO
622 !-----------------------------------------------------------------------------
623 ! 5. Lets Tag the unwanted bonds due to the use of 4x6
624 !-----------------------------------------------------------------------------
625 DO ikind = 1, SIZE(molecule_kind_set)
626 molecule_kind => molecule_kind_set(ikind)
627 CALL get_molecule_kind(molecule_kind=molecule_kind, &
628 ng4x6=ng4x6, &
629 g4x6_list=g4x6_list, &
630 nbond=nbond, &
631 bond_list=bond_list)
632 DO ig4x6 = 1, ng4x6
633 atm_a = g4x6_list(ig4x6)%a
634 atm_b = g4x6_list(ig4x6)%b
635 atm_c = g4x6_list(ig4x6)%c
636 atm_d = g4x6_list(ig4x6)%d
637 DO ibond = 1, nbond
638 unsetme = .false.
639 atm2_a = bond_list(ibond)%a
640 atm2_b = bond_list(ibond)%b
641 IF (atm2_a == atm_a .AND. atm2_b == atm_b) unsetme = .true.
642 IF (atm2_a == atm_a .AND. atm2_b == atm_c) unsetme = .true.
643 IF (atm2_a == atm_a .AND. atm2_b == atm_d) unsetme = .true.
644 IF (unsetme) bond_list(ibond)%id_type = do_ff_undef
645 END DO
646 END DO
647 END DO
648 !-----------------------------------------------------------------------------
649 ! 6. Lets Tag the unwanted bends due to the use of 4x6
650 !-----------------------------------------------------------------------------
651 DO ikind = 1, SIZE(molecule_kind_set)
652 molecule_kind => molecule_kind_set(ikind)
653 CALL get_molecule_kind(molecule_kind=molecule_kind, &
654 ng4x6=ng4x6, &
655 g4x6_list=g4x6_list, &
656 nbend=nbend, &
657 bend_list=bend_list)
658 DO ig4x6 = 1, ng4x6
659 atm_a = g4x6_list(ig4x6)%a
660 atm_b = g4x6_list(ig4x6)%b
661 atm_c = g4x6_list(ig4x6)%c
662 atm_d = g4x6_list(ig4x6)%d
663 DO ibend = 1, nbend
664 unsetme = .false.
665 atm2_a = bend_list(ibend)%a
666 atm2_b = bend_list(ibend)%b
667 atm2_c = bend_list(ibend)%c
668 IF (atm2_a == atm_b .AND. atm2_b == atm_a .AND. atm2_c == atm_c) unsetme = .true.
669 IF (atm2_a == atm_b .AND. atm2_b == atm_a .AND. atm2_c == atm_d) unsetme = .true.
670 IF (atm2_a == atm_c .AND. atm2_b == atm_a .AND. atm2_c == atm_d) unsetme = .true.
671 IF (unsetme) bend_list(ibend)%id_type = do_ff_undef
672 END DO
673 END DO
674 END DO
675 !-----------------------------------------------------------------------------
676 ! 7. Count the number of UNSET bond kinds there are
677 !-----------------------------------------------------------------------------
678 DO ikind = 1, SIZE(molecule_kind_set)
679 molecule_kind => molecule_kind_set(ikind)
680 CALL get_molecule_kind(molecule_kind=molecule_kind, &
681 nbond=nbond, &
682 bond_kind_set=bond_kind_set, &
683 bond_list=bond_list)
684 IF (nbond > 0) THEN
685 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") Old BOND Count: ", &
686 SIZE(bond_list), SIZE(bond_kind_set)
687 IF (iw > 0) WRITE (iw, '(2I6)') (bond_list(ibond)%a, bond_list(ibond)%b, ibond=1, SIZE(bond_list))
688 NULLIFY (bad1, bad2)
689 ALLOCATE (bad1(SIZE(bond_kind_set)))
690 bad1(:) = 0
691 DO ibond = 1, SIZE(bond_kind_set)
692 unsetme = .false.
693 IF (bond_kind_set(ibond)%id_type == do_ff_undef) unsetme = .true.
694 valid_kind = .false.
695 DO i = 1, SIZE(bond_list)
696 IF (bond_list(i)%id_type /= do_ff_undef .AND. &
697 bond_list(i)%bond_kind%kind_number == ibond) THEN
698 valid_kind = .true.
699 EXIT
700 END IF
701 END DO
702 IF (.NOT. valid_kind) unsetme = .true.
703 IF (unsetme) bad1(ibond) = 1
704 END DO
705 IF (sum(bad1) /= 0) THEN
706 counter = SIZE(bond_kind_set) - sum(bad1)
707 CALL allocate_bond_kind_set(new_bond_kind_set, counter)
708 counter = 0
709 DO ibond = 1, SIZE(bond_kind_set)
710 IF (bad1(ibond) == 0) THEN
711 counter = counter + 1
712 new_bond_kind_set(counter) = bond_kind_set(ibond)
713 END IF
714 END DO
715 counter = 0
716 ALLOCATE (bad2(SIZE(bond_list)))
717 bad2(:) = 0
718 DO ibond = 1, SIZE(bond_list)
719 unsetme = .false.
720 IF (bond_list(ibond)%bond_kind%id_type == do_ff_undef) unsetme = .true.
721 IF (bond_list(ibond)%id_type == do_ff_undef) unsetme = .true.
722 IF (unsetme) bad2(ibond) = 1
723 END DO
724 IF (sum(bad2) /= 0) THEN
725 counter = SIZE(bond_list) - sum(bad2)
726 ALLOCATE (new_bond_list(counter))
727 counter = 0
728 DO ibond = 1, SIZE(bond_list)
729 IF (bad2(ibond) == 0) THEN
730 counter = counter + 1
731 new_bond_list(counter) = bond_list(ibond)
732 newkind = bond_list(ibond)%bond_kind%kind_number
733 newkind = newkind - sum(bad1(1:newkind))
734 new_bond_list(counter)%bond_kind => new_bond_kind_set(newkind)
735 END IF
736 END DO
737 CALL set_molecule_kind(molecule_kind=molecule_kind, &
738 nbond=SIZE(new_bond_list), &
739 bond_kind_set=new_bond_kind_set, &
740 bond_list=new_bond_list)
741 DO ibond = 1, SIZE(new_bond_kind_set)
742 new_bond_kind_set(ibond)%kind_number = ibond
743 END DO
744 END IF
745 DEALLOCATE (bad2)
746 CALL deallocate_bond_kind_set(bond_kind_set)
747 DEALLOCATE (bond_list)
748 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") New BOND Count: ", &
749 SIZE(new_bond_list), SIZE(new_bond_kind_set)
750 IF (iw > 0) WRITE (iw, '(2I6)') (new_bond_list(ibond)%a, new_bond_list(ibond)%b, &
751 ibond=1, SIZE(new_bond_list))
752 END IF
753 DEALLOCATE (bad1)
754 END IF
755 END DO
756 !-----------------------------------------------------------------------------
757 ! 8. Count the number of UNSET bend kinds there are
758 !-----------------------------------------------------------------------------
759 DO ikind = 1, SIZE(molecule_kind_set)
760 molecule_kind => molecule_kind_set(ikind)
761 CALL get_molecule_kind(molecule_kind=molecule_kind, &
762 nbend=nbend, &
763 bend_kind_set=bend_kind_set, &
764 bend_list=bend_list)
765 IF (nbend > 0) THEN
766 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") Old BEND Count: ", &
767 SIZE(bend_list), SIZE(bend_kind_set)
768 IF (iw > 0) WRITE (iw, '(3I6)') (bend_list(ibend)%a, bend_list(ibend)%b, &
769 bend_list(ibend)%c, ibend=1, SIZE(bend_list))
770 NULLIFY (bad1, bad2)
771 ALLOCATE (bad1(SIZE(bend_kind_set)))
772 bad1(:) = 0
773 DO ibend = 1, SIZE(bend_kind_set)
774 unsetme = .false.
775 IF (bend_kind_set(ibend)%id_type == do_ff_undef) unsetme = .true.
776 valid_kind = .false.
777 DO i = 1, SIZE(bend_list)
778 IF (bend_list(i)%id_type /= do_ff_undef .AND. &
779 bend_list(i)%bend_kind%kind_number == ibend) THEN
780 valid_kind = .true.
781 EXIT
782 END IF
783 END DO
784 IF (.NOT. valid_kind) unsetme = .true.
785 IF (unsetme) bad1(ibend) = 1
786 END DO
787 IF (sum(bad1) /= 0) THEN
788 counter = SIZE(bend_kind_set) - sum(bad1)
789 CALL allocate_bend_kind_set(new_bend_kind_set, counter)
790 counter = 0
791 DO ibend = 1, SIZE(bend_kind_set)
792 IF (bad1(ibend) == 0) THEN
793 counter = counter + 1
794 new_bend_kind_set(counter) = bend_kind_set(ibend)
795 END IF
796 END DO
797 counter = 0
798 ALLOCATE (bad2(SIZE(bend_list)))
799 bad2(:) = 0
800 DO ibend = 1, SIZE(bend_list)
801 unsetme = .false.
802 IF (bend_list(ibend)%bend_kind%id_type == do_ff_undef) unsetme = .true.
803 IF (bend_list(ibend)%id_type == do_ff_undef) unsetme = .true.
804 IF (unsetme) bad2(ibend) = 1
805 END DO
806 IF (sum(bad2) /= 0) THEN
807 counter = SIZE(bend_list) - sum(bad2)
808 ALLOCATE (new_bend_list(counter))
809 counter = 0
810 DO ibend = 1, SIZE(bend_list)
811 IF (bad2(ibend) == 0) THEN
812 counter = counter + 1
813 new_bend_list(counter) = bend_list(ibend)
814 newkind = bend_list(ibend)%bend_kind%kind_number
815 newkind = newkind - sum(bad1(1:newkind))
816 new_bend_list(counter)%bend_kind => new_bend_kind_set(newkind)
817 END IF
818 END DO
819 CALL set_molecule_kind(molecule_kind=molecule_kind, &
820 nbend=SIZE(new_bend_list), &
821 bend_kind_set=new_bend_kind_set, &
822 bend_list=new_bend_list)
823 DO ibend = 1, SIZE(new_bend_kind_set)
824 new_bend_kind_set(ibend)%kind_number = ibend
825 END DO
826 END IF
827 DEALLOCATE (bad2)
828 CALL deallocate_bend_kind_set(bend_kind_set)
829 DEALLOCATE (bend_list)
830 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") New BEND Count: ", &
831 SIZE(new_bend_list), SIZE(new_bend_kind_set)
832 IF (iw > 0) WRITE (iw, '(3I6)') (new_bend_list(ibend)%a, new_bend_list(ibend)%b, &
833 new_bend_list(ibend)%c, ibend=1, SIZE(new_bend_list))
834 END IF
835 DEALLOCATE (bad1)
836 END IF
837 END DO
838 !-----------------------------------------------------------------------------
839 ! 9. Count the number of UNSET Urey-Bradley kinds there are
840 !-----------------------------------------------------------------------------
841 DO ikind = 1, SIZE(molecule_kind_set)
842 molecule_kind => molecule_kind_set(ikind)
843 CALL get_molecule_kind(molecule_kind=molecule_kind, &
844 nub=nub, &
845 ub_kind_set=ub_kind_set, &
846 ub_list=ub_list)
847 IF (nub > 0) THEN
848 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") Old UB Count: ", &
849 SIZE(ub_list), SIZE(ub_kind_set)
850 IF (iw > 0) WRITE (iw, '(3I6)') (ub_list(iub)%a, ub_list(iub)%b, &
851 ub_list(iub)%c, iub=1, SIZE(ub_list))
852 NULLIFY (bad1, bad2)
853 ALLOCATE (bad1(SIZE(ub_kind_set)))
854 bad1(:) = 0
855 DO iub = 1, SIZE(ub_kind_set)
856 unsetme = .false.
857 IF (ub_kind_set(iub)%id_type == do_ff_undef) unsetme = .true.
858 valid_kind = .false.
859 DO i = 1, SIZE(ub_list)
860 IF (ub_list(i)%id_type /= do_ff_undef .AND. &
861 ub_list(i)%ub_kind%kind_number == iub) THEN
862 valid_kind = .true.
863 EXIT
864 END IF
865 END DO
866 IF (.NOT. valid_kind) unsetme = .true.
867 IF (unsetme) bad1(iub) = 1
868 END DO
869 IF (sum(bad1) /= 0) THEN
870 counter = SIZE(ub_kind_set) - sum(bad1)
871 CALL allocate_ub_kind_set(new_ub_kind_set, counter)
872 counter = 0
873 DO iub = 1, SIZE(ub_kind_set)
874 IF (bad1(iub) == 0) THEN
875 counter = counter + 1
876 new_ub_kind_set(counter) = ub_kind_set(iub)
877 END IF
878 END DO
879 counter = 0
880 ALLOCATE (bad2(SIZE(ub_list)))
881 bad2(:) = 0
882 DO iub = 1, SIZE(ub_list)
883 unsetme = .false.
884 IF (ub_list(iub)%ub_kind%id_type == do_ff_undef) unsetme = .true.
885 IF (ub_list(iub)%id_type == do_ff_undef) unsetme = .true.
886 IF (unsetme) bad2(iub) = 1
887 END DO
888 IF (sum(bad2) /= 0) THEN
889 counter = SIZE(ub_list) - sum(bad2)
890 ALLOCATE (new_ub_list(counter))
891 counter = 0
892 DO iub = 1, SIZE(ub_list)
893 IF (bad2(iub) == 0) THEN
894 counter = counter + 1
895 new_ub_list(counter) = ub_list(iub)
896 newkind = ub_list(iub)%ub_kind%kind_number
897 newkind = newkind - sum(bad1(1:newkind))
898 new_ub_list(counter)%ub_kind => new_ub_kind_set(newkind)
899 END IF
900 END DO
901 CALL set_molecule_kind(molecule_kind=molecule_kind, &
902 nub=SIZE(new_ub_list), &
903 ub_kind_set=new_ub_kind_set, &
904 ub_list=new_ub_list)
905 DO iub = 1, SIZE(new_ub_kind_set)
906 new_ub_kind_set(iub)%kind_number = iub
907 END DO
908 END IF
909 DEALLOCATE (bad2)
910 CALL ub_kind_dealloc_ref(ub_kind_set)
911 DEALLOCATE (ub_list)
912 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") New UB Count: ", &
913 SIZE(new_ub_list), SIZE(new_ub_kind_set)
914 IF (iw > 0) WRITE (iw, '(3I6)') (new_ub_list(iub)%a, new_ub_list(iub)%b, &
915 new_ub_list(iub)%c, iub=1, SIZE(new_ub_list))
916 END IF
917 DEALLOCATE (bad1)
918 END IF
919 END DO
920 !-----------------------------------------------------------------------------
921 ! 10. Count the number of UNSET torsion kinds there are
922 !-----------------------------------------------------------------------------
923 DO ikind = 1, SIZE(molecule_kind_set)
924 molecule_kind => molecule_kind_set(ikind)
925 CALL get_molecule_kind(molecule_kind=molecule_kind, &
926 ntorsion=ntorsion, &
927 torsion_kind_set=torsion_kind_set, &
928 torsion_list=torsion_list)
929 IF (ntorsion > 0) THEN
930 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") Old TORSION Count: ", &
931 SIZE(torsion_list), SIZE(torsion_kind_set)
932 IF (iw > 0) WRITE (iw, '(4I6)') (torsion_list(itorsion)%a, torsion_list(itorsion)%b, &
933 torsion_list(itorsion)%c, torsion_list(itorsion)%d, itorsion=1, SIZE(torsion_list))
934 NULLIFY (bad1, bad2)
935 ALLOCATE (bad1(SIZE(torsion_kind_set)))
936 bad1(:) = 0
937 DO itorsion = 1, SIZE(torsion_kind_set)
938 unsetme = .false.
939 IF (torsion_kind_set(itorsion)%id_type == do_ff_undef) unsetme = .true.
940 valid_kind = .false.
941 DO i = 1, SIZE(torsion_list)
942 IF (torsion_list(i)%id_type /= do_ff_undef .AND. &
943 torsion_list(i)%torsion_kind%kind_number == itorsion) THEN
944 valid_kind = .true.
945 EXIT
946 END IF
947 END DO
948 IF (.NOT. valid_kind) unsetme = .true.
949 IF (unsetme) bad1(itorsion) = 1
950 END DO
951 IF (sum(bad1) /= 0) THEN
952 counter = SIZE(torsion_kind_set) - sum(bad1)
953 CALL allocate_torsion_kind_set(new_torsion_kind_set, counter)
954 counter = 0
955 DO itorsion = 1, SIZE(torsion_kind_set)
956 IF (bad1(itorsion) == 0) THEN
957 counter = counter + 1
958 new_torsion_kind_set(counter) = torsion_kind_set(itorsion)
959 i = SIZE(torsion_kind_set(itorsion)%m)
960 j = SIZE(torsion_kind_set(itorsion)%k)
961 k = SIZE(torsion_kind_set(itorsion)%phi0)
962 ALLOCATE (new_torsion_kind_set(counter)%m(i))
963 ALLOCATE (new_torsion_kind_set(counter)%k(i))
964 ALLOCATE (new_torsion_kind_set(counter)%phi0(i))
965 new_torsion_kind_set(counter)%m = torsion_kind_set(itorsion)%m
966 new_torsion_kind_set(counter)%k = torsion_kind_set(itorsion)%k
967 new_torsion_kind_set(counter)%phi0 = torsion_kind_set(itorsion)%phi0
968 END IF
969 END DO
970 counter = 0
971 ALLOCATE (bad2(SIZE(torsion_list)))
972 bad2(:) = 0
973 DO itorsion = 1, SIZE(torsion_list)
974 unsetme = .false.
975 IF (torsion_list(itorsion)%torsion_kind%id_type == do_ff_undef) unsetme = .true.
976 IF (torsion_list(itorsion)%id_type == do_ff_undef) unsetme = .true.
977 IF (unsetme) bad2(itorsion) = 1
978 END DO
979 IF (sum(bad2) /= 0) THEN
980 counter = SIZE(torsion_list) - sum(bad2)
981 ALLOCATE (new_torsion_list(counter))
982 counter = 0
983 DO itorsion = 1, SIZE(torsion_list)
984 IF (bad2(itorsion) == 0) THEN
985 counter = counter + 1
986 new_torsion_list(counter) = torsion_list(itorsion)
987 newkind = torsion_list(itorsion)%torsion_kind%kind_number
988 newkind = newkind - sum(bad1(1:newkind))
989 new_torsion_list(counter)%torsion_kind => new_torsion_kind_set(newkind)
990 END IF
991 END DO
992 CALL set_molecule_kind(molecule_kind=molecule_kind, &
993 ntorsion=SIZE(new_torsion_list), &
994 torsion_kind_set=new_torsion_kind_set, &
995 torsion_list=new_torsion_list)
996 DO itorsion = 1, SIZE(new_torsion_kind_set)
997 new_torsion_kind_set(itorsion)%kind_number = itorsion
998 END DO
999 END IF
1000 DEALLOCATE (bad2)
1001 DO itorsion = 1, SIZE(torsion_kind_set)
1002 CALL torsion_kind_dealloc_ref(torsion_kind_set(itorsion))
1003 END DO
1004 DEALLOCATE (torsion_kind_set)
1005 DEALLOCATE (torsion_list)
1006 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") New TORSION Count: ", &
1007 SIZE(new_torsion_list), SIZE(new_torsion_kind_set)
1008 IF (iw > 0) WRITE (iw, '(4I6)') (new_torsion_list(itorsion)%a, new_torsion_list(itorsion)%b, &
1009 new_torsion_list(itorsion)%c, new_torsion_list(itorsion)%d, itorsion=1, &
1010 SIZE(new_torsion_list))
1011 END IF
1012 DEALLOCATE (bad1)
1013 END IF
1014 END DO
1015 !-----------------------------------------------------------------------------
1016 ! 11. Count the number of UNSET improper kinds there are
1017 !-----------------------------------------------------------------------------
1018 DO ikind = 1, SIZE(molecule_kind_set)
1019 molecule_kind => molecule_kind_set(ikind)
1020 CALL get_molecule_kind(molecule_kind=molecule_kind, &
1021 nimpr=nimpr, &
1022 impr_kind_set=impr_kind_set, &
1023 impr_list=impr_list)
1024 IF (nimpr > 0) THEN
1025 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") Old IMPROPER Count: ", &
1026 SIZE(impr_list), SIZE(impr_kind_set)
1027 NULLIFY (bad1, bad2)
1028 ALLOCATE (bad1(SIZE(impr_kind_set)))
1029 bad1(:) = 0
1030 DO iimpr = 1, SIZE(impr_kind_set)
1031 unsetme = .false.
1032 IF (impr_kind_set(iimpr)%id_type == do_ff_undef) unsetme = .true.
1033 valid_kind = .false.
1034 DO i = 1, SIZE(impr_list)
1035 IF (impr_list(i)%id_type /= do_ff_undef .AND. &
1036 impr_list(i)%impr_kind%kind_number == iimpr) THEN
1037 valid_kind = .true.
1038 EXIT
1039 END IF
1040 END DO
1041 IF (.NOT. valid_kind) unsetme = .true.
1042 IF (unsetme) bad1(iimpr) = 1
1043 END DO
1044 IF (sum(bad1) /= 0) THEN
1045 counter = SIZE(impr_kind_set) - sum(bad1)
1046 CALL allocate_impr_kind_set(new_impr_kind_set, counter)
1047 counter = 0
1048 DO iimpr = 1, SIZE(impr_kind_set)
1049 IF (bad1(iimpr) == 0) THEN
1050 counter = counter + 1
1051 new_impr_kind_set(counter) = impr_kind_set(iimpr)
1052 END IF
1053 END DO
1054 counter = 0
1055 ALLOCATE (bad2(SIZE(impr_list)))
1056 bad2(:) = 0
1057 DO iimpr = 1, SIZE(impr_list)
1058 unsetme = .false.
1059 IF (impr_list(iimpr)%impr_kind%id_type == do_ff_undef) unsetme = .true.
1060 IF (impr_list(iimpr)%id_type == do_ff_undef) unsetme = .true.
1061 IF (unsetme) bad2(iimpr) = 1
1062 END DO
1063 IF (sum(bad2) /= 0) THEN
1064 counter = SIZE(impr_list) - sum(bad2)
1065 ALLOCATE (new_impr_list(counter))
1066 counter = 0
1067 DO iimpr = 1, SIZE(impr_list)
1068 IF (bad2(iimpr) == 0) THEN
1069 counter = counter + 1
1070 new_impr_list(counter) = impr_list(iimpr)
1071 newkind = impr_list(iimpr)%impr_kind%kind_number
1072 newkind = newkind - sum(bad1(1:newkind))
1073 new_impr_list(counter)%impr_kind => new_impr_kind_set(newkind)
1074 END IF
1075 END DO
1076 CALL set_molecule_kind(molecule_kind=molecule_kind, &
1077 nimpr=SIZE(new_impr_list), &
1078 impr_kind_set=new_impr_kind_set, &
1079 impr_list=new_impr_list)
1080 DO iimpr = 1, SIZE(new_impr_kind_set)
1081 new_impr_kind_set(iimpr)%kind_number = iimpr
1082 END DO
1083 END IF
1084 DEALLOCATE (bad2)
1085 DO iimpr = 1, SIZE(impr_kind_set)
1086 CALL impr_kind_dealloc_ref() !This Subroutine doesn't deallocate anything, maybe needs to be implemented
1087 END DO
1088 DEALLOCATE (impr_kind_set)
1089 DEALLOCATE (impr_list)
1090 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") New IMPROPER Count: ", &
1091 SIZE(new_impr_list), SIZE(new_impr_kind_set)
1092 END IF
1093 DEALLOCATE (bad1)
1094 END IF
1095 END DO
1096 !-----------------------------------------------------------------------------
1097 ! 11. Count the number of UNSET opbends kinds there are
1098 !-----------------------------------------------------------------------------
1099 DO ikind = 1, SIZE(molecule_kind_set)
1100 molecule_kind => molecule_kind_set(ikind)
1101 CALL get_molecule_kind(molecule_kind=molecule_kind, &
1102 nopbend=nopbend, &
1103 opbend_kind_set=opbend_kind_set, &
1104 opbend_list=opbend_list)
1105 IF (nopbend > 0) THEN
1106 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") Old OPBEND Count: ", &
1107 SIZE(opbend_list), SIZE(opbend_kind_set)
1108 NULLIFY (bad1, bad2)
1109 ALLOCATE (bad1(SIZE(opbend_kind_set)))
1110 bad1(:) = 0
1111 DO iopbend = 1, SIZE(opbend_kind_set)
1112 unsetme = .false.
1113 IF (opbend_kind_set(iopbend)%id_type == do_ff_undef) unsetme = .true.
1114 valid_kind = .false.
1115 DO i = 1, SIZE(opbend_list)
1116 IF (opbend_list(i)%id_type /= do_ff_undef .AND. &
1117 opbend_list(i)%opbend_kind%kind_number == iopbend) THEN
1118 valid_kind = .true.
1119 EXIT
1120 END IF
1121 END DO
1122 IF (.NOT. valid_kind) unsetme = .true.
1123 IF (unsetme) bad1(iopbend) = 1
1124 END DO
1125 IF (sum(bad1) /= 0) THEN
1126 counter = SIZE(opbend_kind_set) - sum(bad1)
1127 CALL allocate_opbend_kind_set(new_opbend_kind_set, counter)
1128 counter = 0
1129 DO iopbend = 1, SIZE(opbend_kind_set)
1130 IF (bad1(iopbend) == 0) THEN
1131 counter = counter + 1
1132 new_opbend_kind_set(counter) = opbend_kind_set(iopbend)
1133 END IF
1134 END DO
1135 counter = 0
1136 ALLOCATE (bad2(SIZE(opbend_list)))
1137 bad2(:) = 0
1138 DO iopbend = 1, SIZE(opbend_list)
1139 unsetme = .false.
1140 IF (opbend_list(iopbend)%opbend_kind%id_type == do_ff_undef) unsetme = .true.
1141 IF (opbend_list(iopbend)%id_type == do_ff_undef) unsetme = .true.
1142 IF (unsetme) bad2(iopbend) = 1
1143 END DO
1144 IF (sum(bad2) /= 0) THEN
1145 counter = SIZE(opbend_list) - sum(bad2)
1146 ALLOCATE (new_opbend_list(counter))
1147 counter = 0
1148 DO iopbend = 1, SIZE(opbend_list)
1149 IF (bad2(iopbend) == 0) THEN
1150 counter = counter + 1
1151 new_opbend_list(counter) = opbend_list(iopbend)
1152 newkind = opbend_list(iopbend)%opbend_kind%kind_number
1153 newkind = newkind - sum(bad1(1:newkind))
1154 new_opbend_list(counter)%opbend_kind => new_opbend_kind_set(newkind)
1155 END IF
1156 END DO
1157 CALL set_molecule_kind(molecule_kind=molecule_kind, &
1158 nopbend=SIZE(new_opbend_list), &
1159 opbend_kind_set=new_opbend_kind_set, &
1160 opbend_list=new_opbend_list)
1161 DO iopbend = 1, SIZE(new_opbend_kind_set)
1162 new_opbend_kind_set(iopbend)%kind_number = iopbend
1163 END DO
1164 END IF
1165 DEALLOCATE (bad2)
1166 DEALLOCATE (opbend_kind_set)
1167 DEALLOCATE (opbend_list)
1168 IF (iw > 0) WRITE (iw, *) " Mol(", ikind, ") New OPBEND Count: ", &
1169 SIZE(new_opbend_list), SIZE(new_opbend_kind_set)
1170 END IF
1171 DEALLOCATE (bad1)
1172 END IF
1173 END DO
1174 !---------------------------------------------------------------------------
1175 ! 12. Count the number of UNSET NONBOND14 kinds there are
1176 !- NEED TO REMOVE EXTRAS HERE - IKUO
1177 !---------------------------------------------------------------------------
1178 CALL cp_print_key_finished_output(iw, logger, mm_section, &
1179 "PRINT%FF_INFO")
1180
1181 CALL timestop(handle)
1182
1183 END SUBROUTINE clean_intra_force_kind
1184
1185! **************************************************************************************************
1186!> \brief Reads from the input structure all information for generic functions
1187!> \param gen_section ...
1188!> \param func_name ...
1189!> \param xfunction ...
1190!> \param parameters ...
1191!> \param values ...
1192!> \param var_values ...
1193!> \param size_variables ...
1194!> \param i_rep_sec ...
1195!> \param input_variables ...
1196! **************************************************************************************************
1197 SUBROUTINE get_generic_info(gen_section, func_name, xfunction, parameters, values, &
1198 var_values, size_variables, i_rep_sec, input_variables)
1199 TYPE(section_vals_type), POINTER :: gen_section
1200 CHARACTER(LEN=*), INTENT(IN) :: func_name
1201 CHARACTER(LEN=default_path_length), INTENT(OUT) :: xfunction
1202 CHARACTER(LEN=default_string_length), &
1203 DIMENSION(:), POINTER :: parameters
1204 REAL(kind=dp), DIMENSION(:), POINTER :: values
1205 REAL(kind=dp), DIMENSION(:), OPTIONAL, POINTER :: var_values
1206 INTEGER, INTENT(IN), OPTIONAL :: size_variables, i_rep_sec
1207 CHARACTER(LEN=*), DIMENSION(:), OPTIONAL :: input_variables
1208
1209 CHARACTER(LEN=default_string_length), &
1210 DIMENSION(:), POINTER :: my_par, my_par_tmp, my_units, &
1211 my_units_tmp, my_var
1212 INTEGER :: i, ind, irep, isize, j, mydim, n_par, &
1213 n_units, n_val, nblank
1214 LOGICAL :: check
1215 REAL(kind=dp), DIMENSION(:), POINTER :: my_val, my_val_tmp
1216
1217 NULLIFY (my_var, my_par, my_val, my_par_tmp, my_val_tmp)
1218 NULLIFY (my_units)
1219 NULLIFY (my_units_tmp)
1220 IF (ASSOCIATED(parameters)) THEN
1221 DEALLOCATE (parameters)
1222 END IF
1223 IF (ASSOCIATED(values)) THEN
1224 DEALLOCATE (values)
1225 END IF
1226 irep = 1
1227 IF (PRESENT(i_rep_sec)) irep = i_rep_sec
1228 mydim = 0
1229 CALL section_vals_val_get(gen_section, trim(func_name), i_rep_section=irep, c_val=xfunction)
1230 CALL compress(xfunction, full=.true.)
1231 IF (PRESENT(input_variables)) THEN
1232 ALLOCATE (my_var(SIZE(input_variables)))
1233 my_var = input_variables
1234 ELSE
1235 CALL section_vals_val_get(gen_section, "VARIABLES", i_rep_section=irep, c_vals=my_var)
1236 END IF
1237 IF (ASSOCIATED(my_var)) THEN
1238 mydim = SIZE(my_var)
1239 END IF
1240 IF (PRESENT(size_variables)) THEN
1241 cpassert(mydim == size_variables)
1242 END IF
1243 ! Check for presence of Parameters
1244 CALL section_vals_val_get(gen_section, "PARAMETERS", i_rep_section=irep, n_rep_val=n_par)
1245 CALL section_vals_val_get(gen_section, "VALUES", i_rep_section=irep, n_rep_val=n_val)
1246 check = (n_par > 0) .EQV. (n_val > 0)
1247 cpassert(check)
1248 CALL section_vals_val_get(gen_section, "UNITS", i_rep_section=irep, n_rep_val=n_units)
1249 IF (n_par > 0) THEN
1250 ! Parameters
1251 ALLOCATE (my_par(0))
1252 ALLOCATE (my_val(0))
1253 DO i = 1, n_par
1254 isize = SIZE(my_par)
1255 CALL section_vals_val_get(gen_section, "PARAMETERS", i_rep_section=irep, i_rep_val=i, c_vals=my_par_tmp)
1256 nblank = count(my_par_tmp == "")
1257 CALL reallocate(my_par, 1, isize + SIZE(my_par_tmp) - nblank)
1258 ind = 0
1259 DO j = 1, SIZE(my_par_tmp)
1260 IF (my_par_tmp(j) == "") cycle
1261 ind = ind + 1
1262 my_par(isize + ind) = my_par_tmp(j)
1263 END DO
1264 END DO
1265 DO i = 1, n_val
1266 isize = SIZE(my_val)
1267 CALL section_vals_val_get(gen_section, "VALUES", i_rep_section=irep, i_rep_val=i, r_vals=my_val_tmp)
1268 CALL reallocate(my_val, 1, isize + SIZE(my_val_tmp))
1269 my_val(isize + 1:isize + SIZE(my_val_tmp)) = my_val_tmp
1270 END DO
1271 cpassert(SIZE(my_par) == SIZE(my_val))
1272 ! Optionally read the units for each parameter value
1273 ALLOCATE (my_units(0))
1274 IF (n_units > 0) THEN
1275 DO i = 1, n_units
1276 isize = SIZE(my_units)
1277 CALL section_vals_val_get(gen_section, "UNITS", i_rep_section=irep, i_rep_val=i, c_vals=my_units_tmp)
1278 nblank = count(my_units_tmp == "")
1279 CALL reallocate(my_units, 1, isize + SIZE(my_units_tmp) - nblank)
1280 ind = 0
1281 DO j = 1, SIZE(my_units_tmp)
1282 IF (my_units_tmp(j) == "") cycle
1283 ind = ind + 1
1284 my_units(isize + ind) = my_units_tmp(j)
1285 END DO
1286 END DO
1287 cpassert(SIZE(my_units) == SIZE(my_val))
1288 END IF
1289 mydim = mydim + SIZE(my_val)
1290 IF (SIZE(my_val) == 0) THEN
1291 DEALLOCATE (my_par)
1292 DEALLOCATE (my_val)
1293 DEALLOCATE (my_units)
1294 END IF
1295 END IF
1296 ! Handle trivial case of a null function defined
1297 ALLOCATE (parameters(mydim))
1298 ALLOCATE (values(mydim))
1299 IF (mydim > 0) THEN
1300 parameters(1:SIZE(my_var)) = my_var
1301 values(1:SIZE(my_var)) = 0.0_dp
1302 IF (PRESENT(var_values)) THEN
1303 cpassert(SIZE(var_values) == SIZE(my_var))
1304 values(1:SIZE(my_var)) = var_values
1305 END IF
1306 IF (ASSOCIATED(my_val)) THEN
1307 DO i = 1, SIZE(my_val)
1308 parameters(SIZE(my_var) + i) = my_par(i)
1309 IF (n_units > 0) THEN
1310 values(SIZE(my_var) + i) = cp_unit_to_cp2k(my_val(i), trim(adjustl(my_units(i))))
1311 ELSE
1312 values(SIZE(my_var) + i) = my_val(i)
1313 END IF
1314 END DO
1315 END IF
1316 END IF
1317 IF (ASSOCIATED(my_par)) THEN
1318 DEALLOCATE (my_par)
1319 END IF
1320 IF (ASSOCIATED(my_val)) THEN
1321 DEALLOCATE (my_val)
1322 END IF
1323 IF (ASSOCIATED(my_units)) THEN
1324 DEALLOCATE (my_units)
1325 END IF
1326 IF (PRESENT(input_variables)) THEN
1327 DEALLOCATE (my_var)
1328 END IF
1329 END SUBROUTINE get_generic_info
1330
1331END MODULE force_fields_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.
Handles all functions related to the CELL.
Definition cell_types.F:15
Initialize the collective variables types.
integer, parameter, public dist_colvar_id
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Definition cp_units.F:1149
subroutine, public ewald_env_get(ewald_env, ewald_type, alpha, eps_pol, epsilon, gmax, ns_max, o_spline, group, para_env, poisson_section, precs, rcut, do_multipoles, max_multipole, do_ipol, max_ipol_iter, interaction_cutoffs, cell_hmat)
Purpose: Get the EWALD environment.
subroutine, public fist_nonbond_env_create(fist_nonbond_env, atomic_kind_set, potparm14, potparm, do_nonbonded, do_electrostatics, verlet_skin, ewald_rcut, ei_scale14, vdw_scale14, shift_cutoff)
allocates and intitializes a fist_nonbond_env
subroutine, public fist_nonbond_env_set(fist_nonbond_env, potparm14, potparm, rlist_cut, rlist_lowsq, nonbonded, aup, lup, ei_scale14, vdw_scale14, shift_cutoff, do_electrostatics, r_last_update, r_last_update_pbc, rshell_last_update_pbc, rcore_last_update_pbc, cell_last_update, num_update, last_update, counter, natom_types, long_range_correction, eam_data, quip_data, nequip_data, allegro_data, deepmd_data, ace_data, charges)
sets a fist_nonbond_env
Define all structure types related to force field kinds.
pure subroutine, public deallocate_bend_kind_set(bend_kind_set)
Deallocate a bend kind set.
integer, parameter, public do_ff_undef
pure subroutine, public allocate_impr_kind_set(impr_kind_set, nkind)
Allocate and initialize a impr kind set.
pure subroutine, public torsion_kind_dealloc_ref(torsion_kind)
Deallocate a torsion kind element.
pure subroutine, public allocate_torsion_kind_set(torsion_kind_set, nkind)
Allocate and initialize a torsion kind set.
pure subroutine, public allocate_bond_kind_set(bond_kind_set, nkind)
Allocate and initialize a bond kind set.
pure subroutine, public allocate_opbend_kind_set(opbend_kind_set, nkind)
Allocate and initialize a opbend kind set.
pure subroutine, public ub_kind_dealloc_ref(ub_kind_set)
Deallocate a ub kind set.
pure subroutine, public allocate_bend_kind_set(bend_kind_set, nkind)
Allocate and initialize a bend kind set.
pure subroutine, public deallocate_bond_kind_set(bond_kind_set)
Deallocate a bond kind set.
pure subroutine, public allocate_ub_kind_set(ub_kind_set, nkind)
Allocate and initialize a ub kind set.
pure subroutine, public impr_kind_dealloc_ref()
Deallocate a impr kind element.
Define all structures types related to force_fields.
subroutine, public force_field_unique_ub(particle_set, molecule_kind_set, molecule_set, iw)
Determine the number of unique Urey-Bradley kind and allocate ub_kind_set.
subroutine, public force_field_pack_tors(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, gro_info, amb_info, iw)
Pack in torsion information needed for the force_field.
subroutine, public force_field_unique_bond(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique bond kind and allocate bond_kind_set.
subroutine, public force_field_unique_opbend(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique opbend kind and allocate opbend_kind_set based on the present improper...
subroutine, public force_field_pack_impr(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, gro_info, iw)
Pack in impropers information needed for the force_field.
subroutine, public force_field_pack_radius(atomic_kind_set, iw, subsys_section)
Set up the radius of the electrostatic multipole in Fist.
subroutine, public force_field_pack_shell(particle_set, atomic_kind_set, molecule_kind_set, molecule_set, root_section, subsys_section, shell_particle_set, core_particle_set, cell, iw, inp_info)
Set up shell potential parameters.
subroutine, public force_field_pack_opbend(particle_set, molecule_kind_set, molecule_set, ainfo, inp_info, iw)
Pack in opbend information needed for the force_field. No loop over params for charmm,...
subroutine, public force_field_pack_charges(charges, charges_section, particle_set, my_qmmm, qmmm_env, inp_info, iw4)
Set up array of full charges.
subroutine, public force_field_pack_pol(atomic_kind_set, iw, inp_info)
Set up the polarizable FF parameters.
subroutine, public force_field_unique_bend(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique bend kind and allocate bend_kind_set.
subroutine, public force_field_unique_impr(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique impr kind and allocate impr_kind_set.
subroutine, public force_field_pack_splines(atomic_kind_set, ff_type, iw2, iw3, iw4, potparm, do_zbl, nonbonded_type)
create the pair potential spline environment
subroutine, public force_field_unique_tors(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique torsion kind and allocate torsion_kind_set.
subroutine, public force_field_pack_nonbond(atomic_kind_set, ff_type, qmmm_env, fatal, iw, ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond, ewald_env)
Assign input and potential info to potparm_nonbond.
subroutine, public force_field_pack_charge(atomic_kind_set, qmmm_env, fatal, iw, iw4, ainfo, my_qmmm, inp_info)
Set up atomic_kind_set()fist_potential%[qeff] and shell potential parameters.
subroutine, public force_field_pack_bend(particle_set, molecule_kind_set, molecule_set, fatal, ainfo, chm_info, inp_info, gro_info, amb_info, iw)
Pack in bends information needed for the force_field.
subroutine, public force_field_pack_eicut(atomic_kind_set, ff_type, potparm_nonbond, ewald_env, iw)
Compute the electrostatic interaction cutoffs.
subroutine, public force_field_pack_bond(particle_set, molecule_kind_set, molecule_set, fatal, ainfo, chm_info, inp_info, gro_info, amb_info, iw)
Pack in bonds information needed for the force_field.
subroutine, public force_field_pack_damp(atomic_kind_set, iw, inp_info)
Set up damping parameters.
subroutine, public force_field_pack_nonbond14(atomic_kind_set, ff_type, qmmm_env, iw, ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond14, ewald_env)
Assign input and potential info to potparm_nonbond14.
subroutine, public force_field_pack_ub(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, iw)
Pack in Urey-Bradley information needed for the force_field.
subroutine, public force_field_pack(particle_set, atomic_kind_set, molecule_kind_set, molecule_set, ewald_env, fist_nonbond_env, ff_type, root_section, qmmm, qmmm_env, mm_section, subsys_section, shell_particle_set, core_particle_set, cell)
Pack in all the information needed for the force_field.
subroutine, public get_generic_info(gen_section, func_name, xfunction, parameters, values, var_values, size_variables, i_rep_sec, input_variables)
Reads from the input structure all information for generic functions.
subroutine, public force_field_qeff_output(particle_set, molecule_kind_set, molecule_set, mm_section, charges)
Compute the total qeff charges for each molecule kind and total system.
subroutine, public clean_intra_force_kind(molecule_kind_set, mm_section)
Removes UNSET force field types.
objects that represent the structure of input sections and the data contained in an input section
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
integer, parameter, public default_path_length
Definition kinds.F:58
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 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.
Define the data structure for the particle information.
Utilities for string manipulations.
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
type of a logger, at the moment it contains just a print level starting at which level it should be l...