(git:27c966b)
Loading...
Searching...
No Matches
constraint_clv.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 Module that handles the COLLECTIVE constraints
10!> \par History
11!> none
12!> \author Teodoro Laino [tlaino]
13! **************************************************************************************************
15 USE cell_types, ONLY: cell_type
17 USE colvar_types, ONLY: colvar_type,&
24 USE kinds, ONLY: dp
29 USE molecule_types, ONLY: get_molecule,&
34#include "./base/base_uses.f90"
35
36 IMPLICIT NONE
37
38 PRIVATE
39 PUBLIC :: shake_roll_colv_int, &
49
50 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'constraint_clv'
51
52CONTAINS
53
54! **************************************************************************************************
55!> \brief Evaluate position or velocity residuals of local collective variables.
56!> \param molecule ...
57!> \param particle_set ...
58!> \param cell ...
59!> \param max_sigma ...
60!> \param pos ...
61!> \param vel ...
62!> \param rmat ...
63!> \param veps ...
64! **************************************************************************************************
65 SUBROUTINE check_colv_int(molecule, particle_set, cell, max_sigma, pos, vel, rmat, veps)
66 TYPE(molecule_type), POINTER :: molecule
67 TYPE(particle_type), POINTER :: particle_set(:)
68 TYPE(cell_type), POINTER :: cell
69 REAL(kind=dp), INTENT(INOUT) :: max_sigma
70 REAL(kind=dp), INTENT(IN), OPTIONAL :: pos(:, :), vel(:, :), rmat(:, :), &
71 veps(:, :)
72
73 INTEGER :: iconst
74 REAL(kind=dp) :: sigma
75 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
76 TYPE(fixd_constraint_type), POINTER :: fixd_list(:)
77 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
78 TYPE(molecule_kind_type), POINTER :: molecule_kind
79
80 molecule_kind => molecule%molecule_kind
81 CALL get_molecule_kind(molecule_kind, colv_list=colv_list, fixd_list=fixd_list)
82 CALL get_molecule(molecule, lcolv=lcolv)
83 IF (.NOT. ASSOCIATED(colv_list)) RETURN
84 cpassert(PRESENT(pos) .NEQV. PRESENT(vel))
85 DO iconst = 1, SIZE(colv_list)
86 IF (colv_list(iconst)%restraint%active) cycle
87 IF (PRESENT(pos)) THEN
88 CALL colvar_eval_mol_f(lcolv(iconst)%colvar, cell, particles=particle_set, &
89 pos=pos, fixd_list=fixd_list)
90 sigma = diff_colvar(lcolv(iconst)%colvar, colv_list(iconst)%expected_value)
91 max_sigma = max(max_sigma, abs(sigma))
92 ELSE
93 sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel, roll=PRESENT(rmat), &
94 rmat=rmat, veps=veps, particles=particle_set) - &
95 colv_list(iconst)%target_velocity
96 max_sigma = max(max_sigma, rattle_colv_residual(sigma, colv_list(iconst)))
97 END IF
98 END DO
99 END SUBROUTINE check_colv_int
100
101! **************************************************************************************************
102!> \brief Intramolecular subroutine
103!> shake_colv algorithm for collective variables constraints
104!> updates the multiplier one molecule type at a time
105!> \param molecule ...
106!> \param particle_set ...
107!> \param pos ...
108!> \param vel ...
109!> \param dt ...
110!> \param ishake ...
111!> \param cell ...
112!> \param imass ...
113!> \param max_sigma ...
114!> \par History
115!> none
116!> \author Teodoro Laino [tlaino]
117! **************************************************************************************************
118 SUBROUTINE shake_colv_int(molecule, particle_set, pos, vel, dt, ishake, &
119 cell, imass, max_sigma)
120
121 TYPE(molecule_type), POINTER :: molecule
122 TYPE(particle_type), POINTER :: particle_set(:)
123 REAL(kind=dp), INTENT(INOUT) :: pos(:, :), vel(:, :)
124 REAL(kind=dp), INTENT(in) :: dt
125 INTEGER, INTENT(IN) :: ishake
126 TYPE(cell_type), POINTER :: cell
127 REAL(kind=dp), DIMENSION(:) :: imass
128 REAL(kind=dp), INTENT(INOUT) :: max_sigma
129
130 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
131 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
132 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
133 TYPE(molecule_kind_type), POINTER :: molecule_kind
134
135 NULLIFY (fixd_list)
136 molecule_kind => molecule%molecule_kind
137 CALL get_molecule_kind(molecule_kind, colv_list=colv_list, fixd_list=fixd_list)
138 CALL get_molecule(molecule, lcolv=lcolv)
139 ! Real Shake
140 CALL shake_colv_low(fixd_list, colv_list, lcolv, &
141 particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
142
143 END SUBROUTINE shake_colv_int
144
145! **************************************************************************************************
146!> \brief Intramolecular subroutine for updating the TARGET value of collective
147!> constraints
148!> \param molecule ...
149!> \param dt ...
150!> \param motion_section ...
151!> \author Teodoro Laino [tlaino] - University of Zurich
152! **************************************************************************************************
153 SUBROUTINE shake_update_colv_int(molecule, dt, motion_section)
154
155 TYPE(molecule_type), POINTER :: molecule
156 REAL(kind=dp), INTENT(in) :: dt
157 TYPE(section_vals_type), POINTER :: motion_section
158
159 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
160 TYPE(molecule_kind_type), POINTER :: molecule_kind
161
162 molecule_kind => molecule%molecule_kind
163 CALL get_molecule_kind(molecule_kind, colv_list=colv_list)
164 ! Real update of the Shake target
165 CALL shake_update_colv_low(colv_list, dt, motion_section)
166
167 END SUBROUTINE shake_update_colv_int
168
169! **************************************************************************************************
170!> \brief Intramolecular subroutine
171!> rattle algorithm for collective variables constraints
172!> updates the multiplier one molecule type at a time
173!> \param molecule ...
174!> \param particle_set ...
175!> \param vel ...
176!> \param dt ...
177!> \param irattle ...
178!> \param cell ...
179!> \param imass ...
180!> \param max_sigma ...
181!> \par History
182!> none
183!> \author Teodoro Laino [tlaino]
184! **************************************************************************************************
185 SUBROUTINE rattle_colv_int(molecule, particle_set, vel, dt, irattle, &
186 cell, imass, max_sigma)
187
188 TYPE(molecule_type), POINTER :: molecule
189 TYPE(particle_type), POINTER :: particle_set(:)
190 REAL(kind=dp), INTENT(INOUT) :: vel(:, :)
191 REAL(kind=dp), INTENT(in) :: dt
192 INTEGER, INTENT(IN) :: irattle
193 TYPE(cell_type), POINTER :: cell
194 REAL(kind=dp), DIMENSION(:) :: imass
195 REAL(kind=dp), INTENT(INOUT) :: max_sigma
196
197 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
198 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
199 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
200 TYPE(molecule_kind_type), POINTER :: molecule_kind
201
202 NULLIFY (fixd_list)
203 molecule_kind => molecule%molecule_kind
204 CALL get_molecule_kind(molecule_kind, colv_list=colv_list, fixd_list=fixd_list)
205 CALL get_molecule(molecule, lcolv=lcolv)
206 ! Real Rattle
207 CALL rattle_colv_low(fixd_list, colv_list, lcolv, &
208 particle_set, vel, dt, irattle, cell, imass, max_sigma)
209
210 END SUBROUTINE rattle_colv_int
211
212! **************************************************************************************************
213!> \brief Intramolecular subroutine
214!> shake algorithm (box allowed to change) for collective variables constraints
215!> updates the multiplier one molecule type at a time
216!> \param molecule ...
217!> \param particle_set ...
218!> \param pos ...
219!> \param vel ...
220!> \param r_shake ...
221!> \param v_shake ...
222!> \param dt ...
223!> \param ishake ...
224!> \param cell ...
225!> \param imass ...
226!> \param max_sigma ...
227!> \par History
228!> none
229!> \author Teodoro Laino [tlaino]
230! **************************************************************************************************
231 SUBROUTINE shake_roll_colv_int(molecule, particle_set, pos, vel, r_shake, v_shake, &
232 dt, ishake, cell, imass, max_sigma)
233
234 TYPE(molecule_type), POINTER :: molecule
235 TYPE(particle_type), POINTER :: particle_set(:)
236 REAL(kind=dp), INTENT(INOUT) :: pos(:, :), vel(:, :)
237 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: r_shake, v_shake
238 REAL(kind=dp), INTENT(in) :: dt
239 INTEGER, INTENT(in) :: ishake
240 TYPE(cell_type), POINTER :: cell
241 REAL(kind=dp), DIMENSION(:) :: imass
242 REAL(kind=dp), INTENT(INOUT) :: max_sigma
243
244 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
245 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
246 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
247 TYPE(molecule_kind_type), POINTER :: molecule_kind
248
249 NULLIFY (fixd_list)
250 molecule_kind => molecule%molecule_kind
251 CALL get_molecule_kind(molecule_kind, colv_list=colv_list, fixd_list=fixd_list)
252 CALL get_molecule(molecule, lcolv=lcolv)
253 ! Real Shake
254 CALL shake_roll_colv_low(fixd_list, colv_list, lcolv, &
255 particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, &
256 imass, max_sigma)
257
258 END SUBROUTINE shake_roll_colv_int
259
260! **************************************************************************************************
261!> \brief Intramolecular subroutine
262!> rattle algorithm (box allowed to change) for collective variables constraints
263!> updates the multiplier one molecule type at a time
264!> \param molecule ...
265!> \param particle_set ...
266!> \param vel ...
267!> \param r_rattle ...
268!> \param dt ...
269!> \param irattle ...
270!> \param veps ...
271!> \param cell ...
272!> \param imass ...
273!> \param max_sigma ...
274!> \par History
275!> none
276!> \author Teodoro Laino [tlaino]
277! **************************************************************************************************
278 SUBROUTINE rattle_roll_colv_int(molecule, particle_set, vel, r_rattle, &
279 dt, irattle, veps, cell, imass, max_sigma)
280
281 TYPE(molecule_type), POINTER :: molecule
282 TYPE(particle_type), POINTER :: particle_set(:)
283 REAL(kind=dp), INTENT(INOUT) :: vel(:, :)
284 REAL(kind=dp), INTENT(IN) :: r_rattle(:, :), dt
285 INTEGER, INTENT(in) :: irattle
286 REAL(kind=dp), INTENT(IN) :: veps(:, :)
287 TYPE(cell_type), POINTER :: cell
288 REAL(kind=dp), DIMENSION(:) :: imass
289 REAL(kind=dp), INTENT(INOUT) :: max_sigma
290
291 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
292 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
293 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
294 TYPE(molecule_kind_type), POINTER :: molecule_kind
295
296 NULLIFY (fixd_list)
297 molecule_kind => molecule%molecule_kind
298 CALL get_molecule_kind(molecule_kind, colv_list=colv_list, fixd_list=fixd_list)
299 CALL get_molecule(molecule, lcolv=lcolv)
300 ! Real Rattle
301 CALL rattle_roll_colv_low(fixd_list, colv_list, lcolv, &
302 particle_set, vel, r_rattle, dt, irattle, veps, cell, &
303 imass, max_sigma)
304
305 END SUBROUTINE rattle_roll_colv_int
306
307! **************************************************************************************************
308!> \brief Intermolecular subroutine
309!> shake_colv algorithm for collective variables constraints
310!> updates the multiplier one molecule type at a time
311!> \param gci ...
312!> \param particle_set ...
313!> \param pos ...
314!> \param vel ...
315!> \param dt ...
316!> \param ishake ...
317!> \param cell ...
318!> \param imass ...
319!> \param max_sigma ...
320!> \par History
321!> none
322!> \author Teodoro Laino [tlaino]
323! **************************************************************************************************
324 SUBROUTINE shake_colv_ext(gci, particle_set, pos, vel, dt, ishake, &
325 cell, imass, max_sigma)
326
327 TYPE(global_constraint_type), POINTER :: gci
328 TYPE(particle_type), POINTER :: particle_set(:)
329 REAL(kind=dp), INTENT(INOUT) :: pos(:, :), vel(:, :)
330 REAL(kind=dp), INTENT(in) :: dt
331 INTEGER, INTENT(IN) :: ishake
332 TYPE(cell_type), POINTER :: cell
333 REAL(kind=dp), DIMENSION(:) :: imass
334 REAL(kind=dp), INTENT(INOUT) :: max_sigma
335
336 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
337 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
338 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
339
340 colv_list => gci%colv_list
341 fixd_list => gci%fixd_list
342 lcolv => gci%lcolv
343 ! Real Shake
344 CALL shake_colv_low(fixd_list, colv_list, lcolv, &
345 particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
346
347 END SUBROUTINE shake_colv_ext
348
349! **************************************************************************************************
350!> \brief Intermolecular subroutine for updating the TARGET value for collective
351!> constraints
352!> \param gci ...
353!> \param dt ...
354!> \param motion_section ...
355!> \author Teodoro Laino [tlaino]
356! **************************************************************************************************
357 SUBROUTINE shake_update_colv_ext(gci, dt, motion_section)
358
359 TYPE(global_constraint_type), POINTER :: gci
360 REAL(kind=dp), INTENT(in) :: dt
361 TYPE(section_vals_type), POINTER :: motion_section
362
363 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
364
365 colv_list => gci%colv_list
366 ! Real update of the Shake target
367 CALL shake_update_colv_low(colv_list, dt, motion_section)
368
369 END SUBROUTINE shake_update_colv_ext
370
371! **************************************************************************************************
372!> \brief Intermolecular subroutine
373!> rattle algorithm for collective variables constraints
374!> updates the multiplier one molecule type at a time
375!> \param gci ...
376!> \param particle_set ...
377!> \param vel ...
378!> \param dt ...
379!> \param irattle ...
380!> \param cell ...
381!> \param imass ...
382!> \param max_sigma ...
383!> \par History
384!> none
385!> \author Teodoro Laino [tlaino]
386! **************************************************************************************************
387 SUBROUTINE rattle_colv_ext(gci, particle_set, vel, dt, irattle, &
388 cell, imass, max_sigma)
389
390 TYPE(global_constraint_type), POINTER :: gci
391 TYPE(particle_type), POINTER :: particle_set(:)
392 REAL(kind=dp), INTENT(INOUT) :: vel(:, :)
393 REAL(kind=dp), INTENT(in) :: dt
394 INTEGER, INTENT(IN) :: irattle
395 TYPE(cell_type), POINTER :: cell
396 REAL(kind=dp), DIMENSION(:) :: imass
397 REAL(kind=dp), INTENT(INOUT) :: max_sigma
398
399 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
400 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
401 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
402
403 colv_list => gci%colv_list
404 fixd_list => gci%fixd_list
405 lcolv => gci%lcolv
406 ! Real Rattle
407 CALL rattle_colv_low(fixd_list, colv_list, lcolv, &
408 particle_set, vel, dt, irattle, cell, imass, max_sigma)
409
410 END SUBROUTINE rattle_colv_ext
411
412! **************************************************************************************************
413!> \brief Intermolecular subroutine
414!> shake algorithm (box allowed to change) for collective variables constraints
415!> updates the multiplier one molecule type at a time
416!> \param gci ...
417!> \param particle_set ...
418!> \param pos ...
419!> \param vel ...
420!> \param r_shake ...
421!> \param v_shake ...
422!> \param dt ...
423!> \param ishake ...
424!> \param cell ...
425!> \param imass ...
426!> \param max_sigma ...
427!> \par History
428!> none
429!> \author Teodoro Laino [tlaino]
430! **************************************************************************************************
431 SUBROUTINE shake_roll_colv_ext(gci, particle_set, pos, vel, r_shake, v_shake, &
432 dt, ishake, cell, imass, max_sigma)
433
434 TYPE(global_constraint_type), POINTER :: gci
435 TYPE(particle_type), POINTER :: particle_set(:)
436 REAL(kind=dp), INTENT(INOUT) :: pos(:, :), vel(:, :)
437 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: r_shake, v_shake
438 REAL(kind=dp), INTENT(in) :: dt
439 INTEGER, INTENT(in) :: ishake
440 TYPE(cell_type), POINTER :: cell
441 REAL(kind=dp), DIMENSION(:) :: imass
442 REAL(kind=dp), INTENT(INOUT) :: max_sigma
443
444 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
445 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
446 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
447
448 colv_list => gci%colv_list
449 fixd_list => gci%fixd_list
450 lcolv => gci%lcolv
451 ! Real Shake
452 CALL shake_roll_colv_low(fixd_list, colv_list, lcolv, &
453 particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, &
454 imass, max_sigma)
455
456 END SUBROUTINE shake_roll_colv_ext
457
458! **************************************************************************************************
459!> \brief Intermolecular subroutine
460!> rattle algorithm (box allowed to change) for collective variables constraints
461!> updates the multiplier one molecule type at a time
462!> \param gci ...
463!> \param particle_set ...
464!> \param vel ...
465!> \param r_rattle ...
466!> \param dt ...
467!> \param irattle ...
468!> \param veps ...
469!> \param cell ...
470!> \param imass ...
471!> \param max_sigma ...
472!> \par History
473!> none
474!> \author Teodoro Laino [tlaino]
475! **************************************************************************************************
476 SUBROUTINE rattle_roll_colv_ext(gci, particle_set, vel, r_rattle, &
477 dt, irattle, veps, cell, imass, max_sigma)
478
479 TYPE(global_constraint_type), POINTER :: gci
480 TYPE(particle_type), POINTER :: particle_set(:)
481 REAL(kind=dp), INTENT(INOUT) :: vel(:, :)
482 REAL(kind=dp), INTENT(IN) :: r_rattle(:, :), dt
483 INTEGER, INTENT(in) :: irattle
484 REAL(kind=dp), INTENT(IN) :: veps(:, :)
485 TYPE(cell_type), POINTER :: cell
486 REAL(kind=dp), DIMENSION(:) :: imass
487 REAL(kind=dp), INTENT(INOUT) :: max_sigma
488
489 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
490 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
491 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
492
493 colv_list => gci%colv_list
494 fixd_list => gci%fixd_list
495 lcolv => gci%lcolv
496 ! Real Rattle
497 CALL rattle_roll_colv_low(fixd_list, colv_list, lcolv, &
498 particle_set, vel, r_rattle, dt, irattle, veps, cell, &
499 imass, max_sigma)
500
501 END SUBROUTINE rattle_roll_colv_ext
502
503! **************************************************************************************************
504!> \brief Real Shake subroutine - Low Level
505!> shake_colv algorithm for collective variables constraints
506!> updates the multiplier one molecule type at a time
507!> \param fixd_list ...
508!> \param colv_list ...
509!> \param lcolv ...
510!> \param particle_set ...
511!> \param pos ...
512!> \param vel ...
513!> \param dt ...
514!> \param ishake ...
515!> \param cell ...
516!> \param imass ...
517!> \param max_sigma ...
518!> \par History
519!> none
520!> \author Teodoro Laino [tlaino]
521! **************************************************************************************************
522 SUBROUTINE shake_colv_low(fixd_list, colv_list, lcolv, &
523 particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
524 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
525 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
526 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
527 TYPE(particle_type), POINTER :: particle_set(:)
528 REAL(kind=dp), INTENT(INOUT) :: pos(:, :), vel(:, :)
529 REAL(kind=dp), INTENT(in) :: dt
530 INTEGER, INTENT(IN) :: ishake
531 TYPE(cell_type), POINTER :: cell
532 REAL(kind=dp), DIMENSION(:) :: imass
533 REAL(kind=dp), INTENT(INOUT) :: max_sigma
534
535 INTEGER :: iconst
536 REAL(kind=dp) :: del_lam, dtby2, dtsqby2, fdotf_sum
537
538 dtsqby2 = dt*dt*.5_dp
539 dtby2 = dt*.5_dp
540 IF (ishake == 1) THEN
541 DO iconst = 1, SIZE(colv_list)
542 IF (colv_list(iconst)%restraint%active) cycle
543 ! Update positions
544 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
545 lambda=lcolv(iconst)%lambda, &
546 imass=imass)
547 ! Update velocities
548 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
549 lambda=lcolv(iconst)%lambda, &
550 imass=imass)
551 END DO
552 ELSE
553 DO iconst = 1, SIZE(colv_list)
554 IF (colv_list(iconst)%restraint%active) cycle
555 ! Update colvar
556 CALL colvar_eval_mol_f(lcolv(iconst)%colvar, cell, particles=particle_set, &
557 pos=pos, fixd_list=fixd_list)
558 lcolv(iconst)%sigma = diff_colvar(lcolv(iconst)%colvar, &
559 colv_list(iconst)%expected_value)
560 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar, &
561 lcolv(iconst)%colvar_old, imass=imass)
562 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*dt*fdotf_sum)
563 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
564
565 ! Update positions
566 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
567 lambda=del_lam, &
568 imass=imass)
569 ! Update velocities
570 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
571 lambda=del_lam, &
572 imass=imass)
573 END DO
574 END IF
575 ! computing the constraint and value of tolerance
576 DO iconst = 1, SIZE(colv_list)
577 IF (colv_list(iconst)%restraint%active) cycle
578 CALL colvar_eval_mol_f(lcolv(iconst)%colvar, cell, particles=particle_set, &
579 pos=pos, fixd_list=fixd_list)
580 lcolv(iconst)%sigma = diff_colvar(lcolv(iconst)%colvar, &
581 colv_list(iconst)%expected_value)
582 max_sigma = max(abs(lcolv(iconst)%sigma), max_sigma)
583 END DO
584 END SUBROUTINE shake_colv_low
585
586! **************************************************************************************************
587!> \brief Real Shake subroutine - Low Level - for updating the TARGET value
588!> \param dt ...
589!> \param motion_section ...
590!> \date 02.2008
591!> \author Teodoro Laino [tlaino] - University of Zurich
592! **************************************************************************************************
593 SUBROUTINE shake_update_colv_targets(dt, motion_section)
594 REAL(kind=dp), INTENT(in) :: dt
595 TYPE(section_vals_type), POINTER :: motion_section
596
597 INTEGER :: irep, n_rep
598 LOGICAL :: do_update_colvar, explicit
599 REAL(kind=dp) :: clv_target, limit, new_clv_target, value
600 TYPE(section_vals_type), POINTER :: collective_sections
601
602! Update globally for restart
603
604 collective_sections => section_vals_get_subs_vals(motion_section, "CONSTRAINT%COLLECTIVE")
605 CALL section_vals_get(collective_sections, n_repetition=n_rep)
606 IF (n_rep /= 0) THEN
607 DO irep = 1, n_rep
608 CALL section_vals_val_get(collective_sections, "TARGET_GROWTH", r_val=value, &
609 i_rep_section=irep)
610 IF (value /= 0.0_dp) THEN
611 CALL section_vals_val_get(collective_sections, "TARGET", r_val=clv_target, &
612 i_rep_section=irep)
613 new_clv_target = clv_target + value*dt
614 ! Check limits..
615 CALL section_vals_val_get(collective_sections, "TARGET_LIMIT", explicit=explicit, &
616 i_rep_section=irep)
617 do_update_colvar = .true.
618 IF (explicit) THEN
619 CALL section_vals_val_get(collective_sections, "TARGET_LIMIT", r_val=limit, &
620 i_rep_section=irep)
621 IF (value > 0.0_dp) THEN
622 IF (clv_target == limit) THEN
623 do_update_colvar = .false.
624 ELSE IF (new_clv_target >= limit) THEN
625 new_clv_target = limit
626 END IF
627 ELSE
628 IF (clv_target == limit) THEN
629 do_update_colvar = .false.
630 ELSE IF (new_clv_target <= limit) THEN
631 new_clv_target = limit
632 END IF
633 END IF
634 END IF
635 IF (do_update_colvar) THEN
636 CALL section_vals_val_set(collective_sections, "TARGET", r_val=new_clv_target, &
637 i_rep_section=irep)
638 END IF
639 END IF
640 END DO
641 END IF
642
643 END SUBROUTINE shake_update_colv_targets
644
645! **************************************************************************************************
646!> \brief Cache the actual target rate, including a partially clamped interval.
647!> \param colv_list ...
648!> \param dt ...
649!> \param motion_section ...
650!> \param initialize ...
651! **************************************************************************************************
652 SUBROUTINE shake_update_colv_low(colv_list, dt, motion_section, initialize)
653 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
654 REAL(kind=dp), INTENT(IN) :: dt
655 TYPE(section_vals_type), POINTER :: motion_section
656 LOGICAL, INTENT(IN), OPTIONAL :: initialize
657
658 INTEGER :: iconst
659 LOGICAL :: explicit, initial
660 REAL(kind=dp) :: limit, next_target, old_target, speed
661 TYPE(section_vals_type), POINTER :: collective_sections
662
663 initial = .false.
664 IF (PRESENT(initialize)) initial = initialize
665 collective_sections => section_vals_get_subs_vals(motion_section, "CONSTRAINT%COLLECTIVE")
666 DO iconst = 1, SIZE(colv_list)
667 colv_list(iconst)%target_velocity = 0.0_dp
668 IF (colv_list(iconst)%expected_value_growth_speed == 0.0_dp) cycle
669 old_target = colv_list(iconst)%expected_value
670 CALL section_vals_val_get(collective_sections, "TARGET", &
671 r_val=next_target, &
672 i_rep_section=colv_list(iconst)%inp_seq_num)
673 IF (initial) THEN
674 speed = colv_list(iconst)%expected_value_growth_speed
675 next_target = old_target + speed*dt
676 CALL section_vals_val_get(collective_sections, "TARGET_LIMIT", explicit=explicit, &
677 i_rep_section=colv_list(iconst)%inp_seq_num)
678 IF (explicit) THEN
679 CALL section_vals_val_get(collective_sections, "TARGET_LIMIT", r_val=limit, &
680 i_rep_section=colv_list(iconst)%inp_seq_num)
681 IF (speed > 0.0_dp) next_target = min(next_target, limit)
682 IF (speed < 0.0_dp) next_target = max(next_target, limit)
683 END IF
684 ELSE
685 colv_list(iconst)%expected_value = next_target
686 END IF
687 colv_list(iconst)%target_velocity = (next_target - old_target)/dt
688 END DO
689
690 END SUBROUTINE shake_update_colv_low
691
692! **************************************************************************************************
693!> \brief Real Rattle - Low Level
694!> rattle algorithm for collective variables constraints
695!> updates the multiplier one molecule type at a time
696!> \param fixd_list ...
697!> \param colv_list ...
698!> \param lcolv ...
699!> \param particle_set ...
700!> \param vel ...
701!> \param dt ...
702!> \param irattle ...
703!> \param cell ...
704!> \param imass ...
705!> \param max_sigma ...
706!> \par History
707!> none
708!> \author Teodoro Laino [tlaino]
709! **************************************************************************************************
710 SUBROUTINE rattle_colv_low(fixd_list, colv_list, lcolv, &
711 particle_set, vel, dt, irattle, cell, imass, max_sigma)
712
713 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
714 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
715 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
716 TYPE(particle_type), POINTER :: particle_set(:)
717 REAL(kind=dp), INTENT(INOUT) :: vel(:, :)
718 REAL(kind=dp), INTENT(in) :: dt
719 INTEGER, INTENT(IN) :: irattle
720 TYPE(cell_type), POINTER :: cell
721 REAL(kind=dp), DIMENSION(:) :: imass
722 REAL(kind=dp), INTENT(INOUT) :: max_sigma
723
724 INTEGER :: iconst
725 REAL(kind=dp) :: del_lam, dtby2, fdotf_sum
726
727 dtby2 = dt*.5_dp
728 IF (irattle == 1) THEN
729 DO iconst = 1, SIZE(colv_list)
730 IF (colv_list(iconst)%restraint%active) cycle
731 ! Update colvar_old
732 CALL colvar_eval_mol_f(lcolv(iconst)%colvar_old, cell, &
733 particles=particle_set, fixd_list=fixd_list)
734 ! Update velocities
735 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
736 lambda=lcolv(iconst)%lambda, &
737 imass=imass)
738 END DO
739 ELSE
740 DO iconst = 1, SIZE(colv_list)
741 IF (colv_list(iconst)%restraint%active) cycle
742 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel) - &
743 colv_list(iconst)%target_velocity
744 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar_old, &
745 lcolv(iconst)%colvar_old, imass=imass)
746 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*fdotf_sum)
747 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
748
749 ! Update velocities
750 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
751 lambda=del_lam, &
752 imass=imass)
753 END DO
754 END IF
755
756 DO iconst = 1, SIZE(colv_list)
757 IF (colv_list(iconst)%restraint%active) cycle
758 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel) - &
759 colv_list(iconst)%target_velocity
760 max_sigma = max(rattle_colv_residual(lcolv(iconst)%sigma, colv_list(iconst)), max_sigma)
761 END DO
762
763 END SUBROUTINE rattle_colv_low
764
765! **************************************************************************************************
766!> \brief Real shake_roll - Low Level
767!> shake algorithm (box allowed to change) for collective variables constraints
768!> updates the multiplier one molecule type at a time
769!> \param fixd_list ...
770!> \param colv_list ...
771!> \param lcolv ...
772!> \param particle_set ...
773!> \param pos ...
774!> \param vel ...
775!> \param r_shake ...
776!> \param v_shake ...
777!> \param dt ...
778!> \param ishake ...
779!> \param cell ...
780!> \param imass ...
781!> \param max_sigma ...
782!> \par History
783!> none
784!> \author Teodoro Laino [tlaino]
785! **************************************************************************************************
786 SUBROUTINE shake_roll_colv_low(fixd_list, colv_list, lcolv, &
787 particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, &
788 imass, max_sigma)
789
790 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
791 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
792 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
793 TYPE(particle_type), POINTER :: particle_set(:)
794 REAL(kind=dp), INTENT(INOUT) :: pos(:, :), vel(:, :)
795 REAL(kind=dp), DIMENSION(:, :), INTENT(IN) :: r_shake, v_shake
796 REAL(kind=dp), INTENT(in) :: dt
797 INTEGER, INTENT(in) :: ishake
798 TYPE(cell_type), POINTER :: cell
799 REAL(kind=dp), DIMENSION(:) :: imass
800 REAL(kind=dp), INTENT(INOUT) :: max_sigma
801
802 INTEGER :: iconst
803 REAL(kind=dp) :: del_lam, dtby2, dtsqby2, fdotf_sum
804
805 dtsqby2 = dt*dt*.5_dp
806 dtby2 = dt*.5_dp
807 IF (ishake == 1) THEN
808 DO iconst = 1, SIZE(colv_list)
809 IF (colv_list(iconst)%restraint%active) cycle
810 ! Update positions
811 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
812 lambda=lcolv(iconst)%lambda, &
813 roll=.true., rmat=r_shake, imass=imass)
814 ! Update velocities
815 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
816 lambda=lcolv(iconst)%lambda, &
817 roll=.true., rmat=v_shake, imass=imass)
818 END DO
819 ELSE
820 DO iconst = 1, SIZE(colv_list)
821 IF (colv_list(iconst)%restraint%active) cycle
822 ! Update colvar
823 CALL colvar_eval_mol_f(lcolv(iconst)%colvar, cell, particles=particle_set, &
824 pos=pos, fixd_list=fixd_list)
825 lcolv(iconst)%sigma = diff_colvar(lcolv(iconst)%colvar, &
826 colv_list(iconst)%expected_value)
827 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar, &
828 lcolv(iconst)%colvar_old, roll=.true., rmat=r_shake, &
829 imass=imass)
830 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*dt*fdotf_sum)
831 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
832
833 ! Update positions
834 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
835 lambda=del_lam, &
836 roll=.true., rmat=r_shake, imass=imass)
837 ! Update velocities
838 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
839 lambda=del_lam, &
840 roll=.true., rmat=v_shake, imass=imass)
841 END DO
842 END IF
843 ! computing the constraint and value of tolerance
844 DO iconst = 1, SIZE(colv_list)
845 IF (colv_list(iconst)%restraint%active) cycle
846 CALL colvar_eval_mol_f(lcolv(iconst)%colvar, cell, particles=particle_set, &
847 pos=pos, fixd_list=fixd_list)
848 lcolv(iconst)%sigma = diff_colvar(lcolv(iconst)%colvar, &
849 colv_list(iconst)%expected_value)
850 max_sigma = max(abs(lcolv(iconst)%sigma), max_sigma)
851 END DO
852
853 END SUBROUTINE shake_roll_colv_low
854
855! **************************************************************************************************
856!> \brief Real Rattle_roll - Low Level
857!> rattle algorithm (box allowed to change) for collective variables constraints
858!> updates the multiplier one molecule type at a time
859!> \param fixd_list ...
860!> \param colv_list ...
861!> \param lcolv ...
862!> \param particle_set ...
863!> \param vel ...
864!> \param r_rattle ...
865!> \param dt ...
866!> \param irattle ...
867!> \param veps ...
868!> \param cell ...
869!> \param imass ...
870!> \param max_sigma ...
871!> \par History
872!> none
873!> \author Teodoro Laino [tlaino]
874! **************************************************************************************************
875 SUBROUTINE rattle_roll_colv_low(fixd_list, colv_list, lcolv, &
876 particle_set, vel, r_rattle, dt, irattle, veps, cell, &
877 imass, max_sigma)
878
879 TYPE(fixd_constraint_type), DIMENSION(:), POINTER :: fixd_list
880 TYPE(colvar_constraint_type), POINTER :: colv_list(:)
881 TYPE(local_colvar_constraint_type), POINTER :: lcolv(:)
882 TYPE(particle_type), POINTER :: particle_set(:)
883 REAL(kind=dp), INTENT(INOUT) :: vel(:, :)
884 REAL(kind=dp), INTENT(IN) :: r_rattle(:, :), dt
885 INTEGER, INTENT(in) :: irattle
886 REAL(kind=dp), INTENT(IN) :: veps(:, :)
887 TYPE(cell_type), POINTER :: cell
888 REAL(kind=dp), DIMENSION(:) :: imass
889 REAL(kind=dp), INTENT(INOUT) :: max_sigma
890
891 INTEGER :: iconst
892 REAL(kind=dp) :: del_lam, dtby2, fdotf_sum
893
894 dtby2 = dt*.5_dp
895 IF (irattle == 1) THEN
896 DO iconst = 1, SIZE(colv_list)
897 IF (colv_list(iconst)%restraint%active) cycle
898 ! Update colvar_old
899 CALL colvar_eval_mol_f(lcolv(iconst)%colvar_old, cell, &
900 particles=particle_set, fixd_list=fixd_list)
901 ! Update velocities
902 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
903 lambda=lcolv(iconst)%lambda, &
904 imass=imass)
905 END DO
906 ELSE
907 DO iconst = 1, SIZE(colv_list)
908 IF (colv_list(iconst)%restraint%active) cycle
909 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel, &
910 roll=.true., veps=veps, rmat=r_rattle, particles=particle_set) - &
911 colv_list(iconst)%target_velocity
912 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar_old, &
913 lcolv(iconst)%colvar_old, roll=.true., &
914 rmat=r_rattle, imass=imass)
915 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*fdotf_sum)
916 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
917 ! Update velocities
918 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
919 lambda=del_lam, &
920 roll=.true., rmat=r_rattle, imass=imass)
921 END DO
922 END IF
923 ! computing the constraint and value of the tolerance
924 DO iconst = 1, SIZE(colv_list)
925 IF (colv_list(iconst)%restraint%active) cycle
926 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel, &
927 roll=.true., veps=veps, rmat=r_rattle, particles=particle_set) - &
928 colv_list(iconst)%target_velocity
929 max_sigma = max(rattle_colv_residual(lcolv(iconst)%sigma, colv_list(iconst)), max_sigma)
930 END DO
931
932 END SUBROUTINE rattle_roll_colv_low
933
934! **************************************************************************************************
935!> \brief Require absolute and relative rate convergence for moving targets.
936!> \param sigma ...
937!> \param definition ...
938!> \return ...
939! **************************************************************************************************
940 PURE FUNCTION rattle_colv_residual(sigma, definition) RESULT(residual)
941 REAL(kind=dp), INTENT(IN) :: sigma
942 TYPE(colvar_constraint_type), INTENT(IN) :: definition
943 REAL(kind=dp) :: residual
944
945 residual = abs(sigma)
946 ! A slow imposed rate can be smaller than the legacy absolute velocity tolerance.
947 ! Require relative rate convergence too, including the zero-rate limit transition.
948 IF (definition%expected_value_growth_speed /= 0.0_dp) THEN
949 residual = max(residual, abs(sigma/definition%expected_value_growth_speed))
950 END IF
951 END FUNCTION rattle_colv_residual
952
953! **************************************************************************************************
954!> \brief Update position/velocities
955!> \param wrk ...
956!> \param fac ...
957!> \param lcolv ...
958!> \param lambda ...
959!> \param roll ...
960!> \param rmat ...
961!> \param imass ...
962!> \par History
963!> Teodoro Laino [teo] created 04.2006
964!> \author Teodoro Laino [tlaino]
965! **************************************************************************************************
966 SUBROUTINE update_con_colv(wrk, fac, lcolv, lambda, roll, rmat, imass)
967 REAL(kind=dp), INTENT(INOUT) :: wrk(:, :)
968 REAL(kind=dp), INTENT(IN) :: fac
969 TYPE(local_colvar_constraint_type), INTENT(IN) :: lcolv
970 REAL(kind=dp), INTENT(IN) :: lambda
971 LOGICAL, INTENT(in), OPTIONAL :: roll
972 REAL(kind=dp), DIMENSION(:, :), INTENT(IN), &
973 OPTIONAL :: rmat
974 REAL(kind=dp), DIMENSION(:) :: imass
975
976 INTEGER :: iatm, ind
977 LOGICAL :: my_roll
978 REAL(kind=dp), DIMENSION(3) :: f_roll
979
980 my_roll = .false.
981 IF (PRESENT(roll)) THEN
982 my_roll = roll
983 IF (my_roll) THEN
984 cpassert(PRESENT(rmat))
985 END IF
986 END IF
987 DO iatm = 1, SIZE(lcolv%colvar_old%i_atom)
988 ind = lcolv%colvar_old%i_atom(iatm)
989 !
990 IF (my_roll) THEN
991 ! If ROLL rotate forces
992 f_roll = matmul(rmat, lcolv%colvar_old%dsdr(:, iatm))
993 ELSE
994 f_roll = lcolv%colvar_old%dsdr(:, iatm)
995 END IF
996 wrk(:, ind) = wrk(:, ind) - imass(ind)*fac*lambda*f_roll
997 END DO
998 END SUBROUTINE update_con_colv
999
1000! **************************************************************************************************
1001!> \brief Evaluates the Jacobian of the collective variables constraints
1002!> \param colvar ...
1003!> \param colvar_old ...
1004!> \param roll ...
1005!> \param rmat ...
1006!> \param imass ...
1007!> \return ...
1008!> \par History
1009!> Teodoro Laino [teo] created 04.2006
1010!> \author Teodoro Laino [tlaino]
1011! **************************************************************************************************
1012 FUNCTION eval_jac_colvar(colvar, colvar_old, roll, rmat, imass) RESULT(res)
1013 TYPE(colvar_type), POINTER :: colvar, colvar_old
1014 LOGICAL, INTENT(IN), OPTIONAL :: roll
1015 REAL(kind=dp), DIMENSION(:, :), INTENT(IN), &
1016 OPTIONAL :: rmat
1017 REAL(kind=dp), DIMENSION(:) :: imass
1018 REAL(kind=dp) :: res
1019
1020 INTEGER :: i, iatom
1021 LOGICAL :: my_roll
1022 REAL(kind=dp), DIMENSION(3) :: tmp1, tmp2, tmp3
1023
1024 my_roll = .false.
1025 IF (PRESENT(roll)) THEN
1026 my_roll = roll
1027 IF (my_roll) THEN
1028 cpassert(PRESENT(rmat))
1029 END IF
1030 END IF
1031
1032 res = 0.0_dp
1033 IF (my_roll) THEN
1034 DO i = 1, SIZE(colvar%i_atom)
1035 iatom = colvar%i_atom(i)
1036 tmp1 = colvar%dsdr(1:3, i)
1037 tmp3 = colvar_old%dsdr(1:3, i)
1038 tmp2 = matmul(rmat, tmp3)
1039 res = res + dot_product(tmp1, tmp2)*imass(iatom)
1040 END DO
1041 ELSE
1042 DO i = 1, SIZE(colvar%i_atom)
1043 iatom = colvar%i_atom(i)
1044 tmp1 = colvar%dsdr(1:3, i)
1045 tmp2 = colvar_old%dsdr(1:3, i)
1046 res = res + dot_product(tmp1, tmp2)*imass(iatom)
1047 END DO
1048 END IF
1049
1050 END FUNCTION eval_jac_colvar
1051
1052! **************************************************************************************************
1053!> \brief Evaluates the constraint for the rattle scheme
1054!> \param colvar ...
1055!> \param vel ...
1056!> \param roll ...
1057!> \param veps ...
1058!> \param rmat ...
1059!> \param particles ...
1060!> \return ...
1061!> \par History
1062!> Teodoro Laino [teo] created 04.2006
1063!> \author Teodoro Laino [tlaino]
1064! **************************************************************************************************
1065 FUNCTION rattle_con_eval(colvar, vel, roll, veps, rmat, particles) RESULT(res)
1066 TYPE(colvar_type), POINTER :: colvar
1067 REAL(kind=dp), INTENT(IN) :: vel(:, :)
1068 LOGICAL, INTENT(IN), OPTIONAL :: roll
1069 REAL(kind=dp), DIMENSION(:, :), INTENT(IN), &
1070 OPTIONAL :: veps, rmat
1071 TYPE(particle_type), DIMENSION(:), OPTIONAL, &
1072 POINTER :: particles
1073 REAL(kind=dp) :: res
1074
1075 INTEGER :: iatm, ind
1076 LOGICAL :: my_roll
1077 REAL(kind=dp), DIMENSION(3) :: f_roll, pos, v_roll
1078
1079 my_roll = .false.
1080 IF (PRESENT(roll)) THEN
1081 my_roll = roll
1082 IF (my_roll) THEN
1083 cpassert(PRESENT(rmat))
1084 cpassert(PRESENT(veps))
1085 cpassert(PRESENT(particles))
1086 END IF
1087 END IF
1088 res = 0.0_dp
1089 DO iatm = 1, SIZE(colvar%i_atom)
1090 ind = colvar%i_atom(iatm)
1091 IF (my_roll) THEN
1092 pos = particles(ind)%r
1093 f_roll = matmul(rmat, colvar%dsdr(:, iatm))
1094 v_roll = vel(:, ind) + matmul(veps, pos)
1095 ELSE
1096 f_roll = colvar%dsdr(:, iatm)
1097 v_roll = vel(:, ind)
1098 END IF
1099 res = res + dot_product(f_roll, v_roll)
1100 END DO
1101
1102 END FUNCTION rattle_con_eval
1103
1104END MODULE constraint_clv
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
Definition grid_common.h:57
Handles all functions related to the CELL.
Definition cell_types.F:15
defines collective variables s({R}) and the derivative of this variable wrt R these can then be used ...
subroutine, public colvar_eval_mol_f(colvar, cell, particles, pos, fixd_list)
evaluates the derivatives (dsdr) given and due to the given colvar variables in a molecular environme...
Initialize the collective variables types.
real(kind=dp) function, public diff_colvar(colvar, b)
subtract b from the ss value of a colvar: general function for handling periodic/non-periodic colvar
Module that handles the COLLECTIVE constraints.
subroutine, public shake_colv_int(molecule, particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
Intramolecular subroutine shake_colv algorithm for collective variables constraints updates the multi...
subroutine, public shake_roll_colv_int(molecule, particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, imass, max_sigma)
Intramolecular subroutine shake algorithm (box allowed to change) for collective variables constraint...
subroutine, public shake_update_colv_ext(gci, dt, motion_section)
Intermolecular subroutine for updating the TARGET value for collective constraints.
subroutine, public rattle_roll_colv_ext(gci, particle_set, vel, r_rattle, dt, irattle, veps, cell, imass, max_sigma)
Intermolecular subroutine rattle algorithm (box allowed to change) for collective variables constrain...
subroutine, public shake_update_colv_targets(dt, motion_section)
Real Shake subroutine - Low Level - for updating the TARGET value.
subroutine, public shake_colv_ext(gci, particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
Intermolecular subroutine shake_colv algorithm for collective variables constraints updates the multi...
subroutine, public rattle_roll_colv_int(molecule, particle_set, vel, r_rattle, dt, irattle, veps, cell, imass, max_sigma)
Intramolecular subroutine rattle algorithm (box allowed to change) for collective variables constrain...
subroutine, public rattle_colv_int(molecule, particle_set, vel, dt, irattle, cell, imass, max_sigma)
Intramolecular subroutine rattle algorithm for collective variables constraints updates the multiplie...
subroutine, public rattle_colv_ext(gci, particle_set, vel, dt, irattle, cell, imass, max_sigma)
Intermolecular subroutine rattle algorithm for collective variables constraints updates the multiplie...
subroutine, public shake_update_colv_int(molecule, dt, motion_section)
Intramolecular subroutine for updating the TARGET value of collective constraints.
subroutine, public shake_update_colv_low(colv_list, dt, motion_section, initialize)
Cache the actual target rate, including a partially clamped interval.
subroutine, public shake_roll_colv_ext(gci, particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, imass, max_sigma)
Intermolecular subroutine shake algorithm (box allowed to change) for collective variables constraint...
subroutine, public check_colv_int(molecule, particle_set, cell, max_sigma, pos, vel, rmat, veps)
Evaluate position or velocity residuals of local collective variables.
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
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.
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.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
parameters for a collective variable