-
Notifications
You must be signed in to change notification settings - Fork 1
/
force_fields_input.F
2726 lines (2474 loc) · 142 KB
/
force_fields_input.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \par History
!> Subroutine input_torsions changed (DG) 05-Dec-2000
!> Output formats changed (DG) 05-Dec-2000
!> JGH (26-01-2002) : force field parameters stored in tables, not in
!> matrices. Input changed to have parameters labeled by the position
!> and not atom pairs (triples etc)
!> Teo (11.2005) : Moved all information on force field pair_potential to
!> a much lighter memory structure
!> Teo 09.2006 : Split all routines force_field I/O in a separate file
!> \author CJM
! **************************************************************************************************
MODULE force_fields_input
USE bibliography, ONLY: Clabaut2020,&
Clabaut2021,&
Siepmann1995,&
Tersoff1988,&
Tosi1964a,&
Tosi1964b,&
Yamada2000,&
cite_reference
USE cp_files, ONLY: discover_file
USE cp_linked_list_input, ONLY: cp_sll_val_next,&
cp_sll_val_type
USE cp_log_handling, ONLY: cp_get_default_logger,&
cp_logger_type,&
cp_to_string
USE cp_output_handling, ONLY: cp_print_key_finished_output,&
cp_print_key_unit_nr
USE cp_parser_methods, ONLY: parser_get_next_line
USE cp_parser_types, ONLY: cp_parser_type,&
parser_create,&
parser_release
USE cp_units, ONLY: cp_unit_to_cp2k
USE damping_dipole_types, ONLY: damping_info_type
USE force_field_kind_types, ONLY: do_ff_amber,&
do_ff_charmm,&
do_ff_g87,&
do_ff_g96,&
do_ff_opls,&
do_ff_undef,&
legendre_data_type
USE force_field_types, ONLY: force_field_type,&
input_info_type
USE force_fields_util, ONLY: get_generic_info
USE input_section_types, ONLY: section_vals_get,&
section_vals_get_subs_vals,&
section_vals_list_get,&
section_vals_type,&
section_vals_val_get
USE input_val_types, ONLY: val_get,&
val_type
USE kinds, ONLY: default_path_length,&
default_string_length,&
dp
USE mathconstants, ONLY: pi
USE mathlib, ONLY: invert_matrix
USE memory_utilities, ONLY: reallocate
USE message_passing, ONLY: mp_para_env_type
USE pair_potential_types, ONLY: &
allegro_pot_type, allegro_type, b4_type, bm_type, deepmd_type, &
do_potential_single_allocation, ea_type, eam_pot_type, ft_pot_type, ft_type, ftd_type, &
gal21_type, gal_type, gp_type, gw_type, ip_type, ipbv_pot_type, lj_charmm_type, &
nequip_pot_type, nequip_type, no_potential_single_allocation, pair_potential_p_type, &
pair_potential_reallocate, potential_single_allocation, quip_type, siepmann_type, &
tab_pot_type, tab_type, tersoff_type, wl_type
USE shell_potential_types, ONLY: shell_p_create,&
shell_p_type
USE string_utilities, ONLY: uppercase
USE torch_api, ONLY: torch_allow_tf32,&
torch_model_read_metadata
#include "./base/base_uses.f90"
IMPLICIT NONE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'force_fields_input'
PRIVATE
PUBLIC :: read_force_field_section, &
read_lj_section, &
read_wl_section, &
read_gd_section, &
read_gp_section, &
read_chrg_section
CONTAINS
! **************************************************************************************************
!> \brief Reads the force_field input section
!> \param ff_section ...
!> \param mm_section ...
!> \param ff_type ...
!> \param para_env ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_force_field_section1(ff_section, mm_section, ff_type, para_env)
TYPE(section_vals_type), POINTER :: ff_section, mm_section
TYPE(force_field_type), INTENT(INOUT) :: ff_type
TYPE(mp_para_env_type), POINTER :: para_env
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: nallegro, nb4, nbends, nbm, nbmhft, nbmhftd, nbonds, nchg, ndeepmd, neam, ngal, &
ngal21, ngd, ngp, nimpr, nipbv, nlj, nnequip, nopbend, nquip, nshell, nsiepmann, ntab, &
ntersoff, ntors, ntot, nubs, nwl
LOGICAL :: explicit, unique_spline
REAL(KIND=dp) :: min_eps_spline_allowed
TYPE(input_info_type), POINTER :: inp_info
TYPE(section_vals_type), POINTER :: tmp_section, tmp_section2
INTEGER::i
NULLIFY (tmp_section, tmp_section2)
inp_info => ff_type%inp_info
CALL section_vals_val_get(ff_section, "PARMTYPE", i_val=ff_type%ff_type)
CALL section_vals_val_get(ff_section, "EI_SCALE14", r_val=ff_type%ei_scale14)
CALL section_vals_val_get(ff_section, "VDW_SCALE14", r_val=ff_type%vdw_scale14)
CALL section_vals_val_get(ff_section, "SPLINE%RCUT_NB", r_val=ff_type%rcut_nb)
CALL section_vals_val_get(ff_section, "SPLINE%R0_NB", r_val=ff_type%rlow_nb)
CALL section_vals_val_get(ff_section, "SPLINE%EPS_SPLINE", r_val=ff_type%eps_spline)
CALL section_vals_val_get(ff_section, "SPLINE%EMAX_SPLINE", r_val=ff_type%emax_spline)
CALL section_vals_val_get(ff_section, "SPLINE%EMAX_ACCURACY", r_val=ff_type%max_energy)
CALL section_vals_val_get(ff_section, "SPLINE%NPOINTS", i_val=ff_type%npoints)
CALL section_vals_val_get(ff_section, "IGNORE_MISSING_CRITICAL_PARAMS", l_val=ff_type%ignore_missing_critical)
CPASSERT(ff_type%max_energy <= ff_type%emax_spline)
! Read the parameter file name only if the force field type requires it..
SELECT CASE (ff_type%ff_type)
CASE (do_ff_charmm, do_ff_amber, do_ff_g96, do_ff_g87)
CALL section_vals_val_get(ff_section, "PARM_FILE_NAME", c_val=ff_type%ff_file_name)
IF (TRIM(ff_type%ff_file_name) == "") &
CPABORT("Force Field Parameter's filename is empty! Please check your input file.")
CASE (do_ff_undef)
! Do Nothing
CASE DEFAULT
CPABORT("Force field type not implemented")
END SELECT
! Numerical Accuracy:
! the factors here should depend on the energy and on the shape of each potential mapped
! with splines. this would make everything un-necessarily complicated. Let's just be safe
! and assume that we cannot achieve an accuracy on the spline 2 orders of magnitude more
! than the smallest representable number (taking into account also the max_energy for the
! spline generation
min_eps_spline_allowed = 20.0_dp*MAX(ff_type%max_energy, 10.0_dp)*EPSILON(0.0_dp)
IF (ff_type%eps_spline < min_eps_spline_allowed) THEN
CALL cp_warn(__LOCATION__, &
"Requested spline accuracy ("//TRIM(cp_to_string(ff_type%eps_spline))//" ) "// &
"is smaller than the minimum value allowed ("//TRIM(cp_to_string(min_eps_spline_allowed))// &
" ) with the present machine precision ("//TRIM(cp_to_string(EPSILON(0.0_dp)))//" ). "// &
"New EPS_SPLINE value ("//TRIM(cp_to_string(min_eps_spline_allowed))//" ). ")
ff_type%eps_spline = min_eps_spline_allowed
END IF
CALL section_vals_val_get(ff_section, "SHIFT_CUTOFF", l_val=ff_type%shift_cutoff)
CALL section_vals_val_get(ff_section, "SPLINE%UNIQUE_SPLINE", l_val=unique_spline)
! Single spline
potential_single_allocation = no_potential_single_allocation
IF (unique_spline) potential_single_allocation = do_potential_single_allocation
CALL section_vals_val_get(ff_section, "MULTIPLE_POTENTIAL", l_val=ff_type%multiple_potential)
CALL section_vals_val_get(ff_section, "DO_NONBONDED", l_val=ff_type%do_nonbonded)
CALL section_vals_val_get(ff_section, "DO_ELECTROSTATICS", l_val=ff_type%do_electrostatics)
tmp_section => section_vals_get_subs_vals(ff_section, "NONBONDED")
CALL section_vals_get(tmp_section, explicit=explicit)
IF (explicit .AND. ff_type%do_nonbonded) THEN
tmp_section2 => section_vals_get_subs_vals(tmp_section, "LENNARD-JONES")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nlj)
ntot = 0
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nlj, lj_charmm=.TRUE.)
CALL read_lj_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "WILLIAMS")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nwl)
ntot = nlj
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nwl, williams=.TRUE.)
CALL read_wl_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "EAM")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=neam)
ntot = nlj + nwl
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + neam, eam=.TRUE.)
CALL read_eam_section(inp_info%nonbonded, tmp_section2, ntot, para_env, mm_section)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "GOODWIN")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ngd)
ntot = nlj + nwl + neam
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + ngd, goodwin=.TRUE.)
CALL read_gd_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "IPBV")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nipbv)
ntot = nlj + nwl + neam + ngd
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nipbv, ipbv=.TRUE.)
CALL read_ipbv_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "BMHFT")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nbmhft)
ntot = nlj + nwl + neam + ngd + nipbv
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nbmhft, bmhft=.TRUE.)
CALL read_bmhft_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "BMHFTD")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nbmhftd)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nbmhftd, bmhftd=.TRUE.)
CALL read_bmhftd_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "BUCK4RANGES")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nb4)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nb4, buck4r=.TRUE.)
CALL read_b4_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "BUCKMORSE")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nbm)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nbm, buckmo=.TRUE.)
CALL read_bm_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "GENPOT")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ngp)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + ngp, gp=.TRUE.)
CALL read_gp_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "TERSOFF")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ntersoff)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + ntersoff, tersoff=.TRUE.)
CALL read_tersoff_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "GAL19")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ngal)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + ngal, gal=.TRUE.)
CALL read_gal_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "GAL21")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ngal21)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + ngal21, gal21=.TRUE.)
CALL read_gal21_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "SIEPMANN")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nsiepmann)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nsiepmann, siepmann=.TRUE.)
CALL read_siepmann_section(inp_info%nonbonded, tmp_section2, ntot, tmp_section2)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "quip")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nquip)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nquip, quip=.TRUE.)
CALL read_quip_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "nequip")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nnequip)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
nquip
IF (explicit) THEN
! avoid repeating the nequip section for each pair
CALL section_vals_val_get(tmp_section2, "ATOMS", c_vals=atm_names)
nnequip = nnequip - 1 + SIZE(atm_names) + (SIZE(atm_names)*SIZE(atm_names) - SIZE(atm_names))/2
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nnequip, nequip=.TRUE.)
CALL read_nequip_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "allegro")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nallegro)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
nquip + nnequip
IF (explicit) THEN
! avoid repeating the allegro section for each pair
CALL section_vals_val_get(tmp_section2, "ATOMS", c_vals=atm_names)
nallegro = nallegro - 1 + SIZE(atm_names) + (SIZE(atm_names)*SIZE(atm_names) - SIZE(atm_names))/2
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + nallegro, allegro=.TRUE.)
CALL read_allegro_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "TABPOT")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ntab)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
nquip + nnequip + nallegro
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + ntab, tab=.TRUE.)
CALL read_tabpot_section(inp_info%nonbonded, tmp_section2, ntot, para_env, mm_section)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "DEEPMD")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ndeepmd)
ntot = nlj + nwl + neam + ngd + nipbv + nbmhft + nbmhftd + nb4 + nbm + ngp + ntersoff + ngal + ngal21 + nsiepmann + &
nquip + nnequip + nallegro + ntab
IF (explicit) THEN
! avoid repeating the deepmd section for each pair
CALL section_vals_val_get(tmp_section2, "ATOMS", c_vals=atm_names)
ndeepmd = ndeepmd - 1 + SIZE(atm_names) + (SIZE(atm_names)*SIZE(atm_names) - SIZE(atm_names))/2
CALL pair_potential_reallocate(inp_info%nonbonded, 1, ntot + ndeepmd, deepmd=.TRUE.)
CALL read_deepmd_section(inp_info%nonbonded, tmp_section2, ntot)
END IF
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "NONBONDED14")
CALL section_vals_get(tmp_section, explicit=explicit)
IF (explicit .AND. ff_type%do_nonbonded) THEN
tmp_section2 => section_vals_get_subs_vals(tmp_section, "LENNARD-JONES")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nlj)
ntot = 0
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded14, 1, ntot + nlj, lj_charmm=.TRUE.)
CALL read_lj_section(inp_info%nonbonded14, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "WILLIAMS")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=nwl)
ntot = nlj
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded14, 1, ntot + nwl, williams=.TRUE.)
CALL read_wl_section(inp_info%nonbonded14, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "GOODWIN")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ngd)
ntot = nlj + nwl
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded14, 1, ntot + ngd, goodwin=.TRUE.)
CALL read_gd_section(inp_info%nonbonded14, tmp_section2, ntot)
END IF
tmp_section2 => section_vals_get_subs_vals(tmp_section, "GENPOT")
CALL section_vals_get(tmp_section2, explicit=explicit, n_repetition=ngp)
ntot = nlj + nwl + ngd
IF (explicit) THEN
CALL pair_potential_reallocate(inp_info%nonbonded14, 1, ntot + ngp, gp=.TRUE.)
CALL read_gp_section(inp_info%nonbonded14, tmp_section2, ntot)
END IF
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "CHARGE")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nchg)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%charge_atm, 1, nchg)
CALL reallocate(inp_info%charge, 1, nchg)
CALL read_chrg_section(inp_info%charge_atm, inp_info%charge, tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "DIPOLE")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nchg)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%apol_atm, 1, nchg)
CALL reallocate(inp_info%apol, 1, nchg)
CALL read_apol_section(inp_info%apol_atm, inp_info%apol, inp_info%damping_list, &
tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "QUADRUPOLE")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nchg)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%cpol_atm, 1, nchg)
CALL reallocate(inp_info%cpol, 1, nchg)
CALL read_cpol_section(inp_info%cpol_atm, inp_info%cpol, tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "SHELL")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nshell)
IF (explicit) THEN
ntot = 0
CALL shell_p_create(inp_info%shell_list, nshell)
CALL read_shell_section(inp_info%shell_list, tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "BOND")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nbonds)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%bond_kind, 1, nbonds)
CALL reallocate(inp_info%bond_a, 1, nbonds)
CALL reallocate(inp_info%bond_b, 1, nbonds)
CALL reallocate(inp_info%bond_k, 1, 3, 1, nbonds)
CALL reallocate(inp_info%bond_r0, 1, nbonds)
CALL reallocate(inp_info%bond_cs, 1, nbonds)
CALL read_bonds_section(inp_info%bond_kind, inp_info%bond_a, inp_info%bond_b, inp_info%bond_k, &
inp_info%bond_r0, inp_info%bond_cs, tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "BEND")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nbends)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%bend_kind, 1, nbends)
CALL reallocate(inp_info%bend_a, 1, nbends)
CALL reallocate(inp_info%bend_b, 1, nbends)
CALL reallocate(inp_info%bend_c, 1, nbends)
CALL reallocate(inp_info%bend_k, 1, nbends)
CALL reallocate(inp_info%bend_theta0, 1, nbends)
CALL reallocate(inp_info%bend_cb, 1, nbends)
CALL reallocate(inp_info%bend_r012, 1, nbends)
CALL reallocate(inp_info%bend_r032, 1, nbends)
CALL reallocate(inp_info%bend_kbs12, 1, nbends)
CALL reallocate(inp_info%bend_kbs32, 1, nbends)
CALL reallocate(inp_info%bend_kss, 1, nbends)
IF (ASSOCIATED(inp_info%bend_legendre)) THEN
DO i = 1, SIZE(inp_info%bend_legendre)
IF (ASSOCIATED(inp_info%bend_legendre(i)%coeffs)) THEN
DEALLOCATE (inp_info%bend_legendre(i)%coeffs)
NULLIFY (inp_info%bend_legendre(i)%coeffs)
END IF
END DO
DEALLOCATE (inp_info%bend_legendre)
NULLIFY (inp_info%bend_legendre)
END IF
ALLOCATE (inp_info%bend_legendre(1:nbends))
DO i = 1, SIZE(inp_info%bend_legendre(1:nbends))
NULLIFY (inp_info%bend_legendre(i)%coeffs)
inp_info%bend_legendre(i)%order = 0
END DO
CALL read_bends_section(inp_info%bend_kind, inp_info%bend_a, inp_info%bend_b, inp_info%bend_c, &
inp_info%bend_k, inp_info%bend_theta0, inp_info%bend_cb, &
inp_info%bend_r012, inp_info%bend_r032, inp_info%bend_kbs12, &
inp_info%bend_kbs32, inp_info%bend_kss, &
inp_info%bend_legendre, tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "BEND")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nubs)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%ub_kind, 1, nubs)
CALL reallocate(inp_info%ub_a, 1, nubs)
CALL reallocate(inp_info%ub_b, 1, nubs)
CALL reallocate(inp_info%ub_c, 1, nubs)
CALL reallocate(inp_info%ub_k, 1, 3, 1, nubs)
CALL reallocate(inp_info%ub_r0, 1, nubs)
CALL read_ubs_section(inp_info%ub_kind, inp_info%ub_a, inp_info%ub_b, inp_info%ub_c, &
inp_info%ub_k, inp_info%ub_r0, tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "TORSION")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=ntors)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%torsion_kind, 1, ntors)
CALL reallocate(inp_info%torsion_a, 1, ntors)
CALL reallocate(inp_info%torsion_b, 1, ntors)
CALL reallocate(inp_info%torsion_c, 1, ntors)
CALL reallocate(inp_info%torsion_d, 1, ntors)
CALL reallocate(inp_info%torsion_k, 1, ntors)
CALL reallocate(inp_info%torsion_m, 1, ntors)
CALL reallocate(inp_info%torsion_phi0, 1, ntors)
CALL read_torsions_section(inp_info%torsion_kind, inp_info%torsion_a, inp_info%torsion_b, &
inp_info%torsion_c, inp_info%torsion_d, inp_info%torsion_k, inp_info%torsion_phi0, &
inp_info%torsion_m, tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "IMPROPER")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nimpr)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%impr_kind, 1, nimpr)
CALL reallocate(inp_info%impr_a, 1, nimpr)
CALL reallocate(inp_info%impr_b, 1, nimpr)
CALL reallocate(inp_info%impr_c, 1, nimpr)
CALL reallocate(inp_info%impr_d, 1, nimpr)
CALL reallocate(inp_info%impr_k, 1, nimpr)
CALL reallocate(inp_info%impr_phi0, 1, nimpr)
CALL read_improper_section(inp_info%impr_kind, inp_info%impr_a, inp_info%impr_b, &
inp_info%impr_c, inp_info%impr_d, inp_info%impr_k, inp_info%impr_phi0, &
tmp_section, ntot)
END IF
tmp_section => section_vals_get_subs_vals(ff_section, "OPBEND")
CALL section_vals_get(tmp_section, explicit=explicit, n_repetition=nopbend)
IF (explicit) THEN
ntot = 0
CALL reallocate(inp_info%opbend_kind, 1, nopbend)
CALL reallocate(inp_info%opbend_a, 1, nopbend)
CALL reallocate(inp_info%opbend_b, 1, nopbend)
CALL reallocate(inp_info%opbend_c, 1, nopbend)
CALL reallocate(inp_info%opbend_d, 1, nopbend)
CALL reallocate(inp_info%opbend_k, 1, nopbend)
CALL reallocate(inp_info%opbend_phi0, 1, nopbend)
CALL read_opbend_section(inp_info%opbend_kind, inp_info%opbend_a, inp_info%opbend_b, &
inp_info%opbend_c, inp_info%opbend_d, inp_info%opbend_k, inp_info%opbend_phi0, &
tmp_section, ntot)
END IF
END SUBROUTINE read_force_field_section1
! **************************************************************************************************
!> \brief Set up of the IPBV force fields
!> \param at1 ...
!> \param at2 ...
!> \param ipbv ...
!> \author teo
! **************************************************************************************************
SUBROUTINE set_IPBV_ff(at1, at2, ipbv)
CHARACTER(LEN=*), INTENT(IN) :: at1, at2
TYPE(ipbv_pot_type), POINTER :: ipbv
IF ((at1(1:1) == 'O') .AND. (at2(1:1) == 'O')) THEN
ipbv%rcore = 0.9_dp ! a.u.
ipbv%m = -1.2226442563398141E+11_dp ! Kelvin/a.u.
ipbv%b = 1.1791292385486696E+11_dp ! Hartree
! Hartree*a.u.^2
ipbv%a(2) = 4.786380682394_dp
ipbv%a(3) = -1543.407053545_dp
ipbv%a(4) = 88783.31188529_dp
ipbv%a(5) = -2361200.155376_dp
ipbv%a(6) = 35940504.84679_dp
ipbv%a(7) = -339762743.6358_dp
ipbv%a(8) = 2043874926.466_dp
ipbv%a(9) = -7654856796.383_dp
ipbv%a(10) = 16195251405.65_dp
ipbv%a(11) = -13140392992.18_dp
ipbv%a(12) = -9285572894.245_dp
ipbv%a(13) = 8756947519.029_dp
ipbv%a(14) = 15793297761.67_dp
ipbv%a(15) = 12917180227.21_dp
ELSEIF (((at1(1:1) == 'O') .AND. (at2(1:1) == 'H')) .OR. &
((at1(1:1) == 'H') .AND. (at2(1:1) == 'O'))) THEN
ipbv%rcore = 2.95_dp ! a.u.
ipbv%m = -0.004025691139759147_dp ! Hartree/a.u.
ipbv%b = -2.193731138097428_dp ! Hartree
! Hartree*a.u.^2
ipbv%a(2) = -195.7716013277_dp
ipbv%a(3) = 15343.78613395_dp
ipbv%a(4) = -530864.4586516_dp
ipbv%a(5) = 10707934.39058_dp
ipbv%a(6) = -140099704.7890_dp
ipbv%a(7) = 1250943273.785_dp
ipbv%a(8) = -7795458330.676_dp
ipbv%a(9) = 33955897217.31_dp
ipbv%a(10) = -101135640744.0_dp
ipbv%a(11) = 193107995718.7_dp
ipbv%a(12) = -193440560940.0_dp
ipbv%a(13) = -4224406093.918E0_dp
ipbv%a(14) = 217192386506.5E0_dp
ipbv%a(15) = -157581228915.5_dp
ELSEIF ((at1(1:1) == 'H') .AND. (at2(1:1) == 'H')) THEN
ipbv%rcore = 3.165_dp ! a.u.
ipbv%m = 0.002639704108787555_dp ! Hartree/a.u.
ipbv%b = -0.2735482611857583_dp ! Hartree
! Hartree*a.u.^2
ipbv%a(2) = -26.29456010782_dp
ipbv%a(3) = 2373.352548248_dp
ipbv%a(4) = -93880.43551360_dp
ipbv%a(5) = 2154624.884809_dp
ipbv%a(6) = -31965151.34955_dp
ipbv%a(7) = 322781785.3278_dp
ipbv%a(8) = -2271097368.668_dp
ipbv%a(9) = 11169163192.90_dp
ipbv%a(10) = -37684457778.47_dp
ipbv%a(11) = 82562104256.03_dp
ipbv%a(12) = -100510435213.4_dp
ipbv%a(13) = 24570342714.65E0_dp
ipbv%a(14) = 88766181532.94E0_dp
ipbv%a(15) = -79705131323.98_dp
ELSE
CPABORT("IPBV only for WATER")
END IF
END SUBROUTINE set_IPBV_ff
! **************************************************************************************************
!> \brief Set up of the BMHFT force fields
!> \param at1 ...
!> \param at2 ...
!> \param ft ...
!> \author teo
! **************************************************************************************************
SUBROUTINE set_BMHFT_ff(at1, at2, ft)
CHARACTER(LEN=*), INTENT(IN) :: at1, at2
TYPE(ft_pot_type), POINTER :: ft
ft%b = cp_unit_to_cp2k(3.1545_dp, "angstrom^-1")
IF ((at1(1:2) == 'NA') .AND. (at2(1:2) == 'NA')) THEN
ft%a = cp_unit_to_cp2k(424.097_dp, "eV")
ft%c = cp_unit_to_cp2k(1.05_dp, "eV*angstrom^6")
ft%d = cp_unit_to_cp2k(0.499_dp, "eV*angstrom^8")
ELSEIF (((at1(1:2) == 'NA') .AND. (at2(1:2) == 'CL')) .OR. &
((at1(1:2) == 'CL') .AND. (at2(1:2) == 'NA'))) THEN
ft%a = cp_unit_to_cp2k(1256.31_dp, "eV")
ft%c = cp_unit_to_cp2k(7.00_dp, "eV*angstrom^6")
ft%d = cp_unit_to_cp2k(8.676_dp, "eV*angstrom^8")
ELSEIF ((at1(1:2) == 'CL') .AND. (at2(1:2) == 'CL')) THEN
ft%a = cp_unit_to_cp2k(3488.998_dp, "eV")
ft%c = cp_unit_to_cp2k(72.50_dp, "eV*angstrom^6")
ft%d = cp_unit_to_cp2k(145.427_dp, "eV*angstrom^8")
ELSE
CPABORT("BMHFT only for NaCl")
END IF
END SUBROUTINE set_BMHFT_ff
! **************************************************************************************************
!> \brief Set up of the BMHFTD force fields
!> \author Mathieu Salanne 05.2010
! **************************************************************************************************
SUBROUTINE set_BMHFTD_ff()
CPABORT("No default parameters present for BMHFTD")
END SUBROUTINE set_BMHFTD_ff
! **************************************************************************************************
!> \brief Reads the EAM section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \param para_env ...
!> \param mm_section ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_eam_section(nonbonded, section, start, para_env, mm_section)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
TYPE(mp_para_env_type), POINTER :: para_env
TYPE(section_vals_type), POINTER :: mm_section
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: isec, n_items
CALL section_vals_get(section, n_repetition=n_items)
DO isec = 1, n_items
CALL section_vals_val_get(section, "ATOMS", i_rep_section=isec, c_vals=atm_names)
nonbonded%pot(start + isec)%pot%type = ea_type
nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
CALL section_vals_val_get(section, "PARM_FILE_NAME", i_rep_section=isec, &
c_val=nonbonded%pot(start + isec)%pot%set(1)%eam%eam_file_name)
CALL read_eam_data(nonbonded%pot(start + isec)%pot%set(1)%eam, para_env, mm_section)
nonbonded%pot(start + isec)%pot%rcutsq = nonbonded%pot(start + isec)%pot%set(1)%eam%acutal**2
END DO
END SUBROUTINE read_eam_section
! **************************************************************************************************
!> \brief Reads the DEEPMD section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_deepmd_section(nonbonded, section, start)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
CHARACTER(LEN=default_string_length) :: deepmd_file_name
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: isec, jsec, n_items
INTEGER, DIMENSION(:), POINTER :: atm_deepmd_types
n_items = 1
isec = 1
n_items = isec*n_items
CALL section_vals_val_get(section, "ATOMS", c_vals=atm_names)
CALL section_vals_val_get(section, "ATOMS_DEEPMD_TYPE", i_vals=atm_deepmd_types)
CALL section_vals_val_get(section, "POT_FILE_NAME", c_val=deepmd_file_name)
DO isec = 1, SIZE(atm_names)
DO jsec = isec, SIZE(atm_names)
nonbonded%pot(start + n_items)%pot%type = deepmd_type
nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
nonbonded%pot(start + n_items)%pot%set(1)%deepmd%deepmd_file_name = discover_file(deepmd_file_name)
nonbonded%pot(start + n_items)%pot%set(1)%deepmd%atom_deepmd_type = atm_deepmd_types(isec)
nonbonded%pot(start + n_items)%pot%rcutsq = 0.0_dp
n_items = n_items + 1
END DO
END DO
END SUBROUTINE read_deepmd_section
! **************************************************************************************************
!> \brief Reads the QUIP section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_quip_section(nonbonded, section, start)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: args_str, atm_names
INTEGER :: is, isec, n_calc_args, n_items
CALL section_vals_get(section, n_repetition=n_items)
DO isec = 1, n_items
CALL section_vals_val_get(section, "ATOMS", i_rep_section=isec, c_vals=atm_names)
nonbonded%pot(start + isec)%pot%type = quip_type
nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
CALL section_vals_val_get(section, "PARM_FILE_NAME", i_rep_section=isec, &
c_val=nonbonded%pot(start + isec)%pot%set(1)%quip%quip_file_name)
CALL section_vals_val_get(section, "INIT_ARGS", i_rep_section=isec, &
c_vals=args_str)
nonbonded%pot(start + isec)%pot%set(1)%quip%init_args = ""
DO is = 1, SIZE(args_str)
nonbonded%pot(start + isec)%pot%set(1)%quip%init_args = &
TRIM(nonbonded%pot(start + isec)%pot%set(1)%quip%init_args)// &
" "//TRIM(args_str(is))
END DO ! is
CALL section_vals_val_get(section, "CALC_ARGS", i_rep_section=isec, &
n_rep_val=n_calc_args)
IF (n_calc_args > 0) THEN
CALL section_vals_val_get(section, "CALC_ARGS", i_rep_section=isec, &
c_vals=args_str)
DO is = 1, SIZE(args_str)
nonbonded%pot(start + isec)%pot%set(1)%quip%calc_args = &
TRIM(nonbonded%pot(start + isec)%pot%set(1)%quip%calc_args)// &
" "//TRIM(args_str(is))
END DO ! is
END IF
nonbonded%pot(start + isec)%pot%rcutsq = 0.0_dp
END DO
END SUBROUTINE read_quip_section
! **************************************************************************************************
!> \brief Reads the NEQUIP section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author Gabriele Tocci
! **************************************************************************************************
SUBROUTINE read_nequip_section(nonbonded, section, start)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
CHARACTER(LEN=default_string_length) :: nequip_file_name, unit_cell, &
unit_coords, unit_energy, unit_forces
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: isec, jsec, n_items
n_items = 1
isec = 1
n_items = isec*n_items
CALL section_vals_val_get(section, "ATOMS", c_vals=atm_names)
CALL section_vals_val_get(section, "PARM_FILE_NAME", c_val=nequip_file_name)
CALL section_vals_val_get(section, "UNIT_COORDS", c_val=unit_coords)
CALL section_vals_val_get(section, "UNIT_ENERGY", c_val=unit_energy)
CALL section_vals_val_get(section, "UNIT_FORCES", c_val=unit_forces)
CALL section_vals_val_get(section, "UNIT_CELL", c_val=unit_cell)
DO isec = 1, SIZE(atm_names)
DO jsec = isec, SIZE(atm_names)
nonbonded%pot(start + n_items)%pot%type = nequip_type
nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
nonbonded%pot(start + n_items)%pot%set(1)%nequip%nequip_file_name = discover_file(nequip_file_name)
nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_coords = unit_coords
nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_forces = unit_forces
nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_energy = unit_energy
nonbonded%pot(start + n_items)%pot%set(1)%nequip%unit_cell = unit_cell
CALL read_nequip_data(nonbonded%pot(start + n_items)%pot%set(1)%nequip)
CALL check_cp2k_atom_names_in_torch(atm_names, nonbonded%pot(start + n_items)%pot%set(1)%nequip%type_names_torch)
nonbonded%pot(start + n_items)%pot%rcutsq = nonbonded%pot(start + n_items)%pot%set(1)%nequip%rcutsq
n_items = n_items + 1
END DO
END DO
END SUBROUTINE read_nequip_section
! **************************************************************************************************
!> \brief Reads the ALLEGRO section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author Gabriele Tocci
! **************************************************************************************************
SUBROUTINE read_allegro_section(nonbonded, section, start)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
CHARACTER(LEN=default_string_length) :: allegro_file_name, unit_cell, &
unit_coords, unit_energy, unit_forces
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: isec, jsec, n_items
n_items = 1
isec = 1
n_items = isec*n_items
CALL section_vals_val_get(section, "ATOMS", c_vals=atm_names)
CALL section_vals_val_get(section, "PARM_FILE_NAME", c_val=allegro_file_name)
CALL section_vals_val_get(section, "UNIT_COORDS", c_val=unit_coords)
CALL section_vals_val_get(section, "UNIT_ENERGY", c_val=unit_energy)
CALL section_vals_val_get(section, "UNIT_FORCES", c_val=unit_forces)
CALL section_vals_val_get(section, "UNIT_CELL", c_val=unit_cell)
DO isec = 1, SIZE(atm_names)
DO jsec = isec, SIZE(atm_names)
nonbonded%pot(start + n_items)%pot%type = allegro_type
nonbonded%pot(start + n_items)%pot%at1 = atm_names(isec)
nonbonded%pot(start + n_items)%pot%at2 = atm_names(jsec)
CALL uppercase(nonbonded%pot(start + n_items)%pot%at1)
CALL uppercase(nonbonded%pot(start + n_items)%pot%at2)
nonbonded%pot(start + n_items)%pot%set(1)%allegro%allegro_file_name = discover_file(allegro_file_name)
nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_coords = unit_coords
nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_forces = unit_forces
nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_energy = unit_energy
nonbonded%pot(start + n_items)%pot%set(1)%allegro%unit_cell = unit_cell
CALL read_allegro_data(nonbonded%pot(start + n_items)%pot%set(1)%allegro)
CALL check_cp2k_atom_names_in_torch(atm_names, nonbonded%pot(start + n_items)%pot%set(1)%allegro%type_names_torch)
nonbonded%pot(start + n_items)%pot%rcutsq = nonbonded%pot(start + n_items)%pot%set(1)%allegro%rcutsq
n_items = n_items + 1
END DO
END DO
END SUBROUTINE read_allegro_section
! **************************************************************************************************
!> \brief Reads the LJ section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_lj_section(nonbonded, section, start)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: isec, n_items, n_rep
REAL(KIND=dp) :: epsilon, rcut, sigma
CALL section_vals_get(section, n_repetition=n_items)
DO isec = 1, n_items
CALL section_vals_val_get(section, "ATOMS", i_rep_section=isec, c_vals=atm_names)
CALL section_vals_val_get(section, "EPSILON", i_rep_section=isec, r_val=epsilon)
CALL section_vals_val_get(section, "SIGMA", i_rep_section=isec, r_val=sigma)
CALL section_vals_val_get(section, "RCUT", i_rep_section=isec, r_val=rcut)
nonbonded%pot(start + isec)%pot%type = lj_charmm_type
nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
nonbonded%pot(start + isec)%pot%set(1)%lj%epsilon = epsilon
nonbonded%pot(start + isec)%pot%set(1)%lj%sigma6 = sigma**6
nonbonded%pot(start + isec)%pot%set(1)%lj%sigma12 = sigma**12
nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
!
CALL section_vals_val_get(section, "RMIN", i_rep_section=isec, n_rep_val=n_rep)
IF (n_rep == 1) CALL section_vals_val_get(section, "RMIN", i_rep_section=isec, &
r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
CALL section_vals_val_get(section, "RMAX", i_rep_section=isec, n_rep_val=n_rep)
IF (n_rep == 1) CALL section_vals_val_get(section, "RMAX", i_rep_section=isec, &
r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
END DO
END SUBROUTINE read_lj_section
! **************************************************************************************************
!> \brief Reads the WILLIAMS section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_wl_section(nonbonded, section, start)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: isec, n_items, n_rep
REAL(KIND=dp) :: a, b, c, rcut
CALL section_vals_get(section, n_repetition=n_items)
DO isec = 1, n_items
CALL section_vals_val_get(section, "ATOMS", i_rep_section=isec, c_vals=atm_names)
CALL section_vals_val_get(section, "A", i_rep_section=isec, r_val=a)
CALL section_vals_val_get(section, "B", i_rep_section=isec, r_val=b)
CALL section_vals_val_get(section, "C", i_rep_section=isec, r_val=c)
CALL section_vals_val_get(section, "RCUT", i_rep_section=isec, r_val=rcut)
nonbonded%pot(start + isec)%pot%type = wl_type
nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
nonbonded%pot(start + isec)%pot%set(1)%willis%a = a
nonbonded%pot(start + isec)%pot%set(1)%willis%b = b
nonbonded%pot(start + isec)%pot%set(1)%willis%c = c
nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
!
CALL section_vals_val_get(section, "RMIN", i_rep_section=isec, n_rep_val=n_rep)
IF (n_rep == 1) CALL section_vals_val_get(section, "RMIN", i_rep_section=isec, &
r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
CALL section_vals_val_get(section, "RMAX", i_rep_section=isec, n_rep_val=n_rep)
IF (n_rep == 1) CALL section_vals_val_get(section, "RMAX", i_rep_section=isec, &
r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
END DO
END SUBROUTINE read_wl_section
! **************************************************************************************************
!> \brief Reads the GOODWIN section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_gd_section(nonbonded, section, start)
TYPE(pair_potential_p_type), POINTER :: nonbonded
TYPE(section_vals_type), POINTER :: section
INTEGER, INTENT(IN) :: start
CHARACTER(LEN=default_string_length), &
DIMENSION(:), POINTER :: atm_names
INTEGER :: isec, m, mc, n_items, n_rep
REAL(KIND=dp) :: d, dc, rcut, vr0
CALL section_vals_get(section, n_repetition=n_items)
DO isec = 1, n_items
CALL section_vals_val_get(section, "ATOMS", i_rep_section=isec, c_vals=atm_names)
CALL section_vals_val_get(section, "VR0", i_rep_section=isec, r_val=vr0)
CALL section_vals_val_get(section, "D", i_rep_section=isec, r_val=d)
CALL section_vals_val_get(section, "DC", i_rep_section=isec, r_val=dc)
CALL section_vals_val_get(section, "M", i_rep_section=isec, i_val=m)
CALL section_vals_val_get(section, "MC", i_rep_section=isec, i_val=mc)
CALL section_vals_val_get(section, "RCUT", i_rep_section=isec, r_val=rcut)
nonbonded%pot(start + isec)%pot%type = gw_type
nonbonded%pot(start + isec)%pot%at1 = atm_names(1)
nonbonded%pot(start + isec)%pot%at2 = atm_names(2)
CALL uppercase(nonbonded%pot(start + isec)%pot%at1)
CALL uppercase(nonbonded%pot(start + isec)%pot%at2)
nonbonded%pot(start + isec)%pot%set(1)%goodwin%vr0 = vr0
nonbonded%pot(start + isec)%pot%set(1)%goodwin%d = d
nonbonded%pot(start + isec)%pot%set(1)%goodwin%dc = dc
nonbonded%pot(start + isec)%pot%set(1)%goodwin%m = m
nonbonded%pot(start + isec)%pot%set(1)%goodwin%mc = mc
nonbonded%pot(start + isec)%pot%rcutsq = rcut*rcut
!
CALL section_vals_val_get(section, "RMIN", i_rep_section=isec, n_rep_val=n_rep)
IF (n_rep == 1) CALL section_vals_val_get(section, "RMIN", i_rep_section=isec, &
r_val=nonbonded%pot(start + isec)%pot%set(1)%rmin)
CALL section_vals_val_get(section, "RMAX", i_rep_section=isec, n_rep_val=n_rep)
IF (n_rep == 1) CALL section_vals_val_get(section, "RMAX", i_rep_section=isec, &
r_val=nonbonded%pot(start + isec)%pot%set(1)%rmax)
END DO
END SUBROUTINE read_gd_section
! **************************************************************************************************
!> \brief Reads the IPBV section
!> \param nonbonded ...
!> \param section ...
!> \param start ...
!> \author teo
! **************************************************************************************************
SUBROUTINE read_ipbv_section(nonbonded, section, start)