86#include "./base/base_uses.f90"
90 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'force_fields_all'
93 LOGICAL,
PARAMETER :: debug_this_module = .false.
134 INTEGER,
INTENT(IN) :: iw
136 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_bond'
138 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
140 INTEGER :: atm_a, atm_b, counter, first, handle2, &
141 i, j, k, last, natom, nbond
142 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
143 INTEGER,
POINTER :: map_bond_kind(:)
147 TYPE(
bond_type),
DIMENSION(:),
POINTER :: bond_list
151 CALL timeset(routinen, handle2)
154 WRITE (unit=iw, fmt=
"(/,T2,A)") &
155 "FORCEFIELD| Checking for unique bond terms"
158 DO i = 1,
SIZE(molecule_kind_set)
159 molecule_kind => molecule_kind_set(i)
161 molecule_list=molecule_list, &
163 nbond=nbond, bond_list=bond_list)
164 molecule => molecule_set(molecule_list(1))
165 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
167 ALLOCATE (map_bond_kind(nbond))
176 atm_a = bond_list(j)%a
177 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
180 atm_b = bond_list(j)%b
181 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
186 atm_a = bond_list(k)%a
187 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
190 atm_b = bond_list(k)%b
191 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
194 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
195 ((name_atm_b) == (name_atm_b2))) .OR. &
196 (((name_atm_a) == (name_atm_b2)) .AND. &
197 ((name_atm_b) == (name_atm_a2))))
THEN
199 map_bond_kind(j) = map_bond_kind(k)
203 IF (.NOT. found)
THEN
204 counter = counter + 1
205 map_bond_kind(j) = counter
209 NULLIFY (bond_kind_set)
212 bond_list(j)%bond_kind => bond_kind_set(map_bond_kind(j))
215 bond_kind_set=bond_kind_set, bond_list=bond_list)
216 DEALLOCATE (map_bond_kind)
219 CALL timestop(handle2)
237 INTEGER,
INTENT(IN) :: iw
239 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_bend'
241 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
242 name_atm_b2, name_atm_c, name_atm_c2
243 INTEGER :: atm_a, atm_b, atm_c, counter, first, &
244 handle2, i, j, k, last, natom, nbend
245 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
246 INTEGER,
POINTER :: map_bend_kind(:)
250 TYPE(
bend_type),
DIMENSION(:),
POINTER :: bend_list
254 CALL timeset(routinen, handle2)
257 WRITE (unit=iw, fmt=
"(/,T2,A)") &
258 "FORCEFIELD| Checking for unique bend terms"
261 DO i = 1,
SIZE(molecule_kind_set)
262 molecule_kind => molecule_kind_set(i)
264 molecule_list=molecule_list, &
266 nbend=nbend, bend_list=bend_list)
267 molecule => molecule_set(molecule_list(1))
268 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
270 ALLOCATE (map_bend_kind(nbend))
279 atm_a = bend_list(j)%a
280 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
283 atm_b = bend_list(j)%b
284 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
287 atm_c = bend_list(j)%c
288 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
293 atm_a = bend_list(k)%a
294 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
297 atm_b = bend_list(k)%b
298 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
301 atm_c = bend_list(k)%c
302 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
305 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
306 ((name_atm_b) == (name_atm_b2)) .AND. &
307 ((name_atm_c) == (name_atm_c2))) .OR. &
308 (((name_atm_a) == (name_atm_c2)) .AND. &
309 ((name_atm_b) == (name_atm_b2)) .AND. &
310 ((name_atm_c) == (name_atm_a2))))
THEN
312 map_bend_kind(j) = map_bend_kind(k)
316 IF (.NOT. found)
THEN
317 counter = counter + 1
318 map_bend_kind(j) = counter
322 NULLIFY (bend_kind_set)
325 bend_list(j)%bend_kind => bend_kind_set(map_bend_kind(j))
328 bend_kind_set=bend_kind_set, bend_list=bend_list)
329 DEALLOCATE (map_bend_kind)
333 CALL timestop(handle2)
349 INTEGER,
INTENT(IN) :: iw
351 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_ub'
353 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
354 name_atm_b2, name_atm_c, name_atm_c2
355 INTEGER :: atm_a, atm_b, atm_c, counter, first, &
356 handle2, i, j, k, last, natom, nub
357 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
358 INTEGER,
POINTER :: map_ub_kind(:)
363 TYPE(
ub_kind_type),
DIMENSION(:),
POINTER :: ub_kind_set
364 TYPE(
ub_type),
DIMENSION(:),
POINTER :: ub_list
366 CALL timeset(routinen, handle2)
369 WRITE (unit=iw, fmt=
"(/,T2,A)") &
370 "FORCEFIELD| Checking for unique Urey-Bradley terms"
373 DO i = 1,
SIZE(molecule_kind_set)
374 molecule_kind => molecule_kind_set(i)
376 molecule_list=molecule_list, &
378 nub=nub, ub_list=ub_list)
379 molecule => molecule_set(molecule_list(1))
380 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
382 ALLOCATE (map_ub_kind(nub))
386 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
390 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
394 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
400 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
404 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
408 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
411 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
412 ((name_atm_b) == (name_atm_b2)) .AND. &
413 ((name_atm_c) == (name_atm_c2))) .OR. &
414 (((name_atm_a) == (name_atm_c2)) .AND. &
415 ((name_atm_b) == (name_atm_b2)) .AND. &
416 ((name_atm_c) == (name_atm_a2))))
THEN
418 map_ub_kind(j) = map_ub_kind(k)
422 IF (.NOT. found)
THEN
423 counter = counter + 1
424 map_ub_kind(j) = counter
429 ub_list(j)%ub_kind => ub_kind_set(map_ub_kind(j))
432 ub_kind_set=ub_kind_set, ub_list=ub_list)
433 DEALLOCATE (map_ub_kind)
436 CALL timestop(handle2)
454 INTEGER,
INTENT(IN) :: iw
456 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_tors'
458 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
459 name_atm_b2, name_atm_c, name_atm_c2, &
460 name_atm_d, name_atm_d2
461 INTEGER :: atm_a, atm_b, atm_c, atm_d, counter, &
462 first, handle2, i, j, k, last, natom, &
464 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
465 INTEGER,
POINTER :: map_torsion_kind(:)
466 LOGICAL :: chk_reverse, found
471 TYPE(
torsion_type),
DIMENSION(:),
POINTER :: torsion_list
473 CALL timeset(routinen, handle2)
476 WRITE (unit=iw, fmt=
"(/,T2,A)") &
477 "FORCEFIELD| Checking for unique torsion terms"
484 DO i = 1,
SIZE(molecule_kind_set)
485 molecule_kind => molecule_kind_set(i)
487 molecule_list=molecule_list, &
489 ntorsion=ntorsion, torsion_list=torsion_list)
490 molecule => molecule_set(molecule_list(1))
491 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
492 IF (ntorsion > 0)
THEN
493 ALLOCATE (map_torsion_kind(ntorsion))
497 map_torsion_kind(j) = j
502 atm_a = torsion_list(j)%a
503 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
506 atm_b = torsion_list(j)%b
507 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
510 atm_c = torsion_list(j)%c
511 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
514 atm_d = torsion_list(j)%d
515 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
520 atm_a = torsion_list(k)%a
521 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
524 atm_b = torsion_list(k)%b
525 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
528 atm_c = torsion_list(k)%c
529 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
532 atm_d = torsion_list(k)%d
533 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
536 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
537 ((name_atm_b) == (name_atm_b2)) .AND. &
538 ((name_atm_c) == (name_atm_c2)) .AND. &
539 ((name_atm_d) == (name_atm_d2))) .OR. &
541 ((name_atm_a) == (name_atm_d2)) .AND. &
542 ((name_atm_b) == (name_atm_c2)) .AND. &
543 ((name_atm_c) == (name_atm_b2)) .AND. &
544 ((name_atm_d) == (name_atm_a2))))
THEN
546 map_torsion_kind(j) = map_torsion_kind(k)
550 IF (.NOT. found)
THEN
551 counter = counter + 1
552 map_torsion_kind(j) = counter
556 NULLIFY (torsion_kind_set)
559 torsion_list(j)%torsion_kind => torsion_kind_set(map_torsion_kind(j))
562 torsion_kind_set=torsion_kind_set, torsion_list=torsion_list)
563 DEALLOCATE (map_torsion_kind)
567 CALL timestop(handle2)
585 INTEGER,
INTENT(IN) :: iw
587 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_impr'
589 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
590 name_atm_b2, name_atm_c, name_atm_c2, &
591 name_atm_d, name_atm_d2
592 INTEGER :: atm_a, atm_b, atm_c, atm_d, counter, &
593 first, handle2, i, j, k, last, natom, &
595 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
596 INTEGER,
POINTER :: map_impr_kind(:)
600 TYPE(
impr_type),
DIMENSION(:),
POINTER :: impr_list
604 CALL timeset(routinen, handle2)
607 WRITE (unit=iw, fmt=
"(/,T2,A)") &
608 "FORCEFIELD| Checking for unique improper terms"
611 DO i = 1,
SIZE(molecule_kind_set)
612 molecule_kind => molecule_kind_set(i)
614 molecule_list=molecule_list, &
616 nimpr=nimpr, impr_list=impr_list)
617 molecule => molecule_set(molecule_list(1))
619 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
622 ALLOCATE (map_impr_kind(nimpr))
631 atm_a = impr_list(j)%a
632 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
635 atm_b = impr_list(j)%b
636 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
639 atm_c = impr_list(j)%c
640 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
643 atm_d = impr_list(j)%d
644 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
649 atm_a = impr_list(k)%a
650 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
653 atm_b = impr_list(k)%b
654 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
657 atm_c = impr_list(k)%c
658 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
661 atm_d = impr_list(k)%d
662 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
665 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
666 ((name_atm_b) == (name_atm_b2)) .AND. &
667 ((name_atm_c) == (name_atm_c2)) .AND. &
668 ((name_atm_d) == (name_atm_d2))) .OR. &
669 (((name_atm_a) == (name_atm_a2)) .AND. &
670 ((name_atm_b) == (name_atm_b2)) .AND. &
671 ((name_atm_c) == (name_atm_d2)) .AND. &
672 ((name_atm_d) == (name_atm_c2))))
THEN
674 map_impr_kind(j) = map_impr_kind(k)
678 IF (.NOT. found)
THEN
679 counter = counter + 1
680 map_impr_kind(j) = counter
684 NULLIFY (impr_kind_set)
687 impr_list(j)%impr_kind => impr_kind_set(map_impr_kind(j))
690 impr_kind_set=impr_kind_set, impr_list=impr_list)
691 DEALLOCATE (map_impr_kind)
694 CALL timestop(handle2)
714 INTEGER,
INTENT(IN) :: iw
716 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_opbend'
718 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
719 name_atm_b2, name_atm_c, name_atm_c2, &
720 name_atm_d, name_atm_d2
721 INTEGER :: atm_a, atm_b, atm_c, atm_d, counter, &
722 first, handle2, i, j, k, last, natom, &
724 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
725 INTEGER,
POINTER :: map_opbend_kind(:)
731 TYPE(
opbend_type),
DIMENSION(:),
POINTER :: opbend_list
733 CALL timeset(routinen, handle2)
736 WRITE (unit=iw, fmt=
"(/,T2,A)") &
737 "FORCEFIELD| Checking for unique out-of-plane bend terms"
740 DO i = 1,
SIZE(molecule_kind_set)
741 molecule_kind => molecule_kind_set(i)
743 molecule_list=molecule_list, &
745 nopbend=nopbend, opbend_list=opbend_list)
746 molecule => molecule_set(molecule_list(1))
747 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
748 IF (nopbend > 0)
THEN
749 ALLOCATE (map_opbend_kind(nopbend))
753 map_opbend_kind(j) = j
758 atm_a = opbend_list(j)%a
759 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
762 atm_b = opbend_list(j)%b
763 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
766 atm_c = opbend_list(j)%c
767 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
770 atm_d = opbend_list(j)%d
771 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
776 atm_a = opbend_list(k)%a
777 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
780 atm_b = opbend_list(k)%b
781 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
784 atm_c = opbend_list(k)%c
785 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
788 atm_d = opbend_list(k)%d
789 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
792 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
793 ((name_atm_b) == (name_atm_b2)) .AND. &
794 ((name_atm_c) == (name_atm_c2)) .AND. &
795 ((name_atm_d) == (name_atm_d2))) .OR. &
796 (((name_atm_a) == (name_atm_a2)) .AND. &
797 ((name_atm_b) == (name_atm_c2)) .AND. &
798 ((name_atm_c) == (name_atm_b2)) .AND. &
799 ((name_atm_d) == (name_atm_d2))))
THEN
801 map_opbend_kind(j) = map_opbend_kind(k)
805 IF (.NOT. found)
THEN
806 counter = counter + 1
807 map_opbend_kind(j) = counter
811 NULLIFY (opbend_kind_set)
814 opbend_list(j)%opbend_kind => opbend_kind_set(map_opbend_kind(j))
817 opbend_kind_set=opbend_kind_set, opbend_list=opbend_list)
818 DEALLOCATE (map_opbend_kind)
821 CALL timestop(handle2)
839 chm_info, inp_info, gro_info, amb_info, iw)
845 CHARACTER(LEN=default_string_length), &
846 DIMENSION(:),
POINTER :: ainfo
851 INTEGER,
INTENT(IN) :: iw
853 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_bond'
855 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b
856 INTEGER :: atm_a, atm_b, first, handle2, i, itype, &
857 j, k, last, natom, nbond
858 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
859 LOGICAL :: found, only_qm
861 TYPE(
bond_type),
DIMENSION(:),
POINTER :: bond_list
865 CALL timeset(routinen, handle2)
868 WRITE (unit=iw, fmt=
"(/,T2,A)") &
869 "FORCEFIELD| Checking for bond terms"
872 DO i = 1,
SIZE(molecule_kind_set)
873 molecule_kind => molecule_kind_set(i)
875 molecule_list=molecule_list, &
877 nbond=nbond, bond_list=bond_list)
878 molecule => molecule_set(molecule_list(1))
879 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
881 atm_a = bond_list(j)%a
882 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
885 atm_b = bond_list(j)%b
886 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
895 IF (
ASSOCIATED(gro_info%bond_k))
THEN
896 k =
SIZE(gro_info%bond_k)
897 itype = bond_list(j)%itype
899 bond_list(j)%bond_kind%k(1) = gro_info%bond_k(itype)
900 bond_list(j)%bond_kind%r0 = gro_info%bond_r0(itype)
903 bond_list(j)%bond_kind%k(1) = gro_info%solvent_k(itype)
904 bond_list(j)%bond_kind%r0 = gro_info%solvent_r0(itype)
906 bond_list(j)%bond_kind%id_type = gro_info%ff_gromos_type
907 bond_list(j)%id_type = gro_info%ff_gromos_type
912 IF (
ASSOCIATED(chm_info%bond_a))
THEN
913 DO k = 1,
SIZE(chm_info%bond_a)
914 IF ((((chm_info%bond_a(k)) == (name_atm_a)) .AND. &
915 ((chm_info%bond_b(k)) == (name_atm_b))) .OR. &
916 (((chm_info%bond_a(k)) == (name_atm_b)) .AND. &
917 ((chm_info%bond_b(k)) == (name_atm_a))))
THEN
919 bond_list(j)%bond_kind%k(1) = chm_info%bond_k(k)
920 bond_list(j)%bond_kind%r0 = chm_info%bond_r0(k)
921 CALL issue_duplications(found,
"Bond", name_atm_a, name_atm_b)
929 IF (
ASSOCIATED(amb_info%bond_a))
THEN
930 DO k = 1,
SIZE(amb_info%bond_a)
931 IF ((((amb_info%bond_a(k)) == (name_atm_a)) .AND. &
932 ((amb_info%bond_b(k)) == (name_atm_b))) .OR. &
933 (((amb_info%bond_a(k)) == (name_atm_b)) .AND. &
934 ((amb_info%bond_b(k)) == (name_atm_a))))
THEN
936 bond_list(j)%bond_kind%k(1) = amb_info%bond_k(k)
937 bond_list(j)%bond_kind%r0 = amb_info%bond_r0(k)
938 CALL issue_duplications(found,
"Bond", name_atm_a, name_atm_b)
946 IF (
ASSOCIATED(inp_info%bond_a))
THEN
947 DO k = 1,
SIZE(inp_info%bond_a)
948 IF ((((inp_info%bond_a(k)) == (name_atm_a)) .AND. &
949 ((inp_info%bond_b(k)) == (name_atm_b))) .OR. &
950 (((inp_info%bond_a(k)) == (name_atm_b)) .AND. &
951 ((inp_info%bond_b(k)) == (name_atm_a))))
THEN
952 bond_list(j)%bond_kind%id_type = inp_info%bond_kind(k)
953 bond_list(j)%bond_kind%k(:) = inp_info%bond_k(:, k)
954 bond_list(j)%bond_kind%r0 = inp_info%bond_r0(k)
955 bond_list(j)%bond_kind%cs = inp_info%bond_cs(k)
956 CALL issue_duplications(found,
"Bond", name_atm_a, name_atm_b)
963 IF (.NOT. found)
CALL store_ff_missing_par(atm1=trim(name_atm_a), &
964 atm2=trim(name_atm_b), &
980 CALL timestop(handle2)
998 chm_info, inp_info, gro_info, amb_info, iw)
1004 CHARACTER(LEN=default_string_length), &
1005 DIMENSION(:),
POINTER :: ainfo
1010 INTEGER,
INTENT(IN) :: iw
1012 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_bend'
1014 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c
1015 INTEGER :: atm_a, atm_b, atm_c, first, handle2, i, &
1016 itype, j, k, l, last, natom, nbend
1017 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1018 LOGICAL :: found, only_qm
1020 TYPE(
bend_type),
DIMENSION(:),
POINTER :: bend_list
1024 CALL timeset(routinen, handle2)
1027 WRITE (unit=iw, fmt=
"(/,T2,A)") &
1028 "FORCEFIELD| Checking for bend terms"
1031 DO i = 1,
SIZE(molecule_kind_set)
1032 molecule_kind => molecule_kind_set(i)
1034 molecule_list=molecule_list, &
1036 nbend=nbend, bend_list=bend_list)
1037 molecule => molecule_set(molecule_list(1))
1038 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1040 atm_a = bend_list(j)%a
1041 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1044 atm_b = bend_list(j)%b
1045 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1048 atm_c = bend_list(j)%c
1049 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1059 IF (
ASSOCIATED(gro_info%bend_k))
THEN
1060 k =
SIZE(gro_info%bend_k)
1061 itype = bend_list(j)%itype
1063 bend_list(j)%bend_kind%k = gro_info%bend_k(itype)
1064 bend_list(j)%bend_kind%theta0 = gro_info%bend_theta0(itype)
1066 bend_list(j)%bend_kind%k = gro_info%bend_k(itype/k)
1067 bend_list(j)%bend_kind%theta0 = gro_info%bend_theta0(itype/k)
1069 bend_list(j)%bend_kind%id_type = gro_info%ff_gromos_type
1070 bend_list(j)%id_type = gro_info%ff_gromos_type
1075 IF (
ASSOCIATED(chm_info%bend_a))
THEN
1076 DO k = 1,
SIZE(chm_info%bend_a)
1077 IF ((((chm_info%bend_a(k)) == (name_atm_a)) .AND. &
1078 ((chm_info%bend_b(k)) == (name_atm_b)) .AND. &
1079 ((chm_info%bend_c(k)) == (name_atm_c))) .OR. &
1080 (((chm_info%bend_a(k)) == (name_atm_c)) .AND. &
1081 ((chm_info%bend_b(k)) == (name_atm_b)) .AND. &
1082 ((chm_info%bend_c(k)) == (name_atm_a))))
THEN
1084 bend_list(j)%bend_kind%k = chm_info%bend_k(k)
1085 bend_list(j)%bend_kind%theta0 = chm_info%bend_theta0(k)
1086 CALL issue_duplications(found,
"Bend", name_atm_a, name_atm_b, &
1095 IF (
ASSOCIATED(amb_info%bend_a))
THEN
1096 DO k = 1,
SIZE(amb_info%bend_a)
1097 IF ((((amb_info%bend_a(k)) == (name_atm_a)) .AND. &
1098 ((amb_info%bend_b(k)) == (name_atm_b)) .AND. &
1099 ((amb_info%bend_c(k)) == (name_atm_c))) .OR. &
1100 (((amb_info%bend_a(k)) == (name_atm_c)) .AND. &
1101 ((amb_info%bend_b(k)) == (name_atm_b)) .AND. &
1102 ((amb_info%bend_c(k)) == (name_atm_a))))
THEN
1104 bend_list(j)%bend_kind%k = amb_info%bend_k(k)
1105 bend_list(j)%bend_kind%theta0 = amb_info%bend_theta0(k)
1106 CALL issue_duplications(found,
"Bend", name_atm_a, name_atm_b, &
1115 IF (
ASSOCIATED(inp_info%bend_a))
THEN
1116 DO k = 1,
SIZE(inp_info%bend_a)
1117 IF ((((inp_info%bend_a(k)) == (name_atm_a)) .AND. &
1118 ((inp_info%bend_b(k)) == (name_atm_b)) .AND. &
1119 ((inp_info%bend_c(k)) == (name_atm_c))) .OR. &
1120 (((inp_info%bend_a(k)) == (name_atm_c)) .AND. &
1121 ((inp_info%bend_b(k)) == (name_atm_b)) .AND. &
1122 ((inp_info%bend_c(k)) == (name_atm_a))))
THEN
1123 bend_list(j)%bend_kind%id_type = inp_info%bend_kind(k)
1124 bend_list(j)%bend_kind%k = inp_info%bend_k(k)
1125 bend_list(j)%bend_kind%theta0 = inp_info%bend_theta0(k)
1126 bend_list(j)%bend_kind%cb = inp_info%bend_cb(k)
1127 bend_list(j)%bend_kind%r012 = inp_info%bend_r012(k)
1128 bend_list(j)%bend_kind%r032 = inp_info%bend_r032(k)
1129 bend_list(j)%bend_kind%kbs12 = inp_info%bend_kbs12(k)
1130 bend_list(j)%bend_kind%kbs32 = inp_info%bend_kbs32(k)
1131 bend_list(j)%bend_kind%kss = inp_info%bend_kss(k)
1132 bend_list(j)%bend_kind%legendre%order = inp_info%bend_legendre(k)%order
1133 IF (bend_list(j)%bend_kind%legendre%order /= 0)
THEN
1134 IF (
ASSOCIATED(bend_list(j)%bend_kind%legendre%coeffs))
THEN
1135 DEALLOCATE (bend_list(j)%bend_kind%legendre%coeffs)
1137 ALLOCATE (bend_list(j)%bend_kind%legendre%coeffs(bend_list(j)%bend_kind%legendre%order))
1138 DO l = 1, bend_list(j)%bend_kind%legendre%order
1139 bend_list(j)%bend_kind%legendre%coeffs(l) = inp_info%bend_legendre(k)%coeffs(l)
1142 CALL issue_duplications(found,
"Bend", name_atm_a, name_atm_b, &
1150 IF (.NOT. found)
CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1151 atm2=trim(name_atm_b), &
1152 atm3=trim(name_atm_c), &
1154 type_name=
"Angle", &
1163 bend_list=bend_list)
1165 CALL timestop(handle2)
1180 Ainfo, chm_info, inp_info, iw)
1185 CHARACTER(LEN=default_string_length), &
1186 DIMENSION(:),
POINTER :: ainfo
1191 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_ub'
1193 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c
1194 INTEGER :: atm_a, atm_b, atm_c, first, handle2, i, &
1195 j, k, last, natom, nub
1196 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1197 LOGICAL :: found, only_qm
1201 TYPE(
ub_type),
DIMENSION(:),
POINTER :: ub_list
1203 CALL timeset(routinen, handle2)
1206 WRITE (unit=iw, fmt=
"(/,T2,A)") &
1207 "FORCEFIELD| Checking for Urey-Bradley (UB) terms"
1210 DO i = 1,
SIZE(molecule_kind_set)
1211 molecule_kind => molecule_kind_set(i)
1213 molecule_list=molecule_list, &
1215 nub=nub, ub_list=ub_list)
1216 molecule => molecule_set(molecule_list(1))
1217 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1219 atm_a = ub_list(j)%a
1220 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1223 atm_b = ub_list(j)%b
1224 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1227 atm_c = ub_list(j)%c
1228 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1241 IF (
ASSOCIATED(chm_info%ub_a))
THEN
1242 DO k = 1,
SIZE(chm_info%ub_a)
1243 IF ((((chm_info%ub_a(k)) == (name_atm_a)) .AND. &
1244 ((chm_info%ub_b(k)) == (name_atm_b)) .AND. &
1245 ((chm_info%ub_c(k)) == (name_atm_c))) .OR. &
1246 (((chm_info%ub_a(k)) == (name_atm_c)) .AND. &
1247 ((chm_info%ub_b(k)) == (name_atm_b)) .AND. &
1248 ((chm_info%ub_c(k)) == (name_atm_a))))
THEN
1250 ub_list(j)%ub_kind%k(1) = chm_info%ub_k(k)
1251 ub_list(j)%ub_kind%r0 = chm_info%ub_r0(k)
1253 WRITE (unit=iw, fmt=
"(T2,A)") &
1254 "FORCEFIELD| Found Urey-Bradley term (CHARMM) for the atomic kinds "// &
1255 trim(name_atm_a)//
", "//trim(name_atm_b)//
" and "//trim(name_atm_c)
1257 CALL issue_duplications(found,
"Urey-Bradley", name_atm_a, &
1258 name_atm_b, name_atm_c)
1269 IF (
ASSOCIATED(inp_info%ub_a))
THEN
1270 DO k = 1,
SIZE(inp_info%ub_a)
1271 IF ((((inp_info%ub_a(k)) == (name_atm_a)) .AND. &
1272 ((inp_info%ub_b(k)) == (name_atm_b)) .AND. &
1273 ((inp_info%ub_c(k)) == (name_atm_c))) .OR. &
1274 (((inp_info%ub_a(k)) == (name_atm_c)) .AND. &
1275 ((inp_info%ub_b(k)) == (name_atm_b)) .AND. &
1276 ((inp_info%ub_c(k)) == (name_atm_a))))
THEN
1277 ub_list(j)%ub_kind%id_type = inp_info%ub_kind(k)
1278 ub_list(j)%ub_kind%k(:) = inp_info%ub_k(:, k)
1279 ub_list(j)%ub_kind%r0 = inp_info%ub_r0(k)
1281 WRITE (unit=iw, fmt=
"(T2,A)") &
1282 "FORCEFIELD| Found Urey-Bradley term (input) for the atomic kinds "// &
1283 trim(name_atm_a)//
", "//trim(name_atm_b)//
" and "//trim(name_atm_c)
1285 CALL issue_duplications(found,
"Urey-Bradley", name_atm_a, &
1286 name_atm_b, name_atm_c)
1293 IF (.NOT. found)
THEN
1294 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1295 atm2=trim(name_atm_b), &
1296 atm3=trim(name_atm_c), &
1297 type_name=
"Urey-Bradley", &
1301 ub_list(j)%ub_kind%k = 0.0_dp
1302 ub_list(j)%ub_kind%r0 = 0.0_dp
1317 CALL timestop(handle2)
1334 Ainfo, chm_info, inp_info, gro_info, amb_info, iw)
1339 CHARACTER(LEN=default_string_length), &
1340 DIMENSION(:),
POINTER :: ainfo
1345 INTEGER,
INTENT(IN) :: iw
1347 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_tors'
1349 CHARACTER(LEN=default_string_length) :: ldum, molecule_name, name_atm_a, &
1350 name_atm_b, name_atm_c, name_atm_d
1351 INTEGER :: atm_a, atm_b, atm_c, atm_d, first, &
1352 handle2, i, imul, itype, j, k, k_end, &
1353 k_start, last, natom, ntorsion, &
1355 INTEGER,
DIMENSION(4) :: glob_atm_id
1356 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1357 LOGICAL :: found, only_qm
1361 TYPE(
torsion_type),
DIMENSION(:),
POINTER :: torsion_list
1363 CALL timeset(routinen, handle2)
1366 WRITE (unit=iw, fmt=
"(/,T2,A)") &
1367 "FORCEFIELD| Checking for torsion terms"
1370 DO i = 1,
SIZE(molecule_kind_set)
1371 molecule_kind => molecule_kind_set(i)
1373 molecule_list=molecule_list, &
1374 name=molecule_name, &
1376 ntorsion=ntorsion, &
1377 torsion_list=torsion_list)
1378 molecule => molecule_set(molecule_list(1))
1383 IF (torsion_list(j)%torsion_kind%id_type ==
do_ff_undef)
THEN
1384 atm_a = torsion_list(j)%a
1385 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1388 atm_b = torsion_list(j)%b
1389 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1392 atm_c = torsion_list(j)%c
1393 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1396 atm_d = torsion_list(j)%d
1397 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
1408 IF (
ASSOCIATED(gro_info%torsion_k))
THEN
1409 k =
SIZE(gro_info%torsion_k)
1410 itype = torsion_list(j)%itype
1412 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, 1)
1413 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, 1)
1414 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, 1)
1415 torsion_list(j)%torsion_kind%nmul = 1
1416 torsion_list(j)%torsion_kind%m(1) = gro_info%torsion_m(itype)
1417 torsion_list(j)%torsion_kind%k(1) = gro_info%torsion_k(itype)
1418 torsion_list(j)%torsion_kind%phi0(1) = gro_info%torsion_phi0(itype)
1420 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, 1)
1421 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, 1)
1422 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, 1)
1423 torsion_list(j)%torsion_kind%nmul = 1
1424 torsion_list(j)%torsion_kind%m(1) = gro_info%torsion_m(itype/k)
1425 torsion_list(j)%torsion_kind%k(1) = gro_info%torsion_k(itype/k)
1426 torsion_list(j)%torsion_kind%phi0(1) = gro_info%torsion_phi0(itype/k)
1428 torsion_list(j)%torsion_kind%id_type = gro_info%ff_gromos_type
1429 torsion_list(j)%id_type = gro_info%ff_gromos_type
1431 imul = torsion_list(j)%torsion_kind%nmul
1435 IF (
ASSOCIATED(chm_info%torsion_a))
THEN
1436 DO k = 1,
SIZE(chm_info%torsion_a)
1437 IF ((((chm_info%torsion_a(k)) == (name_atm_a)) .AND. &
1438 ((chm_info%torsion_b(k)) == (name_atm_b)) .AND. &
1439 ((chm_info%torsion_c(k)) == (name_atm_c)) .AND. &
1440 ((chm_info%torsion_d(k)) == (name_atm_d))) .OR. &
1441 (((chm_info%torsion_a(k)) == (name_atm_d)) .AND. &
1442 ((chm_info%torsion_b(k)) == (name_atm_c)) .AND. &
1443 ((chm_info%torsion_c(k)) == (name_atm_b)) .AND. &
1444 ((chm_info%torsion_d(k)) == (name_atm_a))))
THEN
1445 imul = torsion_list(j)%torsion_kind%nmul + 1
1446 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1447 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1448 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1450 torsion_list(j)%torsion_kind%k(imul) = chm_info%torsion_k(k)
1451 torsion_list(j)%torsion_kind%m(imul) = chm_info%torsion_m(k)
1452 torsion_list(j)%torsion_kind%phi0(imul) = chm_info%torsion_phi0(k)
1453 torsion_list(j)%torsion_kind%nmul = imul
1458 IF (.NOT. found)
THEN
1459 DO k = 1,
SIZE(chm_info%torsion_a)
1460 IF ((((chm_info%torsion_a(k)) == (
"X")) .AND. &
1461 ((chm_info%torsion_b(k)) == (name_atm_b)) .AND. &
1462 ((chm_info%torsion_c(k)) == (name_atm_c)) .AND. &
1463 ((chm_info%torsion_d(k)) == (
"X"))) .OR. &
1464 (((chm_info%torsion_a(k)) == (
"X")) .AND. &
1465 ((chm_info%torsion_b(k)) == (name_atm_c)) .AND. &
1466 ((chm_info%torsion_c(k)) == (name_atm_b)) .AND. &
1467 ((chm_info%torsion_d(k)) == (
"X"))))
THEN
1468 imul = torsion_list(j)%torsion_kind%nmul + 1
1469 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1470 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1471 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1473 torsion_list(j)%torsion_kind%k(imul) = chm_info%torsion_k(k)
1474 torsion_list(j)%torsion_kind%m(imul) = chm_info%torsion_m(k)
1475 torsion_list(j)%torsion_kind%phi0(imul) = chm_info%torsion_phi0(k)
1476 torsion_list(j)%torsion_kind%nmul = imul
1486 IF (
ASSOCIATED(amb_info%torsion_a))
THEN
1488 glob_atm_id(1) = atm_a + first - 1
1489 glob_atm_id(2) = atm_b + first - 1
1490 glob_atm_id(3) = atm_c + first - 1
1491 glob_atm_id(4) = atm_d + first - 1
1496 k_start = bsearch_leftmost_2d(amb_info%raw_torsion_id, glob_atm_id(1))
1497 k_end = ubound(amb_info%raw_torsion_id, dim=2)
1500 IF (k_start /= 0)
THEN
1502 DO k = k_start, k_end
1503 IF (glob_atm_id(1) < amb_info%raw_torsion_id(1, k))
EXIT
1504 IF (any((glob_atm_id - amb_info%raw_torsion_id(1:4, k)) /= 0)) cycle
1506 raw_parm_id = amb_info%raw_torsion_id(5, k)
1507 imul = torsion_list(j)%torsion_kind%nmul + 1
1508 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1509 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1510 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1511 torsion_list(j)%torsion_kind%id_type =
do_ff_amber
1512 torsion_list(j)%torsion_kind%k(imul) = amb_info%raw_torsion_k(raw_parm_id)
1513 torsion_list(j)%torsion_kind%m(imul) = nint(amb_info%raw_torsion_m(raw_parm_id))
1514 torsion_list(j)%torsion_kind%phi0(imul) = amb_info%raw_torsion_phi0(raw_parm_id)
1515 torsion_list(j)%torsion_kind%nmul = imul
1524 IF (
ASSOCIATED(inp_info%torsion_a))
THEN
1525 DO k = 1,
SIZE(inp_info%torsion_a)
1526 IF ((((inp_info%torsion_a(k)) == (name_atm_a)) .AND. &
1527 ((inp_info%torsion_b(k)) == (name_atm_b)) .AND. &
1528 ((inp_info%torsion_c(k)) == (name_atm_c)) .AND. &
1529 ((inp_info%torsion_d(k)) == (name_atm_d))) .OR. &
1530 (((inp_info%torsion_a(k)) == (name_atm_d)) .AND. &
1531 ((inp_info%torsion_b(k)) == (name_atm_c)) .AND. &
1532 ((inp_info%torsion_c(k)) == (name_atm_b)) .AND. &
1533 ((inp_info%torsion_d(k)) == (name_atm_a))))
THEN
1534 imul = torsion_list(j)%torsion_kind%nmul + 1
1535 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1536 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1537 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1538 torsion_list(j)%torsion_kind%id_type = inp_info%torsion_kind(k)
1539 torsion_list(j)%torsion_kind%k(imul) = inp_info%torsion_k(k)
1540 torsion_list(j)%torsion_kind%m(imul) = inp_info%torsion_m(k)
1541 torsion_list(j)%torsion_kind%phi0(imul) = inp_info%torsion_phi0(k)
1542 torsion_list(j)%torsion_kind%nmul = imul
1552 WRITE (unit=iw, fmt=
"(T2,A)") &
1553 "FORCEFIELD| No torsion term found"
1554 ELSE IF (imul == 1)
THEN
1555 WRITE (unit=iw, fmt=
"(T2,A)") &
1556 "FORCEFIELD| Found torsion term for the atomic kinds "// &
1557 trim(name_atm_a)//
", "//trim(name_atm_b)// &
1558 ", "//trim(name_atm_c)// &
1559 " and "//trim(name_atm_d)
1561 WRITE (unit=iw, fmt=
"(T2,A)") &
1562 "FORCEFIELD| Found multiple ("//trim(ldum)// &
1563 ") torsion terms for the atomic kinds "// &
1564 trim(name_atm_a)//
", "//trim(name_atm_b)// &
1565 ", "//trim(name_atm_c)// &
1566 " and "//trim(name_atm_d)
1570 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1571 atm2=trim(name_atm_b), &
1572 atm3=trim(name_atm_c), &
1573 atm4=trim(name_atm_d), &
1574 type_name=
"Torsion", &
1576 torsion_list(j)%torsion_kind%id_type =
do_ff_undef
1583 WRITE (unit=iw, fmt=
"(T2,A,I0,4(A,I0))") &
1584 "FORCEFIELD| Torsion ", j,
" for molecule kind "//trim(molecule_name)// &
1585 trim(name_atm_a)// &
1586 "-"//trim(name_atm_b)//
"-"//trim(name_atm_c)//
"-"// &
1587 trim(name_atm_d)//
" (", torsion_list(j)%a,
", ", &
1588 torsion_list(j)%b,
", ", torsion_list(j)%c,
", ", &
1591 torsion_list(j)%torsion_kind%id_type =
do_ff_undef
1600 torsion_list=torsion_list)
1604 CALL timestop(handle2)
1620 Ainfo, chm_info, inp_info, gro_info, iw)
1625 CHARACTER(LEN=default_string_length), &
1626 DIMENSION(:),
POINTER :: ainfo
1630 INTEGER,
INTENT(IN) :: iw
1632 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_impr'
1634 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c, &
1636 INTEGER :: atm_a, atm_b, atm_c, atm_d, first, &
1637 handle2, i, itype, j, k, last, natom, &
1639 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1640 LOGICAL :: found, only_qm
1642 TYPE(
impr_type),
DIMENSION(:),
POINTER :: impr_list
1646 CALL timeset(routinen, handle2)
1649 WRITE (unit=iw, fmt=
"(/,T2,A)") &
1650 "FORCEFIELD| Checking for improper terms"
1653 DO i = 1,
SIZE(molecule_kind_set)
1655 molecule_kind => molecule_kind_set(i)
1657 molecule_list=molecule_list, &
1660 impr_list=impr_list)
1662 molecule => molecule_set(molecule_list(1))
1663 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1666 atm_a = impr_list(j)%a
1667 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1670 atm_b = impr_list(j)%b
1671 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1674 atm_c = impr_list(j)%c
1675 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1678 atm_d = impr_list(j)%d
1679 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
1690 IF (
ASSOCIATED(gro_info%impr_k))
THEN
1691 k =
SIZE(gro_info%impr_k)
1692 itype = impr_list(j)%itype
1694 impr_list(j)%impr_kind%k = gro_info%impr_k(itype)
1695 impr_list(j)%impr_kind%phi0 = gro_info%impr_phi0(itype)
1697 impr_list(j)%impr_kind%k = gro_info%impr_k(itype)
1698 impr_list(j)%impr_kind%phi0 = gro_info%impr_phi0(itype)
1701 impr_list(j)%impr_kind%id_type = gro_info%ff_gromos_type
1702 impr_list(j)%id_type = gro_info%ff_gromos_type
1706 IF (
ASSOCIATED(chm_info%impr_a))
THEN
1707 DO k = 1,
SIZE(chm_info%impr_a)
1708 IF ((((chm_info%impr_a(k)) == (name_atm_a)) .AND. &
1709 ((chm_info%impr_b(k)) == (name_atm_b)) .AND. &
1710 ((chm_info%impr_c(k)) == (name_atm_c)) .AND. &
1711 ((chm_info%impr_d(k)) == (name_atm_d))) .OR. &
1712 (((chm_info%impr_a(k)) == (name_atm_d)) .AND. &
1713 ((chm_info%impr_b(k)) == (name_atm_c)) .AND. &
1714 ((chm_info%impr_c(k)) == (name_atm_b)) .AND. &
1715 ((chm_info%impr_d(k)) == (name_atm_a))))
THEN
1717 impr_list(j)%impr_kind%k = chm_info%impr_k(k)
1718 impr_list(j)%impr_kind%phi0 = chm_info%impr_phi0(k)
1719 CALL issue_duplications(found,
"Impropers", name_atm_a, name_atm_b, &
1720 name_atm_c, name_atm_d)
1725 IF (.NOT. found)
THEN
1726 DO k = 1,
SIZE(chm_info%impr_a)
1727 IF ((((chm_info%impr_a(k)) == (name_atm_a)) .AND. &
1728 ((chm_info%impr_b(k)) == (
"X")) .AND. &
1729 ((chm_info%impr_c(k)) == (
"X")) .AND. &
1730 ((chm_info%impr_d(k)) == (name_atm_d))) .OR. &
1731 (((chm_info%impr_a(k)) == (name_atm_d)) .AND. &
1732 ((chm_info%impr_b(k)) == (
"X")) .AND. &
1733 ((chm_info%impr_c(k)) == (
"X")) .AND. &
1734 ((chm_info%impr_d(k)) == (name_atm_a))))
THEN
1736 impr_list(j)%impr_kind%k = chm_info%impr_k(k)
1737 impr_list(j)%impr_kind%phi0 = chm_info%impr_phi0(k)
1738 CALL issue_duplications(found,
"Impropers", name_atm_a, name_atm_b, &
1739 name_atm_c, name_atm_d)
1751 IF (
ASSOCIATED(inp_info%impr_a))
THEN
1752 DO k = 1,
SIZE(inp_info%impr_a)
1753 IF (((inp_info%impr_a(k)) == (name_atm_a)) .AND. &
1754 ((inp_info%impr_b(k)) == (name_atm_b)) .AND. &
1755 ((((inp_info%impr_c(k)) == (name_atm_c)) .AND. &
1756 ((inp_info%impr_d(k)) == (name_atm_d))) .OR. &
1757 (((inp_info%impr_c(k)) == (name_atm_d)) .AND. &
1758 ((inp_info%impr_d(k)) == (name_atm_c)))))
THEN
1759 impr_list(j)%impr_kind%id_type = inp_info%impr_kind(k)
1760 impr_list(j)%impr_kind%k = inp_info%impr_k(k)
1761 IF (((inp_info%impr_c(k)) == (name_atm_c)) .AND. &
1762 ((inp_info%impr_d(k)) == (name_atm_d)))
THEN
1763 impr_list(j)%impr_kind%phi0 = inp_info%impr_phi0(k)
1765 impr_list(j)%impr_kind%phi0 = -inp_info%impr_phi0(k)
1776 CALL issue_duplications(found,
"Impropers", name_atm_a, name_atm_b, &
1777 name_atm_c, name_atm_d)
1784 IF (.NOT. found)
THEN
1785 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1786 atm2=trim(name_atm_b), &
1787 atm3=trim(name_atm_c), &
1788 atm4=trim(name_atm_d), &
1789 type_name=
"Improper", &
1791 impr_list(j)%impr_kind%k = 0.0_dp
1792 impr_list(j)%impr_kind%phi0 = 0.0_dp
1801 WRITE (unit=iw, fmt=
"(T2,A)") &
1802 "FORCEFIELD| Found improper term for "//trim(name_atm_a)// &
1803 "-"//trim(name_atm_b)//
"-"//trim(name_atm_c)//
"-"// &
1817 CALL timestop(handle2)
1839 CHARACTER(LEN=default_string_length), &
1840 DIMENSION(:),
POINTER :: ainfo
1842 INTEGER,
INTENT(IN) :: iw
1844 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_opbend'
1846 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c, &
1848 INTEGER :: atm_a, atm_b, atm_c, atm_d, first, &
1849 handle2, i, j, k, last, natom, nopbend
1850 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1851 LOGICAL :: found, only_qm
1855 TYPE(
opbend_type),
DIMENSION(:),
POINTER :: opbend_list
1857 CALL timeset(routinen, handle2)
1860 WRITE (unit=iw, fmt=
"(/,T2,A)") &
1861 "FORCEFIELD| Checking for out-of-plane bend terms"
1864 DO i = 1,
SIZE(molecule_kind_set)
1865 molecule_kind => molecule_kind_set(i)
1867 molecule_list=molecule_list, &
1869 nopbend=nopbend, opbend_list=opbend_list)
1870 molecule => molecule_set(molecule_list(1))
1872 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1874 atm_a = opbend_list(j)%a
1875 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1878 atm_b = opbend_list(j)%b
1879 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1882 atm_c = opbend_list(j)%c
1883 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1886 atm_d = opbend_list(j)%d
1887 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
1898 IF (
ASSOCIATED(inp_info%opbend_a))
THEN
1899 DO k = 1,
SIZE(inp_info%opbend_a)
1900 IF (((inp_info%opbend_a(k)) == (name_atm_a)) .AND. &
1901 ((inp_info%opbend_d(k)) == (name_atm_d)) .AND. &
1902 ((((inp_info%opbend_c(k)) == (name_atm_c)) .AND. &
1903 ((inp_info%opbend_b(k)) == (name_atm_b))) .OR. &
1904 (((inp_info%opbend_c(k)) == (name_atm_b)) .AND. &
1905 ((inp_info%opbend_b(k)) == (name_atm_c)))))
THEN
1906 opbend_list(j)%opbend_kind%id_type = inp_info%opbend_kind(k)
1907 opbend_list(j)%opbend_kind%k = inp_info%opbend_k(k)
1908 IF (((inp_info%opbend_c(k)) == (name_atm_c)) .AND. &
1909 ((inp_info%opbend_b(k)) == (name_atm_b)))
THEN
1910 opbend_list(j)%opbend_kind%phi0 = inp_info%opbend_phi0(k)
1912 opbend_list(j)%opbend_kind%phi0 = -inp_info%opbend_phi0(k)
1922 CALL issue_duplications(found,
"Out of plane bend", name_atm_a, name_atm_b, &
1923 name_atm_c, name_atm_d)
1930 IF (.NOT. found)
THEN
1931 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1932 atm2=trim(name_atm_b), &
1933 atm3=trim(name_atm_c), &
1934 atm4=trim(name_atm_d), &
1935 type_name=
"Out of plane bend", &
1937 opbend_list(j)%opbend_kind%k = 0.0_dp
1938 opbend_list(j)%opbend_kind%phi0 = 0.0_dp
1956 CALL timestop(handle2)
1973 my_qmmm, qmmm_env, inp_info, iw4)
1975 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charges
1981 INTEGER,
INTENT(IN) :: iw4
1983 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_charges'
1985 CHARACTER(LEN=default_string_length) :: atmname
1986 INTEGER :: handle, iatom, ilink, j, nval
1987 LOGICAL :: found_p, is_link_atom, is_ok, &
1988 only_manybody, only_qm
1989 REAL(kind=
dp) :: charge, charge_tot, rval, scale_factor
1995 CALL timeset(routinen, handle)
2001 IF (
ASSOCIATED(inp_info%shell_list))
THEN
2002 cpabort(
"Array of charges is not implemented for the core-shell model")
2006 cpassert(.NOT. (
ASSOCIATED(charges)))
2007 ALLOCATE (charges(
SIZE(particle_set)))
2011 cpassert(nval ==
SIZE(charges))
2018 charges(iatom) = rval
2021 atomic_kind => particle_set(iatom)%atomic_kind
2023 fist_potential=fist_potential, &
2029 IF (charge /= -huge(0.0_dp))
THEN
2030 CALL cp_warn(__location__, &
2031 "The charge for atom index ("//
cp_to_string(iatom)//
") and atom name ("// &
2032 trim(atmname)//
") was already defined. The charge associated to this kind"// &
2033 " will be set to an uninitialized value and only the atom specific charge will be used! ")
2035 charge = -huge(0.0_dp)
2038 IF (
ASSOCIATED(inp_info%nonbonded))
THEN
2039 IF (
ASSOCIATED(inp_info%nonbonded%pot))
THEN
2041 only_manybody = .true.
2043 DO j = 1,
SIZE(inp_info%nonbonded%pot)
2044 IF (atmname == inp_info%nonbonded%pot(j)%pot%at1 .OR. &
2045 atmname == inp_info%nonbonded%pot(j)%pot%at2)
THEN
2046 SELECT CASE (inp_info%nonbonded%pot(j)%pot%type(1))
2051 only_manybody = .false.
2057 IF (only_manybody .AND. found_p)
THEN
2058 charges(iatom) = 0.0_dp
2064 IF (only_qm .AND. my_qmmm)
THEN
2066 scale_factor = 0.0_dp
2067 IF (is_link_atom)
THEN
2069 DO ilink = 1,
SIZE(qmmm_env%mm_link_atoms)
2070 IF (iatom == qmmm_env%mm_link_atoms(ilink))
EXIT
2072 cpassert(ilink <=
SIZE(qmmm_env%mm_link_atoms))
2073 scale_factor = qmmm_env%fist_scale_charge_link(ilink)
2075 charges(iatom) = charges(iatom)*scale_factor
2081 charge_tot = sum(charges)
2085 WRITE (unit=iw4, fmt=
"(/,T2,A,T61,F20.10)") &
2086 "FORCEFIELD| Total charge of the classical system: ", charge_tot
2089 CALL timestop(handle)
2106 Ainfo, my_qmmm, inp_info)
2110 LOGICAL,
INTENT(INOUT) :: fatal
2111 INTEGER,
INTENT(IN) :: iw, iw4
2112 CHARACTER(LEN=default_string_length), &
2113 DIMENSION(:),
POINTER :: ainfo
2114 LOGICAL,
INTENT(IN) :: my_qmmm
2117 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_charge'
2119 CHARACTER(LEN=default_string_length) :: atmname
2120 INTEGER :: handle, i, ilink, j
2121 INTEGER,
DIMENSION(:),
POINTER :: my_atom_list
2122 LOGICAL :: found, found_p, is_link_atom, is_shell, &
2123 only_manybody, only_qm
2124 REAL(kind=
dp) :: charge, charge_tot, cs_charge, &
2129 CALL timeset(routinen, handle)
2133 DO i = 1,
SIZE(atomic_kind_set)
2134 atomic_kind => atomic_kind_set(i)
2136 fist_potential=fist_potential, &
2137 atom_list=my_atom_list, &
2145 IF (charge /= -huge(0.0_dp)) found = .true.
2148 IF (
ASSOCIATED(inp_info%charge_atm))
THEN
2149 IF (iw > 0)
WRITE (unit=iw, fmt=
"(A)")
""
2150 DO j = 1,
SIZE(inp_info%charge_atm)
2151 IF (debug_this_module)
THEN
2153 WRITE (unit=iw, fmt=
"(T2,A)") &
2154 "Checking charges for the atomic kinds "// &
2155 trim(inp_info%charge_atm(j))//
" and "//trim(atmname)
2158 IF ((inp_info%charge_atm(j)) == atmname)
THEN
2159 charge = inp_info%charge(j)
2160 CALL issue_duplications(found,
"Charge", atmname)
2168 IF (
ASSOCIATED(inp_info%shell_list))
THEN
2169 DO j = 1,
SIZE(inp_info%shell_list)
2170 IF ((inp_info%shell_list(j)%atm_name) == atmname)
THEN
2172 cs_charge = inp_info%shell_list(j)%shell%charge_core + &
2173 inp_info%shell_list(j)%shell%charge_shell
2177 CALL cp_warn(__location__, &
2178 "CORE-SHELL model defined for KIND ("//trim(atmname)//
")"// &
2179 " ignoring charge definition! ")
2188 IF (
ASSOCIATED(inp_info%nonbonded))
THEN
2189 IF (
ASSOCIATED(inp_info%nonbonded%pot))
THEN
2191 only_manybody = .true.
2193 DO j = 1,
SIZE(inp_info%nonbonded%pot)
2194 IF (atmname == inp_info%nonbonded%pot(j)%pot%at1 .OR. &
2195 atmname == inp_info%nonbonded%pot(j)%pot%at2)
THEN
2196 SELECT CASE (inp_info%nonbonded%pot(j)%pot%type(1))
2202 only_manybody = .false.
2208 IF (only_manybody .AND. found_p)
THEN
2214 IF (.NOT. found)
THEN
2218 CALL store_ff_missing_par(atm1=trim(atmname), &
2220 type_name=
"Charge", &
2226 IF (only_qm .AND. my_qmmm)
THEN
2228 scale_factor = 0.0_dp
2229 IF (is_link_atom)
THEN
2233 DO ilink = 1,
SIZE(qmmm_env%mm_link_atoms)
2234 IF (any(my_atom_list == qmmm_env%mm_link_atoms(ilink)))
EXIT
2236 cpassert(ilink <=
SIZE(qmmm_env%mm_link_atoms))
2237 scale_factor = qmmm_env%fist_scale_charge_link(ilink)
2239 charge = charge*scale_factor
2247 charge_tot = charge_tot + atomic_kind%natom*cs_charge
2249 charge_tot = charge_tot + atomic_kind%natom*charge
2256 WRITE (unit=iw4, fmt=
"(/,T2,A,T61,F20.10)") &
2257 "FORCEFIELD| Total charge of the classical system: ", charge_tot
2260 CALL timestop(handle)
2274 INTEGER,
INTENT(IN) :: iw
2277 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_radius'
2279 CHARACTER(LEN=default_string_length) :: inp_kind_name, kind_name
2280 INTEGER :: handle, i, i_rep, n_rep
2282 REAL(kind=
dp) :: mm_radius
2287 CALL timeset(routinen, handle)
2292 DO i = 1,
SIZE(atomic_kind_set)
2293 atomic_kind => atomic_kind_set(i)
2295 fist_potential=fist_potential, name=kind_name)
2302 IF (iw > 0)
WRITE (unit=iw, fmt=
"(A)")
""
2306 c_val=inp_kind_name, i_rep_section=i_rep)
2309 WRITE (unit=iw, fmt=
"(T2,A)") &
2310 "FORCEFIELD| Matching atomic kinds "//trim(kind_name)// &
2311 " and "//trim(inp_kind_name)//
" for MM_RADIUS"
2313 IF (trim(kind_name) == trim(inp_kind_name))
THEN
2315 keyword_name=
"MM_RADIUS", r_val=mm_radius)
2316 CALL issue_duplications(found,
"MM_RADIUS", kind_name)
2320 CALL set_potential(potential=fist_potential, mm_radius=mm_radius)
2323 CALL timestop(handle)
2337 INTEGER,
INTENT(IN) :: iw
2340 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_pol'
2342 CHARACTER(LEN=default_string_length) :: kind_name
2343 INTEGER :: handle, i, j
2345 REAL(kind=
dp) :: apol, cpol
2349 CALL timeset(routinen, handle)
2352 WRITE (unit=iw, fmt=
"(/,T2,A)") &
2353 "FORCEFIELD| Checking for polarisable forcefield terms"
2356 DO i = 1,
SIZE(atomic_kind_set)
2357 atomic_kind => atomic_kind_set(i)
2359 fist_potential=fist_potential, &
2361 CALL get_potential(potential=fist_potential, apol=apol, cpol=cpol)
2365 IF (iw > 0)
WRITE (unit=iw, fmt=
"(A)")
""
2367 IF (
ASSOCIATED(inp_info%apol_atm))
THEN
2368 DO j = 1,
SIZE(inp_info%apol_atm)
2370 WRITE (unit=iw, fmt=
"(T2,A)") &
2371 "FORCEFIELD| Matching atomic kinds "//trim(kind_name)// &
2372 " and "//trim(inp_info%apol_atm(j))//
" for APOL"
2374 IF ((inp_info%apol_atm(j)) == kind_name)
THEN
2375 apol = inp_info%apol(j)
2376 CALL issue_duplications(found,
"APOL", kind_name)
2382 IF (
ASSOCIATED(inp_info%cpol_atm))
THEN
2383 DO j = 1,
SIZE(inp_info%cpol_atm)
2385 WRITE (unit=iw, fmt=
"(T2,A)") &
2386 "FORCEFIELD| Matching atomic kinds "//trim(kind_name)// &
2387 " and "//trim(inp_info%cpol_atm(j))//
" for CPOL"
2389 IF ((inp_info%cpol_atm(j)) == kind_name)
THEN
2390 cpol = inp_info%cpol(j)
2391 CALL issue_duplications(found,
"CPOL", kind_name)
2397 CALL set_potential(potential=fist_potential, apol=apol, cpol=cpol)
2401 CALL timestop(handle)
2417 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_damp'
2419 CHARACTER(len=default_string_length) :: atm_name1, atm_name2, my_atm_name1, &
2421 INTEGER :: handle2, i, j, k, nkinds
2426 CALL timeset(routinen, handle2)
2429 WRITE (unit=iw, fmt=
"(/,T2,A)") &
2430 "FORCEFIELD| Checking for damping terms"
2434 nkinds =
SIZE(atomic_kind_set)
2436 DO j = 1,
SIZE(atomic_kind_set)
2438 atomic_kind => atomic_kind_set(j)
2444 IF (
ASSOCIATED(inp_info%damping_list))
THEN
2445 DO i = 1,
SIZE(inp_info%damping_list)
2446 my_atm_name1 = inp_info%damping_list(i)%atm_name1
2447 my_atm_name2 = inp_info%damping_list(i)%atm_name2
2448 IF (debug_this_module)
THEN
2450 WRITE (unit=iw, fmt=
"(T2,A)") &
2451 "FORCEFIELD| Check damping for the atomic kinds "// &
2452 trim(my_atm_name1)//
" and "//trim(atm_name1)
2455 IF (my_atm_name1 == atm_name1)
THEN
2456 IF (.NOT.
ASSOCIATED(damping))
THEN
2460 DO k = 1,
SIZE(atomic_kind_set)
2461 atomic_kind2 => atomic_kind_set(k)
2465 IF (my_atm_name2 == atm_name2)
THEN
2466 IF (damping%damp(k)%bij /= huge(0.0_dp)) found = .true.
2467 CALL issue_duplications(found,
"Damping", atm_name1)
2469 SELECT CASE (trim(inp_info%damping_list(i)%dtype))
2470 CASE (
'TANG-TOENNIES')
2473 cpabort(
"Unknown damping type.")
2475 damping%damp(k)%order = inp_info%damping_list(i)%order
2476 damping%damp(k)%bij = inp_info%damping_list(i)%bij
2477 damping%damp(k)%cij = inp_info%damping_list(i)%cij
2480 IF (.NOT. found)
THEN
2481 CALL cp_warn(__location__, &
2482 "Atom "//trim(my_atm_name2)// &
2483 " in damping parameters for atom "//trim(my_atm_name1)// &
2496 CALL timestop(handle2)
2515 molecule_kind_set, molecule_set, root_section, subsys_section, &
2516 shell_particle_set, core_particle_set, cell, iw, inp_info)
2523 TYPE(
particle_type),
DIMENSION(:),
POINTER :: shell_particle_set, core_particle_set
2528 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_shell'
2530 CHARACTER(LEN=default_string_length) :: atmname
2531 INTEGER :: counter, first, first_shell, handle2, i, &
2532 j, last, last_shell, n, natom, nmol, &
2534 INTEGER,
DIMENSION(:),
POINTER :: molecule_list, shell_list_tmp
2535 LOGICAL :: core_coord_read, found_shell, is_a_shell, is_link_atom, null_massfrac, only_qm, &
2536 save_mem, shell_adiabatic, shell_coord_read
2537 REAL(kind=
dp) :: atmmass
2543 TYPE(
shell_type),
DIMENSION(:),
POINTER :: shell_list
2545 CALL timeset(routinen, handle2)
2550 null_massfrac = .false.
2551 core_coord_read = .false.
2552 shell_coord_read = .false.
2554 NULLIFY (global_section)
2559 WRITE (unit=iw, fmt=
"(/,T2,A)") &
2560 "FORCEFIELD| Checking for core-shell terms"
2563 DO i = 1,
SIZE(atomic_kind_set)
2564 atomic_kind => atomic_kind_set(i)
2568 found_shell = .false.
2573 IF (
ASSOCIATED(inp_info%shell_list))
THEN
2574 DO j = 1,
SIZE(inp_info%shell_list)
2575 IF (debug_this_module)
THEN
2577 WRITE (unit=iw, fmt=
"(T2,A)") &
2578 "Checking shells for the atomic kinds "// &
2579 trim(inp_info%shell_list(j)%atm_name)//
" and "//trim(atmname)
2582 IF ((inp_info%shell_list(j)%atm_name) == atmname)
THEN
2584 shell=shell, mass=atmmass, natom=natom)
2585 IF (.NOT.
ASSOCIATED(shell))
ALLOCATE (shell)
2586 nshell_tot = nshell_tot + natom
2587 shell%charge_core = inp_info%shell_list(j)%shell%charge_core
2588 shell%charge_shell = inp_info%shell_list(j)%shell%charge_shell
2589 shell%massfrac = inp_info%shell_list(j)%shell%massfrac
2590 IF (shell%massfrac < epsilon(1.0_dp)) null_massfrac = .true.
2591 shell%k2_spring = inp_info%shell_list(j)%shell%k2_spring
2592 shell%k4_spring = inp_info%shell_list(j)%shell%k4_spring
2593 shell%max_dist = inp_info%shell_list(j)%shell%max_dist
2594 shell%shell_cutoff = inp_info%shell_list(j)%shell%shell_cutoff
2595 shell%mass_shell = shell%massfrac*atmmass
2596 shell%mass_core = atmmass - shell%mass_shell
2597 CALL issue_duplications(found_shell,
"Shell", atmname)
2598 found_shell = .true.
2600 shell=shell, shell_active=.true.)
2607 WRITE (unit=iw, fmt=
"(/,T2,A,T61,I20)") &
2608 "FORCEFIELD| Total number of particles with a shell:", nshell_tot
2611 NULLIFY (shell_particle_set)
2612 NULLIFY (core_particle_set)
2613 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, shell_adiabatic=shell_adiabatic)
2614 IF (nshell_tot > 0)
THEN
2615 IF (shell_adiabatic .AND. null_massfrac)
THEN
2616 cpabort(
"Shell-model adiabatic: at least one shell_kind has mass zero")
2623 DO i = 1,
SIZE(particle_set)
2624 NULLIFY (atomic_kind)
2626 atomic_kind => particle_set(i)%atomic_kind
2627 CALL get_atomic_kind(atomic_kind=atomic_kind, shell_active=is_a_shell)
2628 IF (is_a_shell)
THEN
2629 counter = counter + 1
2630 particle_set(i)%shell_index = counter
2631 shell_particle_set(counter)%shell_index = counter
2632 shell_particle_set(counter)%atomic_kind => particle_set(i)%atomic_kind
2633 shell_particle_set(counter)%r(1:3) = particle_set(i)%r(1:3)
2634 shell_particle_set(counter)%atom_index = i
2635 core_particle_set(counter)%shell_index = counter
2636 core_particle_set(counter)%atomic_kind => particle_set(i)%atomic_kind
2637 core_particle_set(counter)%r(1:3) = particle_set(i)%r(1:3)
2638 core_particle_set(counter)%atom_index = i
2640 particle_set(i)%shell_index = 0
2643 cpassert(counter == nshell_tot)
2648 subsys_section, shell_coord_read, cell)
2650 subsys_section, core_coord_read, cell)
2652 IF (nshell_tot > 0)
THEN
2655 IF (shell_adiabatic)
THEN
2656 IF (.NOT. (core_coord_read .AND. shell_coord_read))
THEN
2658 subsys_section, core_particle_set, &
2662 IF (.NOT. shell_coord_read)
THEN
2664 subsys_section, save_mem=save_mem)
2669 DO i = 1,
SIZE(molecule_kind_set)
2670 molecule_kind => molecule_kind_set(i)
2671 CALL get_molecule_kind(molecule_kind=molecule_kind, molecule_list=molecule_list, &
2672 natom=natom, nmolecule=nmol)
2673 molecule => molecule_set(molecule_list(1))
2674 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
2675 ALLOCATE (shell_list_tmp(natom))
2678 atomic_kind => particle_set(j)%atomic_kind
2679 CALL get_atomic_kind(atomic_kind=atomic_kind, shell_active=is_a_shell)
2680 IF (is_a_shell)
THEN
2681 counter = counter + 1
2682 shell_list_tmp(counter) = j - first + 1
2683 first_shell = min(first_shell, max(1, particle_set(j)%shell_index))
2686 IF (counter /= 0)
THEN
2688 DO j = 1,
SIZE(molecule_list)
2689 last_shell = first_shell + counter - 1
2690 molecule => molecule_set(molecule_list(j))
2691 molecule%first_shell = first_shell
2692 molecule%last_shell = last_shell
2693 first_shell = last_shell + 1
2697 IF (
ASSOCIATED(shell_list))
THEN
2698 DEALLOCATE (shell_list)
2700 ALLOCATE (shell_list(counter))
2702 shell_list(j)%a = shell_list_tmp(j)
2703 atomic_kind => particle_set(shell_list_tmp(j) + first - 1)%atomic_kind
2704 CALL get_atomic_kind(atomic_kind=atomic_kind, name=atmname, shell=shell)
2706 shell_list(j)%name = atmname
2707 shell_list(j)%shell_kind => shell
2709 CALL set_molecule_kind(molecule_kind=molecule_kind, nshell=counter, shell_list=shell_list)
2711 DEALLOCATE (shell_list_tmp)
2712 n = n + nmol*counter
2716 cpassert(first_shell - 1 == nshell_tot)
2717 cpassert(n == nshell_tot)
2719 CALL timestop(handle2)
2738 Ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond14, ewald_env)
2744 CHARACTER(LEN=default_string_length), &
2745 DIMENSION(:),
POINTER :: ainfo
2753 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_nonbond14'
2755 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a_local, &
2756 name_atm_b, name_atm_b_local
2757 INTEGER :: handle2, i, ii, j, jj, k, match_names
2758 LOGICAL :: found, found_a, found_b, only_qm, &
2760 REAL(kind=
dp) :: epsilon0, epsilon_a, epsilon_b, &
2761 ewald_rcut, rmin, rmin2_a, rmin2_b
2765 CALL timeset(routinen, handle2)
2767 use_qmmm_ff = qmmm_env%use_qmmm_ff
2771 WRITE (unit=iw, fmt=
"(/,T2,A)") &
2772 "FORCEFIELD| Checking for nonbonded14 terms"
2778 DO i = 1,
SIZE(atomic_kind_set)
2779 atomic_kind => atomic_kind_set(i)
2781 DO j = i,
SIZE(atomic_kind_set)
2782 atomic_kind => atomic_kind_set(j)
2787 name_atm_a = name_atm_a_local
2788 name_atm_b = name_atm_b_local
2792 pot => potparm_nonbond14%pot(i, j)%pot
2795 IF (
ASSOCIATED(gro_info%nonbond_a_14))
THEN
2798 DO k = 1,
SIZE(gro_info%nonbond_a_14)
2799 IF (trim(name_atm_a) == trim(gro_info%nonbond_a_14(k)))
THEN
2805 DO k = 1,
SIZE(gro_info%nonbond_a_14)
2806 IF (trim(name_atm_b) == trim(gro_info%nonbond_a_14(k)))
THEN
2812 IF (ii /= 0 .AND. jj /= 0)
THEN
2815 pot%at1 = name_atm_a
2816 pot%at2 = name_atm_b
2817 pot%set(1)%lj%epsilon = 1.0_dp
2818 pot%set(1)%lj%sigma6 = gro_info%nonbond_c6_14(ii, jj)
2819 pot%set(1)%lj%sigma12 = gro_info%nonbond_c12_14(ii, jj)
2820 pot%rcutsq = (10.0_dp*
bohr)**2
2821 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
2829 IF (
ASSOCIATED(chm_info%nonbond_a_14))
THEN
2830 DO k = 1,
SIZE(chm_info%nonbond_a_14)
2831 IF ((name_atm_a) == (chm_info%nonbond_a_14(k)))
THEN
2833 rmin2_a = chm_info%nonbond_rmin2_14(k)
2834 epsilon_a = chm_info%nonbond_eps_14(k)
2838 DO k = 1,
SIZE(chm_info%nonbond_a_14)
2839 IF ((name_atm_b) == (chm_info%nonbond_a_14(k)))
THEN
2841 rmin2_b = chm_info%nonbond_rmin2_14(k)
2842 epsilon_b = chm_info%nonbond_eps_14(k)
2847 IF (
ASSOCIATED(chm_info%nonbond_a))
THEN
2848 IF (.NOT. found_a)
THEN
2849 DO k = 1,
SIZE(chm_info%nonbond_a)
2850 IF ((name_atm_a) == (chm_info%nonbond_a(k)))
THEN
2852 rmin2_a = chm_info%nonbond_rmin2(k)
2853 epsilon_a = chm_info%nonbond_eps(k)
2857 IF (.NOT. found_b)
THEN
2858 DO k = 1,
SIZE(chm_info%nonbond_a)
2859 IF ((name_atm_b) == (chm_info%nonbond_a(k)))
THEN
2861 rmin2_b = chm_info%nonbond_rmin2(k)
2862 epsilon_b = chm_info%nonbond_eps(k)
2867 IF (ii /= 0 .AND. jj /= 0)
THEN
2868 rmin = rmin2_a + rmin2_b
2870 epsilon0 = sqrt(abs(epsilon_a*epsilon_b))
2873 pot%at1 = name_atm_a
2874 pot%at2 = name_atm_b
2875 pot%set(1)%lj%epsilon = epsilon0
2876 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
2877 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
2878 pot%rcutsq = (10.0_dp*
bohr)**2
2879 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
2884 IF (
ASSOCIATED(amb_info%nonbond_a))
THEN
2887 IF (.NOT. found_a)
THEN
2888 DO k = 1,
SIZE(amb_info%nonbond_a)
2889 IF ((name_atm_a) == (amb_info%nonbond_a(k)))
THEN
2891 rmin2_a = amb_info%nonbond_rmin2(k)
2892 epsilon_a = amb_info%nonbond_eps(k)
2896 IF (.NOT. found_b)
THEN
2897 DO k = 1,
SIZE(amb_info%nonbond_a)
2898 IF ((name_atm_b) == (amb_info%nonbond_a(k)))
THEN
2900 rmin2_b = amb_info%nonbond_rmin2(k)
2901 epsilon_b = amb_info%nonbond_eps(k)
2905 IF (ii /= 0 .AND. jj /= 0)
THEN
2906 rmin = rmin2_a + rmin2_b
2908 epsilon0 = sqrt(abs(epsilon_a*epsilon_b))
2911 pot%at1 = name_atm_a
2912 pot%at2 = name_atm_b
2913 pot%set(1)%lj%epsilon = epsilon0
2914 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
2915 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
2916 pot%rcutsq = (10.0_dp*
bohr)**2
2917 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, &
2924 IF (
ASSOCIATED(inp_info%nonbonded14))
THEN
2925 DO k = 1,
SIZE(inp_info%nonbonded14%pot)
2926 IF (iw > 0)
WRITE (iw, *)
" TESTING ", trim(name_atm_a), trim(name_atm_b), &
2927 " with ", trim(inp_info%nonbonded14%pot(k)%pot%at1), &
2928 trim(inp_info%nonbonded14%pot(k)%pot%at2)
2929 IF ((((name_atm_a) == (inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2930 ((name_atm_b) == (inp_info%nonbonded14%pot(k)%pot%at2))) .OR. &
2931 (((name_atm_b) == (inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2932 ((name_atm_a) == (inp_info%nonbonded14%pot(k)%pot%at2))))
THEN
2933 IF (ff_type%multiple_potential)
THEN
2936 CALL cp_warn(__location__, &
2937 "Multiple ONFO declaration: "//trim(name_atm_a)// &
2938 " and "//trim(name_atm_b)//
" ADDING! ")
2940 potparm_nonbond14%pot(i, j)%pot => pot
2941 potparm_nonbond14%pot(j, i)%pot => pot
2945 CALL cp_warn(__location__, &
2946 "Multiple ONFO declarations: "//trim(name_atm_a)// &
2947 " and "//trim(name_atm_b)//
" OVERWRITING! ")
2950 IF (iw > 0)
WRITE (iw, *)
" FOUND ", trim(name_atm_a),
" ", trim(name_atm_b)
2958 IF (use_qmmm_ff)
THEN
2960 IF ((name_atm_a) == (name_atm_a_local)) match_names = match_names + 1
2961 IF ((name_atm_b) == (name_atm_b_local)) match_names = match_names + 1
2962 IF (match_names == 1)
THEN
2963 IF (
ASSOCIATED(qmmm_env%inp_info%nonbonded14))
THEN
2964 DO k = 1,
SIZE(qmmm_env%inp_info%nonbonded14%pot)
2965 IF (debug_this_module)
THEN
2967 WRITE (unit=iw, fmt=
"(T2,A)") &
2968 "FORCEFIELD| Testing "//trim(name_atm_a)//
"-"//trim(name_atm_b)// &
2969 " with "//trim(qmmm_env%inp_info%nonbonded14%pot(k)%pot%at1)//
"-"// &
2970 trim(qmmm_env%inp_info%nonbonded14%pot(k)%pot%at2)
2973 IF ((((name_atm_a) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2974 ((name_atm_b) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at2))) .OR. &
2975 (((name_atm_b) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2976 ((name_atm_a) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at2))))
THEN
2977 IF (qmmm_env%multiple_potential)
THEN
2980 CALL cp_warn(__location__, &
2981 "Multiple ONFO declaration: "//trim(name_atm_a)// &
2982 " and "//trim(name_atm_b)//
" Adding QM/MM forcefield specifications")
2984 potparm_nonbond14%pot(i, j)%pot => pot
2985 potparm_nonbond14%pot(j, i)%pot => pot
2989 CALL cp_warn(__location__, &
2990 "Multiple ONFO declaration: "//trim(name_atm_a)// &
2991 " and "//trim(name_atm_b)//
" OVERWRITING QM/MM forcefield specifications! ")
2994 IF (iw > 0)
WRITE (iw, *)
" FOUND ", trim(name_atm_a), &
2995 " ", trim(name_atm_b)
3003 IF (.NOT. found)
THEN
3004 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
3005 atm2=trim(name_atm_b), &
3006 type_name=
"Spline_Bond_Env", &
3010 pot%at1 = name_atm_a
3011 pot%at2 = name_atm_b
3015 IF (ff_type%rcut_nb > 0.0_dp)
THEN
3016 pot%rcutsq = ff_type%rcut_nb*ff_type%rcut_nb
3020 pot%rcutsq = max(pot%rcutsq, ewald_rcut*ewald_rcut)
3029 CALL timestop(handle2)
3049 iw, Ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond, &
3057 CHARACTER(LEN=default_string_length), &
3058 DIMENSION(:),
POINTER :: ainfo
3066 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_nonbond'
3068 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a_local, &
3069 name_atm_b, name_atm_b_local
3070 INTEGER :: handle2, i, ii, j, jj, k, match_names
3071 LOGICAL :: found, is_a_shell, is_b_shell, only_qm, &
3073 REAL(kind=
dp) :: epsilon0, ewald_rcut, rmin
3077 CALL timeset(routinen, handle2)
3079 use_qmmm_ff = qmmm_env%use_qmmm_ff
3083 WRITE (unit=iw, fmt=
"(/,T2,A)") &
3084 "FORCEFIELD| Checking for nonbonded terms"
3090 DO i = 1,
SIZE(atomic_kind_set)
3092 atomic_kind => atomic_kind_set(i)
3094 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name_atm_a_local, &
3095 shell_active=is_a_shell)
3097 DO j = i,
SIZE(atomic_kind_set)
3099 atomic_kind => atomic_kind_set(j)
3101 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name_atm_b_local, &
3102 shell_active=is_b_shell)
3106 name_atm_a = name_atm_a_local
3107 name_atm_b = name_atm_b_local
3111 pot => potparm_nonbond%pot(i, j)%pot
3114 WRITE (unit=iw, fmt=
"(/,T2,A)") &
3115 "FORCEFIELD| Checking for nonbonded terms between the atomic kinds "// &
3116 trim(name_atm_a)//
" and "//trim(name_atm_b)
3120 IF (
ASSOCIATED(gro_info%nonbond_a))
THEN
3123 DO k = 1,
SIZE(gro_info%nonbond_a)
3124 IF (trim(name_atm_a) == trim(gro_info%nonbond_a(k)))
THEN
3129 DO k = 1,
SIZE(gro_info%nonbond_a)
3130 IF (trim(name_atm_b) == trim(gro_info%nonbond_a(k)))
THEN
3136 IF (ii /= 0 .AND. jj /= 0)
THEN
3139 pot%at1 = name_atm_a
3140 pot%at2 = name_atm_b
3141 pot%set(1)%lj%epsilon = 1.0_dp
3142 pot%set(1)%lj%sigma6 = gro_info%nonbond_c6(ii, jj)
3143 pot%set(1)%lj%sigma12 = gro_info%nonbond_c12(ii, jj)
3144 pot%rcutsq = (10.0_dp*
bohr)**2
3145 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
3151 IF (
ASSOCIATED(chm_info%nonbond_a))
THEN
3154 DO k = 1,
SIZE(chm_info%nonbond_a)
3155 IF ((name_atm_a) == (chm_info%nonbond_a(k)))
THEN
3159 DO k = 1,
SIZE(chm_info%nonbond_a)
3160 IF ((name_atm_b) == (chm_info%nonbond_a(k)))
THEN
3165 IF (ii /= 0 .AND. jj /= 0)
THEN
3166 rmin = chm_info%nonbond_rmin2(ii) + chm_info%nonbond_rmin2(jj)
3167 epsilon0 = sqrt(chm_info%nonbond_eps(ii)* &
3168 chm_info%nonbond_eps(jj))
3171 pot%at1 = name_atm_a
3172 pot%at2 = name_atm_b
3173 pot%set(1)%lj%epsilon = epsilon0
3174 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
3175 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
3176 pot%rcutsq = (10.0_dp*
bohr)**2
3177 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
3183 IF (
ASSOCIATED(amb_info%nonbond_a))
THEN
3186 DO k = 1,
SIZE(amb_info%nonbond_a)
3187 IF ((name_atm_a) == (amb_info%nonbond_a(k)))
THEN
3191 DO k = 1,
SIZE(amb_info%nonbond_a)
3192 IF ((name_atm_b) == (amb_info%nonbond_a(k)))
THEN
3197 IF (ii /= 0 .AND. jj /= 0)
THEN
3198 rmin = amb_info%nonbond_rmin2(ii) + amb_info%nonbond_rmin2(jj)
3199 epsilon0 = sqrt(amb_info%nonbond_eps(ii)*amb_info%nonbond_eps(jj))
3202 pot%at1 = name_atm_a
3203 pot%at2 = name_atm_b
3204 pot%set(1)%lj%epsilon = epsilon0
3205 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
3206 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
3207 pot%rcutsq = (10.0_dp*
bohr)**2
3208 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
3214 IF (
ASSOCIATED(inp_info%nonbonded))
THEN
3215 DO k = 1,
SIZE(inp_info%nonbonded%pot)
3216 IF ((trim(inp_info%nonbonded%pot(k)%pot%at1) ==
"*") .OR. &
3217 (trim(inp_info%nonbonded%pot(k)%pot%at2) ==
"*")) cycle
3218 IF (debug_this_module)
THEN
3220 WRITE (unit=iw, fmt=
"(T2,A)") &
3221 "FORCEFIELD| Testing "//trim(name_atm_a)//
"-"//trim(name_atm_b)// &
3222 " with "//trim(inp_info%nonbonded%pot(k)%pot%at1)//
"-"// &
3223 trim(inp_info%nonbonded%pot(k)%pot%at2)
3226 IF ((((name_atm_a) == (inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
3227 ((name_atm_b) == (inp_info%nonbonded%pot(k)%pot%at2))) .OR. &
3228 (((name_atm_b) == (inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
3229 ((name_atm_a) == (inp_info%nonbonded%pot(k)%pot%at2))))
THEN
3231 WRITE (unit=iw, fmt=
"(T2,A)") &
3232 "FORCEFIELD| Found nonbonded term "// &
3233 trim(name_atm_a)//
"-"//trim(name_atm_b)
3235 IF (ff_type%multiple_potential)
THEN
3238 CALL cp_warn(__location__, &
3239 "Multiple NONBONDED declarations for "//trim(name_atm_a)// &
3240 "-"//trim(name_atm_b)//
" -> ADDING")
3242 potparm_nonbond%pot(i, j)%pot => pot
3243 potparm_nonbond%pot(j, i)%pot => pot
3247 CALL cp_warn(__location__, &
3248 "Multiple NONBONDED declarations for "//trim(name_atm_a)// &
3249 "-"//trim(name_atm_b)//
" -> OVERWRITING")
3257 IF (.NOT. found)
THEN
3258 DO k = 1,
SIZE(inp_info%nonbonded%pot)
3259 IF ((trim(inp_info%nonbonded%pot(k)%pot%at1) ==
"*") .EQV. &
3260 (trim(inp_info%nonbonded%pot(k)%pot%at2) ==
"*")) cycle
3261 IF (debug_this_module)
THEN
3263 WRITE (unit=iw, fmt=
"(T2,A)") &
3264 "FORCEFIELD| Testing "//trim(name_atm_a)//
"-"//trim(name_atm_b)// &
3265 " with "//trim(inp_info%nonbonded%pot(k)%pot%at1)//
"-"// &
3266 trim(inp_info%nonbonded%pot(k)%pot%at2)
3269 IF ((name_atm_a == inp_info%nonbonded%pot(k)%pot%at1) .OR. &
3270 (name_atm_b == inp_info%nonbonded%pot(k)%pot%at2) .OR. &
3271 (name_atm_b == inp_info%nonbonded%pot(k)%pot%at1) .OR. &
3272 (name_atm_a == inp_info%nonbonded%pot(k)%pot%at2))
THEN
3274 WRITE (unit=iw, fmt=
"(T2,A)") &
3275 "FORCEFIELD| Found one wildcard for "// &
3276 trim(name_atm_a)//
"-"//trim(name_atm_b)
3278 IF (ff_type%multiple_potential)
THEN
3281 CALL cp_warn(__location__, &
3282 "Multiple NONBONDED declarations "//trim(name_atm_a)// &
3283 "-"//trim(name_atm_b)//
" -> ADDING")
3285 potparm_nonbond%pot(i, j)%pot => pot
3286 potparm_nonbond%pot(j, i)%pot => pot
3290 CALL cp_warn(__location__, &
3291 "Multiple NONBONDED declarations "//trim(name_atm_a)// &
3292 "-"//trim(name_atm_b)//
" -> OVERWRITING")
3301 IF (.NOT. found)
THEN
3302 DO k = 1,
SIZE(inp_info%nonbonded%pot)
3303 IF ((trim(inp_info%nonbonded%pot(k)%pot%at1) /=
"*") .OR. &
3304 (trim(inp_info%nonbonded%pot(k)%pot%at2) /=
"*")) cycle
3305 IF (debug_this_module)
THEN
3307 WRITE (unit=iw, fmt=
"(T2,A)") &
3308 "FORCEFIELD| Testing "//trim(name_atm_a)//
"-"//trim(name_atm_b)// &
3309 " with "//trim(inp_info%nonbonded%pot(k)%pot%at1)//
"-"// &
3310 trim(inp_info%nonbonded%pot(k)%pot%at2)
3314 WRITE (unit=iw, fmt=
"(T2,A)") &
3315 "FORCEFIELD| Found wildcards for both "// &
3316 trim(name_atm_a)//
" and "//trim(name_atm_b)
3318 IF (ff_type%multiple_potential)
THEN
3321 CALL cp_warn(__location__, &
3322 "Multiple NONBONDED declarations "//trim(name_atm_a)// &
3323 " - "//trim(name_atm_b)//
" -> ADDING")
3325 potparm_nonbond%pot(i, j)%pot => pot
3326 potparm_nonbond%pot(j, i)%pot => pot
3330 CALL cp_warn(__location__, &
3331 "Multiple NONBONDED declarations "//trim(name_atm_a)// &
3332 " - "//trim(name_atm_b)//
" -> OVERWRITING")
3342 IF (use_qmmm_ff)
THEN
3344 IF ((name_atm_a) == (name_atm_a_local)) match_names = match_names + 1
3345 IF ((name_atm_b) == (name_atm_b_local)) match_names = match_names + 1
3346 IF (match_names == 1)
THEN
3347 IF (
ASSOCIATED(qmmm_env%inp_info%nonbonded))
THEN
3348 DO k = 1,
SIZE(qmmm_env%inp_info%nonbonded%pot)
3349 IF (debug_this_module)
THEN
3351 WRITE (unit=iw, fmt=
"(T2,A)") &
3352 "FORCEFIELD| Testing "//trim(name_atm_a)//
"-"//trim(name_atm_b)// &
3353 " with "//trim(qmmm_env%inp_info%nonbonded%pot(k)%pot%at1), &
3354 trim(qmmm_env%inp_info%nonbonded%pot(k)%pot%at2)
3357 IF ((((name_atm_a) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
3358 ((name_atm_b) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at2))) .OR. &
3359 (((name_atm_b) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
3360 ((name_atm_a) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at2))))
THEN
3362 WRITE (unit=iw, fmt=
"(T2,A)") &
3363 "FORCEFIELD| Found "//trim(name_atm_a)//
"-"//trim(name_atm_b)//
" (QM/MM)"
3365 IF (qmmm_env%multiple_potential)
THEN
3368 CALL cp_warn(__location__, &
3369 "Multiple NONBONDED declarations for "//trim(name_atm_a)// &
3370 " and "//trim(name_atm_b)//
" -> ADDING QM/MM forcefield specifications")
3372 potparm_nonbond%pot(i, j)%pot => pot
3373 potparm_nonbond%pot(j, i)%pot => pot
3377 CALL cp_warn(__location__, &
3378 "Multiple NONBONDED declarations for "//trim(name_atm_a)// &
3379 " and "//trim(name_atm_b)//
" -> OVERWRITING QM/MM forcefield specifications")
3389 IF (.NOT. found)
THEN
3390 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
3391 atm2=trim(name_atm_b), &
3392 type_name=
"Spline_Non_Bond_Env", &
3398 IF (ff_type%rcut_nb > 0.0_dp)
THEN
3399 pot%rcutsq = ff_type%rcut_nb*ff_type%rcut_nb
3403 pot%rcutsq = max(pot%rcutsq, ewald_rcut*ewald_rcut)
3405 IF ((is_a_shell .AND. .NOT. is_b_shell) .OR. (is_b_shell .AND. .NOT. is_a_shell))
THEN
3407 ELSE IF (is_a_shell .AND. is_b_shell)
THEN
3408 pot%shell_type =
sh_sh
3421 CALL timestop(handle2)
3437 potparm, do_zbl, nonbonded_type)
3441 INTEGER :: iw2, iw3, iw4
3443 LOGICAL,
INTENT(IN) :: do_zbl
3444 CHARACTER(LEN=*),
INTENT(IN) :: nonbonded_type
3446 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_splines'
3448 INTEGER :: handle2, ikind, jkind, n
3452 CALL timeset(routinen, handle2)
3455 WRITE (unit=iw2, fmt=
"(/,T2,A)") &
3456 "FORCEFIELD| Splining nonbonded terms"
3461 NULLIFY (spline_env)
3463 do_zbl, shift_cutoff=ff_type%shift_cutoff)
3466 atomic_kind_set, eps_spline=ff_type%eps_spline, &
3467 max_energy=ff_type%max_energy, rlow_nb=ff_type%rlow_nb, &
3468 emax_spline=ff_type%emax_spline, npoints=ff_type%npoints, &
3469 iw=iw2, iw2=iw3, iw3=iw4, &
3470 do_zbl=do_zbl, shift_cutoff=ff_type%shift_cutoff, &
3471 nonbonded_type=nonbonded_type)
3474 DO ikind = 1,
SIZE(potparm%pot, 1)
3475 DO jkind = ikind,
SIZE(potparm%pot, 2)
3476 n = spline_env%spltab(ikind, jkind)
3477 spl_p => spline_env%spl_pp(n)%spl_p
3480 potparm%pot(ikind, jkind)%pot%pair_spline_data => spl_p
3484 DEALLOCATE (spline_env)
3485 NULLIFY (spline_env)
3488 WRITE (unit=iw2, fmt=
"(/,T2,A)") &
3489 "FORCEFIELD| Splining done"
3492 CALL timestop(handle2)
3511 INTEGER,
INTENT(IN) :: iw
3513 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_eicut'
3515 INTEGER :: ewald_type, handle, i1, i2, nkinds
3516 REAL(kind=
dp) :: alpha, beta, mm_radius1, mm_radius2, &
3517 rcut2, rcut2_ewald, tmp
3518 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: interaction_cutoffs
3521 CALL timeset(routinen, handle)
3524 WRITE (unit=iw, fmt=
"(/,T2,A)") &
3525 "FORCEFIELD| Computing the electrostatic interactions cutoffs"
3529 nkinds =
SIZE(atomic_kind_set)
3533 ALLOCATE (interaction_cutoffs(3, nkinds, nkinds))
3534 interaction_cutoffs = 0.0_dp
3537 IF (ff_type%shift_cutoff)
THEN
3538 CALL ewald_env_get(ewald_env, alpha=alpha, ewald_type=ewald_type, &
3540 rcut2_ewald = rcut2_ewald*rcut2_ewald
3542 atomic_kind => atomic_kind_set(i1)
3546 IF (
ASSOCIATED(potparm_nonbond))
THEN
3547 rcut2 = max(potparm_nonbond%pot(i1, i2)%pot%rcutsq, rcut2_ewald)
3550 atomic_kind => atomic_kind_set(i2)
3554 1.0_dp, ewald_type, alpha, 0.0_dp, 0.0_dp)
3556 IF (mm_radius1 > 0.0_dp)
THEN
3562 1.0_dp, ewald_type, alpha, beta, 0.0_dp)
3564 IF (mm_radius1 + mm_radius2 > 0.0_dp)
THEN
3565 beta =
sqrthalf/sqrt(mm_radius1*mm_radius1 + mm_radius2*mm_radius2)
3570 1.0_dp, ewald_type, alpha, beta, 0.0_dp)
3576 CALL ewald_env_set(ewald_env, interaction_cutoffs=interaction_cutoffs)
3578 CALL timestop(handle)
3593 SUBROUTINE issue_duplications(found, tag_label, name_atm_a, name_atm_b, &
3594 name_atm_c, name_atm_d)
3596 LOGICAL,
INTENT(IN) :: found
3597 CHARACTER(LEN=*),
INTENT(IN) :: tag_label, name_atm_a
3598 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: name_atm_b, name_atm_c, name_atm_d
3600 CHARACTER(LEN=default_string_length) :: item
3602 item =
"("//trim(name_atm_a)
3603 IF (
PRESENT(name_atm_b))
THEN
3604 item = trim(item)//
", "//trim(name_atm_b)
3606 IF (
PRESENT(name_atm_c))
THEN
3607 item = trim(item)//
", "//trim(name_atm_c)
3609 IF (
PRESENT(name_atm_d))
THEN
3610 item = trim(item)//
", "//trim(name_atm_d)
3612 item = trim(item)//
")"
3614 cpwarn(
"Found multiple "//trim(tag_label)//
" terms for "//trim(item)//
" -> OVERWRITING")
3617 END SUBROUTINE issue_duplications
3629 SUBROUTINE store_ff_missing_par(atm1, atm2, atm3, atm4, type_name, fatal, array)
3630 CHARACTER(LEN=*),
INTENT(IN) :: atm1
3631 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: atm2, atm3, atm4
3632 CHARACTER(LEN=*),
INTENT(IN) :: type_name
3633 LOGICAL,
INTENT(INOUT),
OPTIONAL :: fatal
3634 CHARACTER(LEN=default_string_length), &
3635 DIMENSION(:),
POINTER :: array
3637 CHARACTER(LEN=10) :: sfmt
3638 CHARACTER(LEN=9) :: my_atm1, my_atm2, my_atm3, my_atm4
3639 CHARACTER(LEN=default_path_length) :: my_format
3640 INTEGER :: fmt, i, nsize
3645 my_format =
'(T2,"FORCEFIELD| Missing ","'//trim(type_name)// &
3647 IF (
PRESENT(atm2)) fmt = fmt + 1
3648 IF (
PRESENT(atm3)) fmt = fmt + 1
3649 IF (
PRESENT(atm4)) fmt = fmt + 1
3652 my_format =
'(T2,"FORCEFIELD| Missing ","'//trim(type_name)// &
3653 '",T40,"(",A9,'//trim(sfmt)//
'(",",A9),")")'
3655 IF (
PRESENT(fatal)) fatal = .true.
3657 IF (
ASSOCIATED(array)) nsize =
SIZE(array)
3659 IF (nsize >= 1)
THEN
3661 SELECT CASE (type_name)
3663 IF (index(array(i) (21:39),
"Bond") == 0) cycle
3664 my_atm1 = array(i) (41:49)
3665 my_atm2 = array(i) (51:59)
3668 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2)) .OR. &
3669 ((atm1 == my_atm2) .AND. (atm2 == my_atm1))) found = .true.
3671 IF (index(array(i) (21:39),
"Angle") == 0) cycle
3672 my_atm1 = array(i) (41:49)
3673 my_atm2 = array(i) (51:59)
3674 my_atm3 = array(i) (61:69)
3678 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3)) .OR. &
3679 ((atm1 == my_atm3) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm1)))
THEN
3682 CASE (
"Urey-Bradley")
3683 IF (index(array(i) (21:39),
"Urey-Bradley") == 0) cycle
3684 my_atm1 = array(i) (41:49)
3685 my_atm2 = array(i) (51:59)
3686 my_atm3 = array(i) (61:69)
3690 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3)) .OR. &
3691 ((atm1 == my_atm3) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm1)))
THEN
3695 IF (index(array(i) (21:39),
"Torsion") == 0) cycle
3696 my_atm1 = array(i) (41:49)
3697 my_atm2 = array(i) (51:59)
3698 my_atm3 = array(i) (61:69)
3699 my_atm4 = array(i) (71:79)
3704 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm4)) .OR. &
3705 ((atm1 == my_atm4) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm1)))
THEN
3709 IF (index(array(i) (21:39),
"Improper") == 0) cycle
3710 my_atm1 = array(i) (41:49)
3711 my_atm2 = array(i) (51:59)
3712 my_atm3 = array(i) (61:69)
3713 my_atm4 = array(i) (71:79)
3718 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm4)) .OR. &
3719 ((atm1 == my_atm1) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm4)) .OR. &
3720 ((atm1 == my_atm1) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm4) .AND. (atm4 == my_atm3)) .OR. &
3721 ((atm1 == my_atm1) .AND. (atm2 == my_atm4) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm2)) .OR. &
3722 ((atm1 == my_atm1) .AND. (atm2 == my_atm4) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm3)) .OR. &
3723 ((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm4) .AND. (atm4 == my_atm3)))
THEN
3727 CASE (
"Out of plane bend")
3728 IF (index(array(i) (21:39),
"Out of plane bend") == 0) cycle
3729 my_atm1 = array(i) (41:49)
3730 my_atm2 = array(i) (51:59)
3731 my_atm3 = array(i) (61:69)
3732 my_atm4 = array(i) (71:79)
3737 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm4)) .OR. &
3738 ((atm1 == my_atm1) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm4)))
THEN
3743 IF (index(array(i) (21:39),
"Charge") == 0) cycle
3744 my_atm1 = array(i) (41:49)
3746 IF (atm1 == my_atm1) found = .true.
3747 CASE (
"Spline_Bond_Env",
"Spline_Non_Bond_Env")
3748 IF (index(array(i) (21:39),
"Spline_") == 0) cycle
3750 my_atm1 = array(i) (41:49)
3751 my_atm2 = array(i) (51:59)
3754 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2)) .OR. &
3755 ((atm1 == my_atm2) .AND. (atm2 == my_atm1))) found = .true.
3758 CALL cp_abort(__location__, &
3759 "<Bond>, <Angle>, <Urey-Bradley>, <Torsion>, "// &
3760 "<Improper>, <Out of plane bend>, <Charge>, "// &
3761 "<Spline_Bond_Env>, <Spline_Non_Bond_Env> are "// &
3762 "supported as the <type_name> for store_FF_missing_par, "// &
3763 "found unknown option "// &
3764 "<"//trim(type_name)//
">")
3769 IF (.NOT. found)
THEN
3774 WRITE (array(nsize), fmt=trim(my_format)) atm1
3776 WRITE (array(nsize), fmt=trim(my_format)) atm1, atm2
3778 WRITE (array(nsize), fmt=trim(my_format)) atm1, atm2, atm3
3780 WRITE (array(nsize), fmt=trim(my_format)) atm1, atm2, atm3, atm4
3784 END SUBROUTINE store_ff_missing_par
3793 FUNCTION bsearch_leftmost_2d(array, val, row)
RESULT(res)
3794 INTEGER,
INTENT(IN) :: array(:, :), val
3795 INTEGER,
INTENT(IN),
OPTIONAL :: row
3798 INTEGER :: left, locrow, mid, right
3801 IF (
PRESENT(row)) locrow = row
3804 right = ubound(array, dim=2)
3806 DO WHILE (left < right)
3807 mid = (left + right)/2
3808 IF (array(locrow, mid) < val)
THEN
3818 IF (array(locrow, res) /= val) res = 0
3820 END FUNCTION bsearch_leftmost_2d
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public set_atomic_kind(atomic_kind, element_symbol, name, mass, kind_number, natom, atom_list, fist_potential, shell, shell_active, damping)
Set the components of an atomic kind data set.
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.
various routines to log and control the output. The idea is that decisions about where to log should ...
integer, parameter, public tang_toennies
subroutine, public damping_p_create(damping, nkinds)
Creates Data-structure that contains damping information.
subroutine, public ewald_env_set(ewald_env, ewald_type, alpha, epsilon, eps_pol, gmax, ns_max, precs, o_spline, para_env, poisson_section, interaction_cutoffs, cell_hmat)
Purpose: Set the EWALD environment.
subroutine, public ewald_env_get(ewald_env, ewald_type, alpha, eps_pol, epsilon, gmax, ns_max, o_spline, group, para_env, poisson_section, precs, rcut, do_multipoles, max_multipole, do_ipol, max_ipol_iter, interaction_cutoffs, cell_hmat)
Purpose: Get the EWALD environment.
Definition of the atomic potential types.
Define all structure types related to force field kinds.
integer, parameter, public do_ff_undef
pure subroutine, public allocate_impr_kind_set(impr_kind_set, nkind)
Allocate and initialize a impr kind set.
pure subroutine, public allocate_torsion_kind_set(torsion_kind_set, nkind)
Allocate and initialize a torsion kind set.
pure subroutine, public allocate_bond_kind_set(bond_kind_set, nkind)
Allocate and initialize a bond kind set.
integer, parameter, public do_ff_charmm
pure subroutine, public allocate_opbend_kind_set(opbend_kind_set, nkind)
Allocate and initialize a opbend kind set.
integer, parameter, public do_ff_g87
integer, parameter, public do_ff_g96
pure subroutine, public allocate_bend_kind_set(bend_kind_set, nkind)
Allocate and initialize a bend kind set.
integer, parameter, public do_ff_amber
pure subroutine, public allocate_ub_kind_set(ub_kind_set, nkind)
Allocate and initialize a ub kind set.
Define all structures types related to force_fields.
subroutine, public force_field_unique_ub(particle_set, molecule_kind_set, molecule_set, iw)
Determine the number of unique Urey-Bradley kind and allocate ub_kind_set.
subroutine, public force_field_pack_tors(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, gro_info, amb_info, iw)
Pack in torsion information needed for the force_field.
subroutine, public force_field_unique_bond(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique bond kind and allocate bond_kind_set.
subroutine, public force_field_unique_opbend(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique opbend kind and allocate opbend_kind_set based on the present improper...
subroutine, public force_field_pack_impr(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, gro_info, iw)
Pack in impropers information needed for the force_field.
subroutine, public force_field_pack_radius(atomic_kind_set, iw, subsys_section)
Set up the radius of the electrostatic multipole in Fist.
subroutine, public force_field_pack_shell(particle_set, atomic_kind_set, molecule_kind_set, molecule_set, root_section, subsys_section, shell_particle_set, core_particle_set, cell, iw, inp_info)
Set up shell potential parameters.
subroutine, public force_field_pack_opbend(particle_set, molecule_kind_set, molecule_set, ainfo, inp_info, iw)
Pack in opbend information needed for the force_field. No loop over params for charmm,...
subroutine, public force_field_pack_charges(charges, charges_section, particle_set, my_qmmm, qmmm_env, inp_info, iw4)
Set up array of full charges.
subroutine, public force_field_pack_pol(atomic_kind_set, iw, inp_info)
Set up the polarizable FF parameters.
subroutine, public force_field_unique_bend(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique bend kind and allocate bend_kind_set.
subroutine, public force_field_unique_impr(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique impr kind and allocate impr_kind_set.
subroutine, public force_field_pack_splines(atomic_kind_set, ff_type, iw2, iw3, iw4, potparm, do_zbl, nonbonded_type)
create the pair potential spline environment
subroutine, public force_field_unique_tors(particle_set, molecule_kind_set, molecule_set, ff_type, iw)
Determine the number of unique torsion kind and allocate torsion_kind_set.
subroutine, public force_field_pack_nonbond(atomic_kind_set, ff_type, qmmm_env, fatal, iw, ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond, ewald_env)
Assign input and potential info to potparm_nonbond.
subroutine, public force_field_pack_charge(atomic_kind_set, qmmm_env, fatal, iw, iw4, ainfo, my_qmmm, inp_info)
Set up atomic_kind_set()fist_potential%[qeff] and shell potential parameters.
subroutine, public force_field_pack_bend(particle_set, molecule_kind_set, molecule_set, fatal, ainfo, chm_info, inp_info, gro_info, amb_info, iw)
Pack in bends information needed for the force_field.
subroutine, public force_field_pack_eicut(atomic_kind_set, ff_type, potparm_nonbond, ewald_env, iw)
Compute the electrostatic interaction cutoffs.
subroutine, public force_field_pack_bond(particle_set, molecule_kind_set, molecule_set, fatal, ainfo, chm_info, inp_info, gro_info, amb_info, iw)
Pack in bonds information needed for the force_field.
subroutine, public force_field_pack_damp(atomic_kind_set, iw, inp_info)
Set up damping parameters.
subroutine, public force_field_pack_nonbond14(atomic_kind_set, ff_type, qmmm_env, iw, ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond14, ewald_env)
Assign input and potential info to potparm_nonbond14.
subroutine, public force_field_pack_ub(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, iw)
Pack in Urey-Bradley information needed for the force_field.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Definition of mathematical constants and functions.
real(kind=dp), parameter, public sqrthalf
Utility routines for the memory handling.
Define the molecule kind structure types and the corresponding functionality.
subroutine, public get_molecule_kind(molecule_kind, atom_list, bond_list, bend_list, ub_list, impr_list, opbend_list, colv_list, fixd_list, g3x3_list, g4x6_list, vsite_list, torsion_list, shell_list, name, mass, charge, kind_number, natom, nbend, nbond, nub, nimpr, nopbend, nconstraint, nconstraint_fixd, nfixd, ncolv, ng3x3, ng4x6, nvsite, nfixd_restraint, ng3x3_restraint, ng4x6_restraint, nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion, molecule_list, nelectron, nelectron_alpha, nelectron_beta, bond_kind_set, bend_kind_set, ub_kind_set, impr_kind_set, opbend_kind_set, torsion_kind_set, molname_generated)
Get informations about a molecule kind.
subroutine, public set_molecule_kind(molecule_kind, name, mass, charge, kind_number, molecule_list, atom_list, nbond, bond_list, nbend, bend_list, nub, ub_list, nimpr, impr_list, nopbend, opbend_list, ntorsion, torsion_list, fixd_list, ncolv, colv_list, ng3x3, g3x3_list, ng4x6, nfixd, g4x6_list, nvsite, vsite_list, ng3x3_restraint, ng4x6_restraint, nfixd_restraint, nshell, shell_list, nvsite_restraint, bond_kind_set, bend_kind_set, ub_kind_set, torsion_kind_set, impr_kind_set, opbend_kind_set, nelectron, nsgf, molname_generated)
Set the components of a molecule kind.
Define the data structure for the molecule information.
subroutine, public get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, first_atom, last_atom, first_shell, last_shell)
Get components from a molecule data set.
real(kind=dp) function, public potential_coulomb(r2, fscalar, qfac, ewald_type, alpha, beta, interaction_cutoff)
Evaluates the electrostatic energy and force.
integer, parameter, public sh_sh
integer, parameter, public nosh_nosh
integer, parameter, public lj_charmm_type
integer, parameter, public allegro_type
integer, parameter, public nequip_type
integer, parameter, public lj_type
integer, parameter, public deepmd_type
subroutine, public pair_potential_single_copy(potparm_source, potparm_dest)
Copy two potential parameter type.
integer, parameter, public nn_type
subroutine, public pair_potential_single_add(potparm_source, potparm_dest)
Add potential parameter type to an existing potential parameter type Used in case of multiple_potenti...
integer, parameter, public siepmann_type
integer, parameter, public nosh_sh
subroutine, public pair_potential_single_clean(potparm)
Cleans the potential parameter type.
subroutine, public pair_potential_lj_create(lj)
Cleans the LJ potential type.
integer, parameter, public ace_type
subroutine, public pair_potential_pp_create(potparm, nkinds)
Data-structure that constains potential parameters.
integer, parameter, public mace_type
integer, parameter, public ea_type
integer, parameter, public tersoff_type
subroutine, public spline_nonbond_control(spline_env, potparm, atomic_kind_set, eps_spline, max_energy, rlow_nb, emax_spline, npoints, iw, iw2, iw3, do_zbl, shift_cutoff, nonbonded_type)
creates the splines for the potentials
subroutine, public get_nonbond_storage(spline_env, potparm, atomic_kind_set, do_zbl, shift_cutoff)
Prescreening of the effective bonds evaluations. linear scaling algorithm.
Define the data structure for the particle information.
subroutine, public allocate_particle_set(particle_set, nparticle)
Allocate a particle set.
Definition of physical constants:
real(kind=dp), parameter, public bohr
logical function, public qmmm_ff_precond_only_qm(id1, id2, id3, id4, is_link)
This function handles the atom names and modifies the "_QM_" prefix, in order to find the parameters ...
routines for handling splines_types
subroutine, public spline_data_p_release(spl_p)
releases spline_data_p
subroutine, public spline_env_release(spline_env)
releases spline_env
subroutine, public spline_data_p_retain(spl_p)
retains spline_data_p_type
Utilities for string manipulations.
subroutine, public integer_to_string(inumber, string)
Converts an integer number to a string. The WRITE statement will return an error message,...
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
to build arrays of pointers