62 #include "./base/base_uses.f90"
73 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'constraint'
74 INTEGER,
PARAMETER,
PRIVATE :: Max_Shake_Iter = 1000
98 SUBROUTINE shake_control(gci, local_molecules, molecule_set, molecule_kind_set, &
99 particle_set, pos, vel, dt, shake_tol, log_unit, lagrange_mult, dump_lm, &
100 cell, group, local_particles)
102 TYPE(global_constraint_type),
POINTER :: gci
103 TYPE(distribution_1d_type),
POINTER :: local_molecules
104 TYPE(molecule_type),
POINTER :: molecule_set(:)
105 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
106 TYPE(particle_type),
POINTER :: particle_set(:)
107 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
108 REAL(kind=
dp),
INTENT(in) :: dt, shake_tol
109 INTEGER,
INTENT(in) :: log_unit, lagrange_mult
110 LOGICAL,
INTENT(IN) :: dump_lm
111 TYPE(cell_type),
POINTER :: cell
113 CLASS(mp_comm_type),
INTENT(in) :: group
114 TYPE(distribution_1d_type),
POINTER :: local_particles
116 CHARACTER(LEN=*),
PARAMETER :: routinen =
'shake_control'
118 INTEGER :: handle, i, ikind, imol, ishake_ext, &
119 ishake_int, k, n3x3con, n4x6con, &
120 nconstraint, nkind, nmol_per_kind, &
122 LOGICAL :: do_ext_constraint
123 REAL(kind=
dp) :: int_max_sigma, mass, max_sigma
124 REAL(kind=
dp),
DIMENSION(SIZE(pos, 2)) :: imass
125 TYPE(atomic_kind_type),
POINTER :: atomic_kind
126 TYPE(colvar_counters) :: ncolv
127 TYPE(molecule_kind_type),
POINTER :: molecule_kind
128 TYPE(molecule_type),
POINTER :: molecule
130 CALL timeset(routinen, handle)
131 nkind =
SIZE(molecule_kind_set)
132 DO k = 1,
SIZE(pos, 2)
133 atomic_kind => particle_set(k)%atomic_kind
135 imass(k) = 1.0_dp/max(mass, epsilon(0.0_dp))
137 do_ext_constraint = (gci%ntot /= 0)
139 max_sigma = -1.0e+10_dp
140 shake_inter_loop:
DO WHILE ((abs(max_sigma) >= shake_tol) .AND. (ishake_ext <= max_shake_iter))
142 ishake_ext = ishake_ext + 1
144 mol:
DO ikind = 1, nkind
145 nmol_per_kind = local_molecules%n_el(ikind)
146 DO imol = 1, nmol_per_kind
147 i = local_molecules%list(ikind)%array(imol)
148 molecule => molecule_set(i)
149 molecule_kind => molecule%molecule_kind
151 ng3x3=n3x3con, ng4x6=n4x6con, &
152 nconstraint=nconstraint, nvsite=nvsitecon)
153 IF (nconstraint == 0) cycle
155 int_max_sigma = -1.0e+10_dp
156 shake_intra_loop:
DO WHILE ((abs(int_max_sigma) >= shake_tol) .AND. (ishake_int <= max_shake_iter))
157 int_max_sigma = 0.0_dp
158 ishake_int = ishake_int + 1
161 CALL shake_3x3_int(molecule, particle_set, pos, vel, dt, ishake_int, &
165 CALL shake_4x6_int(molecule, particle_set, pos, vel, dt, ishake_int, &
168 IF (ncolv%ntot /= 0) &
169 CALL shake_colv_int(molecule, particle_set, pos, vel, dt, ishake_int, &
170 cell, imass, int_max_sigma)
171 END DO shake_intra_loop
172 max_sigma = max(max_sigma, int_max_sigma)
173 CALL shake_int_info(log_unit, i, ishake_int, max_sigma)
175 IF (nvsitecon /= 0) &
180 IF (do_ext_constraint)
THEN
183 IF (gci%ng3x3 /= 0) &
184 CALL shake_3x3_ext(gci, particle_set, pos, vel, dt, ishake_ext, &
187 IF (gci%ng4x6 /= 0) &
188 CALL shake_4x6_ext(gci, particle_set, pos, vel, dt, ishake_ext, &
191 IF (gci%ncolv%ntot /= 0) &
192 CALL shake_colv_ext(gci, particle_set, pos, vel, dt, ishake_ext, &
193 cell, imass, max_sigma)
195 IF (gci%nvsite /= 0) &
199 CALL shake_ext_info(log_unit, ishake_ext, max_sigma)
200 END DO shake_inter_loop
201 CALL dump_lagrange_mult(dump_lm, lagrange_mult, local_molecules, molecule_set, gci, &
202 molecule_kind_set, group,
"S")
204 CALL timestop(handle)
226 SUBROUTINE rattle_control(gci, local_molecules, molecule_set, molecule_kind_set, &
227 particle_set, vel, dt, rattle_tol, log_unit, lagrange_mult, dump_lm, cell, group, &
230 TYPE(global_constraint_type),
POINTER :: gci
231 TYPE(distribution_1d_type),
POINTER :: local_molecules
232 TYPE(molecule_type),
POINTER :: molecule_set(:)
233 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
234 TYPE(particle_type),
POINTER :: particle_set(:)
235 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
236 REAL(kind=
dp),
INTENT(in) :: dt, rattle_tol
237 INTEGER,
INTENT(in) :: log_unit, lagrange_mult
238 LOGICAL,
INTENT(IN) :: dump_lm
239 TYPE(cell_type),
POINTER :: cell
241 CLASS(mp_comm_type),
INTENT(in) :: group
242 TYPE(distribution_1d_type),
POINTER :: local_particles
244 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rattle_control'
246 INTEGER :: handle, i, ikind, imol, irattle_ext, &
247 irattle_int, k, n3x3con, n4x6con, &
248 nconstraint, nkind, nmol_per_kind
249 LOGICAL :: do_ext_constraint
250 REAL(kind=
dp) :: int_max_sigma, mass, max_sigma
251 REAL(kind=
dp),
DIMENSION(SIZE(vel, 2)) :: imass
252 TYPE(atomic_kind_type),
POINTER :: atomic_kind
253 TYPE(colvar_counters) :: ncolv
254 TYPE(molecule_kind_type),
POINTER :: molecule_kind
255 TYPE(molecule_type),
POINTER :: molecule
257 CALL timeset(routinen, handle)
258 nkind =
SIZE(molecule_kind_set)
259 DO k = 1,
SIZE(vel, 2)
260 atomic_kind => particle_set(k)%atomic_kind
262 imass(k) = 1.0_dp/max(mass, epsilon(0.0_dp))
264 do_ext_constraint = (gci%ntot /= 0)
266 max_sigma = -1.0e+10_dp
267 rattle_inter_loop:
DO WHILE (abs(max_sigma) >= rattle_tol)
269 irattle_ext = irattle_ext + 1
271 mol:
DO ikind = 1, nkind
272 nmol_per_kind = local_molecules%n_el(ikind)
273 DO imol = 1, nmol_per_kind
274 i = local_molecules%list(ikind)%array(imol)
275 molecule => molecule_set(i)
276 molecule_kind => molecule%molecule_kind
278 ng4x6=n4x6con, nconstraint=nconstraint)
279 IF (nconstraint == 0) cycle
281 int_max_sigma = -1.0e+10_dp
282 rattle_intra_loop:
DO WHILE (abs(int_max_sigma) >= rattle_tol)
283 int_max_sigma = 0.0_dp
284 irattle_int = irattle_int + 1
292 IF (ncolv%ntot /= 0) &
294 irattle_int, cell, imass, int_max_sigma)
295 END DO rattle_intra_loop
296 max_sigma = max(max_sigma, int_max_sigma)
297 CALL rattle_int_info(log_unit, i, irattle_int, max_sigma)
301 IF (do_ext_constraint)
THEN
304 IF (gci%ng3x3 /= 0) &
307 IF (gci%ng4x6 /= 0) &
310 IF (gci%ncolv%ntot /= 0) &
312 irattle_ext, cell, imass, max_sigma)
315 CALL rattle_ext_info(log_unit, irattle_ext, max_sigma)
316 END DO rattle_inter_loop
317 CALL dump_lagrange_mult(dump_lm, lagrange_mult, local_molecules, molecule_set, gci, &
318 molecule_kind_set, group,
"R")
319 CALL timestop(handle)
346 molecule_kind_set, particle_set, pos, vel, dt, simpar, roll_tol, iroll, &
347 vector_r, vector_v, group, u, cell, local_particles)
349 TYPE(global_constraint_type),
POINTER :: gci
350 TYPE(distribution_1d_type),
POINTER :: local_molecules
351 TYPE(molecule_type),
POINTER :: molecule_set(:)
352 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
353 TYPE(particle_type),
POINTER :: particle_set(:)
354 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
355 REAL(kind=
dp),
INTENT(IN) :: dt
356 TYPE(simpar_type),
INTENT(IN) :: simpar
357 REAL(kind=
dp),
INTENT(OUT) :: roll_tol
358 INTEGER,
INTENT(INOUT) :: iroll
359 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: vector_r, vector_v
361 CLASS(mp_comm_type),
INTENT(IN) :: group
362 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
364 TYPE(cell_type),
POINTER :: cell
365 TYPE(distribution_1d_type),
POINTER :: local_particles
367 CHARACTER(LEN=*),
PARAMETER :: routinen =
'shake_roll_control'
369 INTEGER :: handle, i, ikind, imol, ishake_ext, ishake_int, k, lagrange_mult, log_unit, &
370 n3x3con, n4x6con, nconstraint, nkind, nmol_per_kind, nvsitecon
371 LOGICAL :: do_ext_constraint, dump_lm
372 REAL(kind=
dp) :: int_max_sigma, mass, max_sigma, shake_tol
373 REAL(kind=
dp),
DIMENSION(3, 3) :: r_shake, v_shake
374 REAL(kind=
dp),
DIMENSION(SIZE(pos, 2)) :: imass
375 TYPE(atomic_kind_type),
POINTER :: atomic_kind
376 TYPE(colvar_counters) :: ncolv
377 TYPE(molecule_kind_type),
POINTER :: molecule_kind
378 TYPE(molecule_type),
POINTER :: molecule
380 CALL timeset(routinen, handle)
381 nkind =
SIZE(molecule_kind_set)
382 shake_tol = simpar%shake_tol
383 log_unit = simpar%info_constraint
384 lagrange_mult = simpar%lagrange_multipliers
385 dump_lm = simpar%dump_lm
392 DO k = 1,
SIZE(pos, 2)
393 atomic_kind => particle_set(k)%atomic_kind
395 imass(k) = 1.0_dp/max(mass, epsilon(0.0_dp))
397 do_ext_constraint = (gci%ntot /= 0)
399 max_sigma = -1.0e+10_dp
400 shake_inter_loop:
DO WHILE (abs(max_sigma) >= shake_tol)
402 ishake_ext = ishake_ext + 1
404 mol:
DO ikind = 1, nkind
405 nmol_per_kind = local_molecules%n_el(ikind)
406 DO imol = 1, nmol_per_kind
407 i = local_molecules%list(ikind)%array(imol)
408 molecule => molecule_set(i)
409 molecule_kind => molecule%molecule_kind
411 ng3x3=n3x3con, ng4x6=n4x6con, &
412 nconstraint=nconstraint, nvsite=nvsitecon)
413 IF (nconstraint == 0) cycle
415 int_max_sigma = -1.0e+10_dp
416 shake_roll_intra_loop:
DO WHILE (abs(int_max_sigma) >= shake_tol)
417 int_max_sigma = 0.0_dp
418 ishake_int = ishake_int + 1
422 v_shake, dt, ishake_int, int_max_sigma)
426 dt, ishake_int, int_max_sigma)
428 IF (ncolv%ntot /= 0) &
430 v_shake, dt, ishake_int, cell, imass, int_max_sigma)
431 END DO shake_roll_intra_loop
432 max_sigma = max(max_sigma, int_max_sigma)
433 CALL shake_int_info(log_unit, i, ishake_int, max_sigma)
435 IF (nvsitecon /= 0)
THEN
436 cpabort(
"Virtual Site Constraint/Restraint not implemented for SHAKE_ROLL!")
441 IF (do_ext_constraint)
THEN
444 IF (gci%ng3x3 /= 0) &
446 v_shake, dt, ishake_ext, max_sigma)
448 IF (gci%ng4x6 /= 0) &
450 dt, ishake_ext, max_sigma)
452 IF (gci%ncolv%ntot /= 0) &
454 v_shake, dt, ishake_ext, cell, imass, max_sigma)
456 IF (gci%nvsite /= 0) &
457 cpabort(
"Virtual Site Constraint/Restraint not implemented for SHAKE_ROLL!")
460 CALL shake_ext_info(log_unit, ishake_ext, max_sigma)
461 END DO shake_inter_loop
462 CALL dump_lagrange_mult(dump_lm, lagrange_mult, local_molecules, molecule_set, gci, &
463 molecule_kind_set, group,
"S")
464 CALL check_tol(roll_tol, iroll,
'SHAKE', r_shake)
465 CALL timestop(handle)
491 molecule_kind_set, particle_set, vel, dt, simpar, vector, &
492 veps, roll_tol, iroll, para_env, u, cell, local_particles)
494 TYPE(global_constraint_type),
POINTER :: gci
495 TYPE(distribution_1d_type),
POINTER :: local_molecules
496 TYPE(molecule_type),
POINTER :: molecule_set(:)
497 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
498 TYPE(particle_type),
POINTER :: particle_set(:)
499 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
500 REAL(kind=
dp),
INTENT(IN) :: dt
501 TYPE(simpar_type),
INTENT(IN) :: simpar
502 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: vector
503 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: veps
504 REAL(kind=
dp),
INTENT(OUT) :: roll_tol
505 INTEGER,
INTENT(INOUT) :: iroll
506 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
507 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
509 TYPE(cell_type),
POINTER :: cell
510 TYPE(distribution_1d_type),
POINTER :: local_particles
512 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rattle_roll_control'
514 INTEGER :: handle, i, ikind, imol, irattle_ext, irattle_int, k, lagrange_mult, log_unit, &
515 n3x3con, n4x6con, nconstraint, nkind, nmol_per_kind
516 LOGICAL :: do_ext_constraint, dump_lm
517 REAL(kind=
dp) :: int_max_sigma, mass, max_sigma, &
519 REAL(kind=
dp),
DIMENSION(3, 3) :: r_rattle
520 REAL(kind=
dp),
DIMENSION(SIZE(vel, 2)) :: imass
521 TYPE(atomic_kind_type),
POINTER :: atomic_kind
522 TYPE(colvar_counters) :: ncolv
523 TYPE(molecule_kind_type),
POINTER :: molecule_kind
524 TYPE(molecule_type),
POINTER :: molecule
526 CALL timeset(routinen, handle)
528 nkind =
SIZE(molecule_kind_set)
529 rattle_tol = simpar%shake_tol
530 log_unit = simpar%info_constraint
531 lagrange_mult = simpar%lagrange_multipliers
532 dump_lm = simpar%dump_lm
539 DO k = 1,
SIZE(vel, 2)
540 atomic_kind => particle_set(k)%atomic_kind
542 imass(k) = 1.0_dp/max(mass, epsilon(0.0_dp))
544 do_ext_constraint = (gci%ntot /= 0)
546 max_sigma = -1.0e+10_dp
547 rattle_inter_loop:
DO WHILE (abs(max_sigma) >= rattle_tol)
549 irattle_ext = irattle_ext + 1
551 mol:
DO ikind = 1, nkind
552 nmol_per_kind = local_molecules%n_el(ikind)
553 DO imol = 1, nmol_per_kind
554 i = local_molecules%list(ikind)%array(imol)
555 molecule => molecule_set(i)
556 molecule_kind => molecule%molecule_kind
558 ng3x3=n3x3con, ng4x6=n4x6con, &
559 nconstraint=nconstraint)
560 IF (nconstraint == 0) cycle
561 int_max_sigma = -1.0e+10_dp
563 rattle_roll_intramolecular:
DO WHILE (abs(int_max_sigma) >= rattle_tol)
564 int_max_sigma = 0.0_dp
565 irattle_int = irattle_int + 1
575 IF (ncolv%ntot /= 0) &
577 irattle_int, veps, cell, imass, int_max_sigma)
578 END DO rattle_roll_intramolecular
579 max_sigma = max(max_sigma, int_max_sigma)
580 CALL rattle_int_info(log_unit, i, irattle_int, max_sigma)
584 IF (do_ext_constraint)
THEN
587 IF (gci%ng3x3 /= 0) &
591 IF (gci%ng4x6 /= 0) &
595 IF (gci%ncolv%ntot /= 0) &
597 irattle_ext, veps, cell, imass, max_sigma)
600 CALL rattle_ext_info(log_unit, irattle_ext, max_sigma)
601 END DO rattle_inter_loop
602 CALL dump_lagrange_mult(dump_lm, lagrange_mult, local_molecules, molecule_set, gci, &
603 molecule_kind_set, para_env,
"R")
604 CALL check_tol(roll_tol, iroll,
'RATTLE', veps=veps)
605 CALL timestop(handle)
621 SUBROUTINE dump_lagrange_mult(dump_lm, log_unit, local_molecules, molecule_set, gci, &
622 molecule_kind_set, group, id_type)
623 LOGICAL,
INTENT(IN) :: dump_lm
624 INTEGER,
INTENT(IN) :: log_unit
625 TYPE(distribution_1d_type),
POINTER :: local_molecules
626 TYPE(molecule_type),
POINTER :: molecule_set(:)
627 TYPE(global_constraint_type),
POINTER :: gci
628 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
630 CLASS(mp_comm_type),
INTENT(IN) :: group
631 CHARACTER(LEN=1),
INTENT(IN) :: id_type
633 CHARACTER(LEN=*),
PARAMETER :: routinen =
'dump_lagrange_mult'
635 CHARACTER(LEN=default_string_length) :: label
636 INTEGER :: handle, i, ikind, imol, j, my_index, &
637 n3x3con, n4x6con, nconstraint, nkind
638 LOGICAL :: do_ext_constraint, do_int_constraint
639 REAL(kind=
dp),
DIMENSION(:),
POINTER :: lagr
640 TYPE(colvar_counters) :: ncolv
641 TYPE(molecule_kind_type),
POINTER :: molecule_kind
642 TYPE(molecule_type),
POINTER :: molecule
644 CALL timeset(routinen, handle)
647 nconstraint=nconstraint)
648 do_int_constraint = (nconstraint > 0)
649 do_ext_constraint = (gci%ntot > 0)
650 IF (dump_lm .AND. (do_int_constraint .OR. do_ext_constraint))
THEN
651 nkind =
SIZE(molecule_kind_set)
652 ALLOCATE (lagr(nconstraint))
656 IF (do_int_constraint)
THEN
657 mol:
DO ikind = 1, nkind
658 molecule_kind => molecule_kind_set(ikind)
663 DO imol = 1, molecule_kind%nmolecule
664 i = molecule_kind%molecule_list(imol)
665 IF (any(local_molecules%list(ikind)%array == i))
THEN
666 molecule => molecule_set(i)
669 lagr(my_index + 1) = molecule%lci%lcolv(j)%lambda
670 my_index = my_index + 1
674 lagr(my_index + 1:my_index + 3) = molecule%lci%lg3x3(j)%lambda(:)
675 my_index = my_index + 3
679 lagr(my_index + 1:my_index + 6) = molecule%lci%lg4x6(j)%lambda(:)
680 my_index = my_index + 6
683 my_index = my_index + ncolv%ntot + 3*n3x3con + 6*n4x6con
690 IF (do_ext_constraint)
THEN
691 CALL reallocate(lagr, 1,
SIZE(lagr) + gci%ntot)
693 DO j = 1, gci%ncolv%ntot
694 lagr(my_index + 1) = gci%lcolv(j)%lambda
695 my_index = my_index + 1
699 lagr(my_index + 1:my_index + 3) = gci%lg3x3(j)%lambda(:)
700 my_index = my_index + 3
704 lagr(my_index + 1:my_index + 6) = gci%lg4x6(j)%lambda(:)
705 my_index = my_index + 6
708 IF (log_unit > 0)
THEN
709 IF (id_type ==
"S")
THEN
710 label =
"Shake Lagrangian Multipliers:"
711 ELSEIF (id_type ==
"R")
THEN
712 label =
"Rattle Lagrangian Multipliers:"
716 WRITE (log_unit, fmt=
'(A,T40,4F15.9)') trim(label), lagr(1:min(4,
SIZE(lagr)))
717 DO j = 5,
SIZE(lagr), 4
718 WRITE (log_unit, fmt=
'(T40,4F15.9)') lagr(j:min(j + 3,
SIZE(lagr)))
723 CALL timestop(handle)
725 END SUBROUTINE dump_lagrange_mult
736 SUBROUTINE shake_int_info(log_unit, i, ishake_int, max_sigma)
737 INTEGER,
INTENT(IN) :: log_unit, i, ishake_int
738 REAL(kind=
dp),
INTENT(IN) :: max_sigma
740 IF (log_unit > 0)
THEN
742 WRITE (log_unit,
'("SHAKE_INFO|",2X,2(A,I6),A,F15.9)') &
743 "Molecule Nr.:", i,
" Nr. Iterations:", ishake_int,
" Max. Err.:", max_sigma
746 IF (ishake_int > max_shake_iter) &
747 CALL cp_warn(__location__, &
748 "Shake NOT converged in "//cp_to_string(max_shake_iter)//
" iterations in the "// &
749 "intramolecular constraint loop for Molecule nr. "//cp_to_string(i)// &
750 ". CP2K continues but results could be meaningless. ")
751 END SUBROUTINE shake_int_info
761 SUBROUTINE shake_ext_info(log_unit, ishake_ext, max_sigma)
762 INTEGER,
INTENT(IN) :: log_unit, ishake_ext
763 REAL(kind=
dp),
INTENT(IN) :: max_sigma
765 IF (log_unit > 0)
THEN
767 WRITE (log_unit,
'("SHAKE_INFO|",2X,A,I6,A,F15.9)') &
768 "External Shake Nr. Iterations:", ishake_ext, &
769 " Max. Err.:", max_sigma
772 IF (ishake_ext > max_shake_iter) &
773 CALL cp_warn(__location__, &
774 "Shake NOT converged in "//cp_to_string(max_shake_iter)//
" iterations in the "// &
775 "intermolecular constraint. CP2K continues but results could be meaningless.")
776 END SUBROUTINE shake_ext_info
787 SUBROUTINE rattle_int_info(log_unit, i, irattle_int, max_sigma)
788 INTEGER,
INTENT(IN) :: log_unit, i, irattle_int
789 REAL(kind=
dp),
INTENT(IN) :: max_sigma
791 IF (log_unit > 0)
THEN
793 WRITE (log_unit,
'("RATTLE_INFO|",1X,2(A,I6),A,F15.9)') &
794 "Molecule Nr.:", i,
" Nr. Iterations:", irattle_int,
" Max. Err.:", max_sigma
797 IF (irattle_int > max_shake_iter) &
798 CALL cp_warn(__location__, &
799 "Rattle NOT converged in "//cp_to_string(max_shake_iter)//
" iterations in the "// &
800 "intramolecular constraint loop for Molecule nr. "//cp_to_string(i)// &
801 ". CP2K continues but results could be meaningless.")
802 END SUBROUTINE rattle_int_info
812 SUBROUTINE rattle_ext_info(log_unit, irattle_ext, max_sigma)
813 INTEGER,
INTENT(IN) :: log_unit, irattle_ext
814 REAL(kind=
dp),
INTENT(IN) :: max_sigma
816 IF (log_unit > 0)
THEN
818 WRITE (log_unit,
'("RATTLE_INFO|",1X,A,I6,A,F15.9)') &
819 "External Rattle Nr. Iterations:", irattle_ext, &
820 " Max. Err.:", max_sigma
823 IF (irattle_ext > max_shake_iter) &
824 CALL cp_warn(__location__, &
825 "Rattle NOT converged in "//cp_to_string(max_shake_iter)//
" iterations in the "// &
826 "intermolecular constraint. CP2K continues but results could be meaningless.")
827 END SUBROUTINE rattle_ext_info
842 molecule_kind_set, dt, root_section)
844 TYPE(global_constraint_type),
POINTER :: gci
845 TYPE(distribution_1d_type),
POINTER :: local_molecules
846 TYPE(molecule_type),
POINTER :: molecule_set(:)
847 TYPE(molecule_kind_type),
POINTER :: molecule_kind_set(:)
848 REAL(kind=
dp),
INTENT(in) :: dt
849 TYPE(section_vals_type),
POINTER :: root_section
851 CHARACTER(LEN=*),
PARAMETER :: routinen =
'shake_update_targets'
853 INTEGER :: handle, i, ikind, imol, nkind, &
855 LOGICAL :: do_ext_constraint
856 TYPE(colvar_counters) :: ncolv
857 TYPE(molecule_kind_type),
POINTER :: molecule_kind
858 TYPE(molecule_type),
POINTER :: molecule
859 TYPE(section_vals_type),
POINTER :: motion_section
861 CALL timeset(routinen, handle)
863 nkind =
SIZE(molecule_kind_set)
864 do_ext_constraint = (gci%ntot /= 0)
866 mol:
DO ikind = 1, nkind
867 nmol_per_kind = local_molecules%n_el(ikind)
868 DO imol = 1, nmol_per_kind
869 i = local_molecules%list(ikind)%array(imol)
870 molecule => molecule_set(i)
871 molecule_kind => molecule%molecule_kind
879 IF (do_ext_constraint)
THEN
883 CALL timestop(handle)
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.
Initialize the collective variables types.
subroutine, public shake_3x3_ext(gci, particle_set, pos, vel, dt, ishake, max_sigma)
...
subroutine, public rattle_roll_3x3_ext(gci, particle_set, vel, r_rattle, dt, veps)
...
subroutine, public shake_roll_3x3_int(molecule, particle_set, pos, vel, r_shake, v_shake, dt, ishake, max_sigma)
...
subroutine, public rattle_3x3_int(molecule, particle_set, vel, dt)
...
subroutine, public shake_3x3_int(molecule, particle_set, pos, vel, dt, ishake, max_sigma)
...
subroutine, public rattle_3x3_ext(gci, particle_set, vel, dt)
...
subroutine, public shake_roll_3x3_ext(gci, particle_set, pos, vel, r_shake, v_shake, dt, ishake, max_sigma)
...
subroutine, public rattle_roll_3x3_int(molecule, particle_set, vel, r_rattle, dt, veps)
...
subroutine, public rattle_roll_4x6_int(molecule, particle_set, vel, r_rattle, dt, veps)
Intramolecular rattle_4x6_roll.
subroutine, public rattle_4x6_int(molecule, particle_set, vel, dt)
Intramolecular rattle_4x6.
subroutine, public shake_roll_4x6_ext(gci, particle_set, pos, vel, r_shake, dt, ishake, max_sigma)
Intramolecular shake_4x6_roll.
subroutine, public rattle_4x6_ext(gci, particle_set, vel, dt)
Intramolecular rattle_4x6.
subroutine, public shake_4x6_ext(gci, particle_set, pos, vel, dt, ishake, max_sigma)
Intramolecular shake_4x6.
subroutine, public shake_roll_4x6_int(molecule, particle_set, pos, vel, r_shake, dt, ishake, max_sigma)
Intramolecular shake_4x6_roll.
subroutine, public rattle_roll_4x6_ext(gci, particle_set, vel, r_rattle, dt, veps)
Intramolecular rattle_4x6_roll.
subroutine, public shake_4x6_int(molecule, particle_set, pos, vel, dt, ishake, max_sigma)
Intramolecular shake_4x6.
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_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_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...
Contains routines useful for the application of constraints during MD.
subroutine, public get_roll_matrix(char, r_shake, v_shake, vector_r, vector_v, u)
...
subroutine, public restore_temporary_set(particle_set, local_particles, pos, vel)
...
subroutine, public update_temporary_set(group, pos, vel)
...
subroutine, public check_tol(roll_tol, iroll, char, matrix, veps)
...
Routines to handle the virtual site constraint/restraint.
subroutine, public shake_vsite_ext(gci, pos)
Intramolecular virtual site.
subroutine, public shake_vsite_int(molecule, pos)
Intramolecular virtual site.
subroutine, public rattle_control(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, vel, dt, rattle_tol, log_unit, lagrange_mult, dump_lm, cell, group, local_particles)
...
subroutine, public rattle_roll_control(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, vel, dt, simpar, vector, veps, roll_tol, iroll, para_env, u, cell, local_particles)
...
subroutine, public shake_control(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, pos, vel, dt, shake_tol, log_unit, lagrange_mult, dump_lm, cell, group, local_particles)
...
subroutine, public shake_roll_control(gci, local_molecules, molecule_set, molecule_kind_set, particle_set, pos, vel, dt, simpar, roll_tol, iroll, vector_r, vector_v, group, u, cell, local_particles)
...
subroutine, public shake_update_targets(gci, local_molecules, molecule_set, molecule_kind_set, dt, root_section)
Updates the TARGET of the COLLECTIVE constraints if the growth speed is different from zero.
various routines to log and control the output. The idea is that decisions about where to log should ...
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Utility routines for the memory handling.
Interface to the message passing library MPI.
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 get_molecule_kind_set(molecule_kind_set, maxatom, natom, nbond, nbend, nub, ntorsion, nimpr, nopbend, nconstraint, nconstraint_fixd, nmolecule, nrestraints)
Get informations about a molecule kind set.
Define the data structure for the molecule information.
Define the data structure for the particle information.
Type for storing MD parameters.