80#include "./base/base_uses.f90"
84 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'force_fields_input'
104 SUBROUTINE read_force_field_section1(ff_section, mm_section, ff_type, para_env)
105 TYPE(section_vals_type),
POINTER :: ff_section, mm_section
106 TYPE(force_field_type),
INTENT(INOUT) :: ff_type
107 TYPE(mp_para_env_type),
POINTER :: para_env
109 CHARACTER(LEN=default_string_length), &
110 DIMENSION(:),
POINTER :: atm_names
111 INTEGER :: nace, nb4, nbends, nbm, nbmhft, nbmhftd, nbonds, nchg, ndeepmd, neam, ngal, &
112 ngal21, ngd, ngp, nimpr, nipbv, nlj, nmace, nnequip, nopbend, nshell, nsiepmann, ntab, &
113 ntersoff, ntors, ntot, nubs, nwl
114 LOGICAL :: explicit, unique_spline
115 REAL(KIND=
dp) :: min_eps_spline_allowed
116 TYPE(input_info_type),
POINTER :: inp_info
117 TYPE(section_vals_type),
POINTER :: tmp_section, tmp_section2
121 NULLIFY (tmp_section, tmp_section2)
122 inp_info => ff_type%inp_info
132 CALL section_vals_val_get(ff_section,
"IGNORE_MISSING_CRITICAL_PARAMS", l_val=ff_type%ignore_missing_critical)
133 cpassert(ff_type%max_energy <= ff_type%emax_spline)
135 SELECT CASE (ff_type%ff_type)
139 IF (trim(ff_type%ff_file_name) ==
"")
THEN
140 cpabort(
"Force Field Parameter's filename is empty! Please check your input file.")
146 cpabort(
"Force field type not implemented")
154 min_eps_spline_allowed = 20.0_dp*max(ff_type%max_energy, 10.0_dp)*epsilon(0.0_dp)
155 IF (ff_type%eps_spline < min_eps_spline_allowed)
THEN
156 CALL cp_warn(__location__, &
157 "Requested spline accuracy ("//trim(
cp_to_string(ff_type%eps_spline))//
" ) "// &
158 "is smaller than the minimum value allowed ("//trim(
cp_to_string(min_eps_spline_allowed))// &
159 " ) with the present machine precision ("//trim(
cp_to_string(epsilon(0.0_dp)))//
" ). "// &
160 "New EPS_SPLINE value ("//trim(
cp_to_string(min_eps_spline_allowed))//
" ). ")
161 ff_type%eps_spline = min_eps_spline_allowed
174 IF (explicit .AND. ff_type%do_nonbonded)
THEN
196 CALL read_eam_section(inp_info%nonbonded, tmp_section2, ntot, para_env, mm_section)
201 ntot = nlj + nwl + neam
209 ntot = nlj + nwl + neam + ngd
212 CALL read_ipbv_section(inp_info%nonbonded, tmp_section2, ntot)
217 ntot = nlj + nwl + neam + ngd + nipbv
220 CALL read_bmhft_section(inp_info%nonbonded, tmp_section2, ntot)
224 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nbmhftd)
225 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft
228 CALL read_bmhftd_section(inp_info%nonbonded, tmp_section2, ntot)
233 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd
236 CALL read_b4_section(inp_info%nonbonded, tmp_section2, ntot)
241 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4
244 CALL read_bm_section(inp_info%nonbonded, tmp_section2, ntot)
249 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm
255 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ntersoff)
256 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp
259 CALL read_tersoff_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
264 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff
267 CALL read_gal_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
272 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal
275 CALL read_gal21_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
279 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nsiepmann)
280 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21
283 CALL read_siepmann_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
287 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nnequip)
288 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + &
289 ngal + ngal21 + nsiepmann
293 nnequip = nnequip - 1 +
SIZE(atm_names) + (
SIZE(atm_names)*
SIZE(atm_names) -
SIZE(atm_names))/2
295 CALL read_nequip_section(inp_info%nonbonded, tmp_section2, ntot)
300 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + &
301 ngal + ngal21 + nsiepmann + nnequip
304 CALL read_tabpot_section(inp_info%nonbonded, tmp_section2, ntot, para_env, mm_section)
308 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ndeepmd)
309 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + &
310 ngal + ngal21 + nsiepmann + nnequip + ntab
314 ndeepmd = ndeepmd - 1 +
SIZE(atm_names) + (
SIZE(atm_names)*
SIZE(atm_names) -
SIZE(atm_names))/2
316 CALL read_deepmd_section(inp_info%nonbonded, tmp_section2, ntot)
321 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + &
322 ngal + ngal21 + nsiepmann + nnequip + ntab + ndeepmd
326 nace = nace - 1 +
SIZE(atm_names) + (
SIZE(atm_names)*
SIZE(atm_names) -
SIZE(atm_names))/2
328 CALL read_ace_section(inp_info%nonbonded, tmp_section2, ntot)
333 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + &
334 ngal + ngal21 + nsiepmann + nnequip + ntab + ndeepmd + nace
338 nmace = nmace - 1 +
SIZE(atm_names) + (
SIZE(atm_names)*
SIZE(atm_names) -
SIZE(atm_names))/2
341 CALL read_mace_section(inp_info%nonbonded, tmp_section2, ntot)
348 IF (explicit .AND. ff_type%do_nonbonded)
THEN
372 ntot = nlj + nwl + ngd
393 CALL read_apol_section(inp_info%apol_atm, inp_info%apol, inp_info%damping_list, &
402 CALL read_cpol_section(inp_info%cpol_atm, inp_info%cpol, tmp_section, ntot)
409 CALL read_shell_section(inp_info%shell_list, tmp_section, ntot)
416 CALL reallocate(inp_info%bond_kind, 1, nbonds)
419 CALL reallocate(inp_info%bond_k, 1, 3, 1, nbonds)
422 CALL read_bonds_section(inp_info%bond_kind, inp_info%bond_a, inp_info%bond_b, inp_info%bond_k, &
423 inp_info%bond_r0, inp_info%bond_cs, tmp_section, ntot)
429 CALL reallocate(inp_info%bend_kind, 1, nbends)
434 CALL reallocate(inp_info%bend_theta0, 1, nbends)
436 CALL reallocate(inp_info%bend_r012, 1, nbends)
437 CALL reallocate(inp_info%bend_r032, 1, nbends)
438 CALL reallocate(inp_info%bend_kbs12, 1, nbends)
439 CALL reallocate(inp_info%bend_kbs32, 1, nbends)
441 IF (
ASSOCIATED(inp_info%bend_legendre))
THEN
442 DO i = 1,
SIZE(inp_info%bend_legendre)
443 IF (
ASSOCIATED(inp_info%bend_legendre(i)%coeffs))
THEN
444 DEALLOCATE (inp_info%bend_legendre(i)%coeffs)
445 NULLIFY (inp_info%bend_legendre(i)%coeffs)
448 DEALLOCATE (inp_info%bend_legendre)
449 NULLIFY (inp_info%bend_legendre)
451 ALLOCATE (inp_info%bend_legendre(1:nbends))
452 DO i = 1,
SIZE(inp_info%bend_legendre(1:nbends))
453 NULLIFY (inp_info%bend_legendre(i)%coeffs)
454 inp_info%bend_legendre(i)%order = 0
456 CALL read_bends_section(inp_info%bend_kind, inp_info%bend_a, inp_info%bend_b, inp_info%bend_c, &
457 inp_info%bend_k, inp_info%bend_theta0, inp_info%bend_cb, &
458 inp_info%bend_r012, inp_info%bend_r032, inp_info%bend_kbs12, &
459 inp_info%bend_kbs32, inp_info%bend_kss, &
460 inp_info%bend_legendre, tmp_section, ntot)
472 CALL read_ubs_section(inp_info%ub_kind, inp_info%ub_a, inp_info%ub_b, inp_info%ub_c, &
473 inp_info%ub_k, inp_info%ub_r0, tmp_section, ntot)
479 CALL reallocate(inp_info%torsion_kind, 1, ntors)
486 CALL reallocate(inp_info%torsion_phi0, 1, ntors)
487 CALL read_torsions_section(inp_info%torsion_kind, inp_info%torsion_a, inp_info%torsion_b, &
488 inp_info%torsion_c, inp_info%torsion_d, inp_info%torsion_k, inp_info%torsion_phi0, &
489 inp_info%torsion_m, tmp_section, ntot)
503 CALL read_improper_section(inp_info%impr_kind, inp_info%impr_a, inp_info%impr_b, &
504 inp_info%impr_c, inp_info%impr_d, inp_info%impr_k, inp_info%impr_phi0, &
512 CALL reallocate(inp_info%opbend_kind, 1, nopbend)
513 CALL reallocate(inp_info%opbend_a, 1, nopbend)
514 CALL reallocate(inp_info%opbend_b, 1, nopbend)
515 CALL reallocate(inp_info%opbend_c, 1, nopbend)
516 CALL reallocate(inp_info%opbend_d, 1, nopbend)
517 CALL reallocate(inp_info%opbend_k, 1, nopbend)
518 CALL reallocate(inp_info%opbend_phi0, 1, nopbend)
519 CALL read_opbend_section(inp_info%opbend_kind, inp_info%opbend_a, inp_info%opbend_b, &
520 inp_info%opbend_c, inp_info%opbend_d, inp_info%opbend_k, inp_info%opbend_phi0, &
524 END SUBROUTINE read_force_field_section1
533 SUBROUTINE set_ipbv_ff(at1, at2, ipbv)
534 CHARACTER(LEN=*),
INTENT(IN) :: at1, at2
535 TYPE(ipbv_pot_type),
POINTER :: ipbv
537 IF ((at1(1:1) ==
'O') .AND. (at2(1:1) ==
'O'))
THEN
539 ipbv%m = -1.2226442563398141e+11_dp
540 ipbv%b = 1.1791292385486696e+11_dp
543 ipbv%a(2) = 4.786380682394_dp
544 ipbv%a(3) = -1543.407053545_dp
545 ipbv%a(4) = 88783.31188529_dp
546 ipbv%a(5) = -2361200.155376_dp
547 ipbv%a(6) = 35940504.84679_dp
548 ipbv%a(7) = -339762743.6358_dp
549 ipbv%a(8) = 2043874926.466_dp
550 ipbv%a(9) = -7654856796.383_dp
551 ipbv%a(10) = 16195251405.65_dp
552 ipbv%a(11) = -13140392992.18_dp
553 ipbv%a(12) = -9285572894.245_dp
554 ipbv%a(13) = 8756947519.029_dp
555 ipbv%a(14) = 15793297761.67_dp
556 ipbv%a(15) = 12917180227.21_dp
557 ELSE IF (((at1(1:1) ==
'O') .AND. (at2(1:1) ==
'H')) .OR. &
558 ((at1(1:1) ==
'H') .AND. (at2(1:1) ==
'O')))
THEN
562 ipbv%m = -0.004025691139759147_dp
563 ipbv%b = -2.193731138097428_dp
565 ipbv%a(2) = -195.7716013277_dp
566 ipbv%a(3) = 15343.78613395_dp
567 ipbv%a(4) = -530864.4586516_dp
568 ipbv%a(5) = 10707934.39058_dp
569 ipbv%a(6) = -140099704.7890_dp
570 ipbv%a(7) = 1250943273.785_dp
571 ipbv%a(8) = -7795458330.676_dp
572 ipbv%a(9) = 33955897217.31_dp
573 ipbv%a(10) = -101135640744.0_dp
574 ipbv%a(11) = 193107995718.7_dp
575 ipbv%a(12) = -193440560940.0_dp
576 ipbv%a(13) = -4224406093.918e0_dp
577 ipbv%a(14) = 217192386506.5e0_dp
578 ipbv%a(15) = -157581228915.5_dp
579 ELSE IF ((at1(1:1) ==
'H') .AND. (at2(1:1) ==
'H'))
THEN
580 ipbv%rcore = 3.165_dp
581 ipbv%m = 0.002639704108787555_dp
582 ipbv%b = -0.2735482611857583_dp
584 ipbv%a(2) = -26.29456010782_dp
585 ipbv%a(3) = 2373.352548248_dp
586 ipbv%a(4) = -93880.43551360_dp
587 ipbv%a(5) = 2154624.884809_dp
588 ipbv%a(6) = -31965151.34955_dp
589 ipbv%a(7) = 322781785.3278_dp
590 ipbv%a(8) = -2271097368.668_dp
591 ipbv%a(9) = 11169163192.90_dp
592 ipbv%a(10) = -37684457778.47_dp
593 ipbv%a(11) = 82562104256.03_dp
594 ipbv%a(12) = -100510435213.4_dp
595 ipbv%a(13) = 24570342714.65e0_dp
596 ipbv%a(14) = 88766181532.94e0_dp
597 ipbv%a(15) = -79705131323.98_dp
599 cpabort(
"IPBV only for WATER")
601 END SUBROUTINE set_ipbv_ff
610 SUBROUTINE set_bmhft_ff(at1, at2, ft)
611 CHARACTER(LEN=*),
INTENT(IN) :: at1, at2
612 TYPE(ft_pot_type),
POINTER :: ft
615 IF ((at1(1:2) ==
'NA') .AND. (at2(1:2) ==
'NA'))
THEN
619 ELSE IF (((at1(1:2) ==
'NA') .AND. (at2(1:2) ==
'CL')) .OR. &
620 ((at1(1:2) ==
'CL') .AND. (at2(1:2) ==
'NA')))
THEN
625 ELSE IF ((at1(1:2) ==
'CL') .AND. (at2(1:2) ==
'CL'))
THEN
630 cpabort(
"BMHFT only for NaCl")
633 END SUBROUTINE set_bmhft_ff
639 SUBROUTINE set_bmhftd_ff()
641 cpabort(
"No default parameters present for BMHFTD")
643 END SUBROUTINE set_bmhftd_ff
654 SUBROUTINE read_eam_section(nonbonded, section, start, para_env, mm_section)
655 TYPE(pair_potential_p_type),
POINTER :: nonbonded
656 TYPE(section_vals_type),
POINTER :: section
657 INTEGER,
INTENT(IN) :: start
658 TYPE(mp_para_env_type),
POINTER :: para_env
659 TYPE(section_vals_type),
POINTER :: mm_section
661 CHARACTER(LEN=default_string_length), &
662 DIMENSION(:),
POINTER :: atm_names
663 INTEGER :: isec, n_items
669 nonbonded%pot(start + isec)%pot%type =
ea_type
670 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
671 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
672 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
673 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
675 c_val=nonbonded%pot(start + isec)%pot%set(1)%eam%eam_file_name)
676 CALL read_eam_data(nonbonded%pot(start + isec)%pot%set(1)%eam, para_env, mm_section)
677 nonbonded%pot(start + isec)%pot%rcutsq = nonbonded%pot(start + isec)%pot%set(1)%eam%acutal**2
679 END SUBROUTINE read_eam_section
687 SUBROUTINE read_ace_section(nonbonded, section, start)
688 TYPE(pair_potential_p_type),
POINTER :: nonbonded
689 TYPE(section_vals_type),
POINTER :: section
690 INTEGER,
INTENT(IN) :: start
692 CHARACTER(LEN=2),
ALLOCATABLE,
DIMENSION(:) :: ace_atype_symbol
693 CHARACTER(LEN=default_path_length) :: ace_filename
694 CHARACTER(LEN=default_string_length) :: ace_file_name
695 CHARACTER(LEN=default_string_length), &
696 DIMENSION(:),
POINTER :: atm_names
697 INTEGER :: ace_ntype, isec, jsec, n_items
698 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: rcutall
699 TYPE(ace_model_type) :: model
703 n_items = isec*n_items
706 ace_ntype =
SIZE(atm_names)
707 ALLOCATE (ace_atype_symbol(ace_ntype), rcutall(ace_ntype, ace_ntype))
708 DO isec = 1, ace_ntype
709 ace_atype_symbol(isec) = atm_names(isec) (1:2)
718 fname=trim(ace_filename), rcutc=rcutall, model=model)
720 cpabort(
"CP2K was compiled without ACE library.")
723 DO isec = 1,
SIZE(atm_names)
724 DO jsec = isec,
SIZE(atm_names)
725 nonbonded%pot(start + n_items)%pot%type =
ace_type
726 nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
727 nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
728 CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
729 CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
731 nonbonded%pot(start + n_items)%pot%set(1)%ace%ace_file_name = ace_filename
732 nonbonded%pot(start + n_items)%pot%set(1)%ace%atom_ace_type = isec
733 nonbonded%pot(start + n_items)%pot%set(1)%ace%model = model
737 nonbonded%pot(start + n_items)%pot%rcutsq =
cp_unit_to_cp2k(rcutall(isec, jsec),
"angstrom")**2
739 n_items = n_items + 1
742 END SUBROUTINE read_ace_section
751 SUBROUTINE read_deepmd_section(nonbonded, section, start)
752 TYPE(pair_potential_p_type),
POINTER :: nonbonded
753 TYPE(section_vals_type),
POINTER :: section
754 INTEGER,
INTENT(IN) :: start
756 CHARACTER(LEN=default_string_length) :: deepmd_file_name
757 CHARACTER(LEN=default_string_length), &
758 DIMENSION(:),
POINTER :: atm_names
759 INTEGER :: isec, jsec, n_items
760 INTEGER,
DIMENSION(:),
POINTER :: atm_deepmd_types
764 n_items = isec*n_items
769 DO isec = 1,
SIZE(atm_names)
770 DO jsec = isec,
SIZE(atm_names)
771 nonbonded%pot(start + n_items)%pot%type =
deepmd_type
772 nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
773 nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
774 CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
775 CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
777 nonbonded%pot(start + n_items)%pot%set(1)%deepmd%deepmd_file_name =
discover_file(deepmd_file_name)
778 nonbonded%pot(start + n_items)%pot%set(1)%deepmd%atom_deepmd_type = atm_deepmd_types(isec)
779 nonbonded%pot(start + n_items)%pot%rcutsq = 0.0_dp
780 n_items = n_items + 1
783 END SUBROUTINE read_deepmd_section
792 SUBROUTINE read_nequip_section(nonbonded, section, start)
793 TYPE(pair_potential_p_type),
POINTER :: nonbonded
794 TYPE(section_vals_type),
POINTER :: section
795 INTEGER,
INTENT(IN) :: start
797 CHARACTER(LEN=default_string_length) :: model_type_str, pot_file_name, &
798 unit_energy, unit_forces, unit_length
799 CHARACTER(LEN=default_string_length), &
800 DIMENSION(:),
POINTER :: atm_names
801 INTEGER :: chosen_type, isec, jsec, n_items
802 TYPE(nequip_pot_type) :: nequip
806 n_items = isec*n_items
815 IF (trim(model_type_str) ==
"ALLEGRO")
THEN
817 ELSE IF (trim(model_type_str) ==
"NEQUIP")
THEN
820 CALL cp_abort(__location__, &
821 "Unknown MODEL_TYPE: "//trim(model_type_str)//
". Use NEQUIP or ALLEGRO.")
825 nequip%unit_length = unit_length
826 nequip%unit_forces = unit_forces
827 nequip%unit_energy = unit_energy
828 CALL read_nequip_data(nequip)
829 CALL check_cp2k_atom_names_in_torch(atm_names, nequip%type_names_torch)
831 DO isec = 1,
SIZE(atm_names)
832 DO jsec = isec,
SIZE(atm_names)
833 nonbonded%pot(start + n_items)%pot%type = chosen_type
834 nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
835 nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
836 CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
837 CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
838 nonbonded%pot(start + n_items)%pot%set(1)%nequip = nequip
839 nonbonded%pot(start + n_items)%pot%rcutsq = nequip%rcutsq
840 n_items = n_items + 1
844 END SUBROUTINE read_nequip_section
853 SUBROUTINE read_mace_section(nonbonded, section, start)
854 TYPE(pair_potential_p_type),
POINTER :: nonbonded
855 TYPE(section_vals_type),
POINTER :: section
856 INTEGER,
INTENT(IN) :: start
858 CHARACTER(LEN=default_string_length) :: pot_file_name
859 CHARACTER(LEN=default_string_length), &
860 DIMENSION(:),
POINTER :: atm_names
861 INTEGER :: isec, jsec, n_items
862 TYPE(nequip_pot_type) :: mace
866 n_items = isec*n_items
872 mace%unit_length =
"angstrom"
873 mace%unit_energy =
"eV"
874 mace%unit_forces =
"eV/Angstrom"
876 CALL read_nequip_data(mace)
877 CALL check_cp2k_atom_names_in_torch(atm_names, mace%type_names_torch)
879 DO isec = 1,
SIZE(atm_names)
880 DO jsec = isec,
SIZE(atm_names)
881 nonbonded%pot(start + n_items)%pot%type =
mace_type
882 nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
883 nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
884 CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
885 CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
886 nonbonded%pot(start + n_items)%pot%set(1)%nequip = mace
887 nonbonded%pot(start + n_items)%pot%rcutsq = mace%rcutsq
888 n_items = n_items + 1
892 END SUBROUTINE read_mace_section
904 INTEGER,
INTENT(IN) :: start
906 CHARACTER(LEN=default_string_length), &
907 DIMENSION(:),
POINTER :: atm_names
908 INTEGER :: isec, n_items, n_rep
909 REAL(kind=
dp) :: epsilon, rcut, sigma
919 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
920 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
921 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
922 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
923 nonbonded%pot(start + isec)%pot%set(1)%lj%epsilon = epsilon
924 nonbonded%pot(start + isec)%pot%set(1)%lj%sigma6 = sigma**6
925 nonbonded%pot(start + isec)%pot%set(1)%lj%sigma12 = sigma**12
926 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
930 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
933 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
947 INTEGER,
INTENT(IN) :: start
949 CHARACTER(LEN=default_string_length), &
950 DIMENSION(:),
POINTER :: atm_names
951 INTEGER :: isec, n_items, n_rep
952 REAL(kind=
dp) :: a, b, c, rcut
962 nonbonded%pot(start + isec)%pot%type =
wl_type
963 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
964 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
965 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
966 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
967 nonbonded%pot(start + isec)%pot%set(1)%willis%a = a
968 nonbonded%pot(start + isec)%pot%set(1)%willis%b = b
969 nonbonded%pot(start + isec)%pot%set(1)%willis%c = c
970 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
974 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
977 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
991 INTEGER,
INTENT(IN) :: start
993 CHARACTER(LEN=default_string_length), &
994 DIMENSION(:),
POINTER :: atm_names
995 INTEGER :: isec, m, mc, n_items, n_rep
996 REAL(kind=
dp) :: d, dc, rcut, vr0
1008 nonbonded%pot(start + isec)%pot%type =
gw_type
1009 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1010 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1011 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1012 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1013 nonbonded%pot(start + isec)%pot%set(1)%goodwin%vr0 = vr0
1014 nonbonded%pot(start + isec)%pot%set(1)%goodwin%d = d
1015 nonbonded%pot(start + isec)%pot%set(1)%goodwin%dc = dc
1016 nonbonded%pot(start + isec)%pot%set(1)%goodwin%m = m
1017 nonbonded%pot(start + isec)%pot%set(1)%goodwin%mc = mc
1018 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
1022 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1025 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1036 SUBROUTINE read_ipbv_section(nonbonded, section, start)
1039 INTEGER,
INTENT(IN) :: start
1041 CHARACTER(LEN=default_string_length), &
1042 DIMENSION(:),
POINTER :: atm_names
1043 INTEGER :: isec, n_items, n_rep
1044 REAL(kind=
dp) :: rcut
1047 DO isec = 1, n_items
1049 nonbonded%pot(start + isec)%pot%type =
ip_type
1050 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1051 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1052 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1053 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1054 CALL set_ipbv_ff(nonbonded%pot(start + isec)%pot%at1, nonbonded%pot(start + isec)%pot%at2, &
1055 nonbonded%pot(start + isec)%pot%set(1)%ipbv)
1057 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1061 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1064 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1066 END SUBROUTINE read_ipbv_section
1075 SUBROUTINE read_bmhft_section(nonbonded, section, start)
1078 INTEGER,
INTENT(IN) :: start
1080 CHARACTER(LEN=default_string_length),
DIMENSION(2) :: map_atoms
1081 CHARACTER(LEN=default_string_length), &
1082 DIMENSION(:),
POINTER :: atm_names
1083 INTEGER :: i, isec, n_items, n_rep
1084 REAL(kind=
dp) :: rcut
1087 DO isec = 1, n_items
1091 nonbonded%pot(start + isec)%pot%type =
ft_type
1092 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1093 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1094 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1095 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1100 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%a)
1102 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%b)
1104 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%c)
1106 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%d)
1109 map_atoms = atm_names
1112 CALL set_bmhft_ff(map_atoms(1), map_atoms(2), nonbonded%pot(start + isec)%pot%set(1)%ft)
1115 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1119 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1122 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1124 END SUBROUTINE read_bmhft_section
1133 SUBROUTINE read_bmhftd_section(nonbonded, section, start)
1136 INTEGER,
INTENT(IN) :: start
1138 CHARACTER(LEN=default_string_length),
DIMENSION(2) :: map_atoms
1139 CHARACTER(LEN=default_string_length), &
1140 DIMENSION(:),
POINTER :: atm_names
1141 INTEGER :: i, isec, n_items, n_rep
1142 REAL(kind=
dp) :: rcut
1143 REAL(kind=
dp),
DIMENSION(:),
POINTER :: bd_vals
1149 DO isec = 1, n_items
1153 nonbonded%pot(start + isec)%pot%type =
ftd_type
1154 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1155 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1156 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1157 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1162 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%a)
1164 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%b)
1166 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%c)
1168 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%d)
1170 IF (
ASSOCIATED(bd_vals))
THEN
1171 SELECT CASE (
SIZE(bd_vals))
1173 cpabort(
"No values specified for parameter BD in section &BMHFTD")
1175 nonbonded%pot(start + isec)%pot%set(1)%ftd%bd(1:2) = bd_vals(1)
1177 nonbonded%pot(start + isec)%pot%set(1)%ftd%bd(1:2) = bd_vals(1:2)
1179 cpabort(
"Too many values specified for parameter BD in section &BMHFTD")
1182 cpabort(
"Parameter BD in section &BMHFTD was not specified")
1186 map_atoms = atm_names
1189 CALL set_bmhftd_ff()
1192 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1196 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1199 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1201 END SUBROUTINE read_bmhftd_section
1212 SUBROUTINE read_b4_section(nonbonded, section, start)
1216 INTEGER,
INTENT(IN) :: start
1218 CHARACTER(LEN=default_string_length), &
1219 DIMENSION(:),
POINTER :: atm_names
1220 INTEGER :: i, ir, isec, n_items, n_rep, np1, np2
1221 LOGICAL :: explicit_poly1, explicit_poly2
1222 REAL(kind=
dp) :: a, b, c, eval_error, r1, r2, r3, rcut
1223 REAL(kind=
dp),
DIMENSION(10) :: v, x
1224 REAL(kind=
dp),
DIMENSION(10, 10) :: p, p_inv
1225 REAL(kind=
dp),
DIMENSION(:),
POINTER :: coeff1, coeff2,
list
1232 DO isec = 1, n_items
1242 IF (explicit_poly1)
THEN
1247 IF (
ASSOCIATED(
list))
THEN
1249 DO i = 1,
SIZE(
list)
1250 coeff1(i + np1 - 1) =
list(i)
1252 np1 = np1 +
SIZE(
list)
1257 IF (explicit_poly2)
THEN
1262 IF (
ASSOCIATED(
list))
THEN
1264 DO i = 1,
SIZE(
list)
1265 coeff2(i + np2 - 1) =
list(i)
1267 np2 = np2 +
SIZE(
list)
1272 IF ((.NOT. explicit_poly1) .OR. (.NOT. explicit_poly2))
THEN
1279 p(1, i) = p(1, i - 1)*r1
1283 p(2, i) = real(i - 1, kind=
dp)*p(1, i - 1)
1287 p(3, i) = real(i - 1, kind=
dp)*p(2, i - 1)
1292 p(4, i) = p(4, i - 1)*r2
1296 p(4, i) = p(4, i - 1)*r2
1300 p(5, i) = real(i - 1, kind=
dp)*p(4, i - 1)
1303 p(5, i) = real(i - 7, kind=
dp)*p(4, i - 1)
1307 p(6, i) = real(i - 1, kind=
dp)*p(5, i - 1)
1310 p(6, i) = real(i - 7, kind=
dp)*p(5, i - 1)
1319 p(8, i) = p(8, i - 1)*r3
1323 p(9, i) = real(i - 7, kind=
dp)*p(8, i - 1)
1327 p(10, i) = real(i - 7, kind=
dp)*p(9, i - 1)
1334 v(8) = -c/p(8, 10)**2
1335 v(9) = -6.0_dp*v(8)/r3
1336 v(10) = -7.0_dp*v(9)/r3
1338 p_inv(:, :) = 0.0_dp
1341 IF (eval_error >= 1.0e-8_dp)
THEN
1342 CALL cp_warn(__location__, &
1343 "The polynomial fit for the BUCK4RANGES potential is only accurate to "// &
1349 x(:) = matmul(p_inv(:, :), v(:))
1356 nonbonded%pot(start + isec)%pot%type =
b4_type
1357 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1358 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1359 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1360 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1361 nonbonded%pot(start + isec)%pot%set(1)%buck4r%a = a
1362 nonbonded%pot(start + isec)%pot%set(1)%buck4r%b = b
1363 nonbonded%pot(start + isec)%pot%set(1)%buck4r%c = c
1364 nonbonded%pot(start + isec)%pot%set(1)%buck4r%r1 = r1
1365 nonbonded%pot(start + isec)%pot%set(1)%buck4r%r2 = r2
1366 nonbonded%pot(start + isec)%pot%set(1)%buck4r%r3 = r3
1367 IF ((.NOT. explicit_poly1) .OR. (.NOT. explicit_poly2))
THEN
1368 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly1 = 5
1369 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly1(0:5) = x(1:6)
1370 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly2 = 3
1371 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly2(0:3) = x(7:10)
1373 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly1 = np1 - 1
1374 cpassert(np1 - 1 <= 10)
1375 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly1(0:np1 - 1) = coeff1(0:np1 - 1)
1376 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly2 = np2 - 1
1377 cpassert(np2 - 1 <= 10)
1378 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly2(0:np2 - 1) = coeff2(0:np2 - 1)
1380 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
1382 IF (
ASSOCIATED(coeff1))
THEN
1385 IF (
ASSOCIATED(coeff2))
THEN
1390 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1393 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1396 END SUBROUTINE read_b4_section
1408 INTEGER,
INTENT(IN) :: start
1410 CHARACTER(LEN=default_string_length), &
1411 DIMENSION(:),
POINTER :: atm_names, my_var
1412 INTEGER :: isec, n_items, n_rep
1413 REAL(kind=
dp) :: rcut
1416 DO isec = 1, n_items
1417 NULLIFY (atm_names, my_var)
1419 IF (
SIZE(atm_names) /= 2)
THEN
1420 CALL cp_abort(__location__, &
1421 "The GENPOT section expects exactly 2 symbols defined in the "// &
1422 "keyword ATOMS as the atom kinds for the generic potential.")
1425 nonbonded%pot(start + isec)%pot%type =
gp_type
1426 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1427 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1428 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
1429 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1430 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1433 IF (
SIZE(my_var) /= 1)
THEN
1434 CALL cp_abort(__location__, &
1435 "The GENPOT section expects exactly 1 symbol defined in the "// &
1436 "keyword VARIABLES as the variable in the potential function.")
1439 nonbonded%pot(start + isec)%pot%set(1)%gp%potential, &
1440 nonbonded%pot(start + isec)%pot%set(1)%gp%parameters, &
1441 nonbonded%pot(start + isec)%pot%set(1)%gp%values, &
1443 nonbonded%pot(start + isec)%pot%set(1)%gp%variables = nonbonded%pot(start + isec)%pot%set(1)%gp%parameters(1)
1448 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1451 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1463 SUBROUTINE read_tersoff_section(nonbonded, section, start, tersoff_section)
1466 INTEGER,
INTENT(IN) :: start
1469 CHARACTER(LEN=default_string_length), &
1470 DIMENSION(:),
POINTER :: atm_names
1471 INTEGER :: isec, n_items, n_rep
1472 REAL(kind=
dp) :: rcut, rcutsq
1475 DO isec = 1, n_items
1480 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1481 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1482 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1483 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1486 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%A)
1488 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%B)
1490 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%lambda1)
1492 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%lambda2)
1494 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%alpha)
1496 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%beta)
1498 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%n)
1500 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%c)
1502 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%d)
1504 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%h)
1506 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%lambda3)
1508 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigR)
1510 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigD)
1512 rcutsq = (nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigR + &
1513 nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigD)**2
1514 nonbonded%pot(start + isec)%pot%set(1)%tersoff%rcutsq = rcutsq
1515 nonbonded%pot(start + isec)%pot%rcutsq = rcutsq
1519 IF (n_rep == 1)
THEN
1521 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1524 END SUBROUTINE read_tersoff_section
1534 SUBROUTINE read_gal_section(nonbonded, section, start, gal_section)
1537 INTEGER,
INTENT(IN) :: start
1540 CHARACTER(LEN=default_string_length), &
1541 DIMENSION(:),
POINTER :: atm_names
1542 INTEGER :: iatom, isec, n_items, n_rep, nval
1544 REAL(kind=
dp) :: rcut, rval
1545 REAL(kind=
dp),
DIMENSION(:),
POINTER :: rvalues
1551 DO isec = 1, n_items
1555 nonbonded%pot(start + isec)%pot%type =
gal_type
1556 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1557 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1558 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1559 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1562 IF (any(len_trim(atm_names(:)) > 2))
THEN
1563 cpwarn(
"The atom name will be truncated.")
1565 nonbonded%pot(start + isec)%pot%set(1)%gal%met1 = trim(atm_names(1))
1566 nonbonded%pot(start + isec)%pot%set(1)%gal%met2 = trim(atm_names(2))
1569 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%epsilon)
1571 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%bxy)
1573 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%bz)
1576 nonbonded%pot(start + isec)%pot%set(1)%gal%r1 = rvalues(1)
1577 nonbonded%pot(start + isec)%pot%set(1)%gal%r2 = rvalues(2)
1580 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a1)
1582 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a2)
1584 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a3)
1586 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a4)
1588 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a)
1590 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%b)
1592 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%c)
1596 ALLOCATE (nonbonded%pot(start + isec)%pot%set(1)%gal%gcn(nval))
1603 nonbonded%pot(start + isec)%pot%set(1)%gal%gcn(iatom) = rval
1607 l_val=nonbonded%pot(start + isec)%pot%set(1)%gal%express)
1611 IF (n_rep == 1)
THEN
1613 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1614 nonbonded%pot(start + isec)%pot%set(1)%gal%rcutsq = rcut**2
1617 END SUBROUTINE read_gal_section
1627 SUBROUTINE read_gal21_section(nonbonded, section, start, gal21_section)
1630 INTEGER,
INTENT(IN) :: start
1633 CHARACTER(LEN=default_string_length), &
1634 DIMENSION(:),
POINTER :: atm_names
1635 INTEGER :: iatom, isec, n_items, n_rep, nval
1637 REAL(kind=
dp) :: rcut, rval
1638 REAL(kind=
dp),
DIMENSION(:),
POINTER :: rvalues
1644 DO isec = 1, n_items
1648 nonbonded%pot(start + isec)%pot%type =
gal21_type
1649 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1650 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1651 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1652 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1655 IF (any(len_trim(atm_names(:)) > 2))
THEN
1656 cpwarn(
"The atom name will be truncated.")
1658 nonbonded%pot(start + isec)%pot%set(1)%gal21%met1 = trim(atm_names(1))
1659 nonbonded%pot(start + isec)%pot%set(1)%gal21%met2 = trim(atm_names(2))
1662 nonbonded%pot(start + isec)%pot%set(1)%gal21%epsilon1 = rvalues(1)
1663 nonbonded%pot(start + isec)%pot%set(1)%gal21%epsilon2 = rvalues(2)
1664 nonbonded%pot(start + isec)%pot%set(1)%gal21%epsilon3 = rvalues(3)
1667 nonbonded%pot(start + isec)%pot%set(1)%gal21%bxy1 = rvalues(1)
1668 nonbonded%pot(start + isec)%pot%set(1)%gal21%bxy2 = rvalues(2)
1671 nonbonded%pot(start + isec)%pot%set(1)%gal21%bz1 = rvalues(1)
1672 nonbonded%pot(start + isec)%pot%set(1)%gal21%bz2 = rvalues(2)
1675 nonbonded%pot(start + isec)%pot%set(1)%gal21%r1 = rvalues(1)
1676 nonbonded%pot(start + isec)%pot%set(1)%gal21%r2 = rvalues(2)
1679 nonbonded%pot(start + isec)%pot%set(1)%gal21%a11 = rvalues(1)
1680 nonbonded%pot(start + isec)%pot%set(1)%gal21%a12 = rvalues(2)
1681 nonbonded%pot(start + isec)%pot%set(1)%gal21%a13 = rvalues(3)
1684 nonbonded%pot(start + isec)%pot%set(1)%gal21%a21 = rvalues(1)
1685 nonbonded%pot(start + isec)%pot%set(1)%gal21%a22 = rvalues(2)
1686 nonbonded%pot(start + isec)%pot%set(1)%gal21%a23 = rvalues(3)
1689 nonbonded%pot(start + isec)%pot%set(1)%gal21%a31 = rvalues(1)
1690 nonbonded%pot(start + isec)%pot%set(1)%gal21%a32 = rvalues(2)
1691 nonbonded%pot(start + isec)%pot%set(1)%gal21%a33 = rvalues(3)
1694 nonbonded%pot(start + isec)%pot%set(1)%gal21%a41 = rvalues(1)
1695 nonbonded%pot(start + isec)%pot%set(1)%gal21%a42 = rvalues(2)
1696 nonbonded%pot(start + isec)%pot%set(1)%gal21%a43 = rvalues(3)
1699 nonbonded%pot(start + isec)%pot%set(1)%gal21%AO1 = rvalues(1)
1700 nonbonded%pot(start + isec)%pot%set(1)%gal21%AO2 = rvalues(2)
1703 nonbonded%pot(start + isec)%pot%set(1)%gal21%BO1 = rvalues(1)
1704 nonbonded%pot(start + isec)%pot%set(1)%gal21%BO2 = rvalues(2)
1707 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal21%c)
1710 nonbonded%pot(start + isec)%pot%set(1)%gal21%AH1 = rvalues(1)
1711 nonbonded%pot(start + isec)%pot%set(1)%gal21%AH2 = rvalues(2)
1714 nonbonded%pot(start + isec)%pot%set(1)%gal21%BH1 = rvalues(1)
1715 nonbonded%pot(start + isec)%pot%set(1)%gal21%BH2 = rvalues(2)
1720 ALLOCATE (nonbonded%pot(start + isec)%pot%set(1)%gal21%gcn(nval))
1727 nonbonded%pot(start + isec)%pot%set(1)%gal21%gcn(iatom) = rval
1731 l_val=nonbonded%pot(start + isec)%pot%set(1)%gal21%express)
1735 IF (n_rep == 1)
THEN
1737 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1738 nonbonded%pot(start + isec)%pot%set(1)%gal21%rcutsq = rcut**2
1741 END SUBROUTINE read_gal21_section
1751 SUBROUTINE read_siepmann_section(nonbonded, section, start, siepmann_section)
1754 INTEGER,
INTENT(IN) :: start
1757 CHARACTER(LEN=default_string_length), &
1758 DIMENSION(:),
POINTER :: atm_names
1759 INTEGER :: isec, n_items, n_rep
1760 REAL(kind=
dp) :: rcut
1763 DO isec = 1, n_items
1768 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1769 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1770 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1771 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1774 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%B)
1776 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%D)
1778 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%E)
1780 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%F)
1782 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%beta)
1784 l_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%allow_oh_formation)
1786 l_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%allow_h3o_formation)
1788 l_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%allow_o_formation)
1792 IF (n_rep == 1)
THEN
1794 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1795 nonbonded%pot(start + isec)%pot%set(1)%siepmann%rcutsq = rcut**2
1798 END SUBROUTINE read_siepmann_section
1807 SUBROUTINE read_bm_section(nonbonded, section, start)
1810 INTEGER,
INTENT(IN) :: start
1812 CHARACTER(LEN=default_string_length), &
1813 DIMENSION(:),
POINTER :: atm_names
1814 INTEGER :: isec, n_items, n_rep
1815 REAL(kind=
dp) :: a1, a2, b1, b2, beta, c, d, f0, r0, rcut
1818 DO isec = 1, n_items
1832 nonbonded%pot(start + isec)%pot%type =
bm_type
1833 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1834 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1835 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1836 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1837 nonbonded%pot(start + isec)%pot%set(1)%buckmo%f0 = f0
1838 nonbonded%pot(start + isec)%pot%set(1)%buckmo%a1 = a1
1839 nonbonded%pot(start + isec)%pot%set(1)%buckmo%a2 = a2
1840 nonbonded%pot(start + isec)%pot%set(1)%buckmo%b1 = b1
1841 nonbonded%pot(start + isec)%pot%set(1)%buckmo%b2 = b2
1842 nonbonded%pot(start + isec)%pot%set(1)%buckmo%c = c
1843 nonbonded%pot(start + isec)%pot%set(1)%buckmo%d = d
1844 nonbonded%pot(start + isec)%pot%set(1)%buckmo%r0 = r0
1845 nonbonded%pot(start + isec)%pot%set(1)%buckmo%beta = beta
1846 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
1850 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1853 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1855 END SUBROUTINE read_bm_section
1866 SUBROUTINE read_tabpot_section(nonbonded, section, start, para_env, mm_section)
1869 INTEGER,
INTENT(IN) :: start
1873 CHARACTER(LEN=default_string_length), &
1874 DIMENSION(:),
POINTER :: atm_names
1875 INTEGER :: isec, n_items
1878 DO isec = 1, n_items
1880 nonbonded%pot(start + isec)%pot%type =
tab_type
1881 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1882 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1883 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1884 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1886 c_val=nonbonded%pot(start + isec)%pot%set(1)%tab%tabpot_file_name)
1887 CALL read_tabpot_data(nonbonded%pot(start + isec)%pot%set(1)%tab, para_env, mm_section)
1888 nonbonded%pot(start + isec)%pot%set(1)%tab%index = isec
1890 END SUBROUTINE read_tabpot_section
1901 CHARACTER(LEN=default_string_length), &
1902 DIMENSION(:),
POINTER :: charge_atm
1903 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charge
1905 INTEGER,
INTENT(IN) :: start
1907 CHARACTER(LEN=default_string_length) :: atm_name
1908 INTEGER :: isec, n_items
1911 DO isec = 1, n_items
1913 charge_atm(start + isec) = atm_name
1914 CALL uppercase(charge_atm(start + isec))
1928 SUBROUTINE read_apol_section(apol_atm, apol, damping_list, section, &
1930 CHARACTER(LEN=default_string_length), &
1931 DIMENSION(:),
POINTER :: apol_atm
1932 REAL(kind=
dp),
DIMENSION(:),
POINTER :: apol
1935 INTEGER,
INTENT(IN) :: start
1937 CHARACTER(LEN=default_string_length) :: atm_name
1938 INTEGER :: isec, isec_damp, n_damp, n_items, &
1939 start_damp, tmp_damp
1943 NULLIFY (tmp_section)
1946 DO isec = 1, n_items
1950 n_damp = n_damp + tmp_damp
1954 IF (n_damp > 0)
THEN
1955 ALLOCATE (damping_list(1:n_damp))
1960 DO isec = 1, n_items
1962 apol_atm(start + isec) = atm_name
1969 DO isec_damp = 1, tmp_damp
1970 damping_list(start_damp + isec_damp)%atm_name1 = apol_atm(start + isec)
1973 damping_list(start_damp + isec_damp)%atm_name2 = atm_name
1974 CALL uppercase(damping_list(start_damp + isec_damp)%atm_name2)
1977 damping_list(start_damp + isec_damp)%dtype = atm_name
1978 CALL uppercase(damping_list(start_damp + isec_damp)%dtype)
1981 i_val=damping_list(start_damp + isec_damp)%order)
1983 r_val=damping_list(start_damp + isec_damp)%bij)
1985 r_val=damping_list(start_damp + isec_damp)%cij)
1987 start_damp = start_damp + tmp_damp
1991 END SUBROUTINE read_apol_section
2001 SUBROUTINE read_cpol_section(cpol_atm, cpol, section, start)
2002 CHARACTER(LEN=default_string_length), &
2003 DIMENSION(:),
POINTER :: cpol_atm
2004 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cpol
2006 INTEGER,
INTENT(IN) :: start
2008 CHARACTER(LEN=default_string_length) :: atm_name
2009 INTEGER :: isec, n_items
2012 DO isec = 1, n_items
2014 cpol_atm(start + isec) = atm_name
2018 END SUBROUTINE read_cpol_section
2027 SUBROUTINE read_shell_section(shell_list, section, start)
2029 TYPE(
shell_p_type),
DIMENSION(:),
POINTER :: shell_list
2031 INTEGER,
INTENT(IN) :: start
2033 CHARACTER(LEN=default_string_length) :: atm_name
2034 INTEGER :: i_rep, n_rep
2035 REAL(
dp) :: ccharge, cutoff, k, maxdist, mfrac, &
2042 c_val=atm_name, i_rep_section=i_rep)
2044 shell_list(start + i_rep)%atm_name = atm_name
2046 shell_list(start + i_rep)%shell%charge_core = ccharge
2048 shell_list(start + i_rep)%shell%charge_shell = scharge
2050 shell_list(start + i_rep)%shell%massfrac = mfrac
2052 IF (k < 0.0_dp)
THEN
2053 CALL cp_abort(__location__, &
2054 "An invalid value was specified for the force constant k2 of the core-shell "// &
2057 shell_list(start + i_rep)%shell%k2_spring = k
2059 IF (k < 0.0_dp)
THEN
2060 CALL cp_abort(__location__, &
2061 "An invalid value was specified for the force constant k4 of the core-shell "// &
2064 shell_list(start + i_rep)%shell%k4_spring = k
2066 shell_list(start + i_rep)%shell%max_dist = maxdist
2068 shell_list(start + i_rep)%shell%shell_cutoff = cutoff
2071 END SUBROUTINE read_shell_section
2085 SUBROUTINE read_bonds_section(bond_kind, bond_a, bond_b, bond_k, bond_r0, bond_cs, section, start)
2086 INTEGER,
DIMENSION(:),
POINTER :: bond_kind
2087 CHARACTER(LEN=default_string_length), &
2088 DIMENSION(:),
POINTER :: bond_a, bond_b
2089 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: bond_k
2090 REAL(kind=
dp),
DIMENSION(:),
POINTER :: bond_r0, bond_cs
2092 INTEGER,
INTENT(IN) :: start
2094 CHARACTER(LEN=default_string_length), &
2095 DIMENSION(:),
POINTER :: atm_names
2096 INTEGER :: isec, k, n_items
2097 REAL(kind=
dp),
DIMENSION(:),
POINTER :: kvals
2099 NULLIFY (kvals, atm_names)
2101 DO isec = 1, n_items
2104 bond_a(start + isec) = atm_names(1)
2105 bond_b(start + isec) = atm_names(2)
2109 cpassert(
SIZE(kvals) <= 3)
2110 bond_k(:, start + isec) = 0.0_dp
2111 DO k = 1,
SIZE(kvals)
2112 bond_k(k, start + isec) = kvals(k)
2117 END SUBROUTINE read_bonds_section
2138 SUBROUTINE read_bends_section(bend_kind, bend_a, bend_b, bend_c, bend_k, bend_theta0, bend_cb, &
2139 bend_r012, bend_r032, bend_kbs12, bend_kbs32, bend_kss, bend_legendre, &
2141 INTEGER,
DIMENSION(:),
POINTER :: bend_kind
2142 CHARACTER(LEN=default_string_length), &
2143 DIMENSION(:),
POINTER :: bend_a, bend_b, bend_c
2144 REAL(kind=
dp),
DIMENSION(:),
POINTER :: bend_k, bend_theta0, bend_cb, bend_r012, &
2145 bend_r032, bend_kbs12, bend_kbs32, &
2149 INTEGER,
INTENT(IN) :: start
2151 CHARACTER(LEN=default_string_length), &
2152 DIMENSION(:),
POINTER :: atm_names
2153 INTEGER :: isec, k, n_items, n_rep
2154 REAL(kind=
dp),
DIMENSION(:),
POINTER :: kvals, r_values
2156 NULLIFY (kvals, atm_names)
2158 bend_legendre%order = 0
2159 DO isec = 1, n_items
2162 bend_a(start + isec) = atm_names(1)
2163 bend_b(start + isec) = atm_names(2)
2164 bend_c(start + isec) = atm_names(3)
2169 cpassert(
SIZE(kvals) == 1)
2170 bend_k(start + isec) = kvals(1)
2171 CALL section_vals_val_get(section,
"THETA0", i_rep_section=isec, r_val=bend_theta0(start + isec))
2175 CALL section_vals_val_get(section,
"KBS12", i_rep_section=isec, r_val=bend_kbs12(start + isec))
2176 CALL section_vals_val_get(section,
"KBS32", i_rep_section=isec, r_val=bend_kbs32(start + isec))
2181 CALL section_vals_val_get(section,
"LEGENDRE", i_rep_val=k, r_vals=r_values, i_rep_section=isec)
2182 bend_legendre(start + isec)%order =
SIZE(r_values)
2183 IF (
ASSOCIATED(bend_legendre(start + isec)%coeffs))
THEN
2184 DEALLOCATE (bend_legendre(start + isec)%coeffs)
2186 ALLOCATE (bend_legendre(start + isec)%coeffs(bend_legendre(start + isec)%order))
2187 bend_legendre(start + isec)%coeffs = r_values
2190 END SUBROUTINE read_bends_section
2203 SUBROUTINE read_ubs_section(ub_kind, ub_a, ub_b, ub_c, ub_k, ub_r0, section, start)
2204 INTEGER,
DIMENSION(:),
POINTER :: ub_kind
2205 CHARACTER(LEN=default_string_length), &
2206 DIMENSION(:),
POINTER :: ub_a, ub_b, ub_c
2207 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: ub_k
2208 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ub_r0
2210 INTEGER,
INTENT(IN) :: start
2212 CHARACTER(LEN=default_string_length), &
2213 DIMENSION(:),
POINTER :: atm_names
2214 INTEGER :: isec, k, n_items
2216 REAL(kind=
dp),
DIMENSION(:),
POINTER :: kvals
2221 DO isec = 1, n_items
2227 ub_a(start + isec) = atm_names(1)
2228 ub_b(start + isec) = atm_names(2)
2229 ub_c(start + isec) = atm_names(3)
2234 cpassert(
SIZE(kvals) <= 3)
2235 ub_k(:, start + isec) = 0.0_dp
2236 DO k = 1,
SIZE(kvals)
2237 ub_k(k, start + isec) = kvals(k)
2242 END SUBROUTINE read_ubs_section
2258 SUBROUTINE read_torsions_section(torsion_kind, torsion_a, torsion_b, torsion_c, torsion_d, torsion_k, &
2259 torsion_phi0, torsion_m, section, start)
2260 INTEGER,
DIMENSION(:),
POINTER :: torsion_kind
2261 CHARACTER(LEN=default_string_length), &
2262 DIMENSION(:),
POINTER :: torsion_a, torsion_b, torsion_c, &
2264 REAL(kind=
dp),
DIMENSION(:),
POINTER :: torsion_k, torsion_phi0
2265 INTEGER,
DIMENSION(:),
POINTER :: torsion_m
2267 INTEGER,
INTENT(IN) :: start
2269 CHARACTER(LEN=default_string_length), &
2270 DIMENSION(:),
POINTER :: atm_names
2271 INTEGER :: isec, n_items
2275 DO isec = 1, n_items
2276 CALL section_vals_val_get(section,
"KIND", i_rep_section=isec, i_val=torsion_kind(start + isec))
2278 torsion_a(start + isec) = atm_names(1)
2279 torsion_b(start + isec) = atm_names(2)
2280 torsion_c(start + isec) = atm_names(3)
2281 torsion_d(start + isec) = atm_names(4)
2287 CALL section_vals_val_get(section,
"PHI0", i_rep_section=isec, r_val=torsion_phi0(start + isec))
2290 IF (torsion_kind(start + isec) ==
do_ff_opls)
THEN
2291 IF (torsion_phi0(start + isec) /= 0.0_dp)
THEN
2292 CALL cp_warn(__location__,
"PHI0 parameter was non-zero "// &
2293 "for an OPLS-type TORSION. It will be ignored.")
2295 IF (
modulo(torsion_m(start + isec), 2) == 0)
THEN
2297 torsion_phi0(start + isec) =
pi
2300 torsion_k(start + isec) = torsion_k(start + isec)*0.5_dp
2303 END SUBROUTINE read_torsions_section
2318 SUBROUTINE read_improper_section(impr_kind, impr_a, impr_b, impr_c, impr_d, impr_k, &
2319 impr_phi0, section, start)
2320 INTEGER,
DIMENSION(:),
POINTER :: impr_kind
2321 CHARACTER(LEN=default_string_length), &
2322 DIMENSION(:),
POINTER :: impr_a, impr_b, impr_c, impr_d
2323 REAL(kind=
dp),
DIMENSION(:),
POINTER :: impr_k, impr_phi0
2325 INTEGER,
INTENT(IN) :: start
2327 CHARACTER(LEN=default_string_length), &
2328 DIMENSION(:),
POINTER :: atm_names
2329 INTEGER :: isec, n_items
2333 DO isec = 1, n_items
2336 impr_a(start + isec) = atm_names(1)
2337 impr_b(start + isec) = atm_names(2)
2338 impr_c(start + isec) = atm_names(3)
2339 impr_d(start + isec) = atm_names(4)
2347 END SUBROUTINE read_improper_section
2362 SUBROUTINE read_opbend_section(opbend_kind, opbend_a, opbend_b, opbend_c, opbend_d, opbend_k, &
2363 opbend_phi0, section, start)
2364 INTEGER,
DIMENSION(:),
POINTER :: opbend_kind
2365 CHARACTER(LEN=default_string_length), &
2366 DIMENSION(:),
POINTER :: opbend_a, opbend_b, opbend_c, opbend_d
2367 REAL(kind=
dp),
DIMENSION(:),
POINTER :: opbend_k, opbend_phi0
2369 INTEGER,
INTENT(IN) :: start
2371 CHARACTER(LEN=default_string_length), &
2372 DIMENSION(:),
POINTER :: atm_names
2373 INTEGER :: isec, n_items
2377 DO isec = 1, n_items
2378 CALL section_vals_val_get(section,
"KIND", i_rep_section=isec, i_val=opbend_kind(start + isec))
2380 opbend_a(start + isec) = atm_names(1)
2381 opbend_b(start + isec) = atm_names(2)
2382 opbend_c(start + isec) = atm_names(3)
2383 opbend_d(start + isec) = atm_names(4)
2389 CALL section_vals_val_get(section,
"PHI0", i_rep_section=isec, r_val=opbend_phi0(start + isec))
2391 END SUBROUTINE read_opbend_section
2410 NULLIFY (ff_section)
2412 CALL read_force_field_section1(ff_section, mm_section, ff_type, para_env)
2421 SUBROUTINE read_eam_data(eam, para_env, mm_section)
2426 CHARACTER(len=*),
PARAMETER :: routinen =
'read_eam_data'
2428 INTEGER :: handle, i, iw
2432 CALL timeset(routinen, handle)
2437 IF (iw > 0)
WRITE (iw, *)
"Reading EAM data from: ", trim(eam%eam_file_name)
2438 CALL parser_create(parser, trim(eam%eam_file_name), para_env=para_env)
2441 IF (iw > 0)
WRITE (iw, *)
"Title: ", parser%input_line
2444 READ (parser%input_line, *) eam%drar, eam%drhoar, eam%acutal, eam%npoints
2457 DO i = 1, eam%npoints
2459 READ (parser%input_line, *) eam%rho(i), eam%rhop(i)
2461 eam%rval(i) = real(i - 1, kind=
dp)*eam%drar
2462 eam%rhoval(i) = real(i - 1, kind=
dp)*eam%drhoar
2465 DO i = 1, eam%npoints
2467 READ (parser%input_line, *) eam%phi(i), eam%phip(i)
2472 DO i = 1, eam%npoints
2474 READ (parser%input_line, *) eam%frho(i), eam%frhop(i)
2479 IF (iw > 0)
WRITE (iw, *)
"Finished EAM data"
2482 CALL timestop(handle)
2484 END SUBROUTINE read_eam_data
2491 SUBROUTINE read_nequip_data(nequip)
2494 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_nequip_data'
2496 CHARACTER(LEN=100),
ALLOCATABLE,
DIMENSION(:) :: tokenized_string
2497 CHARACTER(LEN=4000) :: cutoff_matrix_str
2498 CHARACTER(LEN=default_path_length) :: allow_tf32_str, cutoff_str, model_dtype, &
2499 num_types_str, types_str
2500 INTEGER :: handle, i, j, k, len_path
2501 LOGICAL :: allow_tf32, found_model_file
2502 REAL(kind=
dp) :: cut_val
2504 CALL timeset(routinen, handle)
2506 INQUIRE (file=nequip%pot_file_name, exist=found_model_file)
2507 IF (.NOT. found_model_file)
THEN
2508 CALL cp_abort(__location__, &
2509 "Nequip model file <"//trim(nequip%pot_file_name)// &
2513 len_path = len_trim(nequip%pot_file_name)
2514 IF (len_path >= 4)
THEN
2515 IF (nequip%pot_file_name(len_path - 3:len_path) ==
".pt2")
THEN
2516 CALL cp_abort(__location__, &
2517 "AOT compiled models (.pt2) are not yet supported in CP2K. " &
2518 //
"Please use TorchScript (.pth or .pt) models compiled with nequip-compile.")
2523 READ (num_types_str, *) nequip%num_types
2526 CALL tokenize_string(trim(types_str), tokenized_string)
2528 IF (
SIZE(tokenized_string) /= nequip%num_types)
THEN
2529 CALL cp_abort(__location__, &
2530 "NequIP Metadata Error: 'num_types' does not match count of 'type_names'")
2533 IF (
ALLOCATED(nequip%type_names_torch))
THEN
2534 DEALLOCATE (nequip%type_names_torch)
2536 ALLOCATE (nequip%type_names_torch(
SIZE(tokenized_string)))
2537 nequip%type_names_torch(:) = tokenized_string(:)
2539 IF (
ALLOCATED(nequip%cutoff_matrix))
DEALLOCATE (nequip%cutoff_matrix)
2540 ALLOCATE (nequip%cutoff_matrix(nequip%num_types, nequip%num_types))
2542 READ (cutoff_str, *) nequip%rcutsq
2544 nequip%rcutsq = nequip%rcutsq*nequip%rcutsq
2545 nequip%unit_length_val =
cp_unit_to_cp2k(nequip%unit_length_val, nequip%unit_length)
2546 nequip%unit_forces_val =
cp_unit_to_cp2k(nequip%unit_forces_val, nequip%unit_forces)
2547 nequip%unit_energy_val =
cp_unit_to_cp2k(nequip%unit_energy_val, nequip%unit_energy)
2551 IF (len_trim(cutoff_matrix_str) > 0)
THEN
2552 CALL tokenize_string(trim(cutoff_matrix_str), tokenized_string)
2554 IF (
SIZE(tokenized_string) /= nequip%num_types**2)
THEN
2555 CALL cp_abort(__location__,
"per_edge_type_cutoff size does not match num_types^2")
2559 DO i = 1, nequip%num_types
2560 DO j = 1, nequip%num_types
2562 READ (tokenized_string(k), *) cut_val
2564 nequip%cutoff_matrix(i, j) = cut_val*cut_val
2569 nequip%cutoff_matrix(:, :) = nequip%rcutsq
2573 IF (trim(model_dtype) ==
"float32")
THEN
2574 nequip%mixed_precision = .true.
2575 ELSE IF (trim(model_dtype) ==
"float64")
THEN
2576 nequip%mixed_precision = .false.
2580 allow_tf32 = (trim(allow_tf32_str) ==
"1")
2581 IF (trim(allow_tf32_str) /=
"1" .AND. trim(allow_tf32_str) /=
"0")
THEN
2582 CALL cp_abort(__location__, &
2583 "The value for allow_tf32 <"//trim(allow_tf32_str)// &
2584 "> is not supported. Check the .yaml and .pth files.")
2588 CALL timestop(handle)
2589 END SUBROUTINE read_nequip_data
2597 SUBROUTINE tokenize_string(element, tokenized_array)
2598 CHARACTER(LEN=*),
INTENT(IN) :: element
2599 CHARACTER(LEN=100),
ALLOCATABLE,
DIMENSION(:), &
2600 INTENT(OUT) :: tokenized_array
2602 CHARACTER(LEN=1) :: ch
2603 CHARACTER(LEN=100) :: current
2606 l = len_trim(element)
2613 IF ((ch >=
'A' .AND. ch <=
'Z') .OR. (ch >=
'a' .AND. ch <=
'z'))
THEN
2614 current(len_trim(current) + 1:len_trim(current) + 1) = ch
2616 IF (len_trim(current) > 0)
THEN
2622 IF (len_trim(current) > 0) n = n + 1
2624 ALLOCATE (tokenized_array(n))
2630 IF ((ch >=
'A' .AND. ch <=
'Z') .OR. (ch >=
'a' .AND. ch <=
'z'))
THEN
2631 current(len_trim(current) + 1:len_trim(current) + 1) = ch
2633 IF (len_trim(current) > 0)
THEN
2635 tokenized_array(n) = trim(current)
2640 IF (len_trim(current) > 0)
THEN
2642 tokenized_array(n) = trim(current)
2644 END SUBROUTINE tokenize_string
2652 SUBROUTINE check_cp2k_atom_names_in_torch(cp2k_inp_atom_types, torch_atom_types)
2653 CHARACTER(LEN=*),
DIMENSION(:),
INTENT(IN) :: cp2k_inp_atom_types, torch_atom_types
2656 LOGICAL :: found_atom
2658 DO i = 1,
SIZE(cp2k_inp_atom_types)
2659 found_atom = .false.
2660 DO j = 1,
SIZE(torch_atom_types)
2661 IF (trim(cp2k_inp_atom_types(i)) == trim(torch_atom_types(j)))
THEN
2666 IF (.NOT. found_atom)
THEN
2667 CALL cp_abort(__location__, &
2668 "Atom "//trim(cp2k_inp_atom_types(i))// &
2669 " is defined in the CP2K input file but is missing in the torch model file")
2672 END SUBROUTINE check_cp2k_atom_names_in_torch
2681 SUBROUTINE read_tabpot_data(tab, para_env, mm_section)
2686 CHARACTER(len=*),
PARAMETER :: routinen =
'read_tabpot_data'
2689 INTEGER :: d, handle, i, iw
2693 CALL timeset(routinen, handle)
2698 IF (iw > 0)
WRITE (iw, *)
"Reading TABPOT data from: ", trim(tab%tabpot_file_name)
2699 CALL parser_create(parser, trim(tab%tabpot_file_name), para_env=para_env)
2701 IF (iw > 0)
WRITE (iw, *)
"Title: ", parser%input_line
2706 READ (parser%input_line, *) d1, tab%npoints, d2, tab%dr, tab%rcut
2714 DO i = 1, tab%npoints
2716 READ (parser%input_line, *) d, tab%r(i), tab%e(i), tab%f(i)
2722 tab%dr = tab%r(2) - tab%r(1)
2725 IF (iw > 0)
WRITE (iw, *)
"Finished TABPOT data"
2728 CALL timestop(handle)
2729 END SUBROUTINE read_tabpot_data
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Interface to ACE C wrapper.
subroutine, public ace_model_initialize(ntypec, symbolc, fname, rcutc, model)
...
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public tosi1964b
integer, save, public tersoff1988
integer, save, public tosi1964a
integer, save, public siepmann1995
integer, save, public yamada2000
integer, save, public clabaut2021
integer, save, public clabaut2020
Utility routines to open and close files.
character(len=default_path_length) function, public discover_file(file_name)
Searches for a file in the current directory and then in the data directory.
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_get_next_line(parser, nline, at_end)
Read the next input line and broadcast the input information. Skip (nline-1) lines and skip also all ...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_release(parser)
releases the parser
subroutine, public parser_create(parser, file_name, unit_nr, para_env, end_section_label, separator_chars, comment_char, continuation_char, quote_char, section_char, parse_white_lines, initial_variables, apply_preprocessing)
Start a parser run. Initial variables allow to @SET stuff before opening the file.
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Define all structure types related to force field kinds.
integer, parameter, public do_ff_undef
integer, parameter, public do_ff_charmm
integer, parameter, public do_ff_g87
integer, parameter, public do_ff_g96
integer, parameter, public do_ff_amber
integer, parameter, public do_ff_opls
Define all structures types related to force_fields.
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 pi
Collection of simple mathematical functions and subroutines.
Utility routines for the memory handling.
Interface to the message passing library MPI.
subroutine, public pair_potential_reallocate(p, lb1_new, ub1_new, lj, lj_charmm, williams, goodwin, eam, nequip, bmhft, bmhftd, ipbv, buck4r, buckmo, gp, tersoff, siepmann, gal, gal21, tab, deepmd, ace)
Cleans the potential parameter type.
integer, parameter, public lj_charmm_type
integer, parameter, public allegro_type
integer, parameter, public bm_type
integer, parameter, public gal_type
integer, parameter, public nequip_type
integer, parameter, public wl_type
integer, parameter, public ft_type
integer, parameter, public tab_type
integer, parameter, public ftd_type
integer, parameter, public ip_type
integer, parameter, public deepmd_type
integer, parameter, public gp_type
integer, parameter, public siepmann_type
integer, parameter, public ace_type
integer, dimension(2), parameter, public do_potential_single_allocation
integer, parameter, public gw_type
integer, dimension(2), parameter, public no_potential_single_allocation
integer, parameter, public mace_type
integer, parameter, public b4_type
integer, parameter, public gal21_type
integer, dimension(2), public potential_single_allocation
integer, parameter, public ea_type
integer, parameter, public tersoff_type
subroutine, public shell_p_create(shell_list, ndim)
...
Utilities for string manipulations.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
subroutine, public torch_allow_tf32(allow_tf32)
Set whether to allow the use of TF32. Needed due to changes in defaults from pytorch 1....
character(:) function, allocatable, public torch_model_read_metadata(filename, key)
Reads metadata entry from given "*.pth" file. (In Torch lingo they are called extra files).
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment