64 USE mathlib,
ONLY: invert_matrix
79 #include "./base/base_uses.f90"
83 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'force_fields_input'
103 SUBROUTINE read_force_field_section1(ff_section, mm_section, ff_type, para_env)
104 TYPE(section_vals_type),
POINTER :: ff_section, mm_section
105 TYPE(force_field_type),
INTENT(INOUT) :: ff_type
106 TYPE(mp_para_env_type),
POINTER :: para_env
108 CHARACTER(LEN=default_string_length), &
109 DIMENSION(:),
POINTER :: atm_names
110 INTEGER :: nallegro, nb4, nbends, nbm, nbmhft, nbmhftd, nbonds, nchg, ndeepmd, neam, ngal, &
111 ngal21, ngd, ngp, nimpr, nipbv, nlj, nnequip, nopbend, nquip, nshell, nsiepmann, ntab, &
112 ntersoff, ntors, ntot, nubs, nwl
113 LOGICAL :: explicit, unique_spline
114 REAL(KIND=
dp) :: min_eps_spline_allowed
115 TYPE(input_info_type),
POINTER :: inp_info
116 TYPE(section_vals_type),
POINTER :: tmp_section, tmp_section2
120 NULLIFY (tmp_section, tmp_section2)
121 inp_info => ff_type%inp_info
131 CALL section_vals_val_get(ff_section,
"IGNORE_MISSING_CRITICAL_PARAMS", l_val=ff_type%ignore_missing_critical)
132 cpassert(ff_type%max_energy <= ff_type%emax_spline)
134 SELECT CASE (ff_type%ff_type)
137 IF (trim(ff_type%ff_file_name) ==
"") &
138 cpabort(
"Force Field Parameter's filename is empty! Please check your input file.")
142 cpabort(
"Force field type not implemented")
150 min_eps_spline_allowed = 20.0_dp*max(ff_type%max_energy, 10.0_dp)*epsilon(0.0_dp)
151 IF (ff_type%eps_spline < min_eps_spline_allowed)
THEN
152 CALL cp_warn(__location__, &
153 "Requested spline accuracy ("//trim(cp_to_string(ff_type%eps_spline))//
" ) "// &
154 "is smaller than the minimum value allowed ("//trim(cp_to_string(min_eps_spline_allowed))// &
155 " ) with the present machine precision ("//trim(cp_to_string(epsilon(0.0_dp)))//
" ). "// &
156 "New EPS_SPLINE value ("//trim(cp_to_string(min_eps_spline_allowed))//
" ). ")
157 ff_type%eps_spline = min_eps_spline_allowed
170 IF (explicit .AND. ff_type%do_nonbonded)
THEN
192 CALL read_eam_section(inp_info%nonbonded, tmp_section2, ntot, para_env, mm_section)
197 ntot = nlj + nwl + neam
205 ntot = nlj + nwl + neam + ngd
208 CALL read_ipbv_section(inp_info%nonbonded, tmp_section2, ntot)
213 ntot = nlj + nwl + neam + ngd + nipbv
216 CALL read_bmhft_section(inp_info%nonbonded, tmp_section2, ntot)
220 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nbmhftd)
221 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft
224 CALL read_bmhftd_section(inp_info%nonbonded, tmp_section2, ntot)
229 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd
232 CALL read_b4_section(inp_info%nonbonded, tmp_section2, ntot)
237 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4
240 CALL read_bm_section(inp_info%nonbonded, tmp_section2, ntot)
245 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm
251 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ntersoff)
252 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp
255 CALL read_tersoff_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
260 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff
263 CALL read_gal_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
268 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal
271 CALL read_gal21_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
275 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nsiepmann)
276 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21
279 CALL read_siepmann_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
284 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann
287 CALL read_quip_section(inp_info%nonbonded, tmp_section2, ntot)
291 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nnequip)
292 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
297 nnequip = nnequip - 1 +
SIZE(atm_names) + (
SIZE(atm_names)*
SIZE(atm_names) -
SIZE(atm_names))/2
299 CALL read_nequip_section(inp_info%nonbonded, tmp_section2, ntot)
303 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nallegro)
304 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
309 nallegro = nallegro - 1 +
SIZE(atm_names) + (
SIZE(atm_names)*
SIZE(atm_names) -
SIZE(atm_names))/2
311 CALL read_allegro_section(inp_info%nonbonded, tmp_section2, ntot)
316 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
317 nquip + nnequip + nallegro
320 CALL read_tabpot_section(inp_info%nonbonded, tmp_section2, ntot, para_env, mm_section)
324 CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ndeepmd)
325 ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
326 nquip + nnequip + nallegro + ntab
330 ndeepmd = ndeepmd - 1 +
SIZE(atm_names) + (
SIZE(atm_names)*
SIZE(atm_names) -
SIZE(atm_names))/2
332 CALL read_deepmd_section(inp_info%nonbonded, tmp_section2, ntot)
339 IF (explicit .AND. ff_type%do_nonbonded)
THEN
363 ntot = nlj + nwl + ngd
374 CALL reallocate(inp_info%charge_atm, 1, nchg)
375 CALL reallocate(inp_info%charge, 1, nchg)
382 CALL reallocate(inp_info%apol_atm, 1, nchg)
383 CALL reallocate(inp_info%apol, 1, nchg)
384 CALL read_apol_section(inp_info%apol_atm, inp_info%apol, inp_info%damping_list, &
391 CALL reallocate(inp_info%cpol_atm, 1, nchg)
392 CALL reallocate(inp_info%cpol, 1, nchg)
393 CALL read_cpol_section(inp_info%cpol_atm, inp_info%cpol, tmp_section, ntot)
400 CALL read_shell_section(inp_info%shell_list, tmp_section, ntot)
407 CALL reallocate(inp_info%bond_kind, 1, nbonds)
408 CALL reallocate(inp_info%bond_a, 1, nbonds)
409 CALL reallocate(inp_info%bond_b, 1, nbonds)
410 CALL reallocate(inp_info%bond_k, 1, 3, 1, nbonds)
411 CALL reallocate(inp_info%bond_r0, 1, nbonds)
412 CALL reallocate(inp_info%bond_cs, 1, nbonds)
413 CALL read_bonds_section(inp_info%bond_kind, inp_info%bond_a, inp_info%bond_b, inp_info%bond_k, &
414 inp_info%bond_r0, inp_info%bond_cs, tmp_section, ntot)
420 CALL reallocate(inp_info%bend_kind, 1, nbends)
421 CALL reallocate(inp_info%bend_a, 1, nbends)
422 CALL reallocate(inp_info%bend_b, 1, nbends)
423 CALL reallocate(inp_info%bend_c, 1, nbends)
424 CALL reallocate(inp_info%bend_k, 1, nbends)
425 CALL reallocate(inp_info%bend_theta0, 1, nbends)
426 CALL reallocate(inp_info%bend_cb, 1, nbends)
427 CALL reallocate(inp_info%bend_r012, 1, nbends)
428 CALL reallocate(inp_info%bend_r032, 1, nbends)
429 CALL reallocate(inp_info%bend_kbs12, 1, nbends)
430 CALL reallocate(inp_info%bend_kbs32, 1, nbends)
431 CALL reallocate(inp_info%bend_kss, 1, nbends)
432 IF (
ASSOCIATED(inp_info%bend_legendre))
THEN
433 DO i = 1,
SIZE(inp_info%bend_legendre)
434 IF (
ASSOCIATED(inp_info%bend_legendre(i)%coeffs))
THEN
435 DEALLOCATE (inp_info%bend_legendre(i)%coeffs)
436 NULLIFY (inp_info%bend_legendre(i)%coeffs)
439 DEALLOCATE (inp_info%bend_legendre)
440 NULLIFY (inp_info%bend_legendre)
442 ALLOCATE (inp_info%bend_legendre(1:nbends))
443 DO i = 1,
SIZE(inp_info%bend_legendre(1:nbends))
444 NULLIFY (inp_info%bend_legendre(i)%coeffs)
445 inp_info%bend_legendre(i)%order = 0
447 CALL read_bends_section(inp_info%bend_kind, inp_info%bend_a, inp_info%bend_b, inp_info%bend_c, &
448 inp_info%bend_k, inp_info%bend_theta0, inp_info%bend_cb, &
449 inp_info%bend_r012, inp_info%bend_r032, inp_info%bend_kbs12, &
450 inp_info%bend_kbs32, inp_info%bend_kss, &
451 inp_info%bend_legendre, tmp_section, ntot)
457 CALL reallocate(inp_info%ub_kind, 1, nubs)
458 CALL reallocate(inp_info%ub_a, 1, nubs)
459 CALL reallocate(inp_info%ub_b, 1, nubs)
460 CALL reallocate(inp_info%ub_c, 1, nubs)
461 CALL reallocate(inp_info%ub_k, 1, 3, 1, nubs)
462 CALL reallocate(inp_info%ub_r0, 1, nubs)
463 CALL read_ubs_section(inp_info%ub_kind, inp_info%ub_a, inp_info%ub_b, inp_info%ub_c, &
464 inp_info%ub_k, inp_info%ub_r0, tmp_section, ntot)
470 CALL reallocate(inp_info%torsion_kind, 1, ntors)
471 CALL reallocate(inp_info%torsion_a, 1, ntors)
472 CALL reallocate(inp_info%torsion_b, 1, ntors)
473 CALL reallocate(inp_info%torsion_c, 1, ntors)
474 CALL reallocate(inp_info%torsion_d, 1, ntors)
475 CALL reallocate(inp_info%torsion_k, 1, ntors)
476 CALL reallocate(inp_info%torsion_m, 1, ntors)
477 CALL reallocate(inp_info%torsion_phi0, 1, ntors)
478 CALL read_torsions_section(inp_info%torsion_kind, inp_info%torsion_a, inp_info%torsion_b, &
479 inp_info%torsion_c, inp_info%torsion_d, inp_info%torsion_k, inp_info%torsion_phi0, &
480 inp_info%torsion_m, tmp_section, ntot)
487 CALL reallocate(inp_info%impr_kind, 1, nimpr)
488 CALL reallocate(inp_info%impr_a, 1, nimpr)
489 CALL reallocate(inp_info%impr_b, 1, nimpr)
490 CALL reallocate(inp_info%impr_c, 1, nimpr)
491 CALL reallocate(inp_info%impr_d, 1, nimpr)
492 CALL reallocate(inp_info%impr_k, 1, nimpr)
493 CALL reallocate(inp_info%impr_phi0, 1, nimpr)
494 CALL read_improper_section(inp_info%impr_kind, inp_info%impr_a, inp_info%impr_b, &
495 inp_info%impr_c, inp_info%impr_d, inp_info%impr_k, inp_info%impr_phi0, &
503 CALL reallocate(inp_info%opbend_kind, 1, nopbend)
504 CALL reallocate(inp_info%opbend_a, 1, nopbend)
505 CALL reallocate(inp_info%opbend_b, 1, nopbend)
506 CALL reallocate(inp_info%opbend_c, 1, nopbend)
507 CALL reallocate(inp_info%opbend_d, 1, nopbend)
508 CALL reallocate(inp_info%opbend_k, 1, nopbend)
509 CALL reallocate(inp_info%opbend_phi0, 1, nopbend)
510 CALL read_opbend_section(inp_info%opbend_kind, inp_info%opbend_a, inp_info%opbend_b, &
511 inp_info%opbend_c, inp_info%opbend_d, inp_info%opbend_k, inp_info%opbend_phi0, &
515 END SUBROUTINE read_force_field_section1
524 SUBROUTINE set_ipbv_ff(at1, at2, ipbv)
525 CHARACTER(LEN=*),
INTENT(IN) :: at1, at2
526 TYPE(ipbv_pot_type),
POINTER :: ipbv
528 IF ((at1(1:1) ==
'O') .AND. (at2(1:1) ==
'O'))
THEN
530 ipbv%m = -1.2226442563398141e+11_dp
531 ipbv%b = 1.1791292385486696e+11_dp
534 ipbv%a(2) = 4.786380682394_dp
535 ipbv%a(3) = -1543.407053545_dp
536 ipbv%a(4) = 88783.31188529_dp
537 ipbv%a(5) = -2361200.155376_dp
538 ipbv%a(6) = 35940504.84679_dp
539 ipbv%a(7) = -339762743.6358_dp
540 ipbv%a(8) = 2043874926.466_dp
541 ipbv%a(9) = -7654856796.383_dp
542 ipbv%a(10) = 16195251405.65_dp
543 ipbv%a(11) = -13140392992.18_dp
544 ipbv%a(12) = -9285572894.245_dp
545 ipbv%a(13) = 8756947519.029_dp
546 ipbv%a(14) = 15793297761.67_dp
547 ipbv%a(15) = 12917180227.21_dp
548 ELSEIF (((at1(1:1) ==
'O') .AND. (at2(1:1) ==
'H')) .OR. &
549 ((at1(1:1) ==
'H') .AND. (at2(1:1) ==
'O')))
THEN
552 ipbv%m = -0.004025691139759147_dp
553 ipbv%b = -2.193731138097428_dp
555 ipbv%a(2) = -195.7716013277_dp
556 ipbv%a(3) = 15343.78613395_dp
557 ipbv%a(4) = -530864.4586516_dp
558 ipbv%a(5) = 10707934.39058_dp
559 ipbv%a(6) = -140099704.7890_dp
560 ipbv%a(7) = 1250943273.785_dp
561 ipbv%a(8) = -7795458330.676_dp
562 ipbv%a(9) = 33955897217.31_dp
563 ipbv%a(10) = -101135640744.0_dp
564 ipbv%a(11) = 193107995718.7_dp
565 ipbv%a(12) = -193440560940.0_dp
566 ipbv%a(13) = -4224406093.918e0_dp
567 ipbv%a(14) = 217192386506.5e0_dp
568 ipbv%a(15) = -157581228915.5_dp
569 ELSEIF ((at1(1:1) ==
'H') .AND. (at2(1:1) ==
'H'))
THEN
570 ipbv%rcore = 3.165_dp
571 ipbv%m = 0.002639704108787555_dp
572 ipbv%b = -0.2735482611857583_dp
574 ipbv%a(2) = -26.29456010782_dp
575 ipbv%a(3) = 2373.352548248_dp
576 ipbv%a(4) = -93880.43551360_dp
577 ipbv%a(5) = 2154624.884809_dp
578 ipbv%a(6) = -31965151.34955_dp
579 ipbv%a(7) = 322781785.3278_dp
580 ipbv%a(8) = -2271097368.668_dp
581 ipbv%a(9) = 11169163192.90_dp
582 ipbv%a(10) = -37684457778.47_dp
583 ipbv%a(11) = 82562104256.03_dp
584 ipbv%a(12) = -100510435213.4_dp
585 ipbv%a(13) = 24570342714.65e0_dp
586 ipbv%a(14) = 88766181532.94e0_dp
587 ipbv%a(15) = -79705131323.98_dp
589 cpabort(
"IPBV only for WATER")
591 END SUBROUTINE set_ipbv_ff
600 SUBROUTINE set_bmhft_ff(at1, at2, ft)
601 CHARACTER(LEN=*),
INTENT(IN) :: at1, at2
602 TYPE(ft_pot_type),
POINTER :: ft
605 IF ((at1(1:2) ==
'NA') .AND. (at2(1:2) ==
'NA'))
THEN
609 ELSEIF (((at1(1:2) ==
'NA') .AND. (at2(1:2) ==
'CL')) .OR. &
610 ((at1(1:2) ==
'CL') .AND. (at2(1:2) ==
'NA')))
THEN
614 ELSEIF ((at1(1:2) ==
'CL') .AND. (at2(1:2) ==
'CL'))
THEN
619 cpabort(
"BMHFT only for NaCl")
622 END SUBROUTINE set_bmhft_ff
628 SUBROUTINE set_bmhftd_ff()
630 cpabort(
"No default parameters present for BMHFTD")
632 END SUBROUTINE set_bmhftd_ff
643 SUBROUTINE read_eam_section(nonbonded, section, start, para_env, mm_section)
644 TYPE(pair_potential_p_type),
POINTER :: nonbonded
645 TYPE(section_vals_type),
POINTER :: section
646 INTEGER,
INTENT(IN) :: start
647 TYPE(mp_para_env_type),
POINTER :: para_env
648 TYPE(section_vals_type),
POINTER :: mm_section
650 CHARACTER(LEN=default_string_length), &
651 DIMENSION(:),
POINTER :: atm_names
652 INTEGER :: isec, n_items
658 nonbonded%pot(start + isec)%pot%type =
ea_type
659 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
660 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
661 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
662 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
664 c_val=nonbonded%pot(start + isec)%pot%set(1)%eam%eam_file_name)
665 CALL read_eam_data(nonbonded%pot(start + isec)%pot%set(1)%eam, para_env, mm_section)
666 nonbonded%pot(start + isec)%pot%rcutsq = nonbonded%pot(start + isec)%pot%set(1)%eam%acutal**2
668 END SUBROUTINE read_eam_section
677 SUBROUTINE read_deepmd_section(nonbonded, section, start)
678 TYPE(pair_potential_p_type),
POINTER :: nonbonded
679 TYPE(section_vals_type),
POINTER :: section
680 INTEGER,
INTENT(IN) :: start
682 CHARACTER(LEN=default_string_length) :: deepmd_file_name
683 CHARACTER(LEN=default_string_length), &
684 DIMENSION(:),
POINTER :: atm_names
685 INTEGER :: isec, jsec, n_items
686 INTEGER,
DIMENSION(:),
POINTER :: atm_deepmd_types
690 n_items = isec*n_items
695 DO isec = 1,
SIZE(atm_names)
696 DO jsec = isec,
SIZE(atm_names)
697 nonbonded%pot(start + n_items)%pot%type =
deepmd_type
698 nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
699 nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
700 CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
701 CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
703 nonbonded%pot(start + n_items)%pot%set(1)%deepmd%deepmd_file_name =
discover_file(deepmd_file_name)
704 nonbonded%pot(start + n_items)%pot%set(1)%deepmd%atom_deepmd_type = atm_deepmd_types(isec)
705 nonbonded%pot(start + n_items)%pot%rcutsq = 0.0_dp
706 n_items = n_items + 1
709 END SUBROUTINE read_deepmd_section
718 SUBROUTINE read_quip_section(nonbonded, section, start)
719 TYPE(pair_potential_p_type),
POINTER :: nonbonded
720 TYPE(section_vals_type),
POINTER :: section
721 INTEGER,
INTENT(IN) :: start
723 CHARACTER(LEN=default_string_length), &
724 DIMENSION(:),
POINTER :: args_str, atm_names
725 INTEGER :: is, isec, n_calc_args, n_items
731 nonbonded%pot(start + isec)%pot%type =
quip_type
732 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
733 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
734 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
735 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
737 c_val=nonbonded%pot(start + isec)%pot%set(1)%quip%quip_file_name)
740 nonbonded%pot(start + isec)%pot%set(1)%quip%init_args =
""
741 DO is = 1,
SIZE(args_str)
742 nonbonded%pot(start + isec)%pot%set(1)%quip%init_args = &
743 trim(nonbonded%pot(start + isec)%pot%set(1)%quip%init_args)// &
744 " "//trim(args_str(is))
747 n_rep_val=n_calc_args)
748 IF (n_calc_args > 0)
THEN
751 DO is = 1,
SIZE(args_str)
752 nonbonded%pot(start + isec)%pot%set(1)%quip%calc_args = &
753 trim(nonbonded%pot(start + isec)%pot%set(1)%quip%calc_args)// &
754 " "//trim(args_str(is))
757 nonbonded%pot(start + isec)%pot%rcutsq = 0.0_dp
759 END SUBROUTINE read_quip_section
768 SUBROUTINE read_nequip_section(nonbonded, section, start)
769 TYPE(pair_potential_p_type),
POINTER :: nonbonded
770 TYPE(section_vals_type),
POINTER :: section
771 INTEGER,
INTENT(IN) :: start
773 CHARACTER(LEN=default_string_length) :: nequip_file_name, unit_cell, &
774 unit_coords, unit_energy, unit_forces
775 CHARACTER(LEN=default_string_length), &
776 DIMENSION(:),
POINTER :: atm_names
777 INTEGER :: isec, jsec, n_items
781 n_items = isec*n_items
789 DO isec = 1,
SIZE(atm_names)
790 DO jsec = isec,
SIZE(atm_names)
791 nonbonded%pot(start + n_items)%pot%type =
nequip_type
792 nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
793 nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
794 CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
795 CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
796 nonbonded%pot(start + n_items)%pot%set(1)%nequip%nequip_file_name =
discover_file(nequip_file_name)
797 nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_coords = unit_coords
798 nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_forces = unit_forces
799 nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_energy = unit_energy
800 nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_cell = unit_cell
801 CALL read_nequip_data(nonbonded%pot(start + n_items)%pot%set(1)%nequip)
802 nonbonded%pot(start + n_items)%pot%rcutsq = nonbonded%pot(start + n_items)%pot%set(1)%nequip%rcutsq
803 n_items = n_items + 1
807 END SUBROUTINE read_nequip_section
816 SUBROUTINE read_allegro_section(nonbonded, section, start)
817 TYPE(pair_potential_p_type),
POINTER :: nonbonded
818 TYPE(section_vals_type),
POINTER :: section
819 INTEGER,
INTENT(IN) :: start
821 CHARACTER(LEN=default_string_length) :: allegro_file_name, unit_cell, &
822 unit_coords, unit_energy, unit_forces
823 CHARACTER(LEN=default_string_length), &
824 DIMENSION(:),
POINTER :: atm_names
825 INTEGER :: isec, jsec, n_items
829 n_items = isec*n_items
837 DO isec = 1,
SIZE(atm_names)
838 DO jsec = isec,
SIZE(atm_names)
840 nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
841 nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
842 CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
843 CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
844 nonbonded%pot(start + n_items)%pot%set(1)%allegro%allegro_file_name =
discover_file(allegro_file_name)
845 nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_coords = unit_coords
846 nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_forces = unit_forces
847 nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_energy = unit_energy
848 nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_cell = unit_cell
849 CALL read_allegro_data(nonbonded%pot(start + n_items)%pot%set(1)%allegro)
850 nonbonded%pot(start + n_items)%pot%rcutsq = nonbonded%pot(start + n_items)%pot%set(1)%allegro%rcutsq
851 n_items = n_items + 1
855 END SUBROUTINE read_allegro_section
865 TYPE(pair_potential_p_type),
POINTER :: nonbonded
866 TYPE(section_vals_type),
POINTER :: section
867 INTEGER,
INTENT(IN) :: start
869 CHARACTER(LEN=default_string_length), &
870 DIMENSION(:),
POINTER :: atm_names
871 INTEGER :: isec, n_items, n_rep
872 REAL(kind=
dp) :: epsilon, rcut, sigma
882 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
883 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
884 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
885 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
886 nonbonded%pot(start + isec)%pot%set(1)%lj%epsilon = epsilon
887 nonbonded%pot(start + isec)%pot%set(1)%lj%sigma6 = sigma**6
888 nonbonded%pot(start + isec)%pot%set(1)%lj%sigma12 = sigma**12
889 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
893 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
896 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
908 TYPE(pair_potential_p_type),
POINTER :: nonbonded
909 TYPE(section_vals_type),
POINTER :: section
910 INTEGER,
INTENT(IN) :: start
912 CHARACTER(LEN=default_string_length), &
913 DIMENSION(:),
POINTER :: atm_names
914 INTEGER :: isec, n_items, n_rep
915 REAL(kind=
dp) :: a, b, c, rcut
925 nonbonded%pot(start + isec)%pot%type =
wl_type
926 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
927 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
928 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
929 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
930 nonbonded%pot(start + isec)%pot%set(1)%willis%a = a
931 nonbonded%pot(start + isec)%pot%set(1)%willis%b = b
932 nonbonded%pot(start + isec)%pot%set(1)%willis%c = c
933 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
937 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
940 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
952 TYPE(pair_potential_p_type),
POINTER :: nonbonded
953 TYPE(section_vals_type),
POINTER :: section
954 INTEGER,
INTENT(IN) :: start
956 CHARACTER(LEN=default_string_length), &
957 DIMENSION(:),
POINTER :: atm_names
958 INTEGER :: isec, m, mc, n_items, n_rep
959 REAL(kind=
dp) :: d, dc, rcut, vr0
971 nonbonded%pot(start + isec)%pot%type =
gw_type
972 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
973 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
974 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
975 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
976 nonbonded%pot(start + isec)%pot%set(1)%goodwin%vr0 = vr0
977 nonbonded%pot(start + isec)%pot%set(1)%goodwin%d = d
978 nonbonded%pot(start + isec)%pot%set(1)%goodwin%dc = dc
979 nonbonded%pot(start + isec)%pot%set(1)%goodwin%m = m
980 nonbonded%pot(start + isec)%pot%set(1)%goodwin%mc = mc
981 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
985 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
988 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
999 SUBROUTINE read_ipbv_section(nonbonded, section, start)
1000 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1001 TYPE(section_vals_type),
POINTER :: section
1002 INTEGER,
INTENT(IN) :: start
1004 CHARACTER(LEN=default_string_length), &
1005 DIMENSION(:),
POINTER :: atm_names
1006 INTEGER :: isec, n_items, n_rep
1007 REAL(kind=
dp) :: rcut
1010 DO isec = 1, n_items
1012 nonbonded%pot(start + isec)%pot%type =
ip_type
1013 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1014 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1015 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1016 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1017 CALL set_ipbv_ff(nonbonded%pot(start + isec)%pot%at1, nonbonded%pot(start + isec)%pot%at2, &
1018 nonbonded%pot(start + isec)%pot%set(1)%ipbv)
1020 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1024 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1027 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1029 END SUBROUTINE read_ipbv_section
1038 SUBROUTINE read_bmhft_section(nonbonded, section, start)
1039 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1040 TYPE(section_vals_type),
POINTER :: section
1041 INTEGER,
INTENT(IN) :: start
1043 CHARACTER(LEN=default_string_length),
DIMENSION(2) :: map_atoms
1044 CHARACTER(LEN=default_string_length), &
1045 DIMENSION(:),
POINTER :: atm_names
1046 INTEGER :: i, isec, n_items, n_rep
1047 REAL(kind=
dp) :: rcut
1050 DO isec = 1, n_items
1054 nonbonded%pot(start + isec)%pot%type =
ft_type
1055 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1056 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1057 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1058 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1063 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%a)
1065 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%b)
1067 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%c)
1069 r_val=nonbonded%pot(start + isec)%pot%set(1)%ft%d)
1072 map_atoms = atm_names
1075 CALL set_bmhft_ff(map_atoms(1), map_atoms(2), nonbonded%pot(start + isec)%pot%set(1)%ft)
1078 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1082 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1085 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1087 END SUBROUTINE read_bmhft_section
1096 SUBROUTINE read_bmhftd_section(nonbonded, section, start)
1097 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1098 TYPE(section_vals_type),
POINTER :: section
1099 INTEGER,
INTENT(IN) :: start
1101 CHARACTER(LEN=default_string_length),
DIMENSION(2) :: map_atoms
1102 CHARACTER(LEN=default_string_length), &
1103 DIMENSION(:),
POINTER :: atm_names
1104 INTEGER :: i, isec, n_items, n_rep
1105 REAL(kind=
dp) :: rcut
1106 REAL(kind=
dp),
DIMENSION(:),
POINTER :: bd_vals
1112 DO isec = 1, n_items
1116 nonbonded%pot(start + isec)%pot%type =
ftd_type
1117 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1118 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1119 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1120 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1125 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%a)
1127 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%b)
1129 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%c)
1131 r_val=nonbonded%pot(start + isec)%pot%set(1)%ftd%d)
1133 IF (
ASSOCIATED(bd_vals))
THEN
1134 SELECT CASE (
SIZE(bd_vals))
1136 cpabort(
"No values specified for parameter BD in section &BMHFTD")
1138 nonbonded%pot(start + isec)%pot%set(1)%ftd%bd(1:2) = bd_vals(1)
1140 nonbonded%pot(start + isec)%pot%set(1)%ftd%bd(1:2) = bd_vals(1:2)
1142 cpabort(
"Too many values specified for parameter BD in section &BMHFTD")
1145 cpabort(
"Parameter BD in section &BMHFTD was not specified")
1149 map_atoms = atm_names
1152 CALL set_bmhftd_ff()
1155 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1159 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1162 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1164 END SUBROUTINE read_bmhftd_section
1175 SUBROUTINE read_b4_section(nonbonded, section, start)
1177 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1178 TYPE(section_vals_type),
POINTER :: section
1179 INTEGER,
INTENT(IN) :: start
1181 CHARACTER(LEN=default_string_length), &
1182 DIMENSION(:),
POINTER :: atm_names
1183 INTEGER :: i, ir, isec, n_items, n_rep, np1, np2
1184 LOGICAL :: explicit_poly1, explicit_poly2
1185 REAL(kind=
dp) :: a, b, c, eval_error, r1, r2, r3, rcut
1186 REAL(kind=
dp),
DIMENSION(10) :: v, x
1187 REAL(kind=
dp),
DIMENSION(10, 10) :: p, p_inv
1188 REAL(kind=
dp),
DIMENSION(:),
POINTER :: coeff1, coeff2,
list
1195 DO isec = 1, n_items
1205 IF (explicit_poly1)
THEN
1210 IF (
ASSOCIATED(
list))
THEN
1211 CALL reallocate(coeff1, 0, np1 +
SIZE(
list) - 1)
1212 DO i = 1,
SIZE(
list)
1213 coeff1(i + np1 - 1) =
list(i)
1215 np1 = np1 +
SIZE(
list)
1220 IF (explicit_poly2)
THEN
1225 IF (
ASSOCIATED(
list))
THEN
1226 CALL reallocate(coeff2, 0, np2 +
SIZE(
list) - 1)
1227 DO i = 1,
SIZE(
list)
1228 coeff2(i + np2 - 1) =
list(i)
1230 np2 = np2 +
SIZE(
list)
1235 IF ((.NOT. explicit_poly1) .OR. (.NOT. explicit_poly2))
THEN
1242 p(1, i) = p(1, i - 1)*r1
1246 p(2, i) = real(i - 1, kind=
dp)*p(1, i - 1)
1250 p(3, i) = real(i - 1, kind=
dp)*p(2, i - 1)
1255 p(4, i) = p(4, i - 1)*r2
1259 p(4, i) = p(4, i - 1)*r2
1263 p(5, i) = real(i - 1, kind=
dp)*p(4, i - 1)
1266 p(5, i) = real(i - 7, kind=
dp)*p(4, i - 1)
1270 p(6, i) = real(i - 1, kind=
dp)*p(5, i - 1)
1273 p(6, i) = real(i - 7, kind=
dp)*p(5, i - 1)
1282 p(8, i) = p(8, i - 1)*r3
1286 p(9, i) = real(i - 7, kind=
dp)*p(8, i - 1)
1290 p(10, i) = real(i - 7, kind=
dp)*p(9, i - 1)
1297 v(8) = -c/p(8, 10)**2
1298 v(9) = -6.0_dp*v(8)/r3
1299 v(10) = -7.0_dp*v(9)/r3
1301 p_inv(:, :) = 0.0_dp
1302 CALL invert_matrix(p, p_inv, eval_error)
1303 IF (eval_error >= 1.0e-8_dp) &
1304 CALL cp_warn(__location__, &
1305 "The polynomial fit for the BUCK4RANGES potential is only accurate to "// &
1306 trim(cp_to_string(eval_error)))
1309 x(:) = matmul(p_inv(:, :), v(:))
1316 nonbonded%pot(start + isec)%pot%type =
b4_type
1317 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1318 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1319 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1320 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1321 nonbonded%pot(start + isec)%pot%set(1)%buck4r%a = a
1322 nonbonded%pot(start + isec)%pot%set(1)%buck4r%b = b
1323 nonbonded%pot(start + isec)%pot%set(1)%buck4r%c = c
1324 nonbonded%pot(start + isec)%pot%set(1)%buck4r%r1 = r1
1325 nonbonded%pot(start + isec)%pot%set(1)%buck4r%r2 = r2
1326 nonbonded%pot(start + isec)%pot%set(1)%buck4r%r3 = r3
1327 IF ((.NOT. explicit_poly1) .OR. (.NOT. explicit_poly2))
THEN
1328 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly1 = 5
1329 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly1(0:5) = x(1:6)
1330 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly2 = 3
1331 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly2(0:3) = x(7:10)
1333 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly1 = np1 - 1
1334 cpassert(np1 - 1 <= 10)
1335 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly1(0:np1 - 1) = coeff1(0:np1 - 1)
1336 nonbonded%pot(start + isec)%pot%set(1)%buck4r%npoly2 = np2 - 1
1337 cpassert(np2 - 1 <= 10)
1338 nonbonded%pot(start + isec)%pot%set(1)%buck4r%poly2(0:np2 - 1) = coeff2(0:np2 - 1)
1340 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
1342 IF (
ASSOCIATED(coeff1))
THEN
1345 IF (
ASSOCIATED(coeff2))
THEN
1350 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1353 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1356 END SUBROUTINE read_b4_section
1366 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1367 TYPE(section_vals_type),
POINTER :: section
1368 INTEGER,
INTENT(IN) :: start
1370 CHARACTER(LEN=default_string_length), &
1371 DIMENSION(:),
POINTER :: atm_names
1372 INTEGER :: isec, n_items, n_rep
1373 REAL(kind=
dp) :: rcut
1376 DO isec = 1, n_items
1380 nonbonded%pot(start + isec)%pot%type =
gp_type
1381 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1382 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1383 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
1384 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1385 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1387 CALL get_generic_info(section,
"FUNCTION", nonbonded%pot(start + isec)%pot%set(1)%gp%potential, &
1388 nonbonded%pot(start + isec)%pot%set(1)%gp%parameters, &
1389 nonbonded%pot(start + isec)%pot%set(1)%gp%values, &
1390 size_variables=1, i_rep_sec=isec)
1391 nonbonded%pot(start + isec)%pot%set(1)%gp%variables = nonbonded%pot(start + isec)%pot%set(1)%gp%parameters(1)
1395 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1398 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1410 SUBROUTINE read_tersoff_section(nonbonded, section, start, tersoff_section)
1411 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1412 TYPE(section_vals_type),
POINTER :: section
1413 INTEGER,
INTENT(IN) :: start
1414 TYPE(section_vals_type),
POINTER :: tersoff_section
1416 CHARACTER(LEN=default_string_length), &
1417 DIMENSION(:),
POINTER :: atm_names
1418 INTEGER :: isec, n_items, n_rep
1419 REAL(kind=
dp) :: rcut, rcutsq
1422 DO isec = 1, n_items
1427 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1428 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1429 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1430 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1433 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%A)
1435 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%B)
1437 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%lambda1)
1439 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%lambda2)
1441 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%alpha)
1443 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%beta)
1445 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%n)
1447 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%c)
1449 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%d)
1451 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%h)
1453 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%lambda3)
1455 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigR)
1457 r_val=nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigD)
1459 rcutsq = (nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigR + &
1460 nonbonded%pot(start + isec)%pot%set(1)%tersoff%bigD)**2
1461 nonbonded%pot(start + isec)%pot%set(1)%tersoff%rcutsq = rcutsq
1462 nonbonded%pot(start + isec)%pot%rcutsq = rcutsq
1466 IF (n_rep == 1)
THEN
1468 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1471 END SUBROUTINE read_tersoff_section
1481 SUBROUTINE read_gal_section(nonbonded, section, start, gal_section)
1482 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1483 TYPE(section_vals_type),
POINTER :: section
1484 INTEGER,
INTENT(IN) :: start
1485 TYPE(section_vals_type),
POINTER :: gal_section
1487 CHARACTER(LEN=default_string_length), &
1488 DIMENSION(:),
POINTER :: atm_names
1489 INTEGER :: iatom, isec, n_items, n_rep, nval
1491 REAL(kind=
dp) :: rcut, rval
1492 REAL(kind=
dp),
DIMENSION(:),
POINTER :: rvalues
1493 TYPE(cp_sll_val_type),
POINTER ::
list
1494 TYPE(section_vals_type),
POINTER :: subsection
1495 TYPE(val_type),
POINTER :: val
1498 DO isec = 1, n_items
1502 nonbonded%pot(start + isec)%pot%type =
gal_type
1503 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1504 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1505 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1506 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1509 nonbonded%pot(start + isec)%pot%set(1)%gal%met1 = atm_names(1)
1510 nonbonded%pot(start + isec)%pot%set(1)%gal%met2 = atm_names(2)
1513 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%epsilon)
1515 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%bxy)
1517 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%bz)
1520 nonbonded%pot(start + isec)%pot%set(1)%gal%r1 = rvalues(1)
1521 nonbonded%pot(start + isec)%pot%set(1)%gal%r2 = rvalues(2)
1524 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a1)
1526 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a2)
1528 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a3)
1530 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a4)
1532 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%a)
1534 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%b)
1536 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal%c)
1540 ALLOCATE (nonbonded%pot(start + isec)%pot%set(1)%gal%gcn(nval))
1547 nonbonded%pot(start + isec)%pot%set(1)%gal%gcn(iatom) = rval
1551 l_val=nonbonded%pot(start + isec)%pot%set(1)%gal%express)
1555 IF (n_rep == 1)
THEN
1557 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1558 nonbonded%pot(start + isec)%pot%set(1)%gal%rcutsq = rcut**2
1561 END SUBROUTINE read_gal_section
1571 SUBROUTINE read_gal21_section(nonbonded, section, start, gal21_section)
1572 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1573 TYPE(section_vals_type),
POINTER :: section
1574 INTEGER,
INTENT(IN) :: start
1575 TYPE(section_vals_type),
POINTER :: gal21_section
1577 CHARACTER(LEN=default_string_length), &
1578 DIMENSION(:),
POINTER :: atm_names
1579 INTEGER :: iatom, isec, n_items, n_rep, nval
1581 REAL(kind=
dp) :: rcut, rval
1582 REAL(kind=
dp),
DIMENSION(:),
POINTER :: rvalues
1583 TYPE(cp_sll_val_type),
POINTER ::
list
1584 TYPE(section_vals_type),
POINTER :: subsection
1585 TYPE(val_type),
POINTER :: val
1588 DO isec = 1, n_items
1592 nonbonded%pot(start + isec)%pot%type =
gal21_type
1593 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1594 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1595 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1596 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1599 nonbonded%pot(start + isec)%pot%set(1)%gal21%met1 = atm_names(1)
1600 nonbonded%pot(start + isec)%pot%set(1)%gal21%met2 = atm_names(2)
1603 nonbonded%pot(start + isec)%pot%set(1)%gal21%epsilon1 = rvalues(1)
1604 nonbonded%pot(start + isec)%pot%set(1)%gal21%epsilon2 = rvalues(2)
1605 nonbonded%pot(start + isec)%pot%set(1)%gal21%epsilon3 = rvalues(3)
1608 nonbonded%pot(start + isec)%pot%set(1)%gal21%bxy1 = rvalues(1)
1609 nonbonded%pot(start + isec)%pot%set(1)%gal21%bxy2 = rvalues(2)
1612 nonbonded%pot(start + isec)%pot%set(1)%gal21%bz1 = rvalues(1)
1613 nonbonded%pot(start + isec)%pot%set(1)%gal21%bz2 = rvalues(2)
1616 nonbonded%pot(start + isec)%pot%set(1)%gal21%r1 = rvalues(1)
1617 nonbonded%pot(start + isec)%pot%set(1)%gal21%r2 = rvalues(2)
1620 nonbonded%pot(start + isec)%pot%set(1)%gal21%a11 = rvalues(1)
1621 nonbonded%pot(start + isec)%pot%set(1)%gal21%a12 = rvalues(2)
1622 nonbonded%pot(start + isec)%pot%set(1)%gal21%a13 = rvalues(3)
1625 nonbonded%pot(start + isec)%pot%set(1)%gal21%a21 = rvalues(1)
1626 nonbonded%pot(start + isec)%pot%set(1)%gal21%a22 = rvalues(2)
1627 nonbonded%pot(start + isec)%pot%set(1)%gal21%a23 = rvalues(3)
1630 nonbonded%pot(start + isec)%pot%set(1)%gal21%a31 = rvalues(1)
1631 nonbonded%pot(start + isec)%pot%set(1)%gal21%a32 = rvalues(2)
1632 nonbonded%pot(start + isec)%pot%set(1)%gal21%a33 = rvalues(3)
1635 nonbonded%pot(start + isec)%pot%set(1)%gal21%a41 = rvalues(1)
1636 nonbonded%pot(start + isec)%pot%set(1)%gal21%a42 = rvalues(2)
1637 nonbonded%pot(start + isec)%pot%set(1)%gal21%a43 = rvalues(3)
1640 nonbonded%pot(start + isec)%pot%set(1)%gal21%AO1 = rvalues(1)
1641 nonbonded%pot(start + isec)%pot%set(1)%gal21%AO2 = rvalues(2)
1644 nonbonded%pot(start + isec)%pot%set(1)%gal21%BO1 = rvalues(1)
1645 nonbonded%pot(start + isec)%pot%set(1)%gal21%BO2 = rvalues(2)
1648 r_val=nonbonded%pot(start + isec)%pot%set(1)%gal21%c)
1651 nonbonded%pot(start + isec)%pot%set(1)%gal21%AH1 = rvalues(1)
1652 nonbonded%pot(start + isec)%pot%set(1)%gal21%AH2 = rvalues(2)
1655 nonbonded%pot(start + isec)%pot%set(1)%gal21%BH1 = rvalues(1)
1656 nonbonded%pot(start + isec)%pot%set(1)%gal21%BH2 = rvalues(2)
1661 ALLOCATE (nonbonded%pot(start + isec)%pot%set(1)%gal21%gcn(nval))
1668 nonbonded%pot(start + isec)%pot%set(1)%gal21%gcn(iatom) = rval
1672 l_val=nonbonded%pot(start + isec)%pot%set(1)%gal21%express)
1676 IF (n_rep == 1)
THEN
1678 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1679 nonbonded%pot(start + isec)%pot%set(1)%gal21%rcutsq = rcut**2
1682 END SUBROUTINE read_gal21_section
1692 SUBROUTINE read_siepmann_section(nonbonded, section, start, siepmann_section)
1693 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1694 TYPE(section_vals_type),
POINTER :: section
1695 INTEGER,
INTENT(IN) :: start
1696 TYPE(section_vals_type),
POINTER :: siepmann_section
1698 CHARACTER(LEN=default_string_length), &
1699 DIMENSION(:),
POINTER :: atm_names
1700 INTEGER :: isec, n_items, n_rep
1701 REAL(kind=
dp) :: rcut
1704 DO isec = 1, n_items
1709 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1710 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1711 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1712 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1715 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%B)
1717 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%D)
1719 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%E)
1721 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%F)
1723 r_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%beta)
1725 l_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%allow_oh_formation)
1727 l_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%allow_h3o_formation)
1729 l_val=nonbonded%pot(start + isec)%pot%set(1)%siepmann%allow_o_formation)
1733 IF (n_rep == 1)
THEN
1735 nonbonded%pot(start + isec)%pot%rcutsq = rcut**2
1736 nonbonded%pot(start + isec)%pot%set(1)%siepmann%rcutsq = rcut**2
1739 END SUBROUTINE read_siepmann_section
1748 SUBROUTINE read_bm_section(nonbonded, section, start)
1749 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1750 TYPE(section_vals_type),
POINTER :: section
1751 INTEGER,
INTENT(IN) :: start
1753 CHARACTER(LEN=default_string_length), &
1754 DIMENSION(:),
POINTER :: atm_names
1755 INTEGER :: isec, n_items, n_rep
1756 REAL(kind=
dp) :: a1, a2, b1, b2, beta, c, d, f0, r0, rcut
1759 DO isec = 1, n_items
1773 nonbonded%pot(start + isec)%pot%type =
bm_type
1774 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1775 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1776 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1777 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1778 nonbonded%pot(start + isec)%pot%set(1)%buckmo%f0 = f0
1779 nonbonded%pot(start + isec)%pot%set(1)%buckmo%a1 = a1
1780 nonbonded%pot(start + isec)%pot%set(1)%buckmo%a2 = a2
1781 nonbonded%pot(start + isec)%pot%set(1)%buckmo%b1 = b1
1782 nonbonded%pot(start + isec)%pot%set(1)%buckmo%b2 = b2
1783 nonbonded%pot(start + isec)%pot%set(1)%buckmo%c = c
1784 nonbonded%pot(start + isec)%pot%set(1)%buckmo%d = d
1785 nonbonded%pot(start + isec)%pot%set(1)%buckmo%r0 = r0
1786 nonbonded%pot(start + isec)%pot%set(1)%buckmo%beta = beta
1787 nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
1791 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
1794 r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
1796 END SUBROUTINE read_bm_section
1807 SUBROUTINE read_tabpot_section(nonbonded, section, start, para_env, mm_section)
1808 TYPE(pair_potential_p_type),
POINTER :: nonbonded
1809 TYPE(section_vals_type),
POINTER :: section
1810 INTEGER,
INTENT(IN) :: start
1811 TYPE(mp_para_env_type),
POINTER :: para_env
1812 TYPE(section_vals_type),
POINTER :: mm_section
1814 CHARACTER(LEN=default_string_length), &
1815 DIMENSION(:),
POINTER :: atm_names
1816 INTEGER :: isec, n_items
1819 DO isec = 1, n_items
1821 nonbonded%pot(start + isec)%pot%type =
tab_type
1822 nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
1823 nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
1824 CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
1825 CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
1827 c_val=nonbonded%pot(start + isec)%pot%set(1)%tab%tabpot_file_name)
1828 CALL read_tabpot_data(nonbonded%pot(start + isec)%pot%set(1)%tab, para_env, mm_section)
1829 nonbonded%pot(start + isec)%pot%set(1)%tab%index = isec
1831 END SUBROUTINE read_tabpot_section
1842 CHARACTER(LEN=default_string_length), &
1843 DIMENSION(:),
POINTER :: charge_atm
1844 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charge
1845 TYPE(section_vals_type),
POINTER :: section
1846 INTEGER,
INTENT(IN) :: start
1848 CHARACTER(LEN=default_string_length) :: atm_name
1849 INTEGER :: isec, n_items
1852 DO isec = 1, n_items
1854 charge_atm(start + isec) = atm_name
1855 CALL uppercase(charge_atm(start + isec))
1869 SUBROUTINE read_apol_section(apol_atm, apol, damping_list, section, &
1871 CHARACTER(LEN=default_string_length), &
1872 DIMENSION(:),
POINTER :: apol_atm
1873 REAL(kind=
dp),
DIMENSION(:),
POINTER :: apol
1874 TYPE(damping_info_type),
DIMENSION(:),
POINTER :: damping_list
1875 TYPE(section_vals_type),
POINTER :: section
1876 INTEGER,
INTENT(IN) :: start
1878 CHARACTER(LEN=default_string_length) :: atm_name
1879 INTEGER :: isec, isec_damp, n_damp, n_items, &
1880 start_damp, tmp_damp
1881 TYPE(section_vals_type),
POINTER :: tmp_section
1884 NULLIFY (tmp_section)
1887 DO isec = 1, n_items
1891 n_damp = n_damp + tmp_damp
1895 IF (n_damp > 0)
THEN
1896 ALLOCATE (damping_list(1:n_damp))
1901 DO isec = 1, n_items
1903 apol_atm(start + isec) = atm_name
1910 DO isec_damp = 1, tmp_damp
1911 damping_list(start_damp + isec_damp)%atm_name1 = apol_atm(start + isec)
1914 damping_list(start_damp + isec_damp)%atm_name2 = atm_name
1915 CALL uppercase(damping_list(start_damp + isec_damp)%atm_name2)
1918 damping_list(start_damp + isec_damp)%dtype = atm_name
1919 CALL uppercase(damping_list(start_damp + isec_damp)%dtype)
1922 i_val=damping_list(start_damp + isec_damp)%order)
1924 r_val=damping_list(start_damp + isec_damp)%bij)
1926 r_val=damping_list(start_damp + isec_damp)%cij)
1928 start_damp = start_damp + tmp_damp
1932 END SUBROUTINE read_apol_section
1942 SUBROUTINE read_cpol_section(cpol_atm, cpol, section, start)
1943 CHARACTER(LEN=default_string_length), &
1944 DIMENSION(:),
POINTER :: cpol_atm
1945 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cpol
1946 TYPE(section_vals_type),
POINTER :: section
1947 INTEGER,
INTENT(IN) :: start
1949 CHARACTER(LEN=default_string_length) :: atm_name
1950 INTEGER :: isec, n_items
1953 DO isec = 1, n_items
1955 cpol_atm(start + isec) = atm_name
1959 END SUBROUTINE read_cpol_section
1968 SUBROUTINE read_shell_section(shell_list, section, start)
1970 TYPE(shell_p_type),
DIMENSION(:),
POINTER :: shell_list
1971 TYPE(section_vals_type),
POINTER :: section
1972 INTEGER,
INTENT(IN) :: start
1974 CHARACTER(LEN=default_string_length) :: atm_name
1975 INTEGER :: i_rep, n_rep
1976 REAL(
dp) :: ccharge, cutoff, k, maxdist, mfrac, &
1983 c_val=atm_name, i_rep_section=i_rep)
1985 shell_list(start + i_rep)%atm_name = atm_name
1987 shell_list(start + i_rep)%shell%charge_core = ccharge
1989 shell_list(start + i_rep)%shell%charge_shell = scharge
1991 shell_list(start + i_rep)%shell%massfrac = mfrac
1993 IF (k < 0.0_dp)
THEN
1994 CALL cp_abort(__location__, &
1995 "An invalid value was specified for the force constant k2 of the core-shell "// &
1998 shell_list(start + i_rep)%shell%k2_spring = k
2000 IF (k < 0.0_dp)
THEN
2001 CALL cp_abort(__location__, &
2002 "An invalid value was specified for the force constant k4 of the core-shell "// &
2005 shell_list(start + i_rep)%shell%k4_spring = k
2007 shell_list(start + i_rep)%shell%max_dist = maxdist
2009 shell_list(start + i_rep)%shell%shell_cutoff = cutoff
2012 END SUBROUTINE read_shell_section
2026 SUBROUTINE read_bonds_section(bond_kind, bond_a, bond_b, bond_k, bond_r0, bond_cs, section, start)
2027 INTEGER,
DIMENSION(:),
POINTER :: bond_kind
2028 CHARACTER(LEN=default_string_length), &
2029 DIMENSION(:),
POINTER :: bond_a, bond_b
2030 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: bond_k
2031 REAL(kind=
dp),
DIMENSION(:),
POINTER :: bond_r0, bond_cs
2032 TYPE(section_vals_type),
POINTER :: section
2033 INTEGER,
INTENT(IN) :: start
2035 CHARACTER(LEN=default_string_length), &
2036 DIMENSION(:),
POINTER :: atm_names
2037 INTEGER :: isec, k, n_items
2038 REAL(kind=
dp),
DIMENSION(:),
POINTER :: kvals
2040 NULLIFY (kvals, atm_names)
2042 DO isec = 1, n_items
2045 bond_a(start + isec) = atm_names(1)
2046 bond_b(start + isec) = atm_names(2)
2050 cpassert(
SIZE(kvals) <= 3)
2051 bond_k(:, start + isec) = 0.0_dp
2052 DO k = 1,
SIZE(kvals)
2053 bond_k(k, start + isec) = kvals(k)
2058 END SUBROUTINE read_bonds_section
2079 SUBROUTINE read_bends_section(bend_kind, bend_a, bend_b, bend_c, bend_k, bend_theta0, bend_cb, &
2080 bend_r012, bend_r032, bend_kbs12, bend_kbs32, bend_kss, bend_legendre, &
2082 INTEGER,
DIMENSION(:),
POINTER :: bend_kind
2083 CHARACTER(LEN=default_string_length), &
2084 DIMENSION(:),
POINTER :: bend_a, bend_b, bend_c
2085 REAL(kind=
dp),
DIMENSION(:),
POINTER :: bend_k, bend_theta0, bend_cb, bend_r012, &
2086 bend_r032, bend_kbs12, bend_kbs32, &
2088 TYPE(legendre_data_type),
DIMENSION(:),
POINTER :: bend_legendre
2089 TYPE(section_vals_type),
POINTER :: section
2090 INTEGER,
INTENT(IN) :: start
2092 CHARACTER(LEN=default_string_length), &
2093 DIMENSION(:),
POINTER :: atm_names
2094 INTEGER :: isec, k, n_items, n_rep
2095 REAL(kind=
dp),
DIMENSION(:),
POINTER :: kvals, r_values
2097 NULLIFY (kvals, atm_names)
2099 bend_legendre%order = 0
2100 DO isec = 1, n_items
2103 bend_a(start + isec) = atm_names(1)
2104 bend_b(start + isec) = atm_names(2)
2105 bend_c(start + isec) = atm_names(3)
2110 cpassert(
SIZE(kvals) == 1)
2111 bend_k(start + isec) = kvals(1)
2112 CALL section_vals_val_get(section,
"THETA0", i_rep_section=isec, r_val=bend_theta0(start + isec))
2116 CALL section_vals_val_get(section,
"KBS12", i_rep_section=isec, r_val=bend_kbs12(start + isec))
2117 CALL section_vals_val_get(section,
"KBS32", i_rep_section=isec, r_val=bend_kbs32(start + isec))
2122 CALL section_vals_val_get(section,
"LEGENDRE", i_rep_val=k, r_vals=r_values, i_rep_section=isec)
2123 bend_legendre(start + isec)%order =
SIZE(r_values)
2124 IF (
ASSOCIATED(bend_legendre(start + isec)%coeffs))
THEN
2125 DEALLOCATE (bend_legendre(start + isec)%coeffs)
2127 ALLOCATE (bend_legendre(start + isec)%coeffs(bend_legendre(start + isec)%order))
2128 bend_legendre(start + isec)%coeffs = r_values
2131 END SUBROUTINE read_bends_section
2144 SUBROUTINE read_ubs_section(ub_kind, ub_a, ub_b, ub_c, ub_k, ub_r0, section, start)
2145 INTEGER,
DIMENSION(:),
POINTER :: ub_kind
2146 CHARACTER(LEN=default_string_length), &
2147 DIMENSION(:),
POINTER :: ub_a, ub_b, ub_c
2148 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: ub_k
2149 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ub_r0
2150 TYPE(section_vals_type),
POINTER :: section
2151 INTEGER,
INTENT(IN) :: start
2153 CHARACTER(LEN=default_string_length), &
2154 DIMENSION(:),
POINTER :: atm_names
2155 INTEGER :: isec, k, n_items
2157 REAL(kind=
dp),
DIMENSION(:),
POINTER :: kvals
2158 TYPE(section_vals_type),
POINTER :: subsection
2162 DO isec = 1, n_items
2168 ub_a(start + isec) = atm_names(1)
2169 ub_b(start + isec) = atm_names(2)
2170 ub_c(start + isec) = atm_names(3)
2175 cpassert(
SIZE(kvals) <= 3)
2176 ub_k(:, start + isec) = 0.0_dp
2177 DO k = 1,
SIZE(kvals)
2178 ub_k(k, start + isec) = kvals(k)
2183 END SUBROUTINE read_ubs_section
2199 SUBROUTINE read_torsions_section(torsion_kind, torsion_a, torsion_b, torsion_c, torsion_d, torsion_k, &
2200 torsion_phi0, torsion_m, section, start)
2201 INTEGER,
DIMENSION(:),
POINTER :: torsion_kind
2202 CHARACTER(LEN=default_string_length), &
2203 DIMENSION(:),
POINTER :: torsion_a, torsion_b, torsion_c, &
2205 REAL(kind=
dp),
DIMENSION(:),
POINTER :: torsion_k, torsion_phi0
2206 INTEGER,
DIMENSION(:),
POINTER :: torsion_m
2207 TYPE(section_vals_type),
POINTER :: section
2208 INTEGER,
INTENT(IN) :: start
2210 CHARACTER(LEN=default_string_length), &
2211 DIMENSION(:),
POINTER :: atm_names
2212 INTEGER :: isec, n_items
2216 DO isec = 1, n_items
2217 CALL section_vals_val_get(section,
"KIND", i_rep_section=isec, i_val=torsion_kind(start + isec))
2219 torsion_a(start + isec) = atm_names(1)
2220 torsion_b(start + isec) = atm_names(2)
2221 torsion_c(start + isec) = atm_names(3)
2222 torsion_d(start + isec) = atm_names(4)
2228 CALL section_vals_val_get(section,
"PHI0", i_rep_section=isec, r_val=torsion_phi0(start + isec))
2231 IF (torsion_kind(start + isec) .EQ.
do_ff_opls)
THEN
2232 IF (torsion_phi0(start + isec) .NE. 0.0_dp)
THEN
2233 CALL cp_warn(__location__,
"PHI0 parameter was non-zero "// &
2234 "for an OPLS-type TORSION. It will be ignored.")
2236 IF (
modulo(torsion_m(start + isec), 2) .EQ. 0)
THEN
2238 torsion_phi0(start + isec) =
pi
2241 torsion_k(start + isec) = torsion_k(start + isec)*0.5_dp
2244 END SUBROUTINE read_torsions_section
2259 SUBROUTINE read_improper_section(impr_kind, impr_a, impr_b, impr_c, impr_d, impr_k, &
2260 impr_phi0, section, start)
2261 INTEGER,
DIMENSION(:),
POINTER :: impr_kind
2262 CHARACTER(LEN=default_string_length), &
2263 DIMENSION(:),
POINTER :: impr_a, impr_b, impr_c, impr_d
2264 REAL(kind=
dp),
DIMENSION(:),
POINTER :: impr_k, impr_phi0
2265 TYPE(section_vals_type),
POINTER :: section
2266 INTEGER,
INTENT(IN) :: start
2268 CHARACTER(LEN=default_string_length), &
2269 DIMENSION(:),
POINTER :: atm_names
2270 INTEGER :: isec, n_items
2274 DO isec = 1, n_items
2277 impr_a(start + isec) = atm_names(1)
2278 impr_b(start + isec) = atm_names(2)
2279 impr_c(start + isec) = atm_names(3)
2280 impr_d(start + isec) = atm_names(4)
2288 END SUBROUTINE read_improper_section
2303 SUBROUTINE read_opbend_section(opbend_kind, opbend_a, opbend_b, opbend_c, opbend_d, opbend_k, &
2304 opbend_phi0, section, start)
2305 INTEGER,
DIMENSION(:),
POINTER :: opbend_kind
2306 CHARACTER(LEN=default_string_length), &
2307 DIMENSION(:),
POINTER :: opbend_a, opbend_b, opbend_c, opbend_d
2308 REAL(kind=
dp),
DIMENSION(:),
POINTER :: opbend_k, opbend_phi0
2309 TYPE(section_vals_type),
POINTER :: section
2310 INTEGER,
INTENT(IN) :: start
2312 CHARACTER(LEN=default_string_length), &
2313 DIMENSION(:),
POINTER :: atm_names
2314 INTEGER :: isec, n_items
2318 DO isec = 1, n_items
2319 CALL section_vals_val_get(section,
"KIND", i_rep_section=isec, i_val=opbend_kind(start + isec))
2321 opbend_a(start + isec) = atm_names(1)
2322 opbend_b(start + isec) = atm_names(2)
2323 opbend_c(start + isec) = atm_names(3)
2324 opbend_d(start + isec) = atm_names(4)
2330 CALL section_vals_val_get(section,
"PHI0", i_rep_section=isec, r_val=opbend_phi0(start + isec))
2332 END SUBROUTINE read_opbend_section
2345 TYPE(force_field_type),
INTENT(INOUT) :: ff_type
2346 TYPE(mp_para_env_type),
POINTER :: para_env
2347 TYPE(section_vals_type),
POINTER :: mm_section
2349 TYPE(section_vals_type),
POINTER :: ff_section
2351 NULLIFY (ff_section)
2353 CALL read_force_field_section1(ff_section, mm_section, ff_type, para_env)
2362 SUBROUTINE read_eam_data(eam, para_env, mm_section)
2363 TYPE(eam_pot_type),
POINTER :: eam
2364 TYPE(mp_para_env_type),
POINTER :: para_env
2365 TYPE(section_vals_type),
POINTER :: mm_section
2367 CHARACTER(len=*),
PARAMETER :: routinen =
'read_eam_data'
2369 INTEGER :: handle, i, iw
2370 TYPE(cp_logger_type),
POINTER :: logger
2371 TYPE(cp_parser_type) :: parser
2373 CALL timeset(routinen, handle)
2378 IF (iw > 0)
WRITE (iw, *)
"Reading EAM data from: ", trim(eam%eam_file_name)
2379 CALL parser_create(parser, trim(eam%eam_file_name), para_env=para_env)
2382 IF (iw > 0)
WRITE (iw, *)
"Title: ", parser%input_line
2385 READ (parser%input_line, *) eam%drar, eam%drhoar, eam%acutal, eam%npoints
2389 CALL reallocate(eam%rho, 1, eam%npoints)
2390 CALL reallocate(eam%rhop, 1, eam%npoints)
2391 CALL reallocate(eam%rval, 1, eam%npoints)
2392 CALL reallocate(eam%rhoval, 1, eam%npoints)
2393 CALL reallocate(eam%phi, 1, eam%npoints)
2394 CALL reallocate(eam%phip, 1, eam%npoints)
2395 CALL reallocate(eam%frho, 1, eam%npoints)
2396 CALL reallocate(eam%frhop, 1, eam%npoints)
2398 DO i = 1, eam%npoints
2400 READ (parser%input_line, *) eam%rho(i), eam%rhop(i)
2402 eam%rval(i) = real(i - 1, kind=
dp)*eam%drar
2403 eam%rhoval(i) = real(i - 1, kind=
dp)*eam%drhoar
2406 DO i = 1, eam%npoints
2408 READ (parser%input_line, *) eam%phi(i), eam%phip(i)
2413 DO i = 1, eam%npoints
2415 READ (parser%input_line, *) eam%frho(i), eam%frhop(i)
2420 IF (iw > 0)
WRITE (iw, *)
"Finished EAM data"
2423 CALL timestop(handle)
2425 END SUBROUTINE read_eam_data
2432 SUBROUTINE read_nequip_data(nequip)
2433 TYPE(nequip_pot_type),
POINTER :: nequip
2435 CHARACTER(len=*),
PARAMETER :: routinen =
'read_nequip_data'
2437 CHARACTER(LEN=default_path_length) :: allow_tf32_str, config_str, cutoff_str
2439 LOGICAL :: allow_tf32, found
2441 CALL timeset(routinen, handle)
2443 INQUIRE (file=nequip%nequip_file_name, exist=found)
2444 IF (.NOT. found)
THEN
2445 CALL cp_abort(__location__, &
2446 "Nequip model file <"//trim(nequip%nequip_file_name)// &
2452 READ (cutoff_str, *) nequip%rcutsq
2454 nequip%rcutsq = nequip%rcutsq*nequip%rcutsq
2455 nequip%unit_coords_val =
cp_unit_to_cp2k(nequip%unit_coords_val, nequip%unit_coords)
2456 nequip%unit_forces_val =
cp_unit_to_cp2k(nequip%unit_forces_val, nequip%unit_forces)
2457 nequip%unit_energy_val =
cp_unit_to_cp2k(nequip%unit_energy_val, nequip%unit_energy)
2458 nequip%unit_cell_val =
cp_unit_to_cp2k(nequip%unit_cell_val, nequip%unit_cell)
2462 CALL read_default_dtype(config_str, nequip%do_nequip_sp)
2465 allow_tf32 = (trim(allow_tf32_str) ==
"1")
2466 IF (trim(allow_tf32_str) /=
"1" .AND. trim(allow_tf32_str) /=
"0")
THEN
2467 CALL cp_abort(__location__, &
2468 "The value for allow_tf32 <"//trim(allow_tf32_str)// &
2469 "> is not supported. Check the .yaml and .pth files.")
2473 CALL timestop(handle)
2474 END SUBROUTINE read_nequip_data
2481 SUBROUTINE read_allegro_data(allegro)
2482 TYPE(allegro_pot_type),
POINTER :: allegro
2484 CHARACTER(len=*),
PARAMETER :: routinen =
'read_allegro_data'
2486 CHARACTER(LEN=default_path_length) :: allow_tf32_str, config_str, cutoff_str
2488 LOGICAL :: allow_tf32, found
2490 CALL timeset(routinen, handle)
2492 INQUIRE (file=allegro%allegro_file_name, exist=found)
2493 IF (.NOT. found)
THEN
2494 CALL cp_abort(__location__, &
2495 "Allegro model file <"//trim(allegro%allegro_file_name)// &
2500 IF (allegro%nequip_version ==
"")
THEN
2501 CALL cp_abort(__location__, &
2502 "Allegro model file <"//trim(allegro%allegro_file_name)// &
2503 "> has not been deployed; did you forget to run `nequip-deploy`?")
2506 READ (cutoff_str, *) allegro%rcutsq
2508 allegro%rcutsq = allegro%rcutsq*allegro%rcutsq
2509 allegro%unit_coords_val =
cp_unit_to_cp2k(allegro%unit_coords_val, allegro%unit_coords)
2510 allegro%unit_forces_val =
cp_unit_to_cp2k(allegro%unit_forces_val, allegro%unit_forces)
2511 allegro%unit_energy_val =
cp_unit_to_cp2k(allegro%unit_energy_val, allegro%unit_energy)
2512 allegro%unit_cell_val =
cp_unit_to_cp2k(allegro%unit_cell_val, allegro%unit_cell)
2516 CALL read_default_dtype(config_str, allegro%do_allegro_sp)
2519 allow_tf32 = (trim(allow_tf32_str) ==
"1")
2520 IF (trim(allow_tf32_str) /=
"1" .AND. trim(allow_tf32_str) /=
"0")
THEN
2521 CALL cp_abort(__location__, &
2522 "The value for allow_tf32 <"//trim(allow_tf32_str)// &
2523 "> is not supported. Check the .yaml and .pth files.")
2527 CALL timestop(handle)
2528 END SUBROUTINE read_allegro_data
2536 SUBROUTINE read_default_dtype(config_str, do_model_sp)
2538 CHARACTER(LEN=default_path_length) :: config_str
2539 LOGICAL :: do_model_sp
2541 CHARACTER(len=*),
PARAMETER :: routinen =
'read_default_dtype'
2543 INTEGER :: handle, i,
idx, len_config
2545 CALL timeset(routinen, handle)
2547 len_config = len_trim(config_str)
2548 idx = index(config_str,
"default_dtype:")
2551 DO WHILE (i <= len_config .AND. config_str(i:i) ==
" ")
2555 IF (i > len_config)
THEN
2556 CALL cp_abort(__location__, &
2557 "No default_dtype found, check the Nequip/Allegro .yaml or .pth files."// &
2558 " Default_dtype should be either <float32> or <float64>.")
2559 ELSE IF (config_str(i:i + 6) ==
"float32")
THEN
2560 do_model_sp = .true.
2561 ELSE IF (config_str(i:i + 6) ==
"float64")
THEN
2562 do_model_sp = .false.
2564 CALL cp_abort(__location__, &
2565 "The default_dtype should be either <float32> or <float64>."// &
2566 " Check the NequIP/Allegro .yaml and .pth files.")
2570 CALL timestop(handle)
2571 END SUBROUTINE read_default_dtype
2580 SUBROUTINE read_tabpot_data(tab, para_env, mm_section)
2581 TYPE(tab_pot_type),
POINTER :: tab
2582 TYPE(mp_para_env_type),
POINTER :: para_env
2583 TYPE(section_vals_type),
POINTER :: mm_section
2585 CHARACTER(len=*),
PARAMETER :: routinen =
'read_tabpot_data'
2588 INTEGER :: d, handle, i, iw
2589 TYPE(cp_logger_type),
POINTER :: logger
2590 TYPE(cp_parser_type) :: parser
2592 CALL timeset(routinen, handle)
2597 IF (iw > 0)
WRITE (iw, *)
"Reading TABPOT data from: ", trim(tab%tabpot_file_name)
2598 CALL parser_create(parser, trim(tab%tabpot_file_name), para_env=para_env)
2600 IF (iw > 0)
WRITE (iw, *)
"Title: ", parser%input_line
2605 READ (parser%input_line, *) d1, tab%npoints, d2, tab%dr, tab%rcut
2608 CALL reallocate(tab%r, 1, tab%npoints)
2609 CALL reallocate(tab%e, 1, tab%npoints)
2610 CALL reallocate(tab%f, 1, tab%npoints)
2613 DO i = 1, tab%npoints
2615 READ (parser%input_line, *) d, tab%r(i), tab%e(i), tab%f(i)
2621 tab%dr = tab%r(2) - tab%r(1)
2624 IF (iw > 0)
WRITE (iw, *)
"Finished TABPOT data"
2627 CALL timestop(handle)
2628 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....
static GRID_HOST_DEVICE int idx(const orbital a)
Return coset index of given orbital angular momentum.
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. Tracking of preconnections.
character(len=default_path_length) function, public discover_file(file_name)
Checks various locations for a file name.
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.
subroutine, public get_generic_info(gen_section, func_name, xfunction, parameters, values, var_values, size_variables, i_rep_sec, input_variables)
Reads from the input structure all information for generic functions.
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.
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 quip_type
integer, parameter, public gp_type
integer, parameter, public siepmann_type
integer, dimension(2), parameter, public do_potential_single_allocation
integer, parameter, public gw_type
subroutine, public pair_potential_reallocate(p, lb1_new, ub1_new, lj, lj_charmm, williams, goodwin, eam, quip, nequip, allegro, bmhft, bmhftd, ipbv, buck4r, buckmo, gp, tersoff, siepmann, gal, gal21, tab, deepmd)
Cleans the potential parameter type.
integer, dimension(2), parameter, public no_potential_single_allocation
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)