-
Notifications
You must be signed in to change notification settings - Fork 19
/
descriptors.f95
13206 lines (10555 loc) · 535 KB
/
descriptors.f95
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
! HND XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
! HND X
! HND X GAP (Gaussian Approximation Potental)
! HND X
! HND X
! HND X Portions of GAP were written by Albert Bartok-Partay, Gabor Csanyi,
! HND X Copyright 2006-2021.
! HND X
! HND X Portions of GAP were written by Noam Bernstein as part of
! HND X his employment for the U.S. Government, and are not subject
! HND X to copyright in the USA.
! HND X©
! HND X GAP is published and distributed under the
! HND X Academic Software License v1.0 (ASL)
! HND X
! HND X GAP is distributed in the hope that it will be useful for non-commercial
! HND X academic research, but WITHOUT ANY WARRANTY; without even the implied
! HND X warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! HND X ASL for more details.
! HND X
! HND X You should have received a copy of the ASL along with this program
! HND X (e.g. in a LICENSE.md file); if not, you can write to the original licensors,
! HND X Gabor Csanyi or Albert Bartok-Partay. The ASL is also published at
! HND X http://github.com/gabor1/ASL
! HND X
! HND X When using this software, please cite the following reference:
! HND X
! HND X A. P. Bartok et al Physical Review Letters vol 104 p136403 (2010)
! HND X
! HND X When using the SOAP kernel or its variants, please additionally cite:
! HND X
! HND X A. P. Bartok et al Physical Review B vol 87 p184115 (2013)
! HND X
! HND XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "error.inc"
#ifdef _OPENMP
#define OMP_SAVE ,save
#else
#define OMP_SAVE
#endif
module descriptors_module
use error_module
use system_module, only : dp, print, optional_default, system_timer, operator(//), split_string, string_to_int, split_string_simple, inoutput, OUTPUT, PRINT_VERBOSE, PRINT_NERD, ran_normal, system_reseed_rng, system_get_random_seed
use linkedlist_module
use units_module
use periodictable_module
use linearalgebra_module
use dictionary_module
use paramreader_module
use atoms_module
use atoms_types_module
use topology_module
use mpi_context_module
use table_module
#ifdef DESCRIPTORS_NONCOMMERCIAL
use permutation_maker_module
#endif
use CInOutput_module
use clusters_module
use connection_module
use angular_functions_module
use gamma_module
implicit none
private
#ifdef GAP_VERSION
integer, parameter :: gap_version = GAP_VERSION
#else
integer, parameter :: gap_version = 0
#endif
integer, parameter, public :: DT_NONE = 0
integer, parameter, public :: DT_BISPECTRUM_SO4 = 1
integer, parameter, public :: DT_BISPECTRUM_SO3 = 2
integer, parameter, public :: DT_BEHLER = 3
integer, parameter, public :: DT_DISTANCE_2B = 4
integer, parameter, public :: DT_COORDINATION = 5
integer, parameter, public :: DT_ANGLE_3B = 6
integer, parameter, public :: DT_CO_ANGLE_3B = 7
integer, parameter, public :: DT_CO_DISTANCE_2B = 8
integer, parameter, public :: DT_COSNX = 9
integer, parameter, public :: DT_TRIHIS = 10
integer, parameter, public :: DT_WATER_MONOMER = 11
integer, parameter, public :: DT_WATER_DIMER = 12
integer, parameter, public :: DT_A2_DIMER = 13
integer, parameter, public :: DT_AB_DIMER = 14
integer, parameter, public :: DT_BOND_REAL_SPACE = 15
integer, parameter, public :: DT_ATOM_REAL_SPACE = 16
integer, parameter, public :: DT_POWER_SO3 = 17
integer, parameter, public :: DT_POWER_SO4 = 18
integer, parameter, public :: DT_SOAP = 19
integer, parameter, public :: DT_AN_MONOMER = 20
integer, parameter, public :: DT_GENERAL_MONOMER = 21
integer, parameter, public :: DT_GENERAL_DIMER = 22
integer, parameter, public :: DT_GENERAL_TRIMER = 23
integer, parameter, public :: DT_RDF = 24
integer, parameter, public :: DT_AS_DISTANCE_2B = 25
integer, parameter, public :: DT_MOLECULE_LO_D = 26
integer, parameter, public :: DT_alex = 27
integer, parameter, public :: DT_COM_DIMER = 28
integer, parameter, public :: DT_DISTANCE_NB = 29
integer, parameter, public :: DT_SOAP_EXPRESS = 30
integer, parameter, public :: DT_SOAP_TURBO = 31
integer, parameter, public :: DT_WATER_TRIMER = 32
integer, parameter :: NP_WATER_DIMER = 8
integer, parameter :: NP_A2_DIMER = 8
integer, parameter :: NP_AB_DIMER = 2
type transfer_parameters_type
logical :: do_transfer
real(dp) :: factor, r0, width
endtype transfer_parameters_type
type descriptor_data_mono
real(dp), dimension(:), allocatable :: data
real(dp), dimension(:,:,:), allocatable :: grad_data
! ci : atom indices amongst which to distribute energy of descriptor
! ii : all atoms involved in descriptor (for partial derivatives)
integer, dimension(:), allocatable :: ci, ii
real(dp), dimension(:,:), allocatable :: pos
logical :: has_data
logical, dimension(:), allocatable :: has_grad_data
real(dp) :: covariance_cutoff = 1.0_dp
real(dp), dimension(:,:), allocatable :: grad_covariance_cutoff
endtype descriptor_data_mono
type cplx_2d
complex(dp), dimension(:,:), allocatable :: mm
endtype cplx_2d
type int_2d
integer , dimension(:,:), allocatable :: mm
endtype int_2d
type real_2d
real(dp), dimension(:,:), allocatable :: mm
endtype real_2d
type cplx_3d
complex(dp), dimension(:,:,:), allocatable :: mm
endtype cplx_3d
!=======================================================================
!== begin descriptors
!=======================================================================
type RadialFunction_type
integer :: n_max
real(dp) :: cutoff, min_cutoff
real(dp), dimension(:,:), allocatable :: RadialTransform
real(dp), dimension(:), allocatable :: NormFunction
logical :: initialised = .false.
endtype RadialFunction_type
type fourier_SO4_type
real(dp) :: cutoff
real(dp) :: z0_ratio
real(dp) :: z0
integer :: j_max, Z
integer, dimension(:), allocatable :: species_Z
real(dp), dimension(:), allocatable :: w
logical :: initialised = .false.
endtype fourier_SO4_type
type bispectrum_SO4
real(dp), pointer :: cutoff
integer, pointer :: j_max, Z
real(dp), pointer :: z0_ratio
real(dp), pointer :: z0
integer, dimension(:), pointer :: species_Z
real(dp), dimension(:), pointer :: w
type(fourier_SO4_type) :: fourier_SO4
logical :: initialised = .false.
endtype bispectrum_SO4
type bispectrum_SO3
integer :: l_max, n_max, Z
real(dp) :: cutoff, min_cutoff
type(RadialFunction_type) :: radial
integer, dimension(:), allocatable :: species_Z
real(dp), dimension(:), allocatable :: w
logical :: initialised = .false.
endtype bispectrum_SO3
type behler_g2
integer :: Z_n = 0
real(dp) :: eta
real(dp) :: rs
real(dp) :: rc
endtype behler_g2
type behler_g3
integer,dimension(2) :: Z_n = 0
real(dp) :: eta
real(dp) :: lambda
real(dp) :: zeta
real(dp) :: rc
endtype behler_g3
type behler
real(dp) :: cutoff = 0.0_dp
logical :: initialised = .false.
integer :: Z = 0
integer :: n_g2, n_g3
type(behler_g2), dimension(:), allocatable :: g2
type(behler_g3), dimension(:), allocatable :: g3
endtype behler
type distance_2b
real(dp) :: cutoff
real(dp) :: cutoff_transition_width
integer :: Z1, Z2
character(STRING_LENGTH) :: resid_name
logical :: only_intra, only_inter
integer :: n_exponents, tail_exponent
real(dp) :: tail_range
integer, dimension(:), allocatable :: exponents
logical :: has_tail
logical :: initialised = .false.
endtype distance_2b
type coordination
real(dp) :: cutoff
real(dp) :: transition_width
integer :: Z
logical :: initialised = .false.
endtype coordination
type angle_3b
real(dp) :: cutoff
real(dp) :: cutoff_transition_width
integer :: Z, Z1, Z2
logical :: initialised = .false.
endtype angle_3b
type co_angle_3b
real(dp) :: cutoff
real(dp) :: coordination_cutoff
real(dp) :: coordination_transition_width
integer :: Z, Z1, Z2
logical :: initialised = .false.
endtype co_angle_3b
type co_distance_2b
real(dp) :: cutoff
real(dp) :: transition_width
real(dp) :: coordination_cutoff
real(dp) :: coordination_transition_width
integer :: Z1, Z2
logical :: initialised = .false.
endtype co_distance_2b
type cosnx
integer :: l_max, n_max, Z
real(dp) :: cutoff, min_cutoff
type(RadialFunction_type) :: radial
integer, dimension(:), allocatable :: species_Z
real(dp), dimension(:), allocatable :: w
logical :: initialised = .false.
endtype cosnx
type trihis
real(dp) :: cutoff
integer :: n_gauss
real(dp), dimension(:,:), allocatable :: gauss_centre
real(dp), dimension(:,:), allocatable :: gauss_width
logical :: initialised = .false.
endtype trihis
type water_monomer
real(dp) :: cutoff
logical :: initialised = .false.
endtype water_monomer
type water_dimer
real(dp) :: cutoff, cutoff_transition_width
real(dp) :: monomer_cutoff
logical :: OHH_ordercheck
real(dp) :: power,dist_shift
logical :: initialised = .false.
endtype water_dimer
type A2_dimer
real(dp) :: cutoff
real(dp) :: monomer_cutoff
integer :: atomic_number
logical :: initialised = .false.
endtype A2_dimer
type AB_dimer
real(dp) :: cutoff
real(dp) :: monomer_cutoff
integer :: atomic_number1, atomic_number2
logical :: initialised = .false.
endtype AB_dimer
type atom_real_space
real(dp) :: cutoff
real(dp) :: cutoff_transition_width
integer :: l_max
real(dp) :: alpha
real(dp) :: zeta
logical :: initialised = .false.
endtype atom_real_space
type power_so3
integer :: l_max, n_max, Z
real(dp) :: cutoff, min_cutoff
type(RadialFunction_type) :: radial
integer, dimension(:), allocatable :: species_Z
real(dp), dimension(:), allocatable :: w
logical :: initialised = .false.
endtype power_so3
type power_SO4
real(dp), pointer :: cutoff
integer, pointer :: j_max, Z
real(dp), pointer :: z0_ratio
real(dp), pointer :: z0
integer, dimension(:), pointer :: species_Z
real(dp), dimension(:), pointer :: w
type(fourier_SO4_type) :: fourier_SO4
logical :: initialised = .false.
endtype power_SO4
type soap
real(dp) :: cutoff
real(dp) :: cutoff_transition_width
real(dp) :: alpha, atom_sigma, covariance_sigma0, central_weight
integer :: cutoff_dexp
real(dp) :: cutoff_scale
real(dp) :: cutoff_rate
integer :: l_max, n_max, n_Z, n_species
integer :: nu_R, nu_S
integer, dimension(:), allocatable :: species_Z, Z
real(dp), dimension(:), allocatable :: r_basis
real(dp), dimension(:,:,:), allocatable :: cholesky_overlap_basis
real(dp), dimension(:, :), allocatable :: transform_basis
logical :: global = .false.
logical :: central_reference_all_species = .false.
logical :: diagonal_radial = .false.
logical :: normalise = .true.
logical :: initialised = .false.
logical :: Z_mix = .false.
logical :: R_mix = .false.
logical :: sym_mix = .false.
logical :: coupling = .false.
integer :: K
integer :: mix_shift = 0
character(len=STRING_LENGTH) :: Z_map_str
character(len=STRING_LENGTH) :: radial_basis
real(dp), dimension(:,:,:), allocatable :: QR_factor
real(dp), dimension(:,:), allocatable :: QR_tau
endtype soap
type rdf
real(dp) :: cutoff
real(dp) :: transition_width, w_gauss
integer :: Z, n_gauss
real(dp), dimension(:), allocatable :: r_gauss
logical :: initialised = .false.
endtype rdf
type as_distance_2b
real(dp) :: min_cutoff, max_cutoff, as_cutoff, overlap_alpha
real(dp) :: min_transition_width, max_transition_width, as_transition_width
real(dp) :: coordination_cutoff
real(dp) :: coordination_transition_width
integer :: Z1, Z2
logical :: initialised = .false.
endtype as_distance_2b
type alex
integer :: Z, power_min, power_max
real(dp) :: cutoff
integer :: n_species
integer, dimension(:), allocatable :: species_Z
logical :: initialised = .false.
endtype alex
type distance_Nb
real(dp) :: cutoff
real(dp) :: cutoff_transition_width
integer :: order
integer, dimension(:), allocatable :: Z
integer :: n_permutations
integer, dimension(:,:), allocatable :: permutations
logical, dimension(:,:,:), allocatable :: monomerConnectivities
logical :: compact_clusters = .false.
logical :: initialised = .false.
endtype distance_Nb
type soap_turbo
! User controllable parameters
real(dp) :: rcut_hard, rcut_soft, nf
integer :: n_species, radial_enhancement, central_index, l_max, compress_P_nonzero
character(len=STRING_LENGTH) :: basis, scaling_mode, compress_file, compress_mode
real(dp), dimension(:), allocatable :: atom_sigma_r, atom_sigma_r_scaling, &
atom_sigma_t, atom_sigma_t_scaling, amplitude_scaling, central_weight, compress_P_el
integer, dimension(:), allocatable :: species_Z, alpha_max, compress_P_i, compress_P_j
logical :: initialised = .false., compress = .false.
endtype soap_turbo
#ifdef DESCRIPTORS_NONCOMMERCIAL
#include "descriptors_noncommercial_types.inc"
#endif
!
! All the descriptors need to be public so that they are visible to the python wrapper
#ifdef DESCRIPTORS_NONCOMMERCIAL
public :: soap, general_monomer, bispectrum_so4, bispectrum_so3, behler, distance_2b, &
coordination, angle_3b, co_angle_3b, co_distance_2b, cosnx, trihis, water_monomer, &
water_dimer, a2_dimer, bond_real_space, power_so3, power_so4, an_monomer, general_dimer, &
general_trimer, water_trimer, rdf, as_distance_2b, molecule_lo_d, alex, com_dimer, distance_nb, &
descriptor_data_mono, fourier_so4_type, radialfunction_type, transfer_parameters_type, &
ab_dimer, atom_real_space, spherical_harmonics_type, behler_g2, behler_g3, soap_turbo, soap_express
#else
public :: soap, bispectrum_so4, bispectrum_so3, behler, distance_2b, &
coordination, angle_3b, co_angle_3b, co_distance_2b, cosnx, trihis, water_monomer, &
water_dimer, a2_dimer, power_so3, power_so4, &
rdf, as_distance_2b, alex, distance_nb, &
descriptor_data_mono, fourier_so4_type, radialfunction_type, transfer_parameters_type, &
ab_dimer, atom_real_space, spherical_harmonics_type, behler_g2, behler_g3, &
soap_turbo
#endif
!=======================================================================
!== end descriptors
!=======================================================================
type descriptor
integer :: descriptor_type = DT_NONE
type(bispectrum_SO4) :: descriptor_bispectrum_SO4
type(bispectrum_SO3) :: descriptor_bispectrum_SO3
type(behler) :: descriptor_behler
type(distance_2b) :: descriptor_distance_2b
type(coordination) :: descriptor_coordination
type(angle_3b) :: descriptor_angle_3b
type(co_angle_3b) :: descriptor_co_angle_3b
type(co_distance_2b) :: descriptor_co_distance_2b
type(cosnx) :: descriptor_cosnx
type(trihis) :: descriptor_trihis
type(water_monomer) :: descriptor_water_monomer
type(water_dimer) :: descriptor_water_dimer
type(A2_dimer) :: descriptor_A2_dimer
type(AB_dimer) :: descriptor_AB_dimer
type(atom_real_space) :: descriptor_atom_real_space
type(power_so3) :: descriptor_power_so3
type(power_SO4) :: descriptor_power_SO4
type(soap) :: descriptor_soap
type(rdf) :: descriptor_rdf
type(as_distance_2b) :: descriptor_as_distance_2b
type(alex) :: descriptor_alex
type(distance_Nb) :: descriptor_distance_Nb
type(soap_turbo) :: descriptor_soap_turbo
#ifdef DESCRIPTORS_NONCOMMERCIAL
type(AN_monomer) :: descriptor_AN_monomer
type(general_monomer) :: descriptor_general_monomer
type(general_dimer) :: descriptor_general_dimer
type(general_trimer) :: descriptor_general_trimer
type(water_trimer) :: descriptor_water_trimer
type(molecule_lo_d) :: descriptor_molecule_lo_d
type(com_dimer) :: descriptor_com_dimer
type(soap_express) :: descriptor_soap_express
type(bond_real_space) :: descriptor_bond_real_space
#endif
endtype
type descriptor_data
type(descriptor_data_mono), dimension(:), allocatable :: x
endtype descriptor_data
type cplx_1d
complex(dp), dimension(:), allocatable :: m
endtype cplx_1d
type real_1d
real(dp), dimension(:), allocatable :: m
endtype real_1d
type spherical_harmonics_type
type(cplx_1d), dimension(:), allocatable :: spherical_harmonics
type(cplx_2d), dimension(:), allocatable :: grad_spherical_harmonics
real(dp) :: r
real(dp), dimension(3) :: u
endtype spherical_harmonics_type
type neighbour_type
type(spherical_harmonics_type), dimension(:), allocatable :: neighbour
endtype neighbour_type
type grad_spherical_harmonics_overlap_type
type(cplx_3d), dimension(:), allocatable :: grad_integral
endtype grad_spherical_harmonics_overlap_type
public :: neighbour_type, real_space_fourier_coefficients, real_space_covariance_coefficient
public :: SphericalYCartesian
interface initialise
#ifdef DESCRIPTORS_NONCOMMERCIAL
module procedure descriptor_initialise, RadialFunction_initialise, fourier_so4_initialise, &
bispectrum_SO4_initialise, bispectrum_SO3_initialise, behler_initialise, distance_2b_initialise, &
coordination_initialise, angle_3b_initialise, co_angle_3b_initialise, co_distance_2b_initialise, cosnx_initialise, trihis_initialise, &
water_monomer_initialise, water_dimer_initialise, A2_dimer_initialise, AB_dimer_initialise, distance_Nb_initialise, rdf_initialise, as_distance_2b_initialise, alex_initialise, &
atom_real_space_initialise, power_so3_initialise, power_SO4_initialise, soap_initialise, soap_turbo_initialise, &
general_monomer_initialise, general_dimer_initialise, general_trimer_initialise, water_trimer_initialise, molecule_lo_d_initialise, AN_monomer_initialise, &
bond_real_space_initialise, transfer_initialise, com_dimer_initialise, soap_express_initialise
#else
module procedure descriptor_initialise, RadialFunction_initialise, fourier_so4_initialise, &
bispectrum_SO4_initialise, bispectrum_SO3_initialise, behler_initialise, distance_2b_initialise, &
coordination_initialise, angle_3b_initialise, co_angle_3b_initialise, co_distance_2b_initialise, cosnx_initialise, trihis_initialise, &
water_monomer_initialise, water_dimer_initialise, A2_dimer_initialise, AB_dimer_initialise, distance_Nb_initialise, rdf_initialise, as_distance_2b_initialise, alex_initialise, &
atom_real_space_initialise, power_so3_initialise, power_SO4_initialise, soap_initialise, soap_turbo_initialise
#endif
endinterface initialise
public :: initialise
interface finalise
#ifdef DESCRIPTORS_NONCOMMERCIAL
module procedure descriptor_finalise, descriptor_data_finalise, RadialFunction_finalise, fourier_so4_finalise, cplx_2d_array1_finalise, cplx_3d_array2_finalise, &
bispectrum_SO4_finalise, bispectrum_SO3_finalise, behler_finalise, distance_2b_finalise, coordination_finalise, angle_3b_finalise, co_angle_3b_finalise, &
co_distance_2b_finalise, cosnx_finalise, trihis_finalise, water_monomer_finalise, water_dimer_finalise, rdf_finalise, as_distance_2b_finalise, alex_finalise, &
A2_dimer_finalise, AB_dimer_finalise, atom_real_space_finalise, power_so3_finalise, power_SO4_finalise, soap_finalise, distance_Nb_finalise, soap_turbo_finalise, &
AN_monomer_finalise, general_monomer_finalise, general_dimer_finalise, general_trimer_finalise, water_trimer_finalise, molecule_lo_d_finalise, com_dimer_finalise, &
bond_real_space_finalise, soap_express_finalise
#else
module procedure descriptor_finalise, descriptor_data_finalise, RadialFunction_finalise, fourier_so4_finalise, cplx_2d_array1_finalise, cplx_3d_array2_finalise, &
bispectrum_SO4_finalise, bispectrum_SO3_finalise, behler_finalise, distance_2b_finalise, coordination_finalise, angle_3b_finalise, co_angle_3b_finalise, &
co_distance_2b_finalise, cosnx_finalise, trihis_finalise, water_monomer_finalise, water_dimer_finalise, rdf_finalise, as_distance_2b_finalise, alex_finalise, &
A2_dimer_finalise, AB_dimer_finalise, atom_real_space_finalise, power_so3_finalise, power_SO4_finalise, soap_finalise, distance_Nb_finalise, soap_turbo_finalise
#endif
endinterface finalise
public :: finalise
interface calc
#ifdef DESCRIPTORS_NONCOMMERCIAL
module procedure descriptor_calc, descriptor_calc_array, bispectrum_SO4_calc, bispectrum_SO3_calc, behler_calc, distance_2b_calc, coordination_calc, angle_3b_calc, co_angle_3b_calc, &
co_distance_2b_calc, cosnx_calc, trihis_calc, water_monomer_calc, water_dimer_calc, A2_dimer_calc, AB_dimer_calc, atom_real_space_calc, &
power_so3_calc, power_SO4_calc, soap_calc, rdf_calc, as_distance_2b_calc, &
distance_Nb_calc, alex_calc, soap_turbo_calc, &
AN_monomer_calc, soap_express_calc, general_monomer_calc, general_dimer_calc, general_trimer_calc, water_trimer_calc, molecule_lo_d_calc, com_dimer_calc, bond_real_space_calc
#else
module procedure descriptor_calc, descriptor_calc_array, bispectrum_SO4_calc, bispectrum_SO3_calc, behler_calc, distance_2b_calc, coordination_calc, angle_3b_calc, co_angle_3b_calc, &
co_distance_2b_calc, cosnx_calc, trihis_calc, water_monomer_calc, water_dimer_calc, A2_dimer_calc, AB_dimer_calc, atom_real_space_calc, &
power_so3_calc, power_SO4_calc, soap_calc, rdf_calc, as_distance_2b_calc, &
distance_Nb_calc, alex_calc, soap_turbo_calc
#endif
endinterface calc
public :: calc
interface cutoff
#ifdef DESCRIPTORS_NONCOMMERCIAL
module procedure descriptor_cutoff, bispectrum_SO4_cutoff, bispectrum_SO3_cutoff, behler_cutoff, distance_2b_cutoff, coordination_cutoff, angle_3b_cutoff, co_angle_3b_cutoff, &
co_distance_2b_cutoff, cosnx_cutoff, trihis_cutoff, water_monomer_cutoff, water_dimer_cutoff, A2_dimer_cutoff, AB_dimer_cutoff, atom_real_space_cutoff, &
power_so3_cutoff, power_SO4_cutoff, soap_cutoff, alex_cutoff, distance_Nb_cutoff, rdf_cutoff, as_distance_2b_cutoff, soap_turbo_cutoff, &
molecule_lo_d_cutoff, com_dimer_cutoff, soap_express_cutoff, AN_monomer_cutoff, general_monomer_cutoff, general_dimer_cutoff, general_trimer_cutoff, water_trimer_cutoff, bond_real_space_cutoff
#else
module procedure descriptor_cutoff, bispectrum_SO4_cutoff, bispectrum_SO3_cutoff, behler_cutoff, distance_2b_cutoff, coordination_cutoff, angle_3b_cutoff, co_angle_3b_cutoff, &
co_distance_2b_cutoff, cosnx_cutoff, trihis_cutoff, water_monomer_cutoff, water_dimer_cutoff, A2_dimer_cutoff, AB_dimer_cutoff, atom_real_space_cutoff, &
power_so3_cutoff, power_SO4_cutoff, soap_cutoff, alex_cutoff, distance_Nb_cutoff, rdf_cutoff, as_distance_2b_cutoff, soap_turbo_cutoff
#endif
endinterface cutoff
public :: cutoff
interface descriptor_sizes
#ifdef DESCRIPTORS_NONCOMMERCIAL
module procedure descriptor_sizes, bispectrum_SO4_sizes, bispectrum_SO3_sizes, behler_sizes, distance_2b_sizes, coordination_sizes, angle_3b_sizes, co_angle_3b_sizes, &
co_distance_2b_sizes, cosnx_sizes, trihis_sizes, water_monomer_sizes, water_dimer_sizes, A2_dimer_sizes, AB_dimer_sizes, atom_real_space_sizes, &
power_so3_sizes, power_SO4_sizes, soap_sizes, rdf_sizes, as_distance_2b_sizes, &
alex_sizes, distance_Nb_sizes, soap_turbo_sizes, &
molecule_lo_d_sizes, com_dimer_sizes, soap_express_sizes, AN_monomer_sizes, general_monomer_sizes, general_dimer_sizes, general_trimer_sizes, water_trimer_sizes, bond_real_space_sizes
#else
module procedure descriptor_sizes, bispectrum_SO4_sizes, bispectrum_SO3_sizes, behler_sizes, distance_2b_sizes, coordination_sizes, angle_3b_sizes, co_angle_3b_sizes, &
co_distance_2b_sizes, cosnx_sizes, trihis_sizes, water_monomer_sizes, water_dimer_sizes, A2_dimer_sizes, AB_dimer_sizes, atom_real_space_sizes, &
power_so3_sizes, power_SO4_sizes, soap_sizes, rdf_sizes, as_distance_2b_sizes, &
alex_sizes, distance_Nb_sizes, soap_turbo_sizes
#endif
endinterface descriptor_sizes
public :: descriptor_sizes
public :: descriptor_MPI_setup
public :: descriptor, descriptor_data, descriptor_dimensions, descriptor_n_permutations, descriptor_permutations, descriptor_str_add_species
public :: real_space_covariance
public :: cplx_1d, cplx_2d
contains
#ifdef DESCRIPTORS_NONCOMMERCIAL
#include "descriptors_noncommercial.inc"
#endif
function get_descriptor_type(args_str,error)
character(len=*), intent(in) :: args_str
integer, optional, intent(out) :: error
integer :: get_descriptor_type
type(Dictionary) :: params
logical :: is_bispectrum_so4, is_bispectrum_so3, is_behler, is_distance_2b, is_coordination, is_angle_3b, &
is_co_angle_3b, is_co_distance_2b, is_cosnx, is_trihis, is_water_monomer, is_water_dimer, is_A2_dimer, &
is_AB_dimer, is_bond_real_space, is_atom_real_space, is_power_so3, is_power_so4, is_soap, &
is_AN_monomer, is_general_monomer, is_general_dimer, is_general_trimer, is_water_trimer, is_rdf, is_as_distance_2b, &
is_molecule_lo_d, is_alex, is_com_dimer, is_distance_Nb, is_soap_express, is_soap_turbo
integer n_true
INIT_ERROR(error)
call initialise(params)
call param_register(params, 'bispectrum_so4', 'false', is_bispectrum_so4, help_string="Type of descriptor is bispectrum_so4.")
call param_register(params, 'bispectrum_so3', 'false', is_bispectrum_so3, help_string="Type of descriptor is bispectrum_so3.")
call param_register(params, 'behler', 'false', is_behler, help_string="Type of descriptor is behler.")
call param_register(params, 'distance_2b', 'false', is_distance_2b, help_string="Type of descriptor is distance_2b.")
call param_register(params, 'coordination', 'false', is_coordination, help_string="Type of descriptor is coordination.")
call param_register(params, 'angle_3b', 'false', is_angle_3b, help_string="Type of descriptor is angle_3b.")
call param_register(params, 'co_angle_3b', 'false', is_co_angle_3b, help_string="Type of descriptor is co_angle_3b.")
call param_register(params, 'co_distance_2b', 'false', is_co_distance_2b, help_string="Type of descriptor is co_distance_2b.")
call param_register(params, 'cosnx', 'false', is_cosnx, help_string="Type of descriptor is cosnx.")
call param_register(params, 'trihis', 'false', is_trihis, help_string="Type of descriptor is trihis.")
call param_register(params, 'water_monomer', 'false', is_water_monomer, help_string="Type of descriptor is water_monomer.")
call param_register(params, 'water_dimer', 'false', is_water_dimer, help_string="Type of descriptor is water_dimer.")
call param_register(params, 'A2_dimer', 'false', is_A2_dimer, help_string="Type of descriptor is A2_dimer.")
call param_register(params, 'AB_dimer', 'false', is_AB_dimer, help_string="Type of descriptor is AB_dimer.")
call param_register(params, 'bond_real_space', 'false', is_bond_real_space, help_string="Type of descriptor is bond_real_space.")
call param_register(params, 'atom_real_space', 'false', is_atom_real_space, help_string="Type of descriptor is atom_real_space.")
call param_register(params, 'power_so3', 'false', is_power_so3, help_string="Type of descriptor is power_so3.")
call param_register(params, 'power_so4', 'false', is_power_so4, help_string="Type of descriptor is power_so4.")
call param_register(params, 'soap', 'false', is_soap, help_string="Type of descriptor is soap.")
call param_register(params, 'AN_monomer', 'false', is_AN_monomer, help_string="Type of descriptor is AN_monomer.")
call param_register(params, 'general_monomer', 'false', is_general_monomer, help_string="Type of descriptor is general_monomer.")
call param_register(params, 'general_dimer', 'false', is_general_dimer, help_string="Type of descriptor is general_dimer.")
call param_register(params, 'general_trimer', 'false', is_general_trimer, help_string="Type of descriptor is general_trimer.")
call param_register(params, 'water_trimer', 'false', is_water_trimer, help_string="Type of descriptor is water_trimer.")
call param_register(params, 'rdf', 'false', is_rdf, help_string="Type of descriptor is rdf.")
call param_register(params, 'as_distance_2b', 'false', is_as_distance_2b, help_string="Type of descriptor is as_distance_2b.")
call param_register(params, 'molecule_lo_d', 'false', is_molecule_lo_d, help_string="Type of descriptor is molecule_lo_d.")
call param_register(params, 'alex', 'false', is_alex, help_string="Type of descriptor is alex.")
call param_register(params, 'com_dimer', 'false', is_com_dimer, help_string="Type of descriptor is com_dimer.")
call param_register(params, 'distance_Nb', 'false', is_distance_Nb, help_string="Type of descriptor is distance_Nb.")
call param_register(params, 'soap_express', 'false', is_soap_express, help_string="Type of descriptor is soap_express.")
call param_register(params, 'soap_turbo', 'false', is_soap_turbo, help_string="Type of descriptor is soap_turbo.")
if (.not. param_read_line(params, args_str, ignore_unknown=.true.,task='descriptor_initialise args_str')) then
RAISE_ERROR("descriptor_initialise failed to parse args_str='"//trim(args_str)//"'", error)
endif
call finalise(params)
n_true = count( (/is_bispectrum_so4, is_bispectrum_so3, is_behler, is_distance_2b, is_coordination, is_angle_3b, is_co_angle_3b, is_co_distance_2b, &
is_cosnx, is_trihis, is_water_monomer, is_water_dimer, is_A2_dimer, is_AB_dimer, is_bond_real_space, is_atom_real_space, is_power_so3, is_power_so4, &
is_soap, is_AN_monomer, is_general_monomer, is_general_dimer, is_general_trimer, is_water_trimer, is_rdf, is_as_distance_2b, is_molecule_lo_d, is_alex, is_com_dimer, &
is_distance_Nb, is_soap_express, is_soap_turbo /) )
if (n_true/= 1) then
RAISE_ERROR("descriptor_initialise found "//n_true//" IP Model types args_str='"//trim(args_str)//"'", error)
endif
get_descriptor_type = DT_NONE
if( is_bispectrum_so4 ) then
get_descriptor_type = DT_BISPECTRUM_SO4
elseif( is_bispectrum_so3 ) then
get_descriptor_type = DT_BISPECTRUM_SO3
elseif( is_behler ) then
get_descriptor_type = DT_BEHLER
elseif( is_distance_2b ) then
get_descriptor_type = DT_DISTANCE_2B
elseif( is_coordination ) then
get_descriptor_type = DT_COORDINATION
elseif( is_angle_3b ) then
get_descriptor_type = DT_ANGLE_3B
elseif( is_co_angle_3b ) then
get_descriptor_type = DT_CO_ANGLE_3B
elseif( is_co_distance_2b ) then
get_descriptor_type = DT_CO_DISTANCE_2B
elseif( is_cosnx ) then
get_descriptor_type = DT_COSNX
elseif( is_trihis ) then
get_descriptor_type = DT_TRIHIS
elseif( is_water_monomer ) then
get_descriptor_type = DT_WATER_MONOMER
elseif( is_water_dimer ) then
get_descriptor_type = DT_WATER_DIMER
elseif( is_A2_dimer ) then
get_descriptor_type = DT_A2_DIMER
elseif( is_AB_dimer ) then
get_descriptor_type = DT_AB_DIMER
elseif( is_bond_real_space ) then
get_descriptor_type = DT_BOND_REAL_SPACE
elseif( is_atom_real_space ) then
get_descriptor_type = DT_ATOM_REAL_SPACE
elseif( is_power_so3 ) then
get_descriptor_type = DT_POWER_SO3
elseif( is_power_so4 ) then
get_descriptor_type = DT_POWER_SO4
elseif( is_soap ) then
get_descriptor_type = DT_SOAP
elseif( is_AN_monomer ) then
get_descriptor_type = DT_AN_MONOMER
elseif( is_general_monomer ) then
get_descriptor_type = DT_GENERAL_MONOMER
elseif( is_general_dimer ) then
get_descriptor_type = DT_GENERAL_DIMER
elseif( is_general_trimer ) then
get_descriptor_type = DT_GENERAL_TRIMER
elseif( is_water_trimer ) then
get_descriptor_type = DT_WATER_TRIMER
elseif( is_rdf ) then
get_descriptor_type = DT_RDF
elseif( is_as_distance_2b ) then
get_descriptor_type = DT_AS_DISTANCE_2B
elseif( is_molecule_lo_d ) then
get_descriptor_type = DT_MOLECULE_LO_D
elseif( is_alex ) then
get_descriptor_type = DT_ALEX
elseif( is_com_dimer ) then
get_descriptor_type = DT_COM_DIMER
elseif( is_distance_Nb ) then
get_descriptor_type = DT_DISTANCE_NB
elseif( is_soap_express ) then
get_descriptor_type = DT_SOAP_EXPRESS
elseif( is_soap_turbo ) then
get_descriptor_type = DT_SOAP_TURBO
endif
endfunction get_descriptor_type
subroutine descriptor_initialise(this,args_str,error)
type(descriptor), intent(inout) :: this
character(len=*), intent(in) :: args_str
integer, optional, intent(out) :: error
INIT_ERROR(error)
call finalise(this)
this%descriptor_type = get_descriptor_type(args_str,error)
select case(this%descriptor_type)
case(DT_BISPECTRUM_SO4)
call initialise(this%descriptor_bispectrum_SO4,args_str,error)
case(DT_BISPECTRUM_SO3)
call initialise(this%descriptor_bispectrum_SO3,args_str,error)
case(DT_BEHLER)
call initialise(this%descriptor_behler,args_str,error)
case(DT_DISTANCE_2B)
call initialise(this%descriptor_distance_2b,args_str,error)
case(DT_COORDINATION)
call initialise(this%descriptor_coordination,args_str,error)
case(DT_ANGLE_3B)
call initialise(this%descriptor_angle_3b,args_str,error)
case(DT_CO_ANGLE_3B)
call initialise(this%descriptor_co_angle_3b,args_str,error)
case(DT_CO_DISTANCE_2B)
call initialise(this%descriptor_co_distance_2b,args_str,error)
case(DT_COSNX)
call initialise(this%descriptor_cosnx,args_str,error)
case(DT_TRIHIS)
call initialise(this%descriptor_trihis,args_str,error)
case(DT_WATER_MONOMER)
call initialise(this%descriptor_water_monomer,args_str,error)
case(DT_WATER_DIMER)
call initialise(this%descriptor_water_dimer,args_str,error)
case(DT_A2_DIMER)
call initialise(this%descriptor_A2_dimer,args_str,error)
case(DT_AB_DIMER)
call initialise(this%descriptor_AB_dimer,args_str,error)
case(DT_ATOM_REAL_SPACE)
call initialise(this%descriptor_atom_real_space,args_str,error)
case(DT_POWER_SO3)
call initialise(this%descriptor_power_so3,args_str,error)
case(DT_POWER_SO4)
call initialise(this%descriptor_power_so4,args_str,error)
case(DT_SOAP)
call initialise(this%descriptor_soap,args_str,error)
case(DT_RDF)
call initialise(this%descriptor_rdf,args_str,error)
case(DT_AS_DISTANCE_2B)
call initialise(this%descriptor_as_distance_2b,args_str,error)
case(DT_ALEX)
call initialise(this%descriptor_alex,args_str,error)
case(DT_DISTANCE_NB)
call initialise(this%descriptor_distance_Nb,args_str,error)
case(DT_SOAP_TURBO)
call initialise(this%descriptor_soap_turbo,args_str,error)
#ifdef DESCRIPTORS_NONCOMMERCIAL
case(DT_BOND_REAL_SPACE)
call initialise(this%descriptor_bond_real_space,args_str,error)
case(DT_AN_MONOMER)
call initialise(this%descriptor_AN_monomer,args_str,error)
case(DT_COM_DIMER)
call initialise(this%descriptor_com_dimer,args_str,error)
case(DT_MOLECULE_LO_D)
call initialise(this%descriptor_molecule_lo_d,args_str,error)
case(DT_GENERAL_MONOMER)
call initialise(this%descriptor_general_monomer,args_str,error)
case(DT_GENERAL_DIMER)
call initialise(this%descriptor_general_dimer,args_str,error)
case(DT_GENERAL_TRIMER)
call initialise(this%descriptor_general_trimer,args_str,error)
case(DT_WATER_TRIMER)
call initialise(this%descriptor_water_trimer,args_str,error)
case(DT_SOAP_EXPRESS)
call initialise(this%descriptor_soap_express,args_str,error)
#endif
endselect
endsubroutine descriptor_initialise
subroutine descriptor_finalise(this,error)
type(descriptor), intent(inout) :: this
integer, optional, intent(out) :: error
INIT_ERROR(error)
selectcase(this%descriptor_type)
case(DT_BISPECTRUM_SO4)
call finalise(this%descriptor_bispectrum_SO4,error)
case(DT_BISPECTRUM_SO3)
call finalise(this%descriptor_bispectrum_SO3,error)
case(DT_BEHLER)
call finalise(this%descriptor_behler,error)
case(DT_DISTANCE_2b)
call finalise(this%descriptor_distance_2b,error)
case(DT_COORDINATION)
call finalise(this%descriptor_coordination,error)
case(DT_ANGLE_3B)
call finalise(this%descriptor_angle_3b,error)
case(DT_CO_ANGLE_3B)
call finalise(this%descriptor_co_angle_3b,error)
case(DT_CO_DISTANCE_2b)
call finalise(this%descriptor_co_distance_2b,error)
case(DT_COSNX)
call finalise(this%descriptor_cosnx,error)
case(DT_TRIHIS)
call finalise(this%descriptor_trihis,error)
case(DT_WATER_MONOMER)
call finalise(this%descriptor_water_monomer,error)
case(DT_WATER_DIMER)
call finalise(this%descriptor_water_dimer,error)
case(DT_A2_dimer)
call finalise(this%descriptor_A2_dimer,error)
case(DT_AB_dimer)
call finalise(this%descriptor_AB_dimer,error)
case(DT_ATOM_REAL_SPACE)
call finalise(this%descriptor_atom_real_space,error)
case(DT_POWER_SO3)
call finalise(this%descriptor_power_so3,error)
case(DT_POWER_SO4)
call finalise(this%descriptor_power_so4,error)
case(DT_SOAP)
call finalise(this%descriptor_soap,error)
case(DT_RDF)
call finalise(this%descriptor_rdf,error)
case(DT_AS_DISTANCE_2b)
call finalise(this%descriptor_as_distance_2b,error)
case(DT_ALEX)
call finalise(this%descriptor_alex,error)
case(DT_DISTANCE_Nb)
call finalise(this%descriptor_distance_Nb,error)
#ifdef DESCRIPTORS_NONCOMMERCIAL
case(DT_COM_DIMER)
call finalise(this%descriptor_com_dimer,error)
case(DT_MOLECULE_LO_D)
call finalise(this%descriptor_molecule_lo_d,error)
case(DT_BOND_REAL_SPACE)
call finalise(this%descriptor_bond_real_space,error)
case(DT_GENERAL_MONOMER)
call finalise(this%descriptor_general_monomer,error)
case(DT_GENERAL_DIMER)
call finalise(this%descriptor_general_dimer,error)
case(DT_GENERAL_TRIMER)
call finalise(this%descriptor_general_trimer,error)
case(DT_WATER_TRIMER)
call finalise(this%descriptor_water_trimer,error)
case(DT_SOAP_EXPRESS)
call finalise(this%descriptor_soap_express,error)
case(DT_SOAP_TURBO)
call finalise(this%descriptor_soap_turbo,error)
#endif
endselect
this%descriptor_type = DT_NONE
endsubroutine descriptor_finalise
subroutine descriptor_MPI_setup(this,at,mpi,mpi_mask,error)
type(descriptor), intent(in) :: this
type(atoms), intent(in) :: at
type(MPI_Context), intent(in) :: mpi
logical, dimension(:), intent(out) :: mpi_mask
integer, optional, intent(out) :: error
INIT_ERROR(error)
if(mpi%active) then
select case(this%descriptor_type)
case(DT_BISPECTRUM_SO4)
call descriptor_atomic_MPI_setup(at,mpi,mpi_mask,error)
case(DT_BISPECTRUM_SO3)
RAISE_ERROR("descriptor_MPI_setup: bispectrum_so3 not MPI ready.", error)
case(DT_BEHLER)
call descriptor_atomic_MPI_setup(at,mpi,mpi_mask,error)
case(DT_DISTANCE_2B)
call descriptor_atomic_MPI_setup(at,mpi,mpi_mask,error)
case(DT_COORDINATION)
call descriptor_atomic_MPI_setup(at,mpi,mpi_mask,error)
case(DT_ANGLE_3B)
RAISE_ERROR("descriptor_MPI_setup: angle_3b not MPI ready.", error)
case(DT_CO_ANGLE_3B)
RAISE_ERROR("descriptor_MPI_setup: co_angle_3b not MPI ready.", error)
case(DT_CO_DISTANCE_2B)
RAISE_ERROR("descriptor_MPI_setup: co_distance_2b not MPI ready.", error)
case(DT_COSNX)
call descriptor_atomic_MPI_setup(at,mpi,mpi_mask,error)
case(DT_TRIHIS)
RAISE_ERROR("descriptor_MPI_setup: trihis not MPI ready.", error)
case(DT_WATER_MONOMER)
call descriptor_water_monomer_dimer_MPI_setup(at,mpi,mpi_mask,error)
case(DT_WATER_DIMER)
call descriptor_water_monomer_dimer_MPI_setup(at,mpi,mpi_mask,error)
case(DT_A2_DIMER)
RAISE_ERROR("descriptor_MPI_setup: A2_dimer not MPI ready.", error)
case(DT_AB_DIMER)
RAISE_ERROR("descriptor_MPI_setup: AB_dimer not MPI ready.", error)