26 fixd_constraint_type,&
30 global_constraint_type,&
31 local_colvar_constraint_type,&
34 #include "./base/base_uses.f90"
50 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'constraint_clv'
72 cell, imass, max_sigma)
74 TYPE(molecule_type),
POINTER :: molecule
75 TYPE(particle_type),
POINTER :: particle_set(:)
76 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
77 REAL(kind=
dp),
INTENT(in) :: dt
78 INTEGER,
INTENT(IN) :: ishake
79 TYPE(cell_type),
POINTER :: cell
80 REAL(kind=
dp),
DIMENSION(:) :: imass
81 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
83 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
84 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
85 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
86 TYPE(molecule_kind_type),
POINTER :: molecule_kind
89 molecule_kind => molecule%molecule_kind
93 CALL shake_colv_low(fixd_list, colv_list, lcolv, &
94 particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
108 TYPE(molecule_type),
POINTER :: molecule
109 REAL(kind=
dp),
INTENT(in) :: dt
110 TYPE(section_vals_type),
POINTER :: motion_section
112 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
113 TYPE(molecule_kind_type),
POINTER :: molecule_kind
115 molecule_kind => molecule%molecule_kind
118 CALL shake_update_colv_low(colv_list, dt, motion_section)
139 cell, imass, max_sigma)
141 TYPE(molecule_type),
POINTER :: molecule
142 TYPE(particle_type),
POINTER :: particle_set(:)
143 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
144 REAL(kind=
dp),
INTENT(in) :: dt
145 INTEGER,
INTENT(IN) :: irattle
146 TYPE(cell_type),
POINTER :: cell
147 REAL(kind=
dp),
DIMENSION(:) :: imass
148 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
150 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
151 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
152 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
153 TYPE(molecule_kind_type),
POINTER :: molecule_kind
156 molecule_kind => molecule%molecule_kind
160 CALL rattle_colv_low(fixd_list, colv_list, lcolv, &
161 particle_set, vel, dt, irattle, cell, imass, max_sigma)
185 dt, ishake, cell, imass, max_sigma)
187 TYPE(molecule_type),
POINTER :: molecule
188 TYPE(particle_type),
POINTER :: particle_set(:)
189 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
190 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: r_shake, v_shake
191 REAL(kind=
dp),
INTENT(in) :: dt
192 INTEGER,
INTENT(in) :: ishake
193 TYPE(cell_type),
POINTER :: cell
194 REAL(kind=
dp),
DIMENSION(:) :: imass
195 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
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
203 molecule_kind => molecule%molecule_kind
207 CALL shake_roll_colv_low(fixd_list, colv_list, lcolv, &
208 particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, &
232 dt, irattle, veps, cell, imass, max_sigma)
234 TYPE(molecule_type),
POINTER :: molecule
235 TYPE(particle_type),
POINTER :: particle_set(:)
236 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
237 REAL(kind=
dp),
INTENT(IN) :: r_rattle(:, :), dt
238 INTEGER,
INTENT(in) :: irattle
239 REAL(kind=
dp),
INTENT(IN) :: veps(:, :)
240 TYPE(cell_type),
POINTER :: cell
241 REAL(kind=
dp),
DIMENSION(:) :: imass
242 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
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
250 molecule_kind => molecule%molecule_kind
254 CALL rattle_roll_colv_low(fixd_list, colv_list, lcolv, &
255 particle_set, vel, r_rattle, dt, irattle, veps, cell, &
278 cell, imass, max_sigma)
280 TYPE(global_constraint_type),
POINTER :: gci
281 TYPE(particle_type),
POINTER :: particle_set(:)
282 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
283 REAL(kind=
dp),
INTENT(in) :: dt
284 INTEGER,
INTENT(IN) :: ishake
285 TYPE(cell_type),
POINTER :: cell
286 REAL(kind=
dp),
DIMENSION(:) :: imass
287 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
289 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
290 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
291 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
293 colv_list => gci%colv_list
294 fixd_list => gci%fixd_list
297 CALL shake_colv_low(fixd_list, colv_list, lcolv, &
298 particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
312 TYPE(global_constraint_type),
POINTER :: gci
313 REAL(kind=
dp),
INTENT(in) :: dt
314 TYPE(section_vals_type),
POINTER :: motion_section
316 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
318 colv_list => gci%colv_list
320 CALL shake_update_colv_low(colv_list, dt, motion_section)
341 cell, imass, max_sigma)
343 TYPE(global_constraint_type),
POINTER :: gci
344 TYPE(particle_type),
POINTER :: particle_set(:)
345 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
346 REAL(kind=
dp),
INTENT(in) :: dt
347 INTEGER,
INTENT(IN) :: irattle
348 TYPE(cell_type),
POINTER :: cell
349 REAL(kind=
dp),
DIMENSION(:) :: imass
350 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
352 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
353 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
354 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
356 colv_list => gci%colv_list
357 fixd_list => gci%fixd_list
360 CALL rattle_colv_low(fixd_list, colv_list, lcolv, &
361 particle_set, vel, dt, irattle, cell, imass, max_sigma)
385 dt, ishake, cell, imass, max_sigma)
387 TYPE(global_constraint_type),
POINTER :: gci
388 TYPE(particle_type),
POINTER :: particle_set(:)
389 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
390 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: r_shake, v_shake
391 REAL(kind=
dp),
INTENT(in) :: dt
392 INTEGER,
INTENT(in) :: ishake
393 TYPE(cell_type),
POINTER :: cell
394 REAL(kind=
dp),
DIMENSION(:) :: imass
395 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
397 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
398 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
399 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
401 colv_list => gci%colv_list
402 fixd_list => gci%fixd_list
405 CALL shake_roll_colv_low(fixd_list, colv_list, lcolv, &
406 particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, &
430 dt, irattle, veps, cell, imass, max_sigma)
432 TYPE(global_constraint_type),
POINTER :: gci
433 TYPE(particle_type),
POINTER :: particle_set(:)
434 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
435 REAL(kind=
dp),
INTENT(IN) :: r_rattle(:, :), dt
436 INTEGER,
INTENT(in) :: irattle
437 REAL(kind=
dp),
INTENT(IN) :: veps(:, :)
438 TYPE(cell_type),
POINTER :: cell
439 REAL(kind=
dp),
DIMENSION(:) :: imass
440 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
442 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
443 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
444 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
446 colv_list => gci%colv_list
447 fixd_list => gci%fixd_list
450 CALL rattle_roll_colv_low(fixd_list, colv_list, lcolv, &
451 particle_set, vel, r_rattle, dt, irattle, veps, cell, &
475 SUBROUTINE shake_colv_low(fixd_list, colv_list, lcolv, &
476 particle_set, pos, vel, dt, ishake, cell, imass, max_sigma)
477 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
478 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
479 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
480 TYPE(particle_type),
POINTER :: particle_set(:)
481 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
482 REAL(kind=
dp),
INTENT(in) :: dt
483 INTEGER,
INTENT(IN) :: ishake
484 TYPE(cell_type),
POINTER :: cell
485 REAL(kind=
dp),
DIMENSION(:) :: imass
486 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
489 REAL(kind=
dp) :: del_lam, dtby2, dtsqby2, fdotf_sum
491 dtsqby2 = dt*dt*.5_dp
493 IF (ishake == 1)
THEN
494 DO iconst = 1,
SIZE(colv_list)
495 IF (colv_list(iconst)%restraint%active) cycle
497 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
498 lambda=lcolv(iconst)%lambda, &
501 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
502 lambda=lcolv(iconst)%lambda, &
506 DO iconst = 1,
SIZE(colv_list)
507 IF (colv_list(iconst)%restraint%active) cycle
510 pos=pos, fixd_list=fixd_list)
511 lcolv(iconst)%sigma =
diff_colvar(lcolv(iconst)%colvar, &
512 colv_list(iconst)%expected_value)
513 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar, &
514 lcolv(iconst)%colvar_old, imass=imass)
515 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*dt*fdotf_sum)
516 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
519 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
523 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
529 DO iconst = 1,
SIZE(colv_list)
530 IF (colv_list(iconst)%restraint%active) cycle
532 pos=pos, fixd_list=fixd_list)
533 lcolv(iconst)%sigma =
diff_colvar(lcolv(iconst)%colvar, &
534 colv_list(iconst)%expected_value)
535 max_sigma = max(abs(lcolv(iconst)%sigma), max_sigma)
537 END SUBROUTINE shake_colv_low
547 SUBROUTINE shake_update_colv_low(colv_list, dt, motion_section)
548 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
549 REAL(kind=
dp),
INTENT(in) :: dt
550 TYPE(section_vals_type),
POINTER :: motion_section
552 INTEGER :: iconst, irep, n_rep
553 LOGICAL :: do_update_colvar, explicit
554 REAL(kind=
dp) :: clv_target, limit, new_clv_target,
value
555 TYPE(section_vals_type),
POINTER :: collective_sections
565 IF (
value /= 0.0_dp)
THEN
568 new_clv_target = clv_target +
value*dt
572 do_update_colvar = .true.
576 IF (
value > 0.0_dp)
THEN
577 IF (clv_target == limit)
THEN
578 do_update_colvar = .false.
579 ELSE IF (new_clv_target >= limit)
THEN
580 new_clv_target = limit
583 IF (clv_target == limit)
THEN
584 do_update_colvar = .false.
585 ELSE IF (new_clv_target <= limit)
THEN
586 new_clv_target = limit
590 IF (do_update_colvar)
THEN
599 DO iconst = 1,
SIZE(colv_list)
601 IF (colv_list(iconst)%expected_value_growth_speed == 0.0_dp) cycle
603 r_val=colv_list(iconst)%expected_value, &
604 i_rep_section=colv_list(iconst)%inp_seq_num)
607 END SUBROUTINE shake_update_colv_low
627 SUBROUTINE rattle_colv_low(fixd_list, colv_list, lcolv, &
628 particle_set, vel, dt, irattle, cell, imass, max_sigma)
630 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
631 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
632 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
633 TYPE(particle_type),
POINTER :: particle_set(:)
634 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
635 REAL(kind=
dp),
INTENT(in) :: dt
636 INTEGER,
INTENT(IN) :: irattle
637 TYPE(cell_type),
POINTER :: cell
638 REAL(kind=
dp),
DIMENSION(:) :: imass
639 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
642 REAL(kind=
dp) :: del_lam, dtby2, fdotf_sum
645 IF (irattle == 1)
THEN
646 DO iconst = 1,
SIZE(colv_list)
647 IF (colv_list(iconst)%restraint%active) cycle
650 particles=particle_set, fixd_list=fixd_list)
652 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
653 lambda=lcolv(iconst)%lambda, &
657 DO iconst = 1,
SIZE(colv_list)
658 IF (colv_list(iconst)%restraint%active) cycle
659 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel)
660 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar_old, &
661 lcolv(iconst)%colvar_old, imass=imass)
662 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*fdotf_sum)
663 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
666 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
672 DO iconst = 1,
SIZE(colv_list)
673 IF (colv_list(iconst)%restraint%active) cycle
674 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel)
675 max_sigma = max(abs(lcolv(iconst)%sigma), max_sigma)
678 END SUBROUTINE rattle_colv_low
701 SUBROUTINE shake_roll_colv_low(fixd_list, colv_list, lcolv, &
702 particle_set, pos, vel, r_shake, v_shake, dt, ishake, cell, &
705 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
706 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
707 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
708 TYPE(particle_type),
POINTER :: particle_set(:)
709 REAL(kind=
dp),
INTENT(INOUT) :: pos(:, :), vel(:, :)
710 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: r_shake, v_shake
711 REAL(kind=
dp),
INTENT(in) :: dt
712 INTEGER,
INTENT(in) :: ishake
713 TYPE(cell_type),
POINTER :: cell
714 REAL(kind=
dp),
DIMENSION(:) :: imass
715 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
718 REAL(kind=
dp) :: del_lam, dtby2, dtsqby2, fdotf_sum
720 dtsqby2 = dt*dt*.5_dp
722 IF (ishake == 1)
THEN
723 DO iconst = 1,
SIZE(colv_list)
724 IF (colv_list(iconst)%restraint%active) cycle
726 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
727 lambda=lcolv(iconst)%lambda, &
728 roll=.true., rmat=r_shake, imass=imass)
730 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
731 lambda=lcolv(iconst)%lambda, &
732 roll=.true., rmat=v_shake, imass=imass)
735 DO iconst = 1,
SIZE(colv_list)
736 IF (colv_list(iconst)%restraint%active) cycle
739 pos=pos, fixd_list=fixd_list)
740 lcolv(iconst)%sigma =
diff_colvar(lcolv(iconst)%colvar, &
741 colv_list(iconst)%expected_value)
742 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar, &
743 lcolv(iconst)%colvar_old, roll=.true., rmat=r_shake, &
745 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*dt*fdotf_sum)
746 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
749 CALL update_con_colv(pos, dtsqby2, lcolv(iconst), &
751 roll=.true., rmat=r_shake, imass=imass)
753 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
755 roll=.true., rmat=v_shake, imass=imass)
759 DO iconst = 1,
SIZE(colv_list)
760 IF (colv_list(iconst)%restraint%active) cycle
762 pos=pos, fixd_list=fixd_list)
763 lcolv(iconst)%sigma =
diff_colvar(lcolv(iconst)%colvar, &
764 colv_list(iconst)%expected_value)
765 max_sigma = max(abs(lcolv(iconst)%sigma), max_sigma)
768 END SUBROUTINE shake_roll_colv_low
790 SUBROUTINE rattle_roll_colv_low(fixd_list, colv_list, lcolv, &
791 particle_set, vel, r_rattle, dt, irattle, veps, cell, &
794 TYPE(fixd_constraint_type),
DIMENSION(:),
POINTER :: fixd_list
795 TYPE(colvar_constraint_type),
POINTER :: colv_list(:)
796 TYPE(local_colvar_constraint_type),
POINTER :: lcolv(:)
797 TYPE(particle_type),
POINTER :: particle_set(:)
798 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
799 REAL(kind=
dp),
INTENT(IN) :: r_rattle(:, :), dt
800 INTEGER,
INTENT(in) :: irattle
801 REAL(kind=
dp),
INTENT(IN) :: veps(:, :)
802 TYPE(cell_type),
POINTER :: cell
803 REAL(kind=
dp),
DIMENSION(:) :: imass
804 REAL(kind=
dp),
INTENT(INOUT) :: max_sigma
807 REAL(kind=
dp) :: del_lam, dtby2, fdotf_sum
810 IF (irattle == 1)
THEN
811 DO iconst = 1,
SIZE(colv_list)
812 IF (colv_list(iconst)%restraint%active) cycle
815 particles=particle_set, fixd_list=fixd_list)
817 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
818 lambda=lcolv(iconst)%lambda, &
822 DO iconst = 1,
SIZE(colv_list)
823 IF (colv_list(iconst)%restraint%active) cycle
824 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel, &
825 roll=.true., veps=veps, rmat=r_rattle, particles=particle_set)
826 fdotf_sum = eval_jac_colvar(lcolv(iconst)%colvar_old, &
827 lcolv(iconst)%colvar_old, roll=.true., &
828 rmat=r_rattle, imass=imass)
829 del_lam = 2.0_dp*lcolv(iconst)%sigma/(dt*fdotf_sum)
830 lcolv(iconst)%lambda = lcolv(iconst)%lambda + del_lam
832 CALL update_con_colv(vel, dtby2, lcolv(iconst), &
834 roll=.true., rmat=r_rattle, imass=imass)
838 DO iconst = 1,
SIZE(colv_list)
839 IF (colv_list(iconst)%restraint%active) cycle
840 lcolv(iconst)%sigma = rattle_con_eval(lcolv(iconst)%colvar_old, vel, &
841 roll=.true., veps=veps, rmat=r_rattle, particles=particle_set)
842 max_sigma = max(abs(lcolv(iconst)%sigma), max_sigma)
845 END SUBROUTINE rattle_roll_colv_low
860 SUBROUTINE update_con_colv(wrk, fac, lcolv, lambda, roll, rmat, imass)
861 REAL(kind=
dp),
INTENT(INOUT) :: wrk(:, :)
862 REAL(kind=
dp),
INTENT(IN) ::
fac
863 TYPE(local_colvar_constraint_type),
INTENT(IN) :: lcolv
864 REAL(kind=
dp),
INTENT(IN) :: lambda
865 LOGICAL,
INTENT(in),
OPTIONAL :: roll
866 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
868 REAL(kind=
dp),
DIMENSION(:) :: imass
872 REAL(kind=
dp),
DIMENSION(3) :: f_roll
875 IF (
PRESENT(roll))
THEN
878 cpassert(
PRESENT(rmat))
881 DO iatm = 1,
SIZE(lcolv%colvar_old%i_atom)
882 ind = lcolv%colvar_old%i_atom(iatm)
886 f_roll = matmul(rmat, lcolv%colvar_old%dsdr(:, iatm))
888 f_roll = lcolv%colvar_old%dsdr(:, iatm)
890 wrk(:, ind) = wrk(:, ind) - imass(ind)*
fac*lambda*f_roll
892 END SUBROUTINE update_con_colv
906 FUNCTION eval_jac_colvar(colvar, colvar_old, roll, rmat, imass)
RESULT(res)
907 TYPE(colvar_type),
POINTER :: colvar, colvar_old
908 LOGICAL,
INTENT(IN),
OPTIONAL :: roll
909 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
911 REAL(kind=
dp),
DIMENSION(:) :: imass
916 REAL(kind=
dp),
DIMENSION(3) :: tmp1, tmp2, tmp3
919 IF (
PRESENT(roll))
THEN
922 cpassert(
PRESENT(rmat))
928 DO i = 1,
SIZE(colvar%i_atom)
929 iatom = colvar%i_atom(i)
930 tmp1 = colvar%dsdr(1:3, i)
931 tmp3 = colvar_old%dsdr(1:3, i)
932 tmp2 = matmul(rmat, tmp3)
933 res = res + dot_product(tmp1, tmp2)*imass(iatom)
936 DO i = 1,
SIZE(colvar%i_atom)
937 iatom = colvar%i_atom(i)
938 tmp1 = colvar%dsdr(1:3, i)
939 tmp2 = colvar_old%dsdr(1:3, i)
940 res = res + dot_product(tmp1, tmp2)*imass(iatom)
944 END FUNCTION eval_jac_colvar
959 FUNCTION rattle_con_eval(colvar, vel, roll, veps, rmat, particles)
RESULT(res)
960 TYPE(colvar_type),
POINTER :: colvar
961 REAL(kind=
dp),
INTENT(INOUT) :: vel(:, :)
962 LOGICAL,
INTENT(IN),
OPTIONAL :: roll
963 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN), &
964 OPTIONAL :: veps, rmat
965 TYPE(particle_type),
DIMENSION(:),
OPTIONAL, &
971 REAL(kind=
dp),
DIMENSION(3) :: f_roll, pos, v_roll
974 IF (
PRESENT(roll))
THEN
977 cpassert(
PRESENT(rmat))
978 cpassert(
PRESENT(veps))
979 cpassert(
PRESENT(particles))
983 DO iatm = 1,
SIZE(colvar%i_atom)
984 ind = colvar%i_atom(iatm)
986 pos = particles(ind)%r
987 f_roll = matmul(rmat, colvar%dsdr(:, iatm))
988 v_roll = vel(:, ind) + matmul(veps, pos)
990 f_roll = colvar%dsdr(:, iatm)
993 res = res + dot_product(f_roll, v_roll)
996 END FUNCTION rattle_con_eval
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
Handles all functions related to the CELL.
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_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...
Defines the basic variable types.
integer, parameter, public dp
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.