86#include "./base/base_uses.f90"
90 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'force_fields_all'
126 molecule_kind_set, molecule_set, ff_type)
133 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_bond'
135 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
137 INTEGER :: atm_a, atm_b, counter, first, handle2, &
138 i, j, k, last, natom, nbond
139 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
140 INTEGER,
POINTER :: map_bond_kind(:)
144 TYPE(
bond_type),
DIMENSION(:),
POINTER :: bond_list
148 CALL timeset(routinen, handle2)
149 DO i = 1,
SIZE(molecule_kind_set)
150 molecule_kind => molecule_kind_set(i)
152 molecule_list=molecule_list, &
154 nbond=nbond, bond_list=bond_list)
155 molecule => molecule_set(molecule_list(1))
156 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
158 ALLOCATE (map_bond_kind(nbond))
167 atm_a = bond_list(j)%a
168 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
171 atm_b = bond_list(j)%b
172 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
177 atm_a = bond_list(k)%a
178 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
181 atm_b = bond_list(k)%b
182 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
185 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
186 ((name_atm_b) == (name_atm_b2))) .OR. &
187 (((name_atm_a) == (name_atm_b2)) .AND. &
188 ((name_atm_b) == (name_atm_a2))))
THEN
190 map_bond_kind(j) = map_bond_kind(k)
194 IF (.NOT. found)
THEN
195 counter = counter + 1
196 map_bond_kind(j) = counter
200 NULLIFY (bond_kind_set)
203 bond_list(j)%bond_kind => bond_kind_set(map_bond_kind(j))
206 bond_kind_set=bond_kind_set, bond_list=bond_list)
207 DEALLOCATE (map_bond_kind)
210 CALL timestop(handle2)
222 molecule_kind_set, molecule_set, ff_type)
229 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_bend'
231 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
232 name_atm_b2, name_atm_c, name_atm_c2
233 INTEGER :: atm_a, atm_b, atm_c, counter, first, &
234 handle2, i, j, k, last, natom, nbend
235 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
236 INTEGER,
POINTER :: map_bend_kind(:)
240 TYPE(
bend_type),
DIMENSION(:),
POINTER :: bend_list
244 CALL timeset(routinen, handle2)
245 DO i = 1,
SIZE(molecule_kind_set)
246 molecule_kind => molecule_kind_set(i)
248 molecule_list=molecule_list, &
250 nbend=nbend, bend_list=bend_list)
251 molecule => molecule_set(molecule_list(1))
252 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
254 ALLOCATE (map_bend_kind(nbend))
263 atm_a = bend_list(j)%a
264 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
267 atm_b = bend_list(j)%b
268 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
271 atm_c = bend_list(j)%c
272 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
277 atm_a = bend_list(k)%a
278 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
281 atm_b = bend_list(k)%b
282 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
285 atm_c = bend_list(k)%c
286 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
289 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
290 ((name_atm_b) == (name_atm_b2)) .AND. &
291 ((name_atm_c) == (name_atm_c2))) .OR. &
292 (((name_atm_a) == (name_atm_c2)) .AND. &
293 ((name_atm_b) == (name_atm_b2)) .AND. &
294 ((name_atm_c) == (name_atm_a2))))
THEN
296 map_bend_kind(j) = map_bend_kind(k)
300 IF (.NOT. found)
THEN
301 counter = counter + 1
302 map_bend_kind(j) = counter
306 NULLIFY (bend_kind_set)
309 bend_list(j)%bend_kind => bend_kind_set(map_bend_kind(j))
312 bend_kind_set=bend_kind_set, bend_list=bend_list)
313 DEALLOCATE (map_bend_kind)
316 CALL timestop(handle2)
327 molecule_kind_set, molecule_set)
333 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_ub'
335 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
336 name_atm_b2, name_atm_c, name_atm_c2
337 INTEGER :: atm_a, atm_b, atm_c, counter, first, &
338 handle2, i, j, k, last, natom, nub
339 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
340 INTEGER,
POINTER :: map_ub_kind(:)
345 TYPE(
ub_kind_type),
DIMENSION(:),
POINTER :: ub_kind_set
346 TYPE(
ub_type),
DIMENSION(:),
POINTER :: ub_list
348 CALL timeset(routinen, handle2)
349 DO i = 1,
SIZE(molecule_kind_set)
350 molecule_kind => molecule_kind_set(i)
352 molecule_list=molecule_list, &
354 nub=nub, ub_list=ub_list)
355 molecule => molecule_set(molecule_list(1))
356 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
358 ALLOCATE (map_ub_kind(nub))
362 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
366 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
370 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
376 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
380 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
384 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
387 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
388 ((name_atm_b) == (name_atm_b2)) .AND. &
389 ((name_atm_c) == (name_atm_c2))) .OR. &
390 (((name_atm_a) == (name_atm_c2)) .AND. &
391 ((name_atm_b) == (name_atm_b2)) .AND. &
392 ((name_atm_c) == (name_atm_a2))))
THEN
394 map_ub_kind(j) = map_ub_kind(k)
398 IF (.NOT. found)
THEN
399 counter = counter + 1
400 map_ub_kind(j) = counter
405 ub_list(j)%ub_kind => ub_kind_set(map_ub_kind(j))
408 ub_kind_set=ub_kind_set, ub_list=ub_list)
409 DEALLOCATE (map_ub_kind)
412 CALL timestop(handle2)
424 molecule_kind_set, molecule_set, ff_type)
431 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_tors'
433 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
434 name_atm_b2, name_atm_c, name_atm_c2, &
435 name_atm_d, name_atm_d2
436 INTEGER :: atm_a, atm_b, atm_c, atm_d, counter, &
437 first, handle2, i, j, k, last, natom, &
439 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
440 INTEGER,
POINTER :: map_torsion_kind(:)
441 LOGICAL :: chk_reverse, found
446 TYPE(
torsion_type),
DIMENSION(:),
POINTER :: torsion_list
448 CALL timeset(routinen, handle2)
454 DO i = 1,
SIZE(molecule_kind_set)
455 molecule_kind => molecule_kind_set(i)
457 molecule_list=molecule_list, &
459 ntorsion=ntorsion, torsion_list=torsion_list)
460 molecule => molecule_set(molecule_list(1))
461 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
462 IF (ntorsion > 0)
THEN
463 ALLOCATE (map_torsion_kind(ntorsion))
467 map_torsion_kind(j) = j
472 atm_a = torsion_list(j)%a
473 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
476 atm_b = torsion_list(j)%b
477 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
480 atm_c = torsion_list(j)%c
481 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
484 atm_d = torsion_list(j)%d
485 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
490 atm_a = torsion_list(k)%a
491 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
494 atm_b = torsion_list(k)%b
495 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
498 atm_c = torsion_list(k)%c
499 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
502 atm_d = torsion_list(k)%d
503 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
506 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
507 ((name_atm_b) == (name_atm_b2)) .AND. &
508 ((name_atm_c) == (name_atm_c2)) .AND. &
509 ((name_atm_d) == (name_atm_d2))) .OR. &
511 ((name_atm_a) == (name_atm_d2)) .AND. &
512 ((name_atm_b) == (name_atm_c2)) .AND. &
513 ((name_atm_c) == (name_atm_b2)) .AND. &
514 ((name_atm_d) == (name_atm_a2))))
THEN
516 map_torsion_kind(j) = map_torsion_kind(k)
520 IF (.NOT. found)
THEN
521 counter = counter + 1
522 map_torsion_kind(j) = counter
526 NULLIFY (torsion_kind_set)
529 torsion_list(j)%torsion_kind => torsion_kind_set(map_torsion_kind(j))
532 torsion_kind_set=torsion_kind_set, torsion_list=torsion_list)
533 DEALLOCATE (map_torsion_kind)
536 CALL timestop(handle2)
548 molecule_kind_set, molecule_set, ff_type)
555 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_impr'
557 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
558 name_atm_b2, name_atm_c, name_atm_c2, &
559 name_atm_d, name_atm_d2
560 INTEGER :: atm_a, atm_b, atm_c, atm_d, counter, &
561 first, handle2, i, j, k, last, natom, &
563 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
564 INTEGER,
POINTER :: map_impr_kind(:)
568 TYPE(
impr_type),
DIMENSION(:),
POINTER :: impr_list
572 CALL timeset(routinen, handle2)
573 DO i = 1,
SIZE(molecule_kind_set)
574 molecule_kind => molecule_kind_set(i)
576 molecule_list=molecule_list, &
578 nimpr=nimpr, impr_list=impr_list)
579 molecule => molecule_set(molecule_list(1))
580 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
582 ALLOCATE (map_impr_kind(nimpr))
591 atm_a = impr_list(j)%a
592 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
595 atm_b = impr_list(j)%b
596 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
599 atm_c = impr_list(j)%c
600 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
603 atm_d = impr_list(j)%d
604 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
609 atm_a = impr_list(k)%a
610 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
613 atm_b = impr_list(k)%b
614 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
617 atm_c = impr_list(k)%c
618 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
621 atm_d = impr_list(k)%d
622 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
625 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
626 ((name_atm_b) == (name_atm_b2)) .AND. &
627 ((name_atm_c) == (name_atm_c2)) .AND. &
628 ((name_atm_d) == (name_atm_d2))) .OR. &
629 (((name_atm_a) == (name_atm_a2)) .AND. &
630 ((name_atm_b) == (name_atm_b2)) .AND. &
631 ((name_atm_c) == (name_atm_d2)) .AND. &
632 ((name_atm_d) == (name_atm_c2))))
THEN
634 map_impr_kind(j) = map_impr_kind(k)
638 IF (.NOT. found)
THEN
639 counter = counter + 1
640 map_impr_kind(j) = counter
644 NULLIFY (impr_kind_set)
647 impr_list(j)%impr_kind => impr_kind_set(map_impr_kind(j))
650 impr_kind_set=impr_kind_set, impr_list=impr_list)
651 DEALLOCATE (map_impr_kind)
654 CALL timestop(handle2)
668 molecule_kind_set, molecule_set, ff_type)
675 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_unique_opbend'
677 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a2, name_atm_b, &
678 name_atm_b2, name_atm_c, name_atm_c2, &
679 name_atm_d, name_atm_d2
680 INTEGER :: atm_a, atm_b, atm_c, atm_d, counter, &
681 first, handle2, i, j, k, last, natom, &
683 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
684 INTEGER,
POINTER :: map_opbend_kind(:)
690 TYPE(
opbend_type),
DIMENSION(:),
POINTER :: opbend_list
692 CALL timeset(routinen, handle2)
693 DO i = 1,
SIZE(molecule_kind_set)
694 molecule_kind => molecule_kind_set(i)
696 molecule_list=molecule_list, &
698 nopbend=nopbend, opbend_list=opbend_list)
699 molecule => molecule_set(molecule_list(1))
700 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
701 IF (nopbend > 0)
THEN
702 ALLOCATE (map_opbend_kind(nopbend))
706 map_opbend_kind(j) = j
711 atm_a = opbend_list(j)%a
712 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
715 atm_b = opbend_list(j)%b
716 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
719 atm_c = opbend_list(j)%c
720 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
723 atm_d = opbend_list(j)%d
724 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
729 atm_a = opbend_list(k)%a
730 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
733 atm_b = opbend_list(k)%b
734 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
737 atm_c = opbend_list(k)%c
738 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
741 atm_d = opbend_list(k)%d
742 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
745 IF ((((name_atm_a) == (name_atm_a2)) .AND. &
746 ((name_atm_b) == (name_atm_b2)) .AND. &
747 ((name_atm_c) == (name_atm_c2)) .AND. &
748 ((name_atm_d) == (name_atm_d2))) .OR. &
749 (((name_atm_a) == (name_atm_a2)) .AND. &
750 ((name_atm_b) == (name_atm_c2)) .AND. &
751 ((name_atm_c) == (name_atm_b2)) .AND. &
752 ((name_atm_d) == (name_atm_d2))))
THEN
754 map_opbend_kind(j) = map_opbend_kind(k)
758 IF (.NOT. found)
THEN
759 counter = counter + 1
760 map_opbend_kind(j) = counter
764 NULLIFY (opbend_kind_set)
767 opbend_list(j)%opbend_kind => opbend_kind_set(map_opbend_kind(j))
770 opbend_kind_set=opbend_kind_set, opbend_list=opbend_list)
771 DEALLOCATE (map_opbend_kind)
774 CALL timestop(handle2)
791 fatal, Ainfo, chm_info, inp_info, gro_info, amb_info)
797 CHARACTER(LEN=default_string_length), &
798 DIMENSION(:),
POINTER :: ainfo
804 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_bond'
806 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b
807 INTEGER :: atm_a, atm_b, first, handle2, i, itype, &
808 j, k, last, natom, nbond
809 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
810 LOGICAL :: found, only_qm
812 TYPE(
bond_type),
DIMENSION(:),
POINTER :: bond_list
816 CALL timeset(routinen, handle2)
818 DO i = 1,
SIZE(molecule_kind_set)
819 molecule_kind => molecule_kind_set(i)
821 molecule_list=molecule_list, &
823 nbond=nbond, bond_list=bond_list)
824 molecule => molecule_set(molecule_list(1))
825 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
827 atm_a = bond_list(j)%a
828 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
831 atm_b = bond_list(j)%b
832 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
841 IF (
ASSOCIATED(gro_info%bond_k))
THEN
842 k =
SIZE(gro_info%bond_k)
843 itype = bond_list(j)%itype
845 bond_list(j)%bond_kind%k(1) = gro_info%bond_k(itype)
846 bond_list(j)%bond_kind%r0 = gro_info%bond_r0(itype)
849 bond_list(j)%bond_kind%k(1) = gro_info%solvent_k(itype)
850 bond_list(j)%bond_kind%r0 = gro_info%solvent_r0(itype)
852 bond_list(j)%bond_kind%id_type = gro_info%ff_gromos_type
853 bond_list(j)%id_type = gro_info%ff_gromos_type
858 IF (
ASSOCIATED(chm_info%bond_a))
THEN
859 DO k = 1,
SIZE(chm_info%bond_a)
860 IF ((((chm_info%bond_a(k)) == (name_atm_a)) .AND. &
861 ((chm_info%bond_b(k)) == (name_atm_b))) .OR. &
862 (((chm_info%bond_a(k)) == (name_atm_b)) .AND. &
863 ((chm_info%bond_b(k)) == (name_atm_a))))
THEN
865 bond_list(j)%bond_kind%k(1) = chm_info%bond_k(k)
866 bond_list(j)%bond_kind%r0 = chm_info%bond_r0(k)
867 CALL issue_duplications(found,
"Bond", name_atm_a, name_atm_b)
875 IF (
ASSOCIATED(amb_info%bond_a))
THEN
876 DO k = 1,
SIZE(amb_info%bond_a)
877 IF ((((amb_info%bond_a(k)) == (name_atm_a)) .AND. &
878 ((amb_info%bond_b(k)) == (name_atm_b))) .OR. &
879 (((amb_info%bond_a(k)) == (name_atm_b)) .AND. &
880 ((amb_info%bond_b(k)) == (name_atm_a))))
THEN
882 bond_list(j)%bond_kind%k(1) = amb_info%bond_k(k)
883 bond_list(j)%bond_kind%r0 = amb_info%bond_r0(k)
884 CALL issue_duplications(found,
"Bond", name_atm_a, name_atm_b)
892 IF (
ASSOCIATED(inp_info%bond_a))
THEN
893 DO k = 1,
SIZE(inp_info%bond_a)
894 IF ((((inp_info%bond_a(k)) == (name_atm_a)) .AND. &
895 ((inp_info%bond_b(k)) == (name_atm_b))) .OR. &
896 (((inp_info%bond_a(k)) == (name_atm_b)) .AND. &
897 ((inp_info%bond_b(k)) == (name_atm_a))))
THEN
898 bond_list(j)%bond_kind%id_type = inp_info%bond_kind(k)
899 bond_list(j)%bond_kind%k(:) = inp_info%bond_k(:, k)
900 bond_list(j)%bond_kind%r0 = inp_info%bond_r0(k)
901 bond_list(j)%bond_kind%cs = inp_info%bond_cs(k)
902 CALL issue_duplications(found,
"Bond", name_atm_a, name_atm_b)
909 IF (.NOT. found)
CALL store_ff_missing_par(atm1=trim(name_atm_a), &
910 atm2=trim(name_atm_b), &
923 CALL timestop(handle2)
940 fatal, Ainfo, chm_info, inp_info, gro_info, amb_info)
946 CHARACTER(LEN=default_string_length), &
947 DIMENSION(:),
POINTER :: ainfo
953 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_bend'
955 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c
956 INTEGER :: atm_a, atm_b, atm_c, first, handle2, i, &
957 itype, j, k, l, last, natom, nbend
958 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
959 LOGICAL :: found, only_qm
961 TYPE(
bend_type),
DIMENSION(:),
POINTER :: bend_list
965 CALL timeset(routinen, handle2)
967 DO i = 1,
SIZE(molecule_kind_set)
968 molecule_kind => molecule_kind_set(i)
970 molecule_list=molecule_list, &
972 nbend=nbend, bend_list=bend_list)
973 molecule => molecule_set(molecule_list(1))
974 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
976 atm_a = bend_list(j)%a
977 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
980 atm_b = bend_list(j)%b
981 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
984 atm_c = bend_list(j)%c
985 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
995 IF (
ASSOCIATED(gro_info%bend_k))
THEN
996 k =
SIZE(gro_info%bend_k)
997 itype = bend_list(j)%itype
999 bend_list(j)%bend_kind%k = gro_info%bend_k(itype)
1000 bend_list(j)%bend_kind%theta0 = gro_info%bend_theta0(itype)
1002 bend_list(j)%bend_kind%k = gro_info%bend_k(itype/k)
1003 bend_list(j)%bend_kind%theta0 = gro_info%bend_theta0(itype/k)
1005 bend_list(j)%bend_kind%id_type = gro_info%ff_gromos_type
1006 bend_list(j)%id_type = gro_info%ff_gromos_type
1011 IF (
ASSOCIATED(chm_info%bend_a))
THEN
1012 DO k = 1,
SIZE(chm_info%bend_a)
1013 IF ((((chm_info%bend_a(k)) == (name_atm_a)) .AND. &
1014 ((chm_info%bend_b(k)) == (name_atm_b)) .AND. &
1015 ((chm_info%bend_c(k)) == (name_atm_c))) .OR. &
1016 (((chm_info%bend_a(k)) == (name_atm_c)) .AND. &
1017 ((chm_info%bend_b(k)) == (name_atm_b)) .AND. &
1018 ((chm_info%bend_c(k)) == (name_atm_a))))
THEN
1020 bend_list(j)%bend_kind%k = chm_info%bend_k(k)
1021 bend_list(j)%bend_kind%theta0 = chm_info%bend_theta0(k)
1022 CALL issue_duplications(found,
"Bend", name_atm_a, name_atm_b, &
1031 IF (
ASSOCIATED(amb_info%bend_a))
THEN
1032 DO k = 1,
SIZE(amb_info%bend_a)
1033 IF ((((amb_info%bend_a(k)) == (name_atm_a)) .AND. &
1034 ((amb_info%bend_b(k)) == (name_atm_b)) .AND. &
1035 ((amb_info%bend_c(k)) == (name_atm_c))) .OR. &
1036 (((amb_info%bend_a(k)) == (name_atm_c)) .AND. &
1037 ((amb_info%bend_b(k)) == (name_atm_b)) .AND. &
1038 ((amb_info%bend_c(k)) == (name_atm_a))))
THEN
1040 bend_list(j)%bend_kind%k = amb_info%bend_k(k)
1041 bend_list(j)%bend_kind%theta0 = amb_info%bend_theta0(k)
1042 CALL issue_duplications(found,
"Bend", name_atm_a, name_atm_b, &
1051 IF (
ASSOCIATED(inp_info%bend_a))
THEN
1052 DO k = 1,
SIZE(inp_info%bend_a)
1053 IF ((((inp_info%bend_a(k)) == (name_atm_a)) .AND. &
1054 ((inp_info%bend_b(k)) == (name_atm_b)) .AND. &
1055 ((inp_info%bend_c(k)) == (name_atm_c))) .OR. &
1056 (((inp_info%bend_a(k)) == (name_atm_c)) .AND. &
1057 ((inp_info%bend_b(k)) == (name_atm_b)) .AND. &
1058 ((inp_info%bend_c(k)) == (name_atm_a))))
THEN
1059 bend_list(j)%bend_kind%id_type = inp_info%bend_kind(k)
1060 bend_list(j)%bend_kind%k = inp_info%bend_k(k)
1061 bend_list(j)%bend_kind%theta0 = inp_info%bend_theta0(k)
1062 bend_list(j)%bend_kind%cb = inp_info%bend_cb(k)
1063 bend_list(j)%bend_kind%r012 = inp_info%bend_r012(k)
1064 bend_list(j)%bend_kind%r032 = inp_info%bend_r032(k)
1065 bend_list(j)%bend_kind%kbs12 = inp_info%bend_kbs12(k)
1066 bend_list(j)%bend_kind%kbs32 = inp_info%bend_kbs32(k)
1067 bend_list(j)%bend_kind%kss = inp_info%bend_kss(k)
1068 bend_list(j)%bend_kind%legendre%order = inp_info%bend_legendre(k)%order
1069 IF (bend_list(j)%bend_kind%legendre%order /= 0)
THEN
1070 IF (
ASSOCIATED(bend_list(j)%bend_kind%legendre%coeffs))
THEN
1071 DEALLOCATE (bend_list(j)%bend_kind%legendre%coeffs)
1073 ALLOCATE (bend_list(j)%bend_kind%legendre%coeffs(bend_list(j)%bend_kind%legendre%order))
1074 DO l = 1, bend_list(j)%bend_kind%legendre%order
1075 bend_list(j)%bend_kind%legendre%coeffs(l) = inp_info%bend_legendre(k)%coeffs(l)
1078 CALL issue_duplications(found,
"Bend", name_atm_a, name_atm_b, &
1086 IF (.NOT. found)
CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1087 atm2=trim(name_atm_b), &
1088 atm3=trim(name_atm_c), &
1090 type_name=
"Angle", &
1099 bend_list=bend_list)
1101 CALL timestop(handle2)
1116 Ainfo, chm_info, inp_info, iw)
1121 CHARACTER(LEN=default_string_length), &
1122 DIMENSION(:),
POINTER :: ainfo
1127 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_ub'
1129 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c
1130 INTEGER :: atm_a, atm_b, atm_c, first, handle2, i, &
1131 j, k, last, natom, nub
1132 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1133 LOGICAL :: found, only_qm
1137 TYPE(
ub_type),
DIMENSION(:),
POINTER :: ub_list
1139 CALL timeset(routinen, handle2)
1140 DO i = 1,
SIZE(molecule_kind_set)
1141 molecule_kind => molecule_kind_set(i)
1143 molecule_list=molecule_list, &
1145 nub=nub, ub_list=ub_list)
1146 molecule => molecule_set(molecule_list(1))
1147 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1149 atm_a = ub_list(j)%a
1150 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1153 atm_b = ub_list(j)%b
1154 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1157 atm_c = ub_list(j)%c
1158 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1171 IF (
ASSOCIATED(chm_info%ub_a))
THEN
1172 DO k = 1,
SIZE(chm_info%ub_a)
1173 IF ((((chm_info%ub_a(k)) == (name_atm_a)) .AND. &
1174 ((chm_info%ub_b(k)) == (name_atm_b)) .AND. &
1175 ((chm_info%ub_c(k)) == (name_atm_c))) .OR. &
1176 (((chm_info%ub_a(k)) == (name_atm_c)) .AND. &
1177 ((chm_info%ub_b(k)) == (name_atm_b)) .AND. &
1178 ((chm_info%ub_c(k)) == (name_atm_a))))
THEN
1180 ub_list(j)%ub_kind%k(1) = chm_info%ub_k(k)
1181 ub_list(j)%ub_kind%r0 = chm_info%ub_r0(k)
1182 IF (iw > 0)
WRITE (iw, *)
" Found UB ", trim(name_atm_a),
" ", &
1183 trim(name_atm_b),
" ", trim(name_atm_c)
1184 CALL issue_duplications(found,
"Urey-Bradley", name_atm_a, &
1185 name_atm_b, name_atm_c)
1196 IF (
ASSOCIATED(inp_info%ub_a))
THEN
1197 DO k = 1,
SIZE(inp_info%ub_a)
1198 IF ((((inp_info%ub_a(k)) == (name_atm_a)) .AND. &
1199 ((inp_info%ub_b(k)) == (name_atm_b)) .AND. &
1200 ((inp_info%ub_c(k)) == (name_atm_c))) .OR. &
1201 (((inp_info%ub_a(k)) == (name_atm_c)) .AND. &
1202 ((inp_info%ub_b(k)) == (name_atm_b)) .AND. &
1203 ((inp_info%ub_c(k)) == (name_atm_a))))
THEN
1204 ub_list(j)%ub_kind%id_type = inp_info%ub_kind(k)
1205 ub_list(j)%ub_kind%k(:) = inp_info%ub_k(:, k)
1206 ub_list(j)%ub_kind%r0 = inp_info%ub_r0(k)
1207 CALL issue_duplications(found,
"Urey-Bradley", name_atm_a, &
1208 name_atm_b, name_atm_c)
1215 IF (.NOT. found)
THEN
1216 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1217 atm2=trim(name_atm_b), &
1218 atm3=trim(name_atm_c), &
1219 type_name=
"Urey-Bradley", &
1223 ub_list(j)%ub_kind%k = 0.0_dp
1224 ub_list(j)%ub_kind%r0 = 0.0_dp
1236 CALL timestop(handle2)
1253 Ainfo, chm_info, inp_info, gro_info, amb_info, iw)
1258 CHARACTER(LEN=default_string_length), &
1259 DIMENSION(:),
POINTER :: ainfo
1264 INTEGER,
INTENT(IN) :: iw
1266 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_tors'
1268 CHARACTER(LEN=default_string_length) :: ldum, name_atm_a, name_atm_b, &
1269 name_atm_c, name_atm_d
1270 INTEGER :: atm_a, atm_b, atm_c, atm_d, first, &
1271 handle2, i, imul, itype, j, k, k_end, &
1272 k_start, last, natom, ntorsion, &
1274 INTEGER,
DIMENSION(4) :: glob_atm_id
1275 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1276 LOGICAL :: found, only_qm
1280 TYPE(
torsion_type),
DIMENSION(:),
POINTER :: torsion_list
1282 CALL timeset(routinen, handle2)
1284 DO i = 1,
SIZE(molecule_kind_set)
1285 molecule_kind => molecule_kind_set(i)
1287 molecule_list=molecule_list, &
1289 ntorsion=ntorsion, torsion_list=torsion_list)
1290 molecule => molecule_set(molecule_list(1))
1291 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1293 IF (torsion_list(j)%torsion_kind%id_type ==
do_ff_undef)
THEN
1294 atm_a = torsion_list(j)%a
1295 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1298 atm_b = torsion_list(j)%b
1299 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1302 atm_c = torsion_list(j)%c
1303 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1306 atm_d = torsion_list(j)%d
1307 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
1318 IF (
ASSOCIATED(gro_info%torsion_k))
THEN
1319 k =
SIZE(gro_info%torsion_k)
1320 itype = torsion_list(j)%itype
1322 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, 1)
1323 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, 1)
1324 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, 1)
1325 torsion_list(j)%torsion_kind%nmul = 1
1326 torsion_list(j)%torsion_kind%m(1) = gro_info%torsion_m(itype)
1327 torsion_list(j)%torsion_kind%k(1) = gro_info%torsion_k(itype)
1328 torsion_list(j)%torsion_kind%phi0(1) = gro_info%torsion_phi0(itype)
1330 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, 1)
1331 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, 1)
1332 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, 1)
1333 torsion_list(j)%torsion_kind%nmul = 1
1334 torsion_list(j)%torsion_kind%m(1) = gro_info%torsion_m(itype/k)
1335 torsion_list(j)%torsion_kind%k(1) = gro_info%torsion_k(itype/k)
1336 torsion_list(j)%torsion_kind%phi0(1) = gro_info%torsion_phi0(itype/k)
1338 torsion_list(j)%torsion_kind%id_type = gro_info%ff_gromos_type
1339 torsion_list(j)%id_type = gro_info%ff_gromos_type
1341 imul = torsion_list(j)%torsion_kind%nmul
1345 IF (
ASSOCIATED(chm_info%torsion_a))
THEN
1346 DO k = 1,
SIZE(chm_info%torsion_a)
1347 IF ((((chm_info%torsion_a(k)) == (name_atm_a)) .AND. &
1348 ((chm_info%torsion_b(k)) == (name_atm_b)) .AND. &
1349 ((chm_info%torsion_c(k)) == (name_atm_c)) .AND. &
1350 ((chm_info%torsion_d(k)) == (name_atm_d))) .OR. &
1351 (((chm_info%torsion_a(k)) == (name_atm_d)) .AND. &
1352 ((chm_info%torsion_b(k)) == (name_atm_c)) .AND. &
1353 ((chm_info%torsion_c(k)) == (name_atm_b)) .AND. &
1354 ((chm_info%torsion_d(k)) == (name_atm_a))))
THEN
1355 imul = torsion_list(j)%torsion_kind%nmul + 1
1356 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1357 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1358 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1360 torsion_list(j)%torsion_kind%k(imul) = chm_info%torsion_k(k)
1361 torsion_list(j)%torsion_kind%m(imul) = chm_info%torsion_m(k)
1362 torsion_list(j)%torsion_kind%phi0(imul) = chm_info%torsion_phi0(k)
1363 torsion_list(j)%torsion_kind%nmul = imul
1368 IF (.NOT. found)
THEN
1369 DO k = 1,
SIZE(chm_info%torsion_a)
1370 IF ((((chm_info%torsion_a(k)) == (
"X")) .AND. &
1371 ((chm_info%torsion_b(k)) == (name_atm_b)) .AND. &
1372 ((chm_info%torsion_c(k)) == (name_atm_c)) .AND. &
1373 ((chm_info%torsion_d(k)) == (
"X"))) .OR. &
1374 (((chm_info%torsion_a(k)) == (
"X")) .AND. &
1375 ((chm_info%torsion_b(k)) == (name_atm_c)) .AND. &
1376 ((chm_info%torsion_c(k)) == (name_atm_b)) .AND. &
1377 ((chm_info%torsion_d(k)) == (
"X"))))
THEN
1378 imul = torsion_list(j)%torsion_kind%nmul + 1
1379 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1380 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1381 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1383 torsion_list(j)%torsion_kind%k(imul) = chm_info%torsion_k(k)
1384 torsion_list(j)%torsion_kind%m(imul) = chm_info%torsion_m(k)
1385 torsion_list(j)%torsion_kind%phi0(imul) = chm_info%torsion_phi0(k)
1386 torsion_list(j)%torsion_kind%nmul = imul
1396 IF (
ASSOCIATED(amb_info%torsion_a))
THEN
1398 glob_atm_id(1) = atm_a + first - 1
1399 glob_atm_id(2) = atm_b + first - 1
1400 glob_atm_id(3) = atm_c + first - 1
1401 glob_atm_id(4) = atm_d + first - 1
1406 k_start = bsearch_leftmost_2d(amb_info%raw_torsion_id, glob_atm_id(1))
1407 k_end = ubound(amb_info%raw_torsion_id, dim=2)
1410 IF (k_start /= 0)
THEN
1412 DO k = k_start, k_end
1413 IF (glob_atm_id(1) < amb_info%raw_torsion_id(1, k))
EXIT
1414 IF (any((glob_atm_id - amb_info%raw_torsion_id(1:4, k)) /= 0)) cycle
1416 raw_parm_id = amb_info%raw_torsion_id(5, k)
1417 imul = torsion_list(j)%torsion_kind%nmul + 1
1418 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1419 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1420 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1421 torsion_list(j)%torsion_kind%id_type =
do_ff_amber
1422 torsion_list(j)%torsion_kind%k(imul) = amb_info%raw_torsion_k(raw_parm_id)
1423 torsion_list(j)%torsion_kind%m(imul) = nint(amb_info%raw_torsion_m(raw_parm_id))
1424 torsion_list(j)%torsion_kind%phi0(imul) = amb_info%raw_torsion_phi0(raw_parm_id)
1425 torsion_list(j)%torsion_kind%nmul = imul
1434 IF (
ASSOCIATED(inp_info%torsion_a))
THEN
1435 DO k = 1,
SIZE(inp_info%torsion_a)
1436 IF ((((inp_info%torsion_a(k)) == (name_atm_a)) .AND. &
1437 ((inp_info%torsion_b(k)) == (name_atm_b)) .AND. &
1438 ((inp_info%torsion_c(k)) == (name_atm_c)) .AND. &
1439 ((inp_info%torsion_d(k)) == (name_atm_d))) .OR. &
1440 (((inp_info%torsion_a(k)) == (name_atm_d)) .AND. &
1441 ((inp_info%torsion_b(k)) == (name_atm_c)) .AND. &
1442 ((inp_info%torsion_c(k)) == (name_atm_b)) .AND. &
1443 ((inp_info%torsion_d(k)) == (name_atm_a))))
THEN
1444 imul = torsion_list(j)%torsion_kind%nmul + 1
1445 CALL reallocate(torsion_list(j)%torsion_kind%k, 1, imul)
1446 CALL reallocate(torsion_list(j)%torsion_kind%m, 1, imul)
1447 CALL reallocate(torsion_list(j)%torsion_kind%phi0, 1, imul)
1448 torsion_list(j)%torsion_kind%id_type = inp_info%torsion_kind(k)
1449 torsion_list(j)%torsion_kind%k(imul) = inp_info%torsion_k(k)
1450 torsion_list(j)%torsion_kind%m(imul) = inp_info%torsion_m(k)
1451 torsion_list(j)%torsion_kind%phi0(imul) = inp_info%torsion_phi0(k)
1452 torsion_list(j)%torsion_kind%nmul = imul
1458 IF (.NOT. found)
THEN
1459 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1460 atm2=trim(name_atm_b), &
1461 atm3=trim(name_atm_c), &
1462 atm4=trim(name_atm_d), &
1463 type_name=
"Torsion", &
1465 torsion_list(j)%torsion_kind%id_type =
do_ff_undef
1469 IF ((imul /= 1) .AND. (iw > 0)) &
1470 WRITE (iw,
'(/,2("UTIL_INFO| ",A,/))') &
1471 "Multiple Torsion declarations: "//trim(name_atm_a)// &
1472 ","//trim(name_atm_b)//
","//trim(name_atm_c)//
" and "//trim(name_atm_d), &
1473 "Number of defined torsions: "//trim(ldum)//
" ."
1479 IF (iw > 0)
WRITE (iw, *)
" Torsion PARAM between QM atoms ", j,
" : ", &
1480 trim(name_atm_a),
" ", &
1481 trim(name_atm_b),
" ", &
1482 trim(name_atm_c),
" ", &
1483 trim(name_atm_d),
" ", &
1484 torsion_list(j)%a, &
1485 torsion_list(j)%b, &
1486 torsion_list(j)%c, &
1488 torsion_list(j)%torsion_kind%id_type =
do_ff_undef
1494 torsion_list=torsion_list)
1496 CALL timestop(handle2)
1511 Ainfo, chm_info, inp_info, gro_info)
1516 CHARACTER(LEN=default_string_length), &
1517 DIMENSION(:),
POINTER :: ainfo
1522 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_impr'
1524 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c, &
1526 INTEGER :: atm_a, atm_b, atm_c, atm_d, first, &
1527 handle2, i, itype, j, k, last, natom, &
1529 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1530 LOGICAL :: found, only_qm
1532 TYPE(
impr_type),
DIMENSION(:),
POINTER :: impr_list
1536 CALL timeset(routinen, handle2)
1538 DO i = 1,
SIZE(molecule_kind_set)
1539 molecule_kind => molecule_kind_set(i)
1541 molecule_list=molecule_list, &
1543 nimpr=nimpr, impr_list=impr_list)
1544 molecule => molecule_set(molecule_list(1))
1545 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1547 atm_a = impr_list(j)%a
1548 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1551 atm_b = impr_list(j)%b
1552 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1555 atm_c = impr_list(j)%c
1556 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1559 atm_d = impr_list(j)%d
1560 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
1571 IF (
ASSOCIATED(gro_info%impr_k))
THEN
1572 k =
SIZE(gro_info%impr_k)
1573 itype = impr_list(j)%itype
1575 impr_list(j)%impr_kind%k = gro_info%impr_k(itype)
1576 impr_list(j)%impr_kind%phi0 = gro_info%impr_phi0(itype)
1578 impr_list(j)%impr_kind%k = gro_info%impr_k(itype)
1579 impr_list(j)%impr_kind%phi0 = gro_info%impr_phi0(itype)
1582 impr_list(j)%impr_kind%id_type = gro_info%ff_gromos_type
1583 impr_list(j)%id_type = gro_info%ff_gromos_type
1587 IF (
ASSOCIATED(chm_info%impr_a))
THEN
1588 DO k = 1,
SIZE(chm_info%impr_a)
1589 IF ((((chm_info%impr_a(k)) == (name_atm_a)) .AND. &
1590 ((chm_info%impr_b(k)) == (name_atm_b)) .AND. &
1591 ((chm_info%impr_c(k)) == (name_atm_c)) .AND. &
1592 ((chm_info%impr_d(k)) == (name_atm_d))) .OR. &
1593 (((chm_info%impr_a(k)) == (name_atm_d)) .AND. &
1594 ((chm_info%impr_b(k)) == (name_atm_c)) .AND. &
1595 ((chm_info%impr_c(k)) == (name_atm_b)) .AND. &
1596 ((chm_info%impr_d(k)) == (name_atm_a))))
THEN
1598 impr_list(j)%impr_kind%k = chm_info%impr_k(k)
1599 impr_list(j)%impr_kind%phi0 = chm_info%impr_phi0(k)
1600 CALL issue_duplications(found,
"Impropers", name_atm_a, name_atm_b, &
1601 name_atm_c, name_atm_d)
1606 IF (.NOT. found)
THEN
1607 DO k = 1,
SIZE(chm_info%impr_a)
1608 IF ((((chm_info%impr_a(k)) == (name_atm_a)) .AND. &
1609 ((chm_info%impr_b(k)) == (
"X")) .AND. &
1610 ((chm_info%impr_c(k)) == (
"X")) .AND. &
1611 ((chm_info%impr_d(k)) == (name_atm_d))) .OR. &
1612 (((chm_info%impr_a(k)) == (name_atm_d)) .AND. &
1613 ((chm_info%impr_b(k)) == (
"X")) .AND. &
1614 ((chm_info%impr_c(k)) == (
"X")) .AND. &
1615 ((chm_info%impr_d(k)) == (name_atm_a))))
THEN
1617 impr_list(j)%impr_kind%k = chm_info%impr_k(k)
1618 impr_list(j)%impr_kind%phi0 = chm_info%impr_phi0(k)
1619 CALL issue_duplications(found,
"Impropers", name_atm_a, name_atm_b, &
1620 name_atm_c, name_atm_d)
1632 IF (
ASSOCIATED(inp_info%impr_a))
THEN
1633 DO k = 1,
SIZE(inp_info%impr_a)
1634 IF (((inp_info%impr_a(k)) == (name_atm_a)) .AND. &
1635 ((inp_info%impr_b(k)) == (name_atm_b)) .AND. &
1636 ((((inp_info%impr_c(k)) == (name_atm_c)) .AND. &
1637 ((inp_info%impr_d(k)) == (name_atm_d))) .OR. &
1638 (((inp_info%impr_c(k)) == (name_atm_d)) .AND. &
1639 ((inp_info%impr_d(k)) == (name_atm_c)))))
THEN
1640 impr_list(j)%impr_kind%id_type = inp_info%impr_kind(k)
1641 impr_list(j)%impr_kind%k = inp_info%impr_k(k)
1642 IF (((inp_info%impr_c(k)) == (name_atm_c)) .AND. &
1643 ((inp_info%impr_d(k)) == (name_atm_d)))
THEN
1644 impr_list(j)%impr_kind%phi0 = inp_info%impr_phi0(k)
1646 impr_list(j)%impr_kind%phi0 = -inp_info%impr_phi0(k)
1657 CALL issue_duplications(found,
"Impropers", name_atm_a, name_atm_b, &
1658 name_atm_c, name_atm_d)
1665 IF (.NOT. found)
THEN
1666 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1667 atm2=trim(name_atm_b), &
1668 atm3=trim(name_atm_c), &
1669 atm4=trim(name_atm_d), &
1670 type_name=
"Improper", &
1672 impr_list(j)%impr_kind%k = 0.0_dp
1673 impr_list(j)%impr_kind%phi0 = 0.0_dp
1688 CALL timestop(handle2)
1709 CHARACTER(LEN=default_string_length), &
1710 DIMENSION(:),
POINTER :: ainfo
1713 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_opbend'
1715 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c, &
1717 INTEGER :: atm_a, atm_b, atm_c, atm_d, first, &
1718 handle2, i, j, k, last, natom, nopbend
1719 INTEGER,
DIMENSION(:),
POINTER :: molecule_list
1720 LOGICAL :: found, only_qm
1724 TYPE(
opbend_type),
DIMENSION(:),
POINTER :: opbend_list
1726 CALL timeset(routinen, handle2)
1728 DO i = 1,
SIZE(molecule_kind_set)
1729 molecule_kind => molecule_kind_set(i)
1731 molecule_list=molecule_list, &
1733 nopbend=nopbend, opbend_list=opbend_list)
1734 molecule => molecule_set(molecule_list(1))
1736 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
1738 atm_a = opbend_list(j)%a
1739 atomic_kind => particle_set(atm_a + first - 1)%atomic_kind
1742 atm_b = opbend_list(j)%b
1743 atomic_kind => particle_set(atm_b + first - 1)%atomic_kind
1746 atm_c = opbend_list(j)%c
1747 atomic_kind => particle_set(atm_c + first - 1)%atomic_kind
1750 atm_d = opbend_list(j)%d
1751 atomic_kind => particle_set(atm_d + first - 1)%atomic_kind
1762 IF (
ASSOCIATED(inp_info%opbend_a))
THEN
1763 DO k = 1,
SIZE(inp_info%opbend_a)
1764 IF (((inp_info%opbend_a(k)) == (name_atm_a)) .AND. &
1765 ((inp_info%opbend_d(k)) == (name_atm_d)) .AND. &
1766 ((((inp_info%opbend_c(k)) == (name_atm_c)) .AND. &
1767 ((inp_info%opbend_b(k)) == (name_atm_b))) .OR. &
1768 (((inp_info%opbend_c(k)) == (name_atm_b)) .AND. &
1769 ((inp_info%opbend_b(k)) == (name_atm_c)))))
THEN
1770 opbend_list(j)%opbend_kind%id_type = inp_info%opbend_kind(k)
1771 opbend_list(j)%opbend_kind%k = inp_info%opbend_k(k)
1772 IF (((inp_info%opbend_c(k)) == (name_atm_c)) .AND. &
1773 ((inp_info%opbend_b(k)) == (name_atm_b)))
THEN
1774 opbend_list(j)%opbend_kind%phi0 = inp_info%opbend_phi0(k)
1776 opbend_list(j)%opbend_kind%phi0 = -inp_info%opbend_phi0(k)
1786 CALL issue_duplications(found,
"Out of plane bend", name_atm_a, name_atm_b, &
1787 name_atm_c, name_atm_d)
1794 IF (.NOT. found)
THEN
1795 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
1796 atm2=trim(name_atm_b), &
1797 atm3=trim(name_atm_c), &
1798 atm4=trim(name_atm_d), &
1799 type_name=
"Out of plane bend", &
1801 opbend_list(j)%opbend_kind%k = 0.0_dp
1802 opbend_list(j)%opbend_kind%phi0 = 0.0_dp
1817 CALL timestop(handle2)
1834 my_qmmm, qmmm_env, inp_info, iw4)
1836 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charges
1844 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_charges'
1846 CHARACTER(LEN=default_string_length) :: atmname
1847 INTEGER :: handle, iatom, ilink, j, nval
1848 LOGICAL :: found_p, is_link_atom, is_ok, &
1849 only_manybody, only_qm
1850 REAL(kind=
dp) :: charge, charge_tot, rval, scale_factor
1856 CALL timeset(routinen, handle)
1861 IF (
ASSOCIATED(inp_info%shell_list))
THEN
1862 cpabort(
"Array of charges not implemented for CORE-SHELL model!")
1866 cpassert(.NOT. (
ASSOCIATED(charges)))
1867 ALLOCATE (charges(
SIZE(particle_set)))
1871 cpassert(nval ==
SIZE(charges))
1878 charges(iatom) = rval
1881 atomic_kind => particle_set(iatom)%atomic_kind
1883 fist_potential=fist_potential, &
1889 IF (charge /= -huge(0.0_dp)) &
1890 CALL cp_warn(__location__, &
1891 "The charge for atom index ("//
cp_to_string(iatom)//
") and atom name ("// &
1892 trim(atmname)//
") was already defined. The charge associated to this kind"// &
1893 " will be set to an uninitialized value and only the atom specific charge will be used! ")
1894 charge = -huge(0.0_dp)
1897 IF (
ASSOCIATED(inp_info%nonbonded))
THEN
1898 IF (
ASSOCIATED(inp_info%nonbonded%pot))
THEN
1900 only_manybody = .true.
1902 DO j = 1,
SIZE(inp_info%nonbonded%pot)
1903 IF (atmname == inp_info%nonbonded%pot(j)%pot%at1 .OR. &
1904 atmname == inp_info%nonbonded%pot(j)%pot%at2)
THEN
1905 SELECT CASE (inp_info%nonbonded%pot(j)%pot%type(1))
1910 only_manybody = .false.
1916 IF (only_manybody .AND. found_p)
THEN
1917 charges(iatom) = 0.0_dp
1924 IF (only_qm .AND. my_qmmm)
THEN
1926 scale_factor = 0.0_dp
1927 IF (is_link_atom)
THEN
1931 DO ilink = 1,
SIZE(qmmm_env%mm_link_atoms)
1932 IF (iatom == qmmm_env%mm_link_atoms(ilink))
EXIT
1934 cpassert(ilink <=
SIZE(qmmm_env%mm_link_atoms))
1935 scale_factor = qmmm_env%fist_scale_charge_link(ilink)
1937 charges(iatom) = charges(iatom)*scale_factor
1942 charge_tot = sum(charges)
1945 WRITE (iw4, fmt=
'(T2,"CHARGE_INFO| Total Charge of the Classical System: ",T69,F12.6)') charge_tot
1947 CALL timestop(handle)
1963 Ainfo, my_qmmm, inp_info)
1969 CHARACTER(LEN=default_string_length), &
1970 DIMENSION(:),
POINTER :: ainfo
1974 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_charge'
1976 CHARACTER(LEN=default_string_length) :: atmname
1977 INTEGER :: handle, i, ilink, j
1978 INTEGER,
DIMENSION(:),
POINTER :: my_atom_list
1979 LOGICAL :: found, found_p, is_link_atom, is_shell, &
1980 only_manybody, only_qm
1981 REAL(kind=
dp) :: charge, charge_tot, cs_charge, &
1986 CALL timeset(routinen, handle)
1988 DO i = 1,
SIZE(atomic_kind_set)
1989 atomic_kind => atomic_kind_set(i)
1991 fist_potential=fist_potential, &
1992 atom_list=my_atom_list, &
2000 IF (charge /= -huge(0.0_dp)) found = .true.
2003 IF (
ASSOCIATED(inp_info%charge_atm))
THEN
2004 DO j = 1,
SIZE(inp_info%charge_atm)
2005 IF (iw > 0)
WRITE (iw, *)
"Charge Checking ::", trim(inp_info%charge_atm(j)), atmname
2006 IF ((inp_info%charge_atm(j)) == atmname)
THEN
2007 charge = inp_info%charge(j)
2008 CALL issue_duplications(found,
"Charge", atmname)
2016 IF (
ASSOCIATED(inp_info%shell_list))
THEN
2017 DO j = 1,
SIZE(inp_info%shell_list)
2018 IF ((inp_info%shell_list(j)%atm_name) == atmname)
THEN
2020 cs_charge = inp_info%shell_list(j)%shell%charge_core + &
2021 inp_info%shell_list(j)%shell%charge_shell
2025 CALL cp_warn(__location__, &
2026 "CORE-SHELL model defined for KIND ("//trim(atmname)//
")"// &
2027 " ignoring charge definition! ")
2035 IF (
ASSOCIATED(inp_info%nonbonded))
THEN
2036 IF (
ASSOCIATED(inp_info%nonbonded%pot))
THEN
2038 only_manybody = .true.
2040 DO j = 1,
SIZE(inp_info%nonbonded%pot)
2041 IF (atmname == inp_info%nonbonded%pot(j)%pot%at1 .OR. &
2042 atmname == inp_info%nonbonded%pot(j)%pot%at2)
THEN
2043 SELECT CASE (inp_info%nonbonded%pot(j)%pot%type(1))
2049 only_manybody = .false.
2055 IF (only_manybody .AND. found_p)
THEN
2061 IF (.NOT. found)
THEN
2065 CALL store_ff_missing_par(atm1=trim(atmname), &
2067 type_name=
"Charge", &
2073 IF (only_qm .AND. my_qmmm)
THEN
2075 scale_factor = 0.0_dp
2076 IF (is_link_atom)
THEN
2080 DO ilink = 1,
SIZE(qmmm_env%mm_link_atoms)
2081 IF (any(my_atom_list == qmmm_env%mm_link_atoms(ilink)))
EXIT
2083 cpassert(ilink <=
SIZE(qmmm_env%mm_link_atoms))
2084 scale_factor = qmmm_env%fist_scale_charge_link(ilink)
2086 charge = charge*scale_factor
2094 charge_tot = charge_tot + atomic_kind%natom*cs_charge
2096 charge_tot = charge_tot + atomic_kind%natom*charge
2102 WRITE (iw4, fmt=
'(T2,"CHARGE_INFO| Total Charge of the Classical System: ",T69,F12.6)') charge_tot
2104 CALL timestop(handle)
2117 INTEGER,
INTENT(IN) :: iw
2120 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_radius'
2122 CHARACTER(LEN=default_string_length) :: inp_kind_name, kind_name
2123 INTEGER :: handle, i, i_rep, n_rep
2125 REAL(kind=
dp) :: mm_radius
2130 CALL timeset(routinen, handle)
2135 DO i = 1,
SIZE(atomic_kind_set)
2136 atomic_kind => atomic_kind_set(i)
2138 fist_potential=fist_potential, name=kind_name)
2148 c_val=inp_kind_name, i_rep_section=i_rep)
2150 IF (iw > 0)
WRITE (iw, *)
"Matching kinds for MM_RADIUS :: '", &
2151 trim(kind_name),
"' with '", trim(inp_kind_name),
"'"
2152 IF (trim(kind_name) == trim(inp_kind_name))
THEN
2154 keyword_name=
"MM_RADIUS", r_val=mm_radius)
2155 CALL issue_duplications(found,
"MM_RADIUS", kind_name)
2160 CALL set_potential(potential=fist_potential, mm_radius=mm_radius)
2162 CALL timestop(handle)
2175 INTEGER,
INTENT(IN) :: iw
2178 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_pol'
2180 CHARACTER(LEN=default_string_length) :: kind_name
2181 INTEGER :: handle, i, j
2183 REAL(kind=
dp) :: apol, cpol
2187 CALL timeset(routinen, handle)
2189 DO i = 1,
SIZE(atomic_kind_set)
2190 atomic_kind => atomic_kind_set(i)
2192 fist_potential=fist_potential, &
2194 CALL get_potential(potential=fist_potential, apol=apol, cpol=cpol)
2199 IF (
ASSOCIATED(inp_info%apol_atm))
THEN
2200 DO j = 1,
SIZE(inp_info%apol_atm)
2201 IF (iw > 0)
WRITE (iw, *)
"Matching kinds for APOL :: '", &
2202 trim(kind_name),
"' with '", trim(inp_info%apol_atm(j)),
"'"
2203 IF ((inp_info%apol_atm(j)) == kind_name)
THEN
2204 apol = inp_info%apol(j)
2205 CALL issue_duplications(found,
"APOL", kind_name)
2211 IF (
ASSOCIATED(inp_info%cpol_atm))
THEN
2212 DO j = 1,
SIZE(inp_info%cpol_atm)
2213 IF (iw > 0)
WRITE (iw, *)
"Matching kinds for CPOL :: '", &
2214 trim(kind_name),
"' with '", trim(inp_info%cpol_atm(j)),
"'"
2215 IF ((inp_info%cpol_atm(j)) == kind_name)
THEN
2216 cpol = inp_info%cpol(j)
2217 CALL issue_duplications(found,
"CPOL", kind_name)
2223 CALL set_potential(potential=fist_potential, apol=apol, cpol=cpol)
2225 CALL timestop(handle)
2241 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_damp'
2243 CHARACTER(len=default_string_length) :: atm_name1, atm_name2, my_atm_name1, &
2245 INTEGER :: handle2, i, j, k, nkinds
2250 CALL timeset(routinen, handle2)
2252 nkinds =
SIZE(atomic_kind_set)
2254 DO j = 1,
SIZE(atomic_kind_set)
2255 atomic_kind => atomic_kind_set(j)
2259 IF (
ASSOCIATED(inp_info%damping_list))
THEN
2260 DO i = 1,
SIZE(inp_info%damping_list)
2261 my_atm_name1 = inp_info%damping_list(i)%atm_name1
2262 my_atm_name2 = inp_info%damping_list(i)%atm_name2
2264 IF (iw > 0)
WRITE (iw, *)
"Damping Checking ::", trim(my_atm_name1), &
2266 IF (my_atm_name1 == atm_name1)
THEN
2267 IF (.NOT.
ASSOCIATED(damping))
THEN
2272 DO k = 1,
SIZE(atomic_kind_set)
2273 atomic_kind2 => atomic_kind_set(k)
2278 IF (my_atm_name2 == atm_name2)
THEN
2279 IF (damping%damp(k)%bij /= huge(0.0_dp)) found = .true.
2280 CALL issue_duplications(found,
"Damping", atm_name1)
2283 SELECT CASE (trim(inp_info%damping_list(i)%dtype))
2284 CASE (
'TANG-TOENNIES')
2287 cpabort(
"Unknown damping type.")
2289 damping%damp(k)%order = inp_info%damping_list(i)%order
2290 damping%damp(k)%bij = inp_info%damping_list(i)%bij
2291 damping%damp(k)%cij = inp_info%damping_list(i)%cij
2296 CALL cp_warn(__location__, &
2297 "Atom "//trim(my_atm_name2)// &
2298 " in damping parameters for atom "//trim(my_atm_name1)// &
2309 CALL timestop(handle2)
2328 molecule_kind_set, molecule_set, root_section, subsys_section, &
2329 shell_particle_set, core_particle_set, cell, iw, inp_info)
2336 TYPE(
particle_type),
DIMENSION(:),
POINTER :: shell_particle_set, core_particle_set
2341 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_shell'
2343 CHARACTER(LEN=default_string_length) :: atmname
2344 INTEGER :: counter, first, first_shell, handle2, i, &
2345 j, last, last_shell, n, natom, nmol, &
2347 INTEGER,
DIMENSION(:),
POINTER :: molecule_list, shell_list_tmp
2348 LOGICAL :: core_coord_read, found_shell, is_a_shell, is_link_atom, null_massfrac, only_qm, &
2349 save_mem, shell_adiabatic, shell_coord_read
2350 REAL(kind=
dp) :: atmmass
2356 TYPE(
shell_type),
DIMENSION(:),
POINTER :: shell_list
2358 CALL timeset(routinen, handle2)
2362 null_massfrac = .false.
2363 core_coord_read = .false.
2364 shell_coord_read = .false.
2366 NULLIFY (global_section)
2370 DO i = 1,
SIZE(atomic_kind_set)
2371 atomic_kind => atomic_kind_set(i)
2375 found_shell = .false.
2380 IF (
ASSOCIATED(inp_info%shell_list))
THEN
2381 DO j = 1,
SIZE(inp_info%shell_list)
2382 IF (iw > 0)
WRITE (iw, *)
"Shell Checking ::", trim(inp_info%shell_list(j)%atm_name), atmname
2383 IF ((inp_info%shell_list(j)%atm_name) == atmname)
THEN
2385 shell=shell, mass=atmmass, natom=natom)
2386 IF (.NOT.
ASSOCIATED(shell))
ALLOCATE (shell)
2387 nshell_tot = nshell_tot + natom
2388 shell%charge_core = inp_info%shell_list(j)%shell%charge_core
2389 shell%charge_shell = inp_info%shell_list(j)%shell%charge_shell
2390 shell%massfrac = inp_info%shell_list(j)%shell%massfrac
2391 IF (shell%massfrac < epsilon(1.0_dp)) null_massfrac = .true.
2392 shell%k2_spring = inp_info%shell_list(j)%shell%k2_spring
2393 shell%k4_spring = inp_info%shell_list(j)%shell%k4_spring
2394 shell%max_dist = inp_info%shell_list(j)%shell%max_dist
2395 shell%shell_cutoff = inp_info%shell_list(j)%shell%shell_cutoff
2396 shell%mass_shell = shell%massfrac*atmmass
2397 shell%mass_core = atmmass - shell%mass_shell
2398 CALL issue_duplications(found_shell,
"Shell", atmname)
2399 found_shell = .true.
2401 shell=shell, shell_active=.true.)
2407 IF (iw > 0)
WRITE (iw, *)
"Total number of particles with a shell :: ", nshell_tot
2409 NULLIFY (shell_particle_set)
2410 NULLIFY (core_particle_set)
2411 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, shell_adiabatic=shell_adiabatic)
2412 IF (nshell_tot > 0)
THEN
2413 IF (shell_adiabatic .AND. null_massfrac)
THEN
2414 cpabort(
"Shell-model adiabatic: at least one shell_kind has mass zero")
2421 DO i = 1,
SIZE(particle_set)
2422 NULLIFY (atomic_kind)
2424 atomic_kind => particle_set(i)%atomic_kind
2425 CALL get_atomic_kind(atomic_kind=atomic_kind, shell_active=is_a_shell)
2426 IF (is_a_shell)
THEN
2427 counter = counter + 1
2428 particle_set(i)%shell_index = counter
2429 shell_particle_set(counter)%shell_index = counter
2430 shell_particle_set(counter)%atomic_kind => particle_set(i)%atomic_kind
2431 shell_particle_set(counter)%r(1:3) = particle_set(i)%r(1:3)
2432 shell_particle_set(counter)%atom_index = i
2433 core_particle_set(counter)%shell_index = counter
2434 core_particle_set(counter)%atomic_kind => particle_set(i)%atomic_kind
2435 core_particle_set(counter)%r(1:3) = particle_set(i)%r(1:3)
2436 core_particle_set(counter)%atom_index = i
2438 particle_set(i)%shell_index = 0
2441 cpassert(counter == nshell_tot)
2446 subsys_section, shell_coord_read)
2448 subsys_section, core_coord_read)
2450 IF (nshell_tot > 0)
THEN
2453 IF (shell_adiabatic)
THEN
2454 IF (.NOT. (core_coord_read .AND. shell_coord_read))
THEN
2456 subsys_section, core_particle_set, &
2460 IF (.NOT. shell_coord_read)
THEN
2462 subsys_section, save_mem=save_mem)
2467 DO i = 1,
SIZE(molecule_kind_set)
2468 molecule_kind => molecule_kind_set(i)
2469 CALL get_molecule_kind(molecule_kind=molecule_kind, molecule_list=molecule_list, &
2470 natom=natom, nmolecule=nmol)
2471 molecule => molecule_set(molecule_list(1))
2472 CALL get_molecule(molecule=molecule, first_atom=first, last_atom=last)
2473 ALLOCATE (shell_list_tmp(natom))
2476 atomic_kind => particle_set(j)%atomic_kind
2477 CALL get_atomic_kind(atomic_kind=atomic_kind, shell_active=is_a_shell)
2478 IF (is_a_shell)
THEN
2479 counter = counter + 1
2480 shell_list_tmp(counter) = j - first + 1
2481 first_shell = min(first_shell, max(1, particle_set(j)%shell_index))
2484 IF (counter /= 0)
THEN
2486 DO j = 1,
SIZE(molecule_list)
2487 last_shell = first_shell + counter - 1
2488 molecule => molecule_set(molecule_list(j))
2489 molecule%first_shell = first_shell
2490 molecule%last_shell = last_shell
2491 first_shell = last_shell + 1
2495 IF (
ASSOCIATED(shell_list))
THEN
2496 DEALLOCATE (shell_list)
2498 ALLOCATE (shell_list(counter))
2500 shell_list(j)%a = shell_list_tmp(j)
2501 atomic_kind => particle_set(shell_list_tmp(j) + first - 1)%atomic_kind
2502 CALL get_atomic_kind(atomic_kind=atomic_kind, name=atmname, shell=shell)
2504 shell_list(j)%name = atmname
2505 shell_list(j)%shell_kind => shell
2507 CALL set_molecule_kind(molecule_kind=molecule_kind, nshell=counter, shell_list=shell_list)
2509 DEALLOCATE (shell_list_tmp)
2510 n = n + nmol*counter
2513 cpassert(first_shell - 1 == nshell_tot)
2514 cpassert(n == nshell_tot)
2515 CALL timestop(handle2)
2534 Ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond14, ewald_env)
2540 CHARACTER(LEN=default_string_length), &
2541 DIMENSION(:),
POINTER :: ainfo
2549 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_nonbond14'
2551 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a_local, &
2552 name_atm_b, name_atm_b_local
2553 INTEGER :: handle2, i, ii, j, jj, k, match_names
2554 LOGICAL :: found, found_a, found_b, only_qm, &
2556 REAL(kind=
dp) :: epsilon0, epsilon_a, epsilon_b, &
2557 ewald_rcut, rmin, rmin2_a, rmin2_b
2561 use_qmmm_ff = qmmm_env%use_qmmm_ff
2564 CALL timeset(routinen, handle2)
2566 DO i = 1,
SIZE(atomic_kind_set)
2567 atomic_kind => atomic_kind_set(i)
2569 DO j = i,
SIZE(atomic_kind_set)
2570 atomic_kind => atomic_kind_set(j)
2575 name_atm_a = name_atm_a_local
2576 name_atm_b = name_atm_b_local
2580 pot => potparm_nonbond14%pot(i, j)%pot
2583 IF (
ASSOCIATED(gro_info%nonbond_a_14))
THEN
2586 DO k = 1,
SIZE(gro_info%nonbond_a_14)
2587 IF (trim(name_atm_a) == trim(gro_info%nonbond_a_14(k)))
THEN
2593 DO k = 1,
SIZE(gro_info%nonbond_a_14)
2594 IF (trim(name_atm_b) == trim(gro_info%nonbond_a_14(k)))
THEN
2600 IF (ii /= 0 .AND. jj /= 0)
THEN
2603 pot%at1 = name_atm_a
2604 pot%at2 = name_atm_b
2605 pot%set(1)%lj%epsilon = 1.0_dp
2606 pot%set(1)%lj%sigma6 = gro_info%nonbond_c6_14(ii, jj)
2607 pot%set(1)%lj%sigma12 = gro_info%nonbond_c12_14(ii, jj)
2608 pot%rcutsq = (10.0_dp*
bohr)**2
2609 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
2617 IF (
ASSOCIATED(chm_info%nonbond_a_14))
THEN
2618 DO k = 1,
SIZE(chm_info%nonbond_a_14)
2619 IF ((name_atm_a) == (chm_info%nonbond_a_14(k)))
THEN
2621 rmin2_a = chm_info%nonbond_rmin2_14(k)
2622 epsilon_a = chm_info%nonbond_eps_14(k)
2626 DO k = 1,
SIZE(chm_info%nonbond_a_14)
2627 IF ((name_atm_b) == (chm_info%nonbond_a_14(k)))
THEN
2629 rmin2_b = chm_info%nonbond_rmin2_14(k)
2630 epsilon_b = chm_info%nonbond_eps_14(k)
2635 IF (
ASSOCIATED(chm_info%nonbond_a))
THEN
2636 IF (.NOT. found_a)
THEN
2637 DO k = 1,
SIZE(chm_info%nonbond_a)
2638 IF ((name_atm_a) == (chm_info%nonbond_a(k)))
THEN
2640 rmin2_a = chm_info%nonbond_rmin2(k)
2641 epsilon_a = chm_info%nonbond_eps(k)
2645 IF (.NOT. found_b)
THEN
2646 DO k = 1,
SIZE(chm_info%nonbond_a)
2647 IF ((name_atm_b) == (chm_info%nonbond_a(k)))
THEN
2649 rmin2_b = chm_info%nonbond_rmin2(k)
2650 epsilon_b = chm_info%nonbond_eps(k)
2655 IF (ii /= 0 .AND. jj /= 0)
THEN
2656 rmin = rmin2_a + rmin2_b
2658 epsilon0 = sqrt(abs(epsilon_a*epsilon_b))
2661 pot%at1 = name_atm_a
2662 pot%at2 = name_atm_b
2663 pot%set(1)%lj%epsilon = epsilon0
2664 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
2665 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
2666 pot%rcutsq = (10.0_dp*
bohr)**2
2667 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
2672 IF (
ASSOCIATED(amb_info%nonbond_a))
THEN
2675 IF (.NOT. found_a)
THEN
2676 DO k = 1,
SIZE(amb_info%nonbond_a)
2677 IF ((name_atm_a) == (amb_info%nonbond_a(k)))
THEN
2679 rmin2_a = amb_info%nonbond_rmin2(k)
2680 epsilon_a = amb_info%nonbond_eps(k)
2684 IF (.NOT. found_b)
THEN
2685 DO k = 1,
SIZE(amb_info%nonbond_a)
2686 IF ((name_atm_b) == (amb_info%nonbond_a(k)))
THEN
2688 rmin2_b = amb_info%nonbond_rmin2(k)
2689 epsilon_b = amb_info%nonbond_eps(k)
2693 IF (ii /= 0 .AND. jj /= 0)
THEN
2694 rmin = rmin2_a + rmin2_b
2696 epsilon0 = sqrt(abs(epsilon_a*epsilon_b))
2699 pot%at1 = name_atm_a
2700 pot%at2 = name_atm_b
2701 pot%set(1)%lj%epsilon = epsilon0
2702 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
2703 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
2704 pot%rcutsq = (10.0_dp*
bohr)**2
2705 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, &
2712 IF (
ASSOCIATED(inp_info%nonbonded14))
THEN
2713 DO k = 1,
SIZE(inp_info%nonbonded14%pot)
2714 IF (iw > 0)
WRITE (iw, *)
" TESTING ", trim(name_atm_a), trim(name_atm_b), &
2715 " with ", trim(inp_info%nonbonded14%pot(k)%pot%at1), &
2716 trim(inp_info%nonbonded14%pot(k)%pot%at2)
2717 IF ((((name_atm_a) == (inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2718 ((name_atm_b) == (inp_info%nonbonded14%pot(k)%pot%at2))) .OR. &
2719 (((name_atm_b) == (inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2720 ((name_atm_a) == (inp_info%nonbonded14%pot(k)%pot%at2))))
THEN
2721 IF (ff_type%multiple_potential)
THEN
2724 CALL cp_warn(__location__, &
2725 "Multiple ONFO declaration: "//trim(name_atm_a)// &
2726 " and "//trim(name_atm_b)//
" ADDING! ")
2727 potparm_nonbond14%pot(i, j)%pot => pot
2728 potparm_nonbond14%pot(j, i)%pot => pot
2732 CALL cp_warn(__location__, &
2733 "Multiple ONFO declarations: "//trim(name_atm_a)// &
2734 " and "//trim(name_atm_b)//
" OVERWRITING! ")
2736 IF (iw > 0)
WRITE (iw, *)
" FOUND ", trim(name_atm_a),
" ", trim(name_atm_b)
2743 IF (use_qmmm_ff)
THEN
2745 IF ((name_atm_a) == (name_atm_a_local)) match_names = match_names + 1
2746 IF ((name_atm_b) == (name_atm_b_local)) match_names = match_names + 1
2747 IF (match_names == 1)
THEN
2748 IF (
ASSOCIATED(qmmm_env%inp_info%nonbonded14))
THEN
2749 DO k = 1,
SIZE(qmmm_env%inp_info%nonbonded14%pot)
2750 IF (iw > 0)
WRITE (iw, *)
" TESTING ", trim(name_atm_a), trim(name_atm_b), &
2751 " with ", trim(qmmm_env%inp_info%nonbonded14%pot(k)%pot%at1), &
2752 trim(qmmm_env%inp_info%nonbonded14%pot(k)%pot%at2)
2753 IF ((((name_atm_a) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2754 ((name_atm_b) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at2))) .OR. &
2755 (((name_atm_b) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at1)) .AND. &
2756 ((name_atm_a) == (qmmm_env%inp_info%nonbonded14%pot(k)%pot%at2))))
THEN
2757 IF (qmmm_env%multiple_potential)
THEN
2760 CALL cp_warn(__location__, &
2761 "Multiple ONFO declaration: "//trim(name_atm_a)// &
2762 " and "//trim(name_atm_b)//
" ADDING QM/MM forcefield specifications! ")
2763 potparm_nonbond14%pot(i, j)%pot => pot
2764 potparm_nonbond14%pot(j, i)%pot => pot
2768 CALL cp_warn(__location__, &
2769 "Multiple ONFO declaration: "//trim(name_atm_a)// &
2770 " and "//trim(name_atm_b)//
" OVERWRITING QM/MM forcefield specifications! ")
2772 IF (iw > 0)
WRITE (iw, *)
" FOUND ", trim(name_atm_a), &
2773 " ", trim(name_atm_b)
2781 IF (.NOT. found)
THEN
2782 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
2783 atm2=trim(name_atm_b), &
2784 type_name=
"Spline_Bond_Env", &
2788 pot%at1 = name_atm_a
2789 pot%at2 = name_atm_b
2792 IF (ff_type%rcut_nb > 0.0_dp)
THEN
2793 pot%rcutsq = ff_type%rcut_nb*ff_type%rcut_nb
2796 pot%rcutsq = max(pot%rcutsq, ewald_rcut*ewald_rcut)
2802 CALL timestop(handle2)
2822 iw, Ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond, &
2830 CHARACTER(LEN=default_string_length), &
2831 DIMENSION(:),
POINTER :: ainfo
2839 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_nonbond'
2841 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_a_local, &
2842 name_atm_b, name_atm_b_local
2843 INTEGER :: handle2, i, ii, j, jj, k, match_names
2844 LOGICAL :: found, is_a_shell, is_b_shell, only_qm, &
2846 REAL(kind=
dp) :: epsilon0, ewald_rcut, rmin
2850 CALL timeset(routinen, handle2)
2851 use_qmmm_ff = qmmm_env%use_qmmm_ff
2855 DO i = 1,
SIZE(atomic_kind_set)
2856 atomic_kind => atomic_kind_set(i)
2857 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name_atm_a_local, &
2858 shell_active=is_a_shell)
2859 DO j = i,
SIZE(atomic_kind_set)
2860 atomic_kind => atomic_kind_set(j)
2861 CALL get_atomic_kind(atomic_kind=atomic_kind, name=name_atm_b_local, &
2862 shell_active=is_b_shell)
2864 name_atm_a = name_atm_a_local
2865 name_atm_b = name_atm_b_local
2869 pot => potparm_nonbond%pot(i, j)%pot
2872 IF (
ASSOCIATED(gro_info%nonbond_a))
THEN
2875 DO k = 1,
SIZE(gro_info%nonbond_a)
2876 IF (trim(name_atm_a) == trim(gro_info%nonbond_a(k)))
THEN
2881 DO k = 1,
SIZE(gro_info%nonbond_a)
2882 IF (trim(name_atm_b) == trim(gro_info%nonbond_a(k)))
THEN
2888 IF (ii /= 0 .AND. jj /= 0)
THEN
2891 pot%at1 = name_atm_a
2892 pot%at2 = name_atm_b
2893 pot%set(1)%lj%epsilon = 1.0_dp
2894 pot%set(1)%lj%sigma6 = gro_info%nonbond_c6(ii, jj)
2895 pot%set(1)%lj%sigma12 = gro_info%nonbond_c12(ii, jj)
2896 pot%rcutsq = (10.0_dp*
bohr)**2
2897 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
2903 IF (
ASSOCIATED(chm_info%nonbond_a))
THEN
2906 DO k = 1,
SIZE(chm_info%nonbond_a)
2907 IF ((name_atm_a) == (chm_info%nonbond_a(k)))
THEN
2911 DO k = 1,
SIZE(chm_info%nonbond_a)
2912 IF ((name_atm_b) == (chm_info%nonbond_a(k)))
THEN
2917 IF (ii /= 0 .AND. jj /= 0)
THEN
2918 rmin = chm_info%nonbond_rmin2(ii) + chm_info%nonbond_rmin2(jj)
2919 epsilon0 = sqrt(chm_info%nonbond_eps(ii)* &
2920 chm_info%nonbond_eps(jj))
2923 pot%at1 = name_atm_a
2924 pot%at2 = name_atm_b
2925 pot%set(1)%lj%epsilon = epsilon0
2926 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
2927 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
2928 pot%rcutsq = (10.0_dp*
bohr)**2
2929 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
2935 IF (
ASSOCIATED(amb_info%nonbond_a))
THEN
2938 DO k = 1,
SIZE(amb_info%nonbond_a)
2939 IF ((name_atm_a) == (amb_info%nonbond_a(k)))
THEN
2943 DO k = 1,
SIZE(amb_info%nonbond_a)
2944 IF ((name_atm_b) == (amb_info%nonbond_a(k)))
THEN
2949 IF (ii /= 0 .AND. jj /= 0)
THEN
2950 rmin = amb_info%nonbond_rmin2(ii) + amb_info%nonbond_rmin2(jj)
2951 epsilon0 = sqrt(amb_info%nonbond_eps(ii)*amb_info%nonbond_eps(jj))
2954 pot%at1 = name_atm_a
2955 pot%at2 = name_atm_b
2956 pot%set(1)%lj%epsilon = epsilon0
2957 pot%set(1)%lj%sigma6 = 0.5_dp*rmin**6
2958 pot%set(1)%lj%sigma12 = 0.25_dp*rmin**12
2959 pot%rcutsq = (10.0_dp*
bohr)**2
2960 CALL issue_duplications(found,
"Lennard-Jones", name_atm_a, name_atm_b)
2966 IF (
ASSOCIATED(inp_info%nonbonded))
THEN
2967 DO k = 1,
SIZE(inp_info%nonbonded%pot)
2968 IF ((trim(inp_info%nonbonded%pot(k)%pot%at1) ==
"*") .OR. &
2969 (trim(inp_info%nonbonded%pot(k)%pot%at2) ==
"*")) cycle
2971 IF (iw > 0)
WRITE (iw, *)
" TESTING ", trim(name_atm_a), trim(name_atm_b), &
2972 " with ", trim(inp_info%nonbonded%pot(k)%pot%at1), &
2973 trim(inp_info%nonbonded%pot(k)%pot%at2)
2974 IF ((((name_atm_a) == (inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
2975 ((name_atm_b) == (inp_info%nonbonded%pot(k)%pot%at2))) .OR. &
2976 (((name_atm_b) == (inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
2977 ((name_atm_a) == (inp_info%nonbonded%pot(k)%pot%at2))))
THEN
2978 IF (ff_type%multiple_potential)
THEN
2981 CALL cp_warn(__location__, &
2982 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
2983 " and "//trim(name_atm_b)//
" ADDING! ")
2984 potparm_nonbond%pot(i, j)%pot => pot
2985 potparm_nonbond%pot(j, i)%pot => pot
2989 CALL cp_warn(__location__, &
2990 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
2991 " and "//trim(name_atm_b)//
" OVERWRITING! ")
2993 IF (iw > 0)
WRITE (iw, *)
" FOUND ", trim(name_atm_a),
" ", trim(name_atm_b)
2998 IF (.NOT. found)
THEN
2999 DO k = 1,
SIZE(inp_info%nonbonded%pot)
3000 IF ((trim(inp_info%nonbonded%pot(k)%pot%at1) ==
"*") .EQV. &
3001 (trim(inp_info%nonbonded%pot(k)%pot%at2) ==
"*")) cycle
3003 IF (iw > 0)
WRITE (iw, *)
" TESTING ", trim(name_atm_a), trim(name_atm_b), &
3004 " with ", trim(inp_info%nonbonded%pot(k)%pot%at1), &
3005 trim(inp_info%nonbonded%pot(k)%pot%at2)
3007 IF ((name_atm_a == inp_info%nonbonded%pot(k)%pot%at1) .OR. &
3008 (name_atm_b == inp_info%nonbonded%pot(k)%pot%at2) .OR. &
3009 (name_atm_b == inp_info%nonbonded%pot(k)%pot%at1) .OR. &
3010 (name_atm_a == inp_info%nonbonded%pot(k)%pot%at2))
THEN
3011 IF (ff_type%multiple_potential)
THEN
3014 CALL cp_warn(__location__, &
3015 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
3016 " and "//trim(name_atm_b)//
" ADDING! ")
3017 potparm_nonbond%pot(i, j)%pot => pot
3018 potparm_nonbond%pot(j, i)%pot => pot
3022 CALL cp_warn(__location__, &
3023 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
3024 " and "//trim(name_atm_b)//
" OVERWRITING! ")
3026 IF (iw > 0)
WRITE (iw, *)
" FOUND (one WILDCARD)", trim(name_atm_a),
" ", trim(name_atm_b)
3032 IF (.NOT. found)
THEN
3033 DO k = 1,
SIZE(inp_info%nonbonded%pot)
3034 IF ((trim(inp_info%nonbonded%pot(k)%pot%at1) /=
"*") .OR. &
3035 (trim(inp_info%nonbonded%pot(k)%pot%at2) /=
"*")) cycle
3037 IF (iw > 0)
WRITE (iw, *)
" TESTING ", trim(name_atm_a), trim(name_atm_b), &
3038 " with ", trim(inp_info%nonbonded%pot(k)%pot%at1), &
3039 trim(inp_info%nonbonded%pot(k)%pot%at2)
3041 IF (ff_type%multiple_potential)
THEN
3044 CALL cp_warn(__location__, &
3045 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
3046 " and "//trim(name_atm_b)//
" ADDING! ")
3047 potparm_nonbond%pot(i, j)%pot => pot
3048 potparm_nonbond%pot(j, i)%pot => pot
3052 CALL cp_warn(__location__, &
3053 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
3054 " and "//trim(name_atm_b)//
" OVERWRITING! ")
3056 IF (iw > 0)
WRITE (iw, *)
" FOUND (both WILDCARDS)", trim(name_atm_a),
" ", trim(name_atm_b)
3064 IF (use_qmmm_ff)
THEN
3066 IF ((name_atm_a) == (name_atm_a_local)) match_names = match_names + 1
3067 IF ((name_atm_b) == (name_atm_b_local)) match_names = match_names + 1
3068 IF (match_names == 1)
THEN
3069 IF (
ASSOCIATED(qmmm_env%inp_info%nonbonded))
THEN
3070 DO k = 1,
SIZE(qmmm_env%inp_info%nonbonded%pot)
3071 IF (iw > 0)
WRITE (iw, *)
" TESTING ", trim(name_atm_a), trim(name_atm_b), &
3072 " with ", trim(qmmm_env%inp_info%nonbonded%pot(k)%pot%at1), &
3073 trim(qmmm_env%inp_info%nonbonded%pot(k)%pot%at2)
3074 IF ((((name_atm_a) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
3075 ((name_atm_b) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at2))) .OR. &
3076 (((name_atm_b) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at1)) .AND. &
3077 ((name_atm_a) == (qmmm_env%inp_info%nonbonded%pot(k)%pot%at2))))
THEN
3078 IF (qmmm_env%multiple_potential)
THEN
3081 CALL cp_warn(__location__, &
3082 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
3083 " and "//trim(name_atm_b)//
" ADDING QM/MM forcefield specifications! ")
3084 potparm_nonbond%pot(i, j)%pot => pot
3085 potparm_nonbond%pot(j, i)%pot => pot
3089 CALL cp_warn(__location__, &
3090 "Multiple NONBONDED declaration: "//trim(name_atm_a)// &
3091 " and "//trim(name_atm_b)//
" OVERWRITING QM/MM forcefield specifications! ")
3093 IF (iw > 0)
WRITE (iw, *)
" FOUND ", trim(name_atm_a),
" ", trim(name_atm_b)
3100 IF (.NOT. found)
THEN
3101 CALL store_ff_missing_par(atm1=trim(name_atm_a), &
3102 atm2=trim(name_atm_b), &
3103 type_name=
"Spline_Non_Bond_Env", &
3108 IF (ff_type%rcut_nb > 0.0_dp)
THEN
3109 pot%rcutsq = ff_type%rcut_nb*ff_type%rcut_nb
3112 pot%rcutsq = max(pot%rcutsq, ewald_rcut*ewald_rcut)
3114 IF ((is_a_shell .AND. .NOT. is_b_shell) .OR. (is_b_shell .AND. .NOT. is_a_shell))
THEN
3116 ELSE IF (is_a_shell .AND. is_b_shell)
THEN
3117 pot%shell_type =
sh_sh
3126 CALL timestop(handle2)
3141 potparm, do_zbl, nonbonded_type)
3145 INTEGER :: iw2, iw3, iw4
3147 LOGICAL,
INTENT(IN) :: do_zbl
3148 CHARACTER(LEN=*),
INTENT(IN) :: nonbonded_type
3150 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_splines'
3152 INTEGER :: handle2, ikind, jkind, n
3156 CALL timeset(routinen, handle2)
3159 NULLIFY (spline_env)
3161 do_zbl, shift_cutoff=ff_type%shift_cutoff)
3164 atomic_kind_set, eps_spline=ff_type%eps_spline, &
3165 max_energy=ff_type%max_energy, rlow_nb=ff_type%rlow_nb, &
3166 emax_spline=ff_type%emax_spline, npoints=ff_type%npoints, iw=iw2, iw2=iw3, iw3=iw4, &
3167 do_zbl=do_zbl, shift_cutoff=ff_type%shift_cutoff, &
3168 nonbonded_type=nonbonded_type)
3171 DO ikind = 1,
SIZE(potparm%pot, 1)
3172 DO jkind = ikind,
SIZE(potparm%pot, 2)
3173 n = spline_env%spltab(ikind, jkind)
3174 spl_p => spline_env%spl_pp(n)%spl_p
3177 potparm%pot(ikind, jkind)%pot%pair_spline_data => spl_p
3181 DEALLOCATE (spline_env)
3182 NULLIFY (spline_env)
3183 CALL timestop(handle2)
3196 potparm_nonbond, ewald_env)
3203 CHARACTER(len=*),
PARAMETER :: routinen =
'force_field_pack_eicut'
3205 INTEGER :: ewald_type, handle, i1, i2, nkinds
3206 REAL(kind=
dp) :: alpha, beta, mm_radius1, mm_radius2, &
3207 rcut2, rcut2_ewald, tmp
3208 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: interaction_cutoffs
3211 CALL timeset(routinen, handle)
3214 nkinds =
SIZE(atomic_kind_set)
3217 ALLOCATE (interaction_cutoffs(3, nkinds, nkinds))
3218 interaction_cutoffs = 0.0_dp
3221 IF (ff_type%shift_cutoff)
THEN
3222 CALL ewald_env_get(ewald_env, alpha=alpha, ewald_type=ewald_type, &
3224 rcut2_ewald = rcut2_ewald*rcut2_ewald
3226 atomic_kind => atomic_kind_set(i1)
3230 IF (
ASSOCIATED(potparm_nonbond))
THEN
3231 rcut2 = max(potparm_nonbond%pot(i1, i2)%pot%rcutsq, rcut2_ewald)
3234 atomic_kind => atomic_kind_set(i2)
3238 1.0_dp, ewald_type, alpha, 0.0_dp, 0.0_dp)
3240 IF (mm_radius1 > 0.0_dp)
THEN
3246 1.0_dp, ewald_type, alpha, beta, 0.0_dp)
3248 IF (mm_radius1 + mm_radius2 > 0.0_dp)
THEN
3249 beta =
sqrthalf/sqrt(mm_radius1*mm_radius1 + mm_radius2*mm_radius2)
3254 1.0_dp, ewald_type, alpha, beta, 0.0_dp)
3260 CALL ewald_env_set(ewald_env, interaction_cutoffs=interaction_cutoffs)
3262 CALL timestop(handle)
3276 SUBROUTINE issue_duplications(found, tag_label, name_atm_a, name_atm_b, &
3277 name_atm_c, name_atm_d)
3279 LOGICAL,
INTENT(IN) :: found
3280 CHARACTER(LEN=*),
INTENT(IN) :: tag_label, name_atm_a
3281 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: name_atm_b, name_atm_c, name_atm_d
3283 CHARACTER(LEN=default_string_length) :: item
3285 item =
"( "//trim(name_atm_a)
3286 IF (
PRESENT(name_atm_b))
THEN
3287 item = trim(item)//
" , "//trim(name_atm_b)
3289 IF (
PRESENT(name_atm_c))
THEN
3290 item = trim(item)//
" , "//trim(name_atm_c)
3292 IF (
PRESENT(name_atm_d))
THEN
3293 item = trim(item)//
" , "//trim(name_atm_d)
3295 item = trim(item)//
" )"
3297 cpwarn(
"Multiple "//trim(tag_label)//
" declarations: "//trim(item)//
" overwriting!")
3300 END SUBROUTINE issue_duplications
3312 SUBROUTINE store_ff_missing_par(atm1, atm2, atm3, atm4, type_name, fatal, array)
3313 CHARACTER(LEN=*),
INTENT(IN) :: atm1
3314 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: atm2, atm3, atm4
3315 CHARACTER(LEN=*),
INTENT(IN) :: type_name
3316 LOGICAL,
INTENT(INOUT),
OPTIONAL :: fatal
3317 CHARACTER(LEN=default_string_length), &
3318 DIMENSION(:),
POINTER :: array
3320 CHARACTER(LEN=10) :: sfmt
3321 CHARACTER(LEN=9) :: my_atm1, my_atm2, my_atm3, my_atm4
3322 CHARACTER(LEN=default_path_length) :: my_format
3323 INTEGER :: fmt, i, nsize
3328 my_format =
'(T2,"FORCEFIELD| Missing ","'//trim(type_name)// &
3330 IF (
PRESENT(atm2)) fmt = fmt + 1
3331 IF (
PRESENT(atm3)) fmt = fmt + 1
3332 IF (
PRESENT(atm4)) fmt = fmt + 1
3335 my_format =
'(T2,"FORCEFIELD| Missing ","'//trim(type_name)// &
3336 '",T40,"(",A9,'//trim(sfmt)//
'(",",A9),")")'
3337 IF (
PRESENT(fatal)) fatal = .true.
3339 IF (
ASSOCIATED(array)) nsize =
SIZE(array)
3341 IF (nsize >= 1)
THEN
3343 SELECT CASE (type_name)
3345 IF (index(array(i) (21:39),
"Bond") == 0) cycle
3346 my_atm1 = array(i) (41:49)
3347 my_atm2 = array(i) (51:59)
3350 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2)) .OR. &
3351 ((atm1 == my_atm2) .AND. (atm2 == my_atm1))) found = .true.
3353 IF (index(array(i) (21:39),
"Angle") == 0) cycle
3354 my_atm1 = array(i) (41:49)
3355 my_atm2 = array(i) (51:59)
3356 my_atm3 = array(i) (61:69)
3360 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3)) .OR. &
3361 ((atm1 == my_atm3) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm1))) &
3363 CASE (
"Urey-Bradley")
3364 IF (index(array(i) (21:39),
"Urey-Bradley") == 0) cycle
3365 my_atm1 = array(i) (41:49)
3366 my_atm2 = array(i) (51:59)
3367 my_atm3 = array(i) (61:69)
3371 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3)) .OR. &
3372 ((atm1 == my_atm3) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm1))) &
3375 IF (index(array(i) (21:39),
"Torsion") == 0) cycle
3376 my_atm1 = array(i) (41:49)
3377 my_atm2 = array(i) (51:59)
3378 my_atm3 = array(i) (61:69)
3379 my_atm4 = array(i) (71:79)
3384 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm4)) .OR. &
3385 ((atm1 == my_atm4) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm1))) &
3388 IF (index(array(i) (21:39),
"Improper") == 0) cycle
3389 my_atm1 = array(i) (41:49)
3390 my_atm2 = array(i) (51:59)
3391 my_atm3 = array(i) (61:69)
3392 my_atm4 = array(i) (71:79)
3397 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm4)) .OR. &
3398 ((atm1 == my_atm1) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm4)) .OR. &
3399 ((atm1 == my_atm1) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm4) .AND. (atm4 == my_atm3)) .OR. &
3400 ((atm1 == my_atm1) .AND. (atm2 == my_atm4) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm2)) .OR. &
3401 ((atm1 == my_atm1) .AND. (atm2 == my_atm4) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm3)) .OR. &
3402 ((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm4) .AND. (atm4 == my_atm3))) &
3405 CASE (
"Out of plane bend")
3406 IF (index(array(i) (21:39),
"Out of plane bend") == 0) cycle
3407 my_atm1 = array(i) (41:49)
3408 my_atm2 = array(i) (51:59)
3409 my_atm3 = array(i) (61:69)
3410 my_atm4 = array(i) (71:79)
3415 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2) .AND. (atm3 == my_atm3) .AND. (atm4 == my_atm4)) .OR. &
3416 ((atm1 == my_atm1) .AND. (atm2 == my_atm3) .AND. (atm3 == my_atm2) .AND. (atm4 == my_atm4))) &
3420 IF (index(array(i) (21:39),
"Charge") == 0) cycle
3421 my_atm1 = array(i) (41:49)
3423 IF (atm1 == my_atm1) found = .true.
3424 CASE (
"Spline_Bond_Env",
"Spline_Non_Bond_Env")
3425 IF (index(array(i) (21:39),
"Spline_") == 0) cycle
3427 my_atm1 = array(i) (41:49)
3428 my_atm2 = array(i) (51:59)
3431 IF (((atm1 == my_atm1) .AND. (atm2 == my_atm2)) .OR. &
3432 ((atm1 == my_atm2) .AND. (atm2 == my_atm1))) found = .true.
3440 IF (.NOT. found)
THEN
3445 WRITE (array(nsize), fmt=trim(my_format)) atm1
3447 WRITE (array(nsize), fmt=trim(my_format)) atm1, atm2
3449 WRITE (array(nsize), fmt=trim(my_format)) atm1, atm2, atm3
3451 WRITE (array(nsize), fmt=trim(my_format)) atm1, atm2, atm3, atm4
3455 END SUBROUTINE store_ff_missing_par
3464 FUNCTION bsearch_leftmost_2d(array, val, row)
RESULT(res)
3465 INTEGER,
INTENT(IN) :: array(:, :), val
3466 INTEGER,
INTENT(IN),
OPTIONAL :: row
3469 INTEGER :: left, locrow, mid, right
3472 IF (
PRESENT(row)) locrow = row
3475 right = ubound(array, dim=2)
3477 DO WHILE (left < right)
3478 mid = (left + right)/2
3479 IF (array(locrow, mid) < val)
THEN
3489 IF (array(locrow, res) /= val) res = 0
3491 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_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_pack_opbend(particle_set, molecule_kind_set, molecule_set, ainfo, inp_info)
Pack in opbend information needed for the force_field. No loop over params for charmm,...
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_bond(particle_set, molecule_kind_set, molecule_set, fatal, ainfo, chm_info, inp_info, gro_info, amb_info)
Pack in bonds information needed for the force_field.
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_ub(particle_set, molecule_kind_set, molecule_set)
Determine the number of unique Urey-Bradley kind and allocate ub_kind_set.
subroutine, public force_field_unique_opbend(particle_set, molecule_kind_set, molecule_set, ff_type)
Determine the number of unique opbend kind and allocate opbend_kind_set based on the present improper...
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_pack_bend(particle_set, molecule_kind_set, molecule_set, fatal, ainfo, chm_info, inp_info, gro_info, amb_info)
Pack in bends information needed for the force_field.
subroutine, public force_field_unique_bend(particle_set, molecule_kind_set, molecule_set, ff_type)
Determine the number of unique bend kind and allocate bend_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_potentail%[qeff] and shell potential parameters.
subroutine, public force_field_unique_impr(particle_set, molecule_kind_set, molecule_set, ff_type)
Determine the number of unique impr kind and allocate impr_kind_set.
subroutine, public force_field_unique_bond(particle_set, molecule_kind_set, molecule_set, ff_type)
Determine the number of unique bond kind and allocate bond_kind_set.
subroutine, public force_field_pack_impr(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, gro_info)
Pack in impropers information needed for the force_field.
subroutine, public force_field_pack_damp(atomic_kind_set, iw, inp_info)
Set up damping parameters.
subroutine, public force_field_pack_nonbond14(atomic_kind_set, ff_type, qmmm_env, iw, ainfo, chm_info, inp_info, gro_info, amb_info, potparm_nonbond14, ewald_env)
Assign input and potential info to potparm_nonbond14.
subroutine, public force_field_pack_ub(particle_set, molecule_kind_set, molecule_set, ainfo, chm_info, inp_info, iw)
Pack in Urey-Bradley information needed for the force_field.
subroutine, public force_field_pack_eicut(atomic_kind_set, ff_type, potparm_nonbond, ewald_env)
Compute the electrostatic interaction cutoffs.
subroutine, public force_field_unique_tors(particle_set, molecule_kind_set, molecule_set, ff_type)
Determine the number of unique torsion kind and allocate torsion_kind_set.
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
integer, parameter, public quip_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.
subroutine, public pair_potential_pp_create(potparm, nkinds)
Data-structure that constains potential parameters.
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