forked from lijiext/lammps
Merge remote-tracking branch 'origin/ml_chem_snap'
This commit is contained in:
commit
564974b6a4
|
@ -0,0 +1,17 @@
|
|||
# DATE: 2020-04-04 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
|
||||
|
||||
# Definition of SNAP potential Ta_Cand06A
|
||||
# Assumes 1 LAMMPS atom type
|
||||
|
||||
variable zblcutinner equal 4
|
||||
variable zblcutouter equal 4.8
|
||||
variable zblz equal 73
|
||||
|
||||
# Specify hybrid with SNAP, ZBL
|
||||
|
||||
pair_style hybrid/overlay &
|
||||
zbl ${zblcutinner} ${zblcutouter} &
|
||||
mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor
|
||||
pair_coeff 1 1 zbl ${zblz} ${zblz}
|
||||
pair_coeff * * mliap Ta
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
|
||||
|
||||
# LAMMPS SNAP parameters for Ta_Cand06A
|
||||
|
||||
# required
|
||||
rcutfac 4.67637
|
||||
twojmax 6
|
||||
|
||||
# elements
|
||||
|
||||
nelems 1
|
||||
elems Ta
|
||||
radelems 0.5
|
||||
welems 1
|
||||
|
||||
# optional
|
||||
|
||||
rfac0 0.99363
|
||||
rmin0 0
|
||||
bzeroflag 0
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
|
||||
|
||||
# LAMMPS SNAP coefficients for Ta_Cand06A
|
||||
|
||||
# nelements ncoeff
|
||||
1 31
|
||||
-2.92477
|
||||
-0.01137
|
||||
-0.00775
|
||||
-0.04907
|
||||
-0.15047
|
||||
0.09157
|
||||
0.05590
|
||||
0.05785
|
||||
-0.11615
|
||||
-0.17122
|
||||
-0.10583
|
||||
0.03941
|
||||
-0.11284
|
||||
0.03939
|
||||
-0.07331
|
||||
-0.06582
|
||||
-0.09341
|
||||
-0.10587
|
||||
-0.15497
|
||||
0.04820
|
||||
0.00205
|
||||
0.00060
|
||||
-0.04898
|
||||
-0.05084
|
||||
-0.03371
|
||||
-0.01441
|
||||
-0.01501
|
||||
-0.00599
|
||||
-0.06373
|
||||
0.03965
|
||||
0.01072
|
|
@ -0,0 +1,13 @@
|
|||
# Definition of SNAP+ZBL potential.
|
||||
variable zblcutinner equal 4
|
||||
variable zblcutouter equal 4.8
|
||||
variable zblz equal 74
|
||||
|
||||
# Specify hybrid with SNAP and ZBL
|
||||
|
||||
pair_style hybrid/overlay &
|
||||
zbl ${zblcutinner} ${zblcutouter} &
|
||||
mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor
|
||||
pair_coeff 1 1 zbl ${zblz} ${zblz}
|
||||
pair_coeff * * mliap W
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# required
|
||||
|
||||
rcutfac 4.73442
|
||||
twojmax 6
|
||||
|
||||
# elements
|
||||
|
||||
nelems 1
|
||||
elems W
|
||||
radelems 0.5
|
||||
welems 1
|
||||
|
||||
# optional
|
||||
|
||||
rfac0 0.99363
|
||||
rmin0 0
|
||||
bzeroflag 1
|
||||
|
|
@ -0,0 +1,500 @@
|
|||
# LAMMPS SNAP coefficients for Quadratic W
|
||||
|
||||
# nelements ncoeff
|
||||
1 496
|
||||
0.000000000000
|
||||
-0.000019342340
|
||||
0.000039964908
|
||||
-0.000450771142
|
||||
-0.000233498664
|
||||
-0.000519872659
|
||||
-0.000089734174
|
||||
-0.000106353291
|
||||
-0.000035475344
|
||||
-0.000254116041
|
||||
-0.000520021242
|
||||
0.000065038801
|
||||
-0.000304498225
|
||||
-0.000032230341
|
||||
-0.000007420702
|
||||
-0.000159369530
|
||||
-0.000144907916
|
||||
0.000078858361
|
||||
-0.000238070583
|
||||
-0.000050556167
|
||||
-0.000008662153
|
||||
0.000017439967
|
||||
-0.000028764863
|
||||
0.000022504717
|
||||
0.000001821340
|
||||
-0.000089967846
|
||||
-0.000106392838
|
||||
0.000013771852
|
||||
0.000070228097
|
||||
-0.000024152909
|
||||
-0.000006036274
|
||||
-4.2551325e-05
|
||||
0.0001982986695
|
||||
5.4994526e-05
|
||||
0.0001760061375
|
||||
0.0005287969295
|
||||
-0.00045677476
|
||||
-0.007136016296
|
||||
0.0003868434375
|
||||
-0.0006071085215
|
||||
-0.000554512177
|
||||
-0.0006596292555
|
||||
-0.0007585367005
|
||||
7.62333015e-05
|
||||
0.0002137614635
|
||||
0.000379897335
|
||||
0.0005441952125
|
||||
0.000128413515
|
||||
5.74706545e-05
|
||||
0.0002303380555
|
||||
-0.0005759952885
|
||||
-0.0001530888095
|
||||
-0.0001614394285
|
||||
-3.80386335e-05
|
||||
-0.0006390699265
|
||||
-2.44191e-05
|
||||
-0.000627990564
|
||||
-0.000199645294
|
||||
-3.63524105e-05
|
||||
-0.0004350939225
|
||||
-0.000230192872
|
||||
-0.000456462716
|
||||
-0.00096561205
|
||||
-0.0016793622125
|
||||
0.008264605054
|
||||
0.005768043843
|
||||
0.0259523273965
|
||||
0.002379667484
|
||||
0.001798185681
|
||||
0.001411261095
|
||||
0.0046629902735
|
||||
-0.001249069583
|
||||
-0.003518728846
|
||||
-0.00152218625
|
||||
-0.0005803019955
|
||||
-0.002443813614
|
||||
0.003302653151
|
||||
-0.0035163183225
|
||||
0.005378221661
|
||||
-0.0005157550285
|
||||
0.0005802384085
|
||||
-8.4625189e-05
|
||||
-0.0003100449505
|
||||
0.0016035457395
|
||||
-0.006841896086
|
||||
0.00327970803
|
||||
0.000517873278
|
||||
0.000462624598
|
||||
0.001556398782
|
||||
0.000629663951
|
||||
0.004036847861
|
||||
0.000410623118
|
||||
0.0033671740175
|
||||
0.0060744662315
|
||||
0.0460285453095
|
||||
0.0106979441315
|
||||
0.006457375952
|
||||
-0.0043000712405
|
||||
-0.0196789547465
|
||||
-0.009589713549
|
||||
-0.0152983426785
|
||||
0.003041488452
|
||||
-0.0032366707575
|
||||
-0.0119067345335
|
||||
0.0049313311815
|
||||
-0.0030034838505
|
||||
8.7700383e-05
|
||||
0.0007061505055
|
||||
0.0097234329625
|
||||
0.007217090323
|
||||
0.000235882459
|
||||
-0.0033595857445
|
||||
-0.0168665065145
|
||||
0.017786509719
|
||||
0.001877013067
|
||||
0.0006351836775
|
||||
0.004600906728
|
||||
0.012509628713
|
||||
-0.003427408333
|
||||
-0.0014640751665
|
||||
-0.003888408385
|
||||
-0.0062058291515
|
||||
-0.001642104699
|
||||
-0.00105774282
|
||||
-0.0059780195505
|
||||
-0.001753939287
|
||||
0.000479345105
|
||||
-0.0019904699045
|
||||
4.98541965e-05
|
||||
-0.0041212491675
|
||||
-0.0042906641465
|
||||
-0.002351418317
|
||||
-0.0106697325275
|
||||
-0.000648222198
|
||||
-0.002286882867
|
||||
-0.000626754824
|
||||
-0.00073748291
|
||||
0.0016922435575
|
||||
0.0037496719655
|
||||
0.004656851048
|
||||
-0.0002176673305
|
||||
-0.0006739876965
|
||||
-0.0006208869175
|
||||
7.61738615e-05
|
||||
0.0019258401385
|
||||
0.005690172208
|
||||
0.007318906809
|
||||
-0.035200169396
|
||||
0.009167226287
|
||||
-0.000404285392
|
||||
-0.00348855982
|
||||
-0.0024229238155
|
||||
0.0022336200925
|
||||
-0.012584737991
|
||||
0.0016262069595
|
||||
0.0048016592015
|
||||
0.0004657340115
|
||||
0.0025051890895
|
||||
-0.0104101829395
|
||||
0.016176490711
|
||||
-0.0094539511845
|
||||
-0.002289487018
|
||||
-0.0002052188655
|
||||
-0.007085549731
|
||||
0.02162608233
|
||||
-0.002238154953
|
||||
0.0190676087705
|
||||
0.0002139442795
|
||||
0.0010403767345
|
||||
0.003360683249
|
||||
0.003153376576
|
||||
-0.001249764819
|
||||
-0.068537163077
|
||||
0.0023354667295
|
||||
0.001767860664
|
||||
-0.0033006265215
|
||||
0.0146223252485
|
||||
-0.003180595809
|
||||
0.0069092040305
|
||||
0.0010583439885
|
||||
-0.003447267898
|
||||
-0.001106713702
|
||||
0.00523272471
|
||||
-0.010758599437
|
||||
-0.001822397317
|
||||
0.018487732527
|
||||
-0.0024400507145
|
||||
-0.007514714512
|
||||
-0.003947742615
|
||||
0.012413627732
|
||||
0.003092235017
|
||||
0.018069399047
|
||||
-0.0035369320715
|
||||
0.0011168541665
|
||||
-0.0014980962775
|
||||
-1.2944254e-05
|
||||
-0.041955689351
|
||||
0.0023033776335
|
||||
-0.040725631204
|
||||
-0.0693632023935
|
||||
0.020674975135
|
||||
-0.0341006922645
|
||||
-0.006059344895
|
||||
0.002385437006
|
||||
-0.004177512167
|
||||
-0.0146544701995
|
||||
-0.0008310261785
|
||||
-0.010934674355
|
||||
0.006492824537
|
||||
-0.014812643723
|
||||
0.004033748718
|
||||
-0.004155996547
|
||||
-0.013113411806
|
||||
-0.0088014221285
|
||||
0.0037541341
|
||||
-0.000805304258
|
||||
0.006318190602
|
||||
0.012552958042
|
||||
0.004200553135
|
||||
-0.00681355806
|
||||
-0.001852228976
|
||||
0.0017381476065
|
||||
-0.002643779529
|
||||
0.0049358851655
|
||||
0.001522146164
|
||||
0.002260955858
|
||||
-0.000839707664
|
||||
0.0008487292955
|
||||
0.002671028789
|
||||
-0.000193952538
|
||||
0.003111368392
|
||||
0.0007482047125
|
||||
0.0020401970905
|
||||
0.000530116057
|
||||
-0.0022777656015
|
||||
-0.0045238154695
|
||||
0.0018290760485
|
||||
-0.0003309336725
|
||||
0.00293571563
|
||||
0.000172269209
|
||||
0.001414752092
|
||||
0.0005614625055
|
||||
0.000441310903
|
||||
-0.002473120026
|
||||
-0.015420836338
|
||||
-0.0058494470115
|
||||
-0.013440044608
|
||||
-0.009774364656
|
||||
-0.0019064948385
|
||||
-1.70476245e-05
|
||||
0.0049669399345
|
||||
-0.0050880033155
|
||||
0.001600486319
|
||||
-0.0018417989075
|
||||
-0.0111031210975
|
||||
0.0007780738275
|
||||
-0.004930202896
|
||||
-0.002537539117
|
||||
-0.0090246084865
|
||||
-0.002694202287
|
||||
-0.0062002945005
|
||||
0.0031924710865
|
||||
0.0021120090085
|
||||
-0.003067483203
|
||||
-0.0002847253785
|
||||
-0.016407568729
|
||||
-0.0012875748665
|
||||
-0.0136223073595
|
||||
-0.00152438356
|
||||
0.0012803681485
|
||||
-0.002216406572
|
||||
-0.001518786423
|
||||
-0.004453055438
|
||||
-0.0078894618465
|
||||
0.001421143537
|
||||
-0.0050288776725
|
||||
0.001199592632
|
||||
-0.002661588749
|
||||
-0.004357715347
|
||||
0.009525078378
|
||||
0.0026286979515
|
||||
0.0043289788665
|
||||
0.0004994005155
|
||||
0.003791227565
|
||||
0.0004056536255
|
||||
0.0033347889035
|
||||
-0.000464347336
|
||||
-0.0069517390965
|
||||
-0.0079588750315
|
||||
-0.004154738239
|
||||
0.006620101338
|
||||
0.008608842617
|
||||
0.0056131740625
|
||||
0.0011860229985
|
||||
0.007580086232
|
||||
0.003260306951
|
||||
0.000979553031
|
||||
-0.0044626742655
|
||||
-0.005235925737
|
||||
-0.0161268610495
|
||||
-0.0069229581565
|
||||
0.003724916317
|
||||
0.0023613845
|
||||
0.0013633397005
|
||||
0.001433661889
|
||||
-0.0009859245845
|
||||
-0.019516619562
|
||||
-0.0051345232355
|
||||
-0.0003792145305
|
||||
-0.009160883563
|
||||
-0.0052408213305
|
||||
-0.000837343292
|
||||
-0.010077898583
|
||||
-0.000297970588
|
||||
-0.000858261403
|
||||
-0.0001092992995
|
||||
-0.002443805024
|
||||
-0.0025107490965
|
||||
-0.0062944996435
|
||||
0.0026546548665
|
||||
0.0006955853785
|
||||
0.000103592795
|
||||
0.000708964143
|
||||
0.0019193670325
|
||||
-0.0001578612265
|
||||
-0.005585721575
|
||||
-0.000421551186
|
||||
0.0022745774245
|
||||
-0.004927140737
|
||||
0.0004199419505
|
||||
-0.0037407737345
|
||||
0.002130170551
|
||||
-0.0030979189135
|
||||
-0.0019395201255
|
||||
0.0067944948975
|
||||
-0.000359694345
|
||||
-0.0002144026575
|
||||
0.0025529098515
|
||||
0.0001917158465
|
||||
-0.000540725939
|
||||
0.001239653721
|
||||
0.00159659403
|
||||
-5.5652017e-05
|
||||
4.5092483e-05
|
||||
0.002495602056
|
||||
-0.0035351180395
|
||||
0.0009665743545
|
||||
-0.0023236857675
|
||||
-0.0014564171785
|
||||
-0.0008165505935
|
||||
-0.000118027852
|
||||
0.002536872662
|
||||
0.0009829535115
|
||||
0.0019442113705
|
||||
0.000664158062
|
||||
0.000326715061
|
||||
0.00019900621
|
||||
0.0004767582395
|
||||
0.000900303081
|
||||
-2.91049685e-05
|
||||
-0.004411179905
|
||||
-0.004064521081
|
||||
0.00692497271
|
||||
-0.005195674108
|
||||
-0.006544598492
|
||||
0.0029896960935
|
||||
0.000425073164
|
||||
-8.0017505e-05
|
||||
0.000846844414
|
||||
0.003287511416
|
||||
-0.009662064447
|
||||
0.0014047560985
|
||||
-0.0008689313915
|
||||
0.0009517570465
|
||||
0.000152017235
|
||||
1.6514158e-05
|
||||
0.00066355894
|
||||
0.0067775973265
|
||||
0.0021844858475
|
||||
0.0056757292145
|
||||
0.0054950676515
|
||||
0.0002498690125
|
||||
-0.006315915302
|
||||
-0.0059966827865
|
||||
-0.0034483171305
|
||||
0.0073702392255
|
||||
0.007591193081
|
||||
0.0004062066825
|
||||
0.000913827769
|
||||
0.000622164767
|
||||
0.0002438011115
|
||||
0.01119218957
|
||||
0.010457943327
|
||||
-0.002352405766
|
||||
-0.000761350789
|
||||
0.000146360756
|
||||
-0.00052151391
|
||||
-0.001421163661
|
||||
-0.0098259784665
|
||||
-0.001387664408
|
||||
-0.0010876399735
|
||||
0.000794093996
|
||||
0.003036965154
|
||||
-0.0017118732635
|
||||
-0.0015837318195
|
||||
-0.006679253783
|
||||
0.000882488727
|
||||
0.0093074758655
|
||||
0.0013319314085
|
||||
-0.011547004122
|
||||
-0.003864301947
|
||||
-0.007112747006
|
||||
-0.00330951085
|
||||
-0.0007122545915
|
||||
-0.001201815256
|
||||
0.0041789351005
|
||||
-0.0001805522685
|
||||
-0.0007465084205
|
||||
0.008838667361
|
||||
0.0048153576585
|
||||
-9.8403371e-05
|
||||
-0.010102205467
|
||||
-0.0090783851625
|
||||
-0.0014465915755
|
||||
0.0056402904815
|
||||
0.004713889865
|
||||
-0.000958685828
|
||||
0.002844420936
|
||||
0.000886932857
|
||||
0.0002483938575
|
||||
0.000144967791
|
||||
-0.0012477036845
|
||||
0.004783753466
|
||||
-0.0076604636325
|
||||
0.00091901227
|
||||
0.0010552043375
|
||||
0.0013117699705
|
||||
-0.000302204736
|
||||
0.002096120671
|
||||
-0.0002417090715
|
||||
0.0008896279815
|
||||
8.3058685e-05
|
||||
0.002360101467
|
||||
0.003364314747
|
||||
0.0008746445705
|
||||
-0.0011215585125
|
||||
-0.0003387424825
|
||||
0.0005632970265
|
||||
-0.0006617281215
|
||||
0.0003733063965
|
||||
0.0002623090815
|
||||
0.004593469114
|
||||
0.0040372304995
|
||||
-0.001688451935
|
||||
-0.003686908717
|
||||
-0.004326202128
|
||||
-0.000870929915
|
||||
-0.0001854711995
|
||||
0.0002189774835
|
||||
0.00071865135
|
||||
0.007416398218
|
||||
0.0020460979
|
||||
-0.008020256566
|
||||
-0.016722806328
|
||||
0.001376213073
|
||||
0.000347513599
|
||||
0.0016684763755
|
||||
-0.000874786219
|
||||
0.001891181919
|
||||
-0.000534904311
|
||||
0.000846430852
|
||||
-0.000641433051
|
||||
0.0007377551475
|
||||
0.001358126396
|
||||
-0.000866748663
|
||||
0.011124487718
|
||||
0.005228666165
|
||||
-0.001490438881
|
||||
-0.0008813532175
|
||||
-0.0001303988565
|
||||
0.0007163794045
|
||||
0.004674505138
|
||||
-0.000722641184
|
||||
-0.002023585289
|
||||
0.001547283689
|
||||
0.000753938405
|
||||
0.000470918236
|
||||
-0.0003316097225
|
||||
-0.0002293860925
|
||||
6.90841455e-05
|
||||
-0.001301344263
|
||||
-0.0004029179255
|
||||
6.69084325e-05
|
||||
-0.000142497889
|
||||
0.0002207077485
|
||||
-0.000201523756
|
|
@ -0,0 +1,16 @@
|
|||
# DATE: 2020-04-04 CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019)
|
||||
# Definition of SNAP+ZBL potential.
|
||||
variable zblcutinner equal 4
|
||||
variable zblcutouter equal 4.8
|
||||
variable zblz1 equal 74
|
||||
variable zblz2 equal 4
|
||||
|
||||
# Specify hybrid with SNAP and ZBL
|
||||
|
||||
pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} &
|
||||
mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor
|
||||
pair_coeff 1 1 zbl ${zblz1} ${zblz1}
|
||||
pair_coeff 1 2 zbl ${zblz1} ${zblz2}
|
||||
pair_coeff 2 2 zbl ${zblz2} ${zblz2}
|
||||
pair_coeff * * mliap W Be
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# required
|
||||
|
||||
rcutfac 4.8123
|
||||
twojmax 8
|
||||
|
||||
# elements
|
||||
|
||||
nelems 2
|
||||
elems W Be
|
||||
radelems 0.5 0.417932
|
||||
welems 1 0.959049
|
||||
|
||||
# optional
|
||||
|
||||
rfac0 0.99363
|
||||
rmin0 0
|
||||
bzeroflag 1
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
# LAMMPS SNAP coefficients for WBe
|
||||
|
||||
# nelements ncoeff
|
||||
2 56
|
||||
-0.000000000000 # B[0]
|
||||
-0.001487061994 # B[1, 0, 0, 0]
|
||||
0.075808306870 # B[2, 1, 0, 1]
|
||||
0.538735683870 # B[3, 1, 1, 2]
|
||||
-0.074148039366 # B[4, 2, 0, 2]
|
||||
0.602629813770 # B[5, 2, 1, 3]
|
||||
-0.147022424344 # B[6, 2, 2, 2]
|
||||
0.117756828488 # B[7, 2, 2, 4]
|
||||
-0.026490439049 # B[8, 3, 0, 3]
|
||||
-0.035162708767 # B[9, 3, 1, 4]
|
||||
0.064315385091 # B[10, 3, 2, 3]
|
||||
-0.131936948089 # B[11, 3, 2, 5]
|
||||
-0.021272860272 # B[12, 3, 3, 4]
|
||||
-0.091171134054 # B[13, 3, 3, 6]
|
||||
-0.024396224398 # B[14, 4, 0, 4]
|
||||
-0.059813132803 # B[15, 4, 1, 5]
|
||||
0.069585393203 # B[16, 4, 2, 4]
|
||||
-0.085344044181 # B[17, 4, 2, 6]
|
||||
-0.155425254597 # B[18, 4, 3, 5]
|
||||
-0.117031758367 # B[19, 4, 3, 7]
|
||||
-0.040956258020 # B[20, 4, 4, 4]
|
||||
-0.084465000389 # B[21, 4, 4, 6]
|
||||
-0.020367513630 # B[22, 4, 4, 8]
|
||||
-0.010730484318 # B[23, 5, 0, 5]
|
||||
-0.054777575658 # B[24, 5, 1, 6]
|
||||
0.050742893747 # B[25, 5, 2, 5]
|
||||
-0.004686334611 # B[26, 5, 2, 7]
|
||||
-0.116372907121 # B[27, 5, 3, 6]
|
||||
0.005542497708 # B[28, 5, 3, 8]
|
||||
-0.126526795635 # B[29, 5, 4, 5]
|
||||
-0.080163926221 # B[30, 5, 4, 7]
|
||||
-0.082426250179 # B[31, 5, 5, 6]
|
||||
-0.010558777281 # B[32, 5, 5, 8]
|
||||
-0.001939058038 # B[33, 6, 0, 6]
|
||||
-0.027907949962 # B[34, 6, 1, 7]
|
||||
0.049483908476 # B[35, 6, 2, 6]
|
||||
0.005103754385 # B[36, 6, 2, 8]
|
||||
-0.054751505141 # B[37, 6, 3, 7]
|
||||
-0.055556071011 # B[38, 6, 4, 6]
|
||||
-0.006026917619 # B[39, 6, 4, 8]
|
||||
-0.060889030109 # B[40, 6, 5, 7]
|
||||
-0.029977673973 # B[41, 6, 6, 6]
|
||||
-0.014987527280 # B[42, 6, 6, 8]
|
||||
-0.006697686658 # B[43, 7, 0, 7]
|
||||
0.017369624409 # B[44, 7, 1, 8]
|
||||
0.047864358817 # B[45, 7, 2, 7]
|
||||
-0.001989812679 # B[46, 7, 3, 8]
|
||||
0.000153530925 # B[47, 7, 4, 7]
|
||||
-0.003862356345 # B[48, 7, 5, 8]
|
||||
-0.009754314198 # B[49, 7, 6, 7]
|
||||
0.000777958970 # B[50, 7, 7, 8]
|
||||
-0.003031424287 # B[51, 8, 0, 8]
|
||||
0.015612715209 # B[52, 8, 2, 8]
|
||||
0.003210129646 # B[53, 8, 4, 8]
|
||||
-0.013088799947 # B[54, 8, 6, 8]
|
||||
0.001465970755 # B[55, 8, 8, 8]
|
||||
0.000000000000 # B[0]
|
||||
-0.000112143918 # B[1, 0, 0, 0]
|
||||
0.002449805180 # B[2, 1, 0, 1]
|
||||
0.189705916830 # B[3, 1, 1, 2]
|
||||
-0.019967429692 # B[4, 2, 0, 2]
|
||||
0.286015704682 # B[5, 2, 1, 3]
|
||||
0.072864063124 # B[6, 2, 2, 2]
|
||||
0.108748154196 # B[7, 2, 2, 4]
|
||||
-0.005203284351 # B[8, 3, 0, 3]
|
||||
0.043948598532 # B[9, 3, 1, 4]
|
||||
0.105425889093 # B[10, 3, 2, 3]
|
||||
0.060460134045 # B[11, 3, 2, 5]
|
||||
-0.003406205141 # B[12, 3, 3, 4]
|
||||
0.002306765306 # B[13, 3, 3, 6]
|
||||
-0.003845115174 # B[14, 4, 0, 4]
|
||||
0.029471162073 # B[15, 4, 1, 5]
|
||||
0.054901130330 # B[16, 4, 2, 4]
|
||||
0.010910192753 # B[17, 4, 2, 6]
|
||||
0.033885210622 # B[18, 4, 3, 5]
|
||||
0.008053439551 # B[19, 4, 3, 7]
|
||||
-0.001432298168 # B[20, 4, 4, 4]
|
||||
0.017478027729 # B[21, 4, 4, 6]
|
||||
-0.003402034990 # B[22, 4, 4, 8]
|
||||
-0.002655339820 # B[23, 5, 0, 5]
|
||||
0.012668749892 # B[24, 5, 1, 6]
|
||||
0.037521561888 # B[25, 5, 2, 5]
|
||||
-0.000682693314 # B[26, 5, 2, 7]
|
||||
0.008525913627 # B[27, 5, 3, 6]
|
||||
0.008977936348 # B[28, 5, 3, 8]
|
||||
0.006922732235 # B[29, 5, 4, 5]
|
||||
0.003031883044 # B[30, 5, 4, 7]
|
||||
-0.000345577975 # B[31, 5, 5, 6]
|
||||
-0.001041600679 # B[32, 5, 5, 8]
|
||||
-0.001407625493 # B[33, 6, 0, 6]
|
||||
0.004211558640 # B[34, 6, 1, 7]
|
||||
0.014450875461 # B[35, 6, 2, 6]
|
||||
-0.007033326252 # B[36, 6, 2, 8]
|
||||
0.004998742185 # B[37, 6, 3, 7]
|
||||
-0.002824617682 # B[38, 6, 4, 6]
|
||||
0.003831871934 # B[39, 6, 4, 8]
|
||||
-0.005700892700 # B[40, 6, 5, 7]
|
||||
0.000184422409 # B[41, 6, 6, 6]
|
||||
0.001592696824 # B[42, 6, 6, 8]
|
||||
-0.000804927645 # B[43, 7, 0, 7]
|
||||
0.008465358642 # B[44, 7, 1, 8]
|
||||
0.005460531160 # B[45, 7, 2, 7]
|
||||
-0.000639605094 # B[46, 7, 3, 8]
|
||||
-0.002403948393 # B[47, 7, 4, 7]
|
||||
-0.001267042453 # B[48, 7, 5, 8]
|
||||
0.003836940623 # B[49, 7, 6, 7]
|
||||
0.002333141437 # B[50, 7, 7, 8]
|
||||
-0.000665360637 # B[51, 8, 0, 8]
|
||||
-0.003460637865 # B[52, 8, 2, 8]
|
||||
-0.001598726043 # B[53, 8, 4, 8]
|
||||
0.001478744304 # B[54, 8, 6, 8]
|
||||
0.000806643203 # B[55, 8, 8, 8]
|
|
@ -0,0 +1,53 @@
|
|||
# Demonstrate SNAP Ta potential
|
||||
|
||||
# Initialize simulation
|
||||
|
||||
variable nsteps index 100
|
||||
variable nrep equal 4
|
||||
variable a equal 3.316
|
||||
units metal
|
||||
|
||||
# generate the box and atom positions using a BCC lattice
|
||||
|
||||
variable nx equal ${nrep}
|
||||
variable ny equal ${nrep}
|
||||
variable nz equal ${nrep}
|
||||
|
||||
boundary p p p
|
||||
|
||||
lattice bcc $a
|
||||
region box block 0 ${nx} 0 ${ny} 0 ${nz}
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
|
||||
mass 1 180.88
|
||||
|
||||
# choose potential
|
||||
|
||||
include Ta06A.mliap
|
||||
|
||||
# Setup output
|
||||
|
||||
compute eatom all pe/atom
|
||||
compute energy all reduce sum c_eatom
|
||||
|
||||
compute satom all stress/atom NULL
|
||||
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
|
||||
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
|
||||
|
||||
thermo_style custom step temp epair c_energy etotal press v_press
|
||||
thermo 10
|
||||
thermo_modify norm yes
|
||||
|
||||
# Set up NVE run
|
||||
|
||||
timestep 0.5e-3
|
||||
neighbor 1.0 bin
|
||||
neigh_modify once no every 1 delay 0 check yes
|
||||
|
||||
# Run MD
|
||||
|
||||
velocity all create 300.0 4928459
|
||||
fix 1 all nve
|
||||
run ${nsteps}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# Demonstrate SNAP W-Be potential
|
||||
|
||||
# Initialize simulation
|
||||
|
||||
variable nsteps index 100
|
||||
variable nrep equal 4
|
||||
variable a equal 3.1803
|
||||
units metal
|
||||
|
||||
# generate the box and atom positions using a BCC lattice
|
||||
|
||||
variable nx equal ${nrep}
|
||||
variable ny equal ${nrep}
|
||||
variable nz equal ${nrep}
|
||||
|
||||
boundary p p p
|
||||
|
||||
lattice bcc $a
|
||||
region box block 0 ${nx} 0 ${ny} 0 ${nz}
|
||||
create_box 2 box
|
||||
create_atoms 1 box
|
||||
mass 1 183.84
|
||||
mass 2 9.012182
|
||||
|
||||
set group all type/fraction 2 0.05 3590153 # Change 5% of W to He
|
||||
group tungsten type 1
|
||||
group beryllium type 2
|
||||
# choose potential
|
||||
|
||||
include WBe_Wood_PRB2019.mliap
|
||||
|
||||
# Setup output
|
||||
|
||||
compute eatom all pe/atom
|
||||
compute energy all reduce sum c_eatom
|
||||
|
||||
compute satom all stress/atom NULL
|
||||
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
|
||||
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
|
||||
|
||||
thermo_style custom step temp epair c_energy etotal press v_press
|
||||
thermo 10
|
||||
thermo_modify norm yes
|
||||
|
||||
# Set up NVE run
|
||||
|
||||
timestep 0.5e-3
|
||||
neighbor 1.0 bin
|
||||
neigh_modify once no every 1 delay 0 check yes
|
||||
|
||||
# Run MD
|
||||
|
||||
velocity all create 300.0 4928459
|
||||
fix 1 all nve
|
||||
run ${nsteps}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
# Demonstrate SNAP Ta potential
|
||||
|
||||
# Initialize simulation
|
||||
|
||||
variable nsteps index 100
|
||||
variable nrep equal 1
|
||||
variable a equal 3.1803
|
||||
units metal
|
||||
|
||||
# generate the box and atom positions using a BCC lattice
|
||||
|
||||
variable nx equal ${nrep}
|
||||
variable ny equal ${nrep}
|
||||
variable nz equal ${nrep}
|
||||
|
||||
boundary p p p
|
||||
|
||||
lattice bcc $a
|
||||
region box block 0 ${nx} 0 ${ny} 0 ${nz}
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
displace_atoms all random 0.01 0.01 0.01 12345
|
||||
|
||||
mass 1 183.84
|
||||
|
||||
# choose potential
|
||||
|
||||
include W.quadratic.mliap
|
||||
|
||||
# Setup output
|
||||
|
||||
compute eatom all pe/atom
|
||||
compute energy all reduce sum c_eatom
|
||||
|
||||
compute satom all stress/atom NULL
|
||||
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
|
||||
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
|
||||
|
||||
thermo_style custom step temp epair c_energy etotal press v_press
|
||||
thermo 10
|
||||
thermo_modify norm yes
|
||||
|
||||
# Set up NVE run
|
||||
|
||||
timestep 0.5e-3
|
||||
neighbor 1.0 bin
|
||||
neigh_modify once no every 1 delay 0 check no
|
||||
|
||||
# Run MD
|
||||
|
||||
velocity all create 300.0 4928459
|
||||
fix 1 all nve
|
||||
run ${nsteps}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
LAMMPS (19 Mar 2020)
|
||||
# Demonstrate SNAP Ta potential
|
||||
|
||||
# Initialize simulation
|
||||
|
||||
variable nsteps index 100
|
||||
variable nrep equal 4
|
||||
variable a equal 3.316
|
||||
units metal
|
||||
|
||||
# generate the box and atom positions using a BCC lattice
|
||||
|
||||
variable nx equal ${nrep}
|
||||
variable nx equal 4
|
||||
variable ny equal ${nrep}
|
||||
variable ny equal 4
|
||||
variable nz equal ${nrep}
|
||||
variable nz equal 4
|
||||
|
||||
boundary p p p
|
||||
|
||||
lattice bcc $a
|
||||
lattice bcc 3.316
|
||||
Lattice spacing in x,y,z = 3.316 3.316 3.316
|
||||
region box block 0 ${nx} 0 ${ny} 0 ${nz}
|
||||
region box block 0 4 0 ${ny} 0 ${nz}
|
||||
region box block 0 4 0 4 0 ${nz}
|
||||
region box block 0 4 0 4 0 4
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (13.264 13.264 13.264)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 128 atoms
|
||||
create_atoms CPU = 0.000254 secs
|
||||
|
||||
mass 1 180.88
|
||||
|
||||
# choose potential
|
||||
|
||||
include Ta06A.snap
|
||||
# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
|
||||
|
||||
# Definition of SNAP potential Ta_Cand06A
|
||||
# Assumes 1 LAMMPS atom type
|
||||
|
||||
variable zblcutinner equal 4
|
||||
variable zblcutouter equal 4.8
|
||||
variable zblz equal 73
|
||||
|
||||
# Specify hybrid with SNAP, ZBL
|
||||
|
||||
pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap
|
||||
pair_style hybrid/overlay zbl 4 ${zblcutouter} snap
|
||||
pair_style hybrid/overlay zbl 4 4.8 snap
|
||||
pair_coeff 1 1 zbl ${zblz} ${zblz}
|
||||
pair_coeff 1 1 zbl 73 ${zblz}
|
||||
pair_coeff 1 1 zbl 73 73
|
||||
pair_coeff * * snap Ta06A.snapcoeff Ta06A.snapparam Ta
|
||||
Reading potential file Ta06A.snapcoeff with DATE: 2014-09-05
|
||||
SNAP Element = Ta, Radius 0.5, Weight 1
|
||||
Reading potential file Ta06A.snapparam with DATE: 2014-09-05
|
||||
SNAP keyword rcutfac 4.67637
|
||||
SNAP keyword twojmax 6
|
||||
SNAP keyword rfac0 0.99363
|
||||
SNAP keyword rmin0 0
|
||||
SNAP keyword bzeroflag 0
|
||||
SNAP keyword quadraticflag 0
|
||||
|
||||
|
||||
# Setup output
|
||||
|
||||
compute eatom all pe/atom
|
||||
compute energy all reduce sum c_eatom
|
||||
|
||||
compute satom all stress/atom NULL
|
||||
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
|
||||
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
|
||||
|
||||
thermo_style custom step temp epair c_energy etotal press v_press
|
||||
thermo 10
|
||||
thermo_modify norm yes
|
||||
|
||||
# Set up NVE run
|
||||
|
||||
timestep 0.5e-3
|
||||
neighbor 1.0 bin
|
||||
neigh_modify once no every 1 delay 0 check yes
|
||||
|
||||
# Run MD
|
||||
|
||||
velocity all create 300.0 4928459
|
||||
fix 1 all nve
|
||||
run ${nsteps}
|
||||
run 100
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5.8
|
||||
ghost atom cutoff = 5.8
|
||||
binsize = 2.9, bins = 5 5 5
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair zbl, perpetual, half/full from (2)
|
||||
attributes: half, newton on
|
||||
pair build: halffull/newton
|
||||
stencil: none
|
||||
bin: none
|
||||
(2) pair snap, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 6.591 | 6.591 | 6.591 Mbytes
|
||||
Step Temp E_pair c_energy TotEng Press v_press
|
||||
0 300 -11.85157 -11.85157 -11.813095 2717.1661 -2717.1661
|
||||
10 295.96579 -11.851053 -11.851053 -11.813095 2696.1559 -2696.1559
|
||||
20 284.32535 -11.84956 -11.84956 -11.813095 2301.3713 -2301.3713
|
||||
30 266.04602 -11.847215 -11.847215 -11.813095 1832.1745 -1832.1745
|
||||
40 242.2862 -11.844168 -11.844168 -11.813095 1492.6765 -1492.6765
|
||||
50 214.48968 -11.840603 -11.840603 -11.813094 1312.8908 -1312.8908
|
||||
60 184.32523 -11.836734 -11.836734 -11.813094 1284.582 -1284.582
|
||||
70 153.58055 -11.832791 -11.832791 -11.813094 1374.4457 -1374.4457
|
||||
80 124.04276 -11.829003 -11.829003 -11.813094 1537.703 -1537.703
|
||||
90 97.37622 -11.825582 -11.825582 -11.813094 1734.9662 -1734.9662
|
||||
100 75.007873 -11.822714 -11.822714 -11.813094 1930.8005 -1930.8005
|
||||
Loop time of 0.995328 on 1 procs for 100 steps with 128 atoms
|
||||
|
||||
Performance: 4.340 ns/day, 5.530 hours/ns, 100.469 timesteps/s
|
||||
99.5% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.99426 | 0.99426 | 0.99426 | 0.0 | 99.89
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0.000305 | 0.000305 | 0.000305 | 0.0 | 0.03
|
||||
Output | 0.000413 | 0.000413 | 0.000413 | 0.0 | 0.04
|
||||
Modify | 0.000159 | 0.000159 | 0.000159 | 0.0 | 0.02
|
||||
Other | | 0.000191 | | | 0.02
|
||||
|
||||
Nlocal: 128 ave 128 max 128 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 727 ave 727 max 727 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 3712 ave 3712 max 3712 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
FullNghs: 7424 ave 7424 max 7424 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 7424
|
||||
Ave neighs/atom = 58
|
||||
Neighbor list builds = 0
|
||||
Dangerous builds = 0
|
||||
|
||||
Total wall time: 0:00:01
|
|
@ -0,0 +1,163 @@
|
|||
LAMMPS (19 Mar 2020)
|
||||
# Demonstrate SNAP W-Be potential
|
||||
|
||||
# Initialize simulation
|
||||
|
||||
variable nsteps index 100
|
||||
variable nrep equal 4
|
||||
variable a equal 3.1803
|
||||
units metal
|
||||
|
||||
# generate the box and atom positions using a BCC lattice
|
||||
|
||||
variable nx equal ${nrep}
|
||||
variable nx equal 4
|
||||
variable ny equal ${nrep}
|
||||
variable ny equal 4
|
||||
variable nz equal ${nrep}
|
||||
variable nz equal 4
|
||||
|
||||
boundary p p p
|
||||
|
||||
lattice bcc $a
|
||||
lattice bcc 3.1803
|
||||
Lattice spacing in x,y,z = 3.1803 3.1803 3.1803
|
||||
region box block 0 ${nx} 0 ${ny} 0 ${nz}
|
||||
region box block 0 4 0 ${ny} 0 ${nz}
|
||||
region box block 0 4 0 4 0 ${nz}
|
||||
region box block 0 4 0 4 0 4
|
||||
create_box 2 box
|
||||
Created orthogonal box = (0 0 0) to (12.7212 12.7212 12.7212)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 128 atoms
|
||||
create_atoms CPU = 0.000231 secs
|
||||
mass 1 183.84
|
||||
mass 2 9.012182
|
||||
|
||||
set group all type/fraction 2 0.05 3590153 # Change 5% of W to He
|
||||
5 settings made for type/fraction
|
||||
group tungsten type 1
|
||||
123 atoms in group tungsten
|
||||
group beryllium type 2
|
||||
5 atoms in group beryllium
|
||||
# choose potential
|
||||
|
||||
include WBe_Wood_PRB2019.snap
|
||||
# DATE: 2019-09-18 CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019)
|
||||
# Definition of SNAP+ZBL potential.
|
||||
variable zblcutinner equal 4
|
||||
variable zblcutouter equal 4.8
|
||||
variable zblz1 equal 74
|
||||
variable zblz2 equal 4
|
||||
|
||||
# Specify hybrid with SNAP and ZBL
|
||||
|
||||
pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap
|
||||
pair_style hybrid/overlay zbl 4 ${zblcutouter} snap
|
||||
pair_style hybrid/overlay zbl 4 4.8 snap
|
||||
pair_coeff 1 1 zbl ${zblz1} ${zblz1}
|
||||
pair_coeff 1 1 zbl 74 ${zblz1}
|
||||
pair_coeff 1 1 zbl 74 74
|
||||
pair_coeff 1 2 zbl ${zblz1} ${zblz2}
|
||||
pair_coeff 1 2 zbl 74 ${zblz2}
|
||||
pair_coeff 1 2 zbl 74 4
|
||||
pair_coeff 2 2 zbl ${zblz2} ${zblz2}
|
||||
pair_coeff 2 2 zbl 4 ${zblz2}
|
||||
pair_coeff 2 2 zbl 4 4
|
||||
pair_coeff * * snap WBe_Wood_PRB2019.snapcoeff WBe_Wood_PRB2019.snapparam W Be
|
||||
SNAP Element = W, Radius 0.5, Weight 1
|
||||
SNAP Element = Be, Radius 0.417932, Weight 0.959049
|
||||
SNAP keyword rcutfac 4.8123
|
||||
SNAP keyword twojmax 8
|
||||
SNAP keyword rfac0 0.99363
|
||||
SNAP keyword rmin0 0
|
||||
SNAP keyword bzeroflag 1
|
||||
SNAP keyword quadraticflag 0
|
||||
|
||||
|
||||
# Setup output
|
||||
|
||||
compute eatom all pe/atom
|
||||
compute energy all reduce sum c_eatom
|
||||
|
||||
compute satom all stress/atom NULL
|
||||
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
|
||||
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
|
||||
|
||||
thermo_style custom step temp epair c_energy etotal press v_press
|
||||
thermo 10
|
||||
thermo_modify norm yes
|
||||
|
||||
# Set up NVE run
|
||||
|
||||
timestep 0.5e-3
|
||||
neighbor 1.0 bin
|
||||
neigh_modify once no every 1 delay 0 check yes
|
||||
|
||||
# Run MD
|
||||
|
||||
velocity all create 300.0 4928459
|
||||
fix 1 all nve
|
||||
run ${nsteps}
|
||||
run 100
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check yes
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5.8123
|
||||
ghost atom cutoff = 5.8123
|
||||
binsize = 2.90615, bins = 5 5 5
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair zbl, perpetual, half/full from (2)
|
||||
attributes: half, newton on
|
||||
pair build: halffull/newton
|
||||
stencil: none
|
||||
bin: none
|
||||
(2) pair snap, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 6.893 | 6.893 | 6.893 Mbytes
|
||||
Step Temp E_pair c_energy TotEng Press v_press
|
||||
0 300 -8.5980876 -8.5980876 -8.5596125 -35284.855 35284.855
|
||||
10 299.29029 -8.5979965 -8.5979965 -8.5596125 -35299.259 35299.259
|
||||
20 288.99334 -8.5966759 -8.5966759 -8.5596124 -35004.093 35004.093
|
||||
30 269.91027 -8.5942284 -8.5942284 -8.5596123 -34447.077 34447.077
|
||||
40 243.57361 -8.5908505 -8.5908505 -8.5596121 -33687.105 33687.105
|
||||
50 212.21385 -8.5868284 -8.5868284 -8.5596119 -32821.864 32821.864
|
||||
60 178.77144 -8.5825391 -8.5825391 -8.5596116 -31971.17 31971.17
|
||||
70 146.71854 -8.578428 -8.578428 -8.5596113 -31245.51 31245.51
|
||||
80 119.50956 -8.5749383 -8.5749383 -8.5596111 -30724.137 30724.137
|
||||
90 99.872785 -8.5724197 -8.5724197 -8.559611 -30440.244 30440.244
|
||||
100 89.604584 -8.5711027 -8.5711027 -8.5596109 -30392.805 30392.805
|
||||
Loop time of 3.17984 on 1 procs for 100 steps with 128 atoms
|
||||
|
||||
Performance: 1.359 ns/day, 17.666 hours/ns, 31.448 timesteps/s
|
||||
99.6% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 3.1748 | 3.1748 | 3.1748 | 0.0 | 99.84
|
||||
Neigh | 0.000314 | 0.000314 | 0.000314 | 0.0 | 0.01
|
||||
Comm | 0.000371 | 0.000371 | 0.000371 | 0.0 | 0.01
|
||||
Output | 0.00386 | 0.00386 | 0.00386 | 0.0 | 0.12
|
||||
Modify | 0.000236 | 0.000236 | 0.000236 | 0.0 | 0.01
|
||||
Other | | 0.000289 | | | 0.01
|
||||
|
||||
Nlocal: 128 ave 128 max 128 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 727 ave 727 max 727 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 3710 ave 3710 max 3710 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
FullNghs: 7420 ave 7420 max 7420 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 7420
|
||||
Ave neighs/atom = 57.9688
|
||||
Neighbor list builds = 1
|
||||
Dangerous builds = 0
|
||||
|
||||
Total wall time: 0:00:03
|
|
@ -0,0 +1,153 @@
|
|||
LAMMPS (19 Mar 2020)
|
||||
# Demonstrate SNAP Ta potential
|
||||
|
||||
# Initialize simulation
|
||||
|
||||
variable nsteps index 100
|
||||
variable nrep equal 1
|
||||
variable a equal 3.1803
|
||||
units metal
|
||||
|
||||
# generate the box and atom positions using a BCC lattice
|
||||
|
||||
variable nx equal ${nrep}
|
||||
variable nx equal 1
|
||||
variable ny equal ${nrep}
|
||||
variable ny equal 1
|
||||
variable nz equal ${nrep}
|
||||
variable nz equal 1
|
||||
|
||||
boundary p p p
|
||||
|
||||
lattice bcc $a
|
||||
lattice bcc 3.1803
|
||||
Lattice spacing in x,y,z = 3.1803 3.1803 3.1803
|
||||
region box block 0 ${nx} 0 ${ny} 0 ${nz}
|
||||
region box block 0 1 0 ${ny} 0 ${nz}
|
||||
region box block 0 1 0 1 0 ${nz}
|
||||
region box block 0 1 0 1 0 1
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (3.1803 3.1803 3.1803)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 2 atoms
|
||||
create_atoms CPU = 0.000215 secs
|
||||
displace_atoms all random 0.01 0.01 0.01 12345
|
||||
|
||||
mass 1 183.84
|
||||
|
||||
# choose potential
|
||||
|
||||
include W.snap.quadratic
|
||||
#
|
||||
#
|
||||
# Definition of SNAP+ZBL potential.
|
||||
variable zblcutinner equal 4
|
||||
variable zblcutouter equal 4.8
|
||||
variable zblz equal 74
|
||||
|
||||
# Specify hybrid with SNAP and ZBL
|
||||
|
||||
pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap
|
||||
pair_style hybrid/overlay zbl 4 ${zblcutouter} snap
|
||||
pair_style hybrid/overlay zbl 4 4.8 snap
|
||||
pair_coeff 1 1 zbl ${zblz} ${zblz}
|
||||
pair_coeff 1 1 zbl 74 ${zblz}
|
||||
pair_coeff 1 1 zbl 74 74
|
||||
pair_coeff * * snap W.quadratic.snapcoeff W.quadratic.snapparam W
|
||||
SNAP Element = W, Radius 0.5, Weight 1
|
||||
SNAP keyword rcutfac 4.73442
|
||||
SNAP keyword twojmax 6
|
||||
SNAP keyword rfac0 0.99363
|
||||
SNAP keyword rmin0 0
|
||||
SNAP keyword bzeroflag 1
|
||||
SNAP keyword quadraticflag 1
|
||||
|
||||
|
||||
# Setup output
|
||||
|
||||
compute eatom all pe/atom
|
||||
compute energy all reduce sum c_eatom
|
||||
|
||||
compute satom all stress/atom NULL
|
||||
compute str all reduce sum c_satom[1] c_satom[2] c_satom[3]
|
||||
variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol)
|
||||
|
||||
thermo_style custom step temp epair c_energy etotal press v_press
|
||||
thermo 10
|
||||
thermo_modify norm yes
|
||||
|
||||
dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom
|
||||
|
||||
# Set up NVE run
|
||||
|
||||
timestep 0.5e-3
|
||||
neighbor 1.0 bin
|
||||
neigh_modify once no every 1 delay 0 check no
|
||||
|
||||
# Run MD
|
||||
|
||||
velocity all create 300.0 4928459
|
||||
fix 1 all nve
|
||||
run ${nsteps}
|
||||
run 100
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5.8
|
||||
ghost atom cutoff = 5.8
|
||||
binsize = 2.9, bins = 2 2 2
|
||||
2 neighbor lists, perpetual/occasional/extra = 2 0 0
|
||||
(1) pair zbl, perpetual, half/full from (2)
|
||||
attributes: half, newton on
|
||||
pair build: halffull/newton
|
||||
stencil: none
|
||||
bin: none
|
||||
(2) pair snap, perpetual
|
||||
attributes: full, newton on
|
||||
pair build: full/bin/atomonly
|
||||
stencil: full/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 7.284 | 7.284 | 7.284 Mbytes
|
||||
Step Temp E_pair c_energy TotEng Press v_press
|
||||
0 300 -1.1575362 -1.1575362 -1.1381472 600966 -600966
|
||||
10 349.32287 -1.1607243 -1.1607243 -1.1381475 599985.48 -599985.48
|
||||
20 384.27065 -1.1629832 -1.1629832 -1.1381478 599287.89 -599287.89
|
||||
30 399.34846 -1.1639578 -1.1639578 -1.1381478 598986.42 -598986.42
|
||||
40 392.19413 -1.1634953 -1.1634953 -1.1381478 599130.05 -599130.05
|
||||
50 363.93932 -1.161669 -1.161669 -1.1381476 599694.93 -599694.93
|
||||
60 319.03014 -1.1587663 -1.1587663 -1.1381473 600588.89 -600588.89
|
||||
70 264.53512 -1.1552439 -1.1552439 -1.138147 601667.76 -601667.76
|
||||
80 209.04294 -1.1516571 -1.1516571 -1.1381466 602760.01 -602760.01
|
||||
90 161.3157 -1.1485722 -1.1485722 -1.1381463 603694.49 -603694.49
|
||||
100 128.9054 -1.1464773 -1.1464773 -1.1381461 604326.7 -604326.7
|
||||
Loop time of 0.030198 on 1 procs for 100 steps with 2 atoms
|
||||
|
||||
Performance: 143.056 ns/day, 0.168 hours/ns, 3311.478 timesteps/s
|
||||
98.4% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.028723 | 0.028723 | 0.028723 | 0.0 | 95.12
|
||||
Neigh | 0.000515 | 0.000515 | 0.000515 | 0.0 | 1.71
|
||||
Comm | 0.000263 | 0.000263 | 0.000263 | 0.0 | 0.87
|
||||
Output | 0.000618 | 0.000618 | 0.000618 | 0.0 | 2.05
|
||||
Modify | 2.7e-05 | 2.7e-05 | 2.7e-05 | 0.0 | 0.09
|
||||
Other | | 5.2e-05 | | | 0.17
|
||||
|
||||
Nlocal: 2 ave 2 max 2 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 187 ave 187 max 187 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 58 ave 58 max 58 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
FullNghs: 116 ave 116 max 116 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 116
|
||||
Ave neighs/atom = 58
|
||||
Neighbor list builds = 100
|
||||
Dangerous builds not checked
|
||||
|
||||
Total wall time: 0:00:00
|
|
@ -0,0 +1,356 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include "mliap_model_linear.h"
|
||||
#include "mliap_model_quadratic.h"
|
||||
#include "mliap_descriptor_snap.h"
|
||||
#include "compute_mliap.h"
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{SCALAR,VECTOR,ARRAY};
|
||||
|
||||
ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg), cutsq(NULL), list(NULL), mliap(NULL),
|
||||
mliap_peratom(NULL), mliapall(NULL)
|
||||
{
|
||||
|
||||
array_flag = 1;
|
||||
extarray = 0;
|
||||
|
||||
int ntypes = atom->ntypes;
|
||||
|
||||
if (narg < 4)
|
||||
error->all(FLERR,"Illegal compute mliap command");
|
||||
|
||||
// process keywords
|
||||
|
||||
int iarg = 0;
|
||||
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"model") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||
if (strcmp(arg[iarg+1],"linear") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||
model = new MLIAPModelLinear(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg+1],"quadratic") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||
model = new MLIAPModelQuadratic(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else error->all(FLERR,"Illegal compute mliap command");
|
||||
} else if (strcmp(arg[iarg],"descriptor") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||
if (strcmp(arg[iarg+1],"sna") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||
descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else error->all(FLERR,"Illegal compute mliap command");
|
||||
}
|
||||
}
|
||||
|
||||
nparams = model->nparams;
|
||||
nperdim = nparams;
|
||||
ndims_force = 3;
|
||||
ndims_virial = 6;
|
||||
yoffset = nperdim;
|
||||
zoffset = 2*nperdim;
|
||||
natoms = atom->natoms;
|
||||
size_array_rows = 1+ndims_force*natoms+ndims_virial;
|
||||
size_array_cols = nperdim*atom->ntypes+1;
|
||||
lastcol = size_array_cols-1;
|
||||
|
||||
ndims_peratom = ndims_force;
|
||||
size_peratom = ndims_peratom*nperdim*atom->ntypes;
|
||||
|
||||
nmax = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeMLIAP::~ComputeMLIAP()
|
||||
{
|
||||
memory->destroy(mliap);
|
||||
memory->destroy(mliapall);
|
||||
memory->destroy(mliap_peratom);
|
||||
memory->destroy(cutsq);
|
||||
|
||||
memory->destroy(map);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeMLIAP::init()
|
||||
{
|
||||
if (force->pair == NULL)
|
||||
error->all(FLERR,"Compute mliap requires a pair style be defined");
|
||||
|
||||
if (descriptor->get_cutmax() > force->pair->cutforce)
|
||||
error->all(FLERR,"Compute mliap cutoff is longer than pairwise cutoff");
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"mliap") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
error->warning(FLERR,"More than one compute mliap");
|
||||
|
||||
// allocate memory for global array
|
||||
|
||||
memory->create(mliap,size_array_rows,size_array_cols,
|
||||
"mliap:mliap");
|
||||
memory->create(mliapall,size_array_rows,size_array_cols,
|
||||
"mliap:mliapall");
|
||||
array = mliapall;
|
||||
|
||||
// find compute for reference energy
|
||||
|
||||
char *id_pe = (char *) "thermo_pe";
|
||||
int ipe = modify->find_compute(id_pe);
|
||||
if (ipe == -1)
|
||||
error->all(FLERR,"compute thermo_pe does not exist.");
|
||||
c_pe = modify->compute[ipe];
|
||||
|
||||
// add compute for reference virial tensor
|
||||
|
||||
char *id_virial = (char *) "mliap_press";
|
||||
char **newarg = new char*[5];
|
||||
newarg[0] = id_virial;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = (char *) "NULL";
|
||||
newarg[4] = (char *) "virial";
|
||||
modify->add_compute(5,newarg);
|
||||
delete [] newarg;
|
||||
|
||||
int ivirial = modify->find_compute(id_virial);
|
||||
if (ivirial == -1)
|
||||
error->all(FLERR,"compute mliap_press does not exist.");
|
||||
c_virial = modify->compute[ivirial];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeMLIAP::init_list(int /*id*/, NeighList *ptr)
|
||||
{
|
||||
list = ptr;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeMLIAP::compute_array()
|
||||
{
|
||||
int ntotal = atom->nlocal + atom->nghost;
|
||||
|
||||
invoked_array = update->ntimestep;
|
||||
|
||||
// grow mliap_peratom array if necessary
|
||||
|
||||
if (atom->nmax > nmax) {
|
||||
memory->destroy(mliap_peratom);
|
||||
nmax = atom->nmax;
|
||||
memory->create(mliap_peratom,nmax,size_peratom,
|
||||
"mliap:mliap_peratom");
|
||||
}
|
||||
|
||||
if (gamma_max < list->inum) {
|
||||
memory->grow(descriptors,list->inum,ndescriptors,"PairMLIAP:descriptors");
|
||||
memory->grow(gamma,nparams,list->inum,ndescriptors,"PairMLIAP:gamma");
|
||||
gamma_max = list->inum;
|
||||
}
|
||||
|
||||
// clear global array
|
||||
|
||||
for (int irow = 0; irow < size_array_rows; irow++)
|
||||
for (int icoeff = 0; icoeff < size_array_cols; icoeff++)
|
||||
mliap[irow][icoeff] = 0.0;
|
||||
|
||||
// clear local peratom array
|
||||
|
||||
for (int i = 0; i < ntotal; i++)
|
||||
for (int icoeff = 0; icoeff < size_peratom; icoeff++) {
|
||||
mliap_peratom[i][icoeff] = 0.0;
|
||||
}
|
||||
|
||||
// invoke full neighbor list (will copy or build if necessary)
|
||||
|
||||
neighbor->build_one(list);
|
||||
|
||||
// compute descriptors, if needed
|
||||
|
||||
if (model->nonlinearflag)
|
||||
descriptor->forward(map, list, descriptors);
|
||||
|
||||
// ***********THIS IS NOT RIGHT**********************
|
||||
// This whole idea is flawed. The gamma matrix is too big to
|
||||
// store. Instead, we should generate the A matrix,
|
||||
// just as ComputeSNAP does, and then pass it to
|
||||
// the model, which can evaluate gradients of E, F, sigma,
|
||||
// w.r.t. model parameters.
|
||||
|
||||
// calculate descriptor contributions to parameter gradients
|
||||
// and gamma = double gradient w.r.t. parameters and descriptors
|
||||
|
||||
// i.e. gamma = d2E/d\sigma.dB_i
|
||||
// sigma is a parameter and B_i is a descriptor of atom i
|
||||
// for SNAP, this is a sparse nparams*natoms*ndescriptors matrix,
|
||||
// but in general it could be fully dense.
|
||||
|
||||
// *******Not implemented yet*****************
|
||||
// This should populate the energy row and gamma
|
||||
// For the linear model energy row will look just like the Bi accumulation
|
||||
// in ComputeSNAP i.e. accumulating the intput descriptors vector,
|
||||
// while gamma will be just 1's and 0's
|
||||
// For the quadratic model, the energy row will be similar,
|
||||
// while gamma will be 1's, 0's and Bi's
|
||||
|
||||
// model->param_gradient(list, descriptors, mliap[0], gamma);
|
||||
|
||||
// calculate descriptor gradient contributions to parameter gradients
|
||||
|
||||
// *******Not implemented yet*****************
|
||||
// This will just take gamma and multiply it with
|
||||
// descriptor gradient contributions i.e. dblist
|
||||
// this will resemble snadi accumualation in ComputeSNAP
|
||||
// descriptor->param_backward(list, gamma, snadi);
|
||||
|
||||
// accumulate descriptor gradient contributions to global array
|
||||
|
||||
for (int itype = 0; itype < atom->ntypes; itype++) {
|
||||
const int typeoffset_local = ndims_peratom*nperdim*itype;
|
||||
const int typeoffset_global = nperdim*itype;
|
||||
for (int icoeff = 0; icoeff < nperdim; icoeff++) {
|
||||
int irow = 1;
|
||||
for (int i = 0; i < ntotal; i++) {
|
||||
double *snadi = mliap_peratom[i]+typeoffset_local;
|
||||
int iglobal = atom->tag[i];
|
||||
int irow = 3*(iglobal-1)+1;
|
||||
mliap[irow][icoeff+typeoffset_global] += snadi[icoeff];
|
||||
mliap[irow+1][icoeff+typeoffset_global] += snadi[icoeff+yoffset];
|
||||
mliap[irow+2][icoeff+typeoffset_global] += snadi[icoeff+zoffset];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// accumulate forces to global array
|
||||
|
||||
for (int i = 0; i < atom->nlocal; i++) {
|
||||
int iglobal = atom->tag[i];
|
||||
int irow = 3*(iglobal-1)+1;
|
||||
mliap[irow][lastcol] = atom->f[i][0];
|
||||
mliap[irow+1][lastcol] = atom->f[i][1];
|
||||
mliap[irow+2][lastcol] = atom->f[i][2];
|
||||
}
|
||||
|
||||
// accumulate bispectrum virial contributions to global array
|
||||
|
||||
dbdotr_compute();
|
||||
|
||||
// sum up over all processes
|
||||
|
||||
MPI_Allreduce(&mliap[0][0],&mliapall[0][0],size_array_rows*size_array_cols,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
// assign energy to last column
|
||||
|
||||
int irow = 0;
|
||||
double reference_energy = c_pe->compute_scalar();
|
||||
mliapall[irow++][lastcol] = reference_energy;
|
||||
|
||||
// assign virial stress to last column
|
||||
// switch to Voigt notation
|
||||
|
||||
c_virial->compute_vector();
|
||||
irow += 3*natoms;
|
||||
mliapall[irow++][lastcol] = c_virial->vector[0];
|
||||
mliapall[irow++][lastcol] = c_virial->vector[1];
|
||||
mliapall[irow++][lastcol] = c_virial->vector[2];
|
||||
mliapall[irow++][lastcol] = c_virial->vector[5];
|
||||
mliapall[irow++][lastcol] = c_virial->vector[4];
|
||||
mliapall[irow++][lastcol] = c_virial->vector[3];
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
compute global virial contributions via summing r_i.dB^j/dr_i over
|
||||
own & ghost atoms
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ComputeMLIAP::dbdotr_compute()
|
||||
{
|
||||
double **x = atom->x;
|
||||
int irow0 = 1+ndims_force*natoms;
|
||||
|
||||
// sum over bispectrum contributions to forces
|
||||
// on all particles including ghosts
|
||||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
for (int i = 0; i < nall; i++)
|
||||
for (int itype = 0; itype < atom->ntypes; itype++) {
|
||||
const int typeoffset_local = ndims_peratom*nperdim*itype;
|
||||
const int typeoffset_global = nperdim*itype;
|
||||
double *snadi = mliap_peratom[i]+typeoffset_local;
|
||||
for (int icoeff = 0; icoeff < nperdim; icoeff++) {
|
||||
double dbdx = snadi[icoeff];
|
||||
double dbdy = snadi[icoeff+yoffset];
|
||||
double dbdz = snadi[icoeff+zoffset];
|
||||
int irow = irow0;
|
||||
mliap[irow++][icoeff+typeoffset_global] += dbdx*x[i][0];
|
||||
mliap[irow++][icoeff+typeoffset_global] += dbdy*x[i][1];
|
||||
mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][2];
|
||||
mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][1];
|
||||
mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][0];
|
||||
mliap[irow++][icoeff+typeoffset_global] += dbdy*x[i][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double ComputeMLIAP::memory_usage()
|
||||
{
|
||||
|
||||
double bytes = size_array_rows*size_array_cols *
|
||||
sizeof(double); // mliap
|
||||
bytes += size_array_rows*size_array_cols *
|
||||
sizeof(double); // mliapall
|
||||
bytes += nmax*size_peratom * sizeof(double); // mliap_peratom
|
||||
int n = atom->ntypes+1;
|
||||
bytes += n*sizeof(int); // map
|
||||
|
||||
return bytes;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef COMPUTE_CLASS
|
||||
|
||||
ComputeStyle(mliap,ComputeMLIAP)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_COMPUTE_MLIAP_H
|
||||
#define LMP_COMPUTE_MLIAP_H
|
||||
|
||||
#include "compute.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ComputeMLIAP : public Compute {
|
||||
public:
|
||||
ComputeMLIAP(class LAMMPS *, int, char **);
|
||||
~ComputeMLIAP();
|
||||
void init();
|
||||
void init_list(int, class NeighList *);
|
||||
void compute_array();
|
||||
double memory_usage();
|
||||
|
||||
private:
|
||||
int natoms, nmax, size_peratom, lastcol;
|
||||
int nperdim, yoffset, zoffset;
|
||||
int ndims_peratom, ndims_force, ndims_virial;
|
||||
double **cutsq;
|
||||
class NeighList *list;
|
||||
double **mliap, **mliapall;
|
||||
double **mliap_peratom;
|
||||
int *map; // map types to [0,nelements)
|
||||
int nelements;
|
||||
|
||||
double*** gamma; // gammas for all atoms in list
|
||||
double** descriptors; // descriptors for all atoms in list
|
||||
int ndescriptors; // number of descriptors
|
||||
int gamma_max; // number of atoms allocated for beta, descriptors
|
||||
int nparams; // number of model paramters per element
|
||||
|
||||
class MLIAPModel* model;
|
||||
class MLIAPDescriptor* descriptor;
|
||||
|
||||
Compute *c_pe;
|
||||
Compute *c_virial;
|
||||
|
||||
void dbdotr_compute();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Compute snap requires a pair style be defined
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Compute snap cutoff is longer than pairwise cutoff
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
W: More than one compute snad/atom
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
*/
|
|
@ -0,0 +1,31 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "mliap_descriptor.h"
|
||||
#include "atom.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define MAXWORD 3
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPDescriptor::MLIAPDescriptor(LAMMPS *lmp) : Pointers(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPDescriptor::~MLIAPDescriptor(){}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_MLIAP_DESCRIPTOR_H
|
||||
#define LMP_MLIAP_DESCRIPTOR_H
|
||||
|
||||
#include "pointers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class MLIAPDescriptor : protected Pointers {
|
||||
public:
|
||||
MLIAPDescriptor(LAMMPS*);
|
||||
~MLIAPDescriptor();
|
||||
virtual void forward(int*, class NeighList*, double**)=0;
|
||||
virtual void backward(class PairMLIAP*, class NeighList*, double**, int)=0;
|
||||
virtual void init()=0;
|
||||
virtual double get_cutoff(int, int)=0;
|
||||
virtual double get_cutmax()=0;
|
||||
virtual double memory_usage()=0;
|
||||
|
||||
int ndescriptors; // number of descriptors
|
||||
int nelements; // # of unique elements
|
||||
char **elements; // names of unique elements
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,457 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "mliap_descriptor_snap.h"
|
||||
#include "pair_mliap.h"
|
||||
#include <mpi.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "sna.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define MAXWORD 3
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename):
|
||||
MLIAPDescriptor(lmp)
|
||||
{
|
||||
nelements = 0;
|
||||
elements = NULL;
|
||||
radelem = NULL;
|
||||
wjelem = NULL;
|
||||
snaptr = NULL;
|
||||
read_paramfile(paramfilename);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPDescriptorSNAP::~MLIAPDescriptorSNAP()
|
||||
{
|
||||
|
||||
if (nelements) {
|
||||
for (int i = 0; i < nelements; i++)
|
||||
delete[] elements[i];
|
||||
delete[] elements;
|
||||
memory->destroy(radelem);
|
||||
memory->destroy(wjelem);
|
||||
}
|
||||
|
||||
delete snaptr;
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
compute descriptors for each atom
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPDescriptorSNAP::forward(int* map, NeighList* list, double **descriptors)
|
||||
{
|
||||
int i,j,jnum,ninside;
|
||||
double delx,dely,delz,rsq;
|
||||
int *jlist;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
|
||||
for (int ii = 0; ii < list->inum; ii++) {
|
||||
i = list->ilist[ii];
|
||||
|
||||
const double xtmp = x[i][0];
|
||||
const double ytmp = x[i][1];
|
||||
const double ztmp = x[i][2];
|
||||
const int itype = type[i];
|
||||
const int ielem = map[itype];
|
||||
const double radi = radelem[ielem];
|
||||
|
||||
jlist = list->firstneigh[i];
|
||||
jnum = list->numneigh[i];
|
||||
|
||||
// insure rij, inside, wj, and rcutij are of size jnum
|
||||
|
||||
snaptr->grow_rij(jnum);
|
||||
|
||||
// rij[][3] = displacements between atom I and those neighbors
|
||||
// inside = indices of neighbors of I within cutoff
|
||||
// wj = weights for neighbors of I within cutoff
|
||||
// rcutij = cutoffs for neighbors of I within cutoff
|
||||
// note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi
|
||||
|
||||
ninside = 0;
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
j &= NEIGHMASK;
|
||||
delx = x[j][0] - xtmp;
|
||||
dely = x[j][1] - ytmp;
|
||||
delz = x[j][2] - ztmp;
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
int jtype = type[j];
|
||||
int jelem = map[jtype];
|
||||
|
||||
// printf("i = %d j = %d itype = %d jtype = %d cutsq[i][j] = %g rsq = %g\n",i,j,itype,jtype,cutsq[itype][jtype],rsq);
|
||||
|
||||
double rcutsqtmp = get_cutoff(ielem, jelem);
|
||||
if (rsq < rcutsqtmp*rcutsqtmp) {
|
||||
snaptr->rij[ninside][0] = delx;
|
||||
snaptr->rij[ninside][1] = dely;
|
||||
snaptr->rij[ninside][2] = delz;
|
||||
snaptr->inside[ninside] = j;
|
||||
snaptr->wj[ninside] = wjelem[jelem];
|
||||
snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac;
|
||||
snaptr->element[ninside] = jelem; // element index for alloy snap
|
||||
ninside++;
|
||||
}
|
||||
}
|
||||
|
||||
if (alloyflag)
|
||||
snaptr->compute_ui(ninside, ielem);
|
||||
else
|
||||
snaptr->compute_ui(ninside, 0);
|
||||
snaptr->compute_zi();
|
||||
if (alloyflag)
|
||||
snaptr->compute_bi(ielem);
|
||||
else
|
||||
snaptr->compute_bi(0);
|
||||
|
||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
||||
descriptors[ii][icoeff] = snaptr->blist[icoeff];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
compute forces for each atom
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPDescriptorSNAP::backward(PairMLIAP* pairmliap, NeighList* list, double **beta, int vflag)
|
||||
{
|
||||
int i,j,jnum,ninside;
|
||||
double delx,dely,delz,evdwl,rsq;
|
||||
double fij[3];
|
||||
int *jlist,*numneigh,**firstneigh;
|
||||
|
||||
double **x = atom->x;
|
||||
double **f = atom->f;
|
||||
int *type = atom->type;
|
||||
int nlocal = atom->nlocal;
|
||||
int newton_pair = force->newton_pair;
|
||||
|
||||
numneigh = list->numneigh;
|
||||
firstneigh = list->firstneigh;
|
||||
|
||||
for (int ii = 0; ii < list->inum; ii++) {
|
||||
i = list->ilist[ii];
|
||||
|
||||
const double xtmp = x[i][0];
|
||||
const double ytmp = x[i][1];
|
||||
const double ztmp = x[i][2];
|
||||
const int itype = type[i];
|
||||
const int ielem = pairmliap->map[itype];
|
||||
const double radi = radelem[ielem];
|
||||
|
||||
jlist = firstneigh[i];
|
||||
jnum = numneigh[i];
|
||||
|
||||
// insure rij, inside, wj, and rcutij are of size jnum
|
||||
|
||||
snaptr->grow_rij(jnum);
|
||||
|
||||
// rij[][3] = displacements between atom I and those neighbors
|
||||
// inside = indices of neighbors of I within cutoff
|
||||
// wj = weights for neighbors of I within cutoff
|
||||
// rcutij = cutoffs for neighbors of I within cutoff
|
||||
// note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi
|
||||
|
||||
ninside = 0;
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
j = jlist[jj];
|
||||
j &= NEIGHMASK;
|
||||
delx = x[j][0] - xtmp;
|
||||
dely = x[j][1] - ytmp;
|
||||
delz = x[j][2] - ztmp;
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
int jtype = type[j];
|
||||
int jelem = pairmliap->map[jtype];
|
||||
|
||||
if (rsq < pairmliap->cutsq[itype][jtype]&&rsq>1e-20) {
|
||||
snaptr->rij[ninside][0] = delx;
|
||||
snaptr->rij[ninside][1] = dely;
|
||||
snaptr->rij[ninside][2] = delz;
|
||||
snaptr->inside[ninside] = j;
|
||||
snaptr->wj[ninside] = wjelem[jelem];
|
||||
snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac;
|
||||
snaptr->element[ninside] = jelem; // element index for alloy snap
|
||||
ninside++;
|
||||
}
|
||||
}
|
||||
|
||||
// compute Ui, Yi for atom I
|
||||
|
||||
if (alloyflag)
|
||||
snaptr->compute_ui(ninside, ielem);
|
||||
else
|
||||
snaptr->compute_ui(ninside, 0);
|
||||
|
||||
// for neighbors of I within cutoff:
|
||||
// compute Fij = dEi/dRj = -dEi/dRi
|
||||
// add to Fi, subtract from Fj
|
||||
|
||||
snaptr->compute_yi(beta[ii]);
|
||||
//for (int q=0; q<snaptr->idxu_max*2; q++){
|
||||
// fprintf(screen, "%i %f\n",q, snaptr->ylist_r[q]);
|
||||
//}
|
||||
|
||||
for (int jj = 0; jj < ninside; jj++) {
|
||||
int j = snaptr->inside[jj];
|
||||
if(alloyflag)
|
||||
snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj],
|
||||
snaptr->rcutij[jj],jj, snaptr->element[jj]);
|
||||
else
|
||||
snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj],
|
||||
snaptr->rcutij[jj],jj, 0);
|
||||
|
||||
snaptr->compute_deidrj(fij);
|
||||
|
||||
f[i][0] += fij[0];
|
||||
f[i][1] += fij[1];
|
||||
f[i][2] += fij[2];
|
||||
f[j][0] -= fij[0];
|
||||
f[j][1] -= fij[1];
|
||||
f[j][2] -= fij[2];
|
||||
|
||||
// add in gloabl and per-atom virial contributions
|
||||
// this is optional and has no effect on force calculation
|
||||
|
||||
if (vflag)
|
||||
pairmliap->v_tally(i,j,
|
||||
fij[0],fij[1],fij[2],
|
||||
-snaptr->rij[jj][0],-snaptr->rij[jj][1],
|
||||
-snaptr->rij[jj][2]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more type pairs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPDescriptorSNAP::init()
|
||||
{
|
||||
|
||||
snaptr = new SNA(lmp, rfac0, twojmax,
|
||||
rmin0, switchflag, bzeroflag,
|
||||
alloyflag, wselfallflag, nelements);
|
||||
|
||||
snaptr->init();
|
||||
|
||||
ndescriptors = snaptr->ncoeff;
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename)
|
||||
{
|
||||
|
||||
// set flags for required keywords
|
||||
|
||||
int rcutfacflag = 0;
|
||||
int twojmaxflag = 0;
|
||||
int nelementsflag = 0;
|
||||
int elementsflag = 0;
|
||||
int radelemflag = 0;
|
||||
int wjelemflag = 0;
|
||||
|
||||
// Set defaults for optional keywords
|
||||
|
||||
rfac0 = 0.99363;
|
||||
rmin0 = 0.0;
|
||||
switchflag = 1;
|
||||
bzeroflag = 1;
|
||||
bnormflag = 0;
|
||||
alloyflag = 0;
|
||||
wselfallflag = 0;
|
||||
|
||||
// open SNAP parameter file on proc 0
|
||||
|
||||
FILE *fpparam;
|
||||
if (comm->me == 0) {
|
||||
fpparam = force->open_potential(paramfilename);
|
||||
if (fpparam == NULL) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
}
|
||||
|
||||
char line[MAXLINE],*ptr;
|
||||
int eof = 0;
|
||||
int n,nwords;
|
||||
|
||||
while (1) {
|
||||
if (comm->me == 0) {
|
||||
ptr = fgets(line,MAXLINE,fpparam);
|
||||
if (ptr == NULL) {
|
||||
eof = 1;
|
||||
fclose(fpparam);
|
||||
} else n = strlen(line) + 1;
|
||||
}
|
||||
MPI_Bcast(&eof,1,MPI_INT,0,world);
|
||||
if (eof) break;
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
|
||||
// strip comment, skip line if blank
|
||||
|
||||
if ((ptr = strchr(line,'#'))) *ptr = '\0';
|
||||
nwords = atom->count_words(line);
|
||||
if (nwords == 0) continue;
|
||||
|
||||
// words = ptrs to all words in line
|
||||
// strip single and double quotes from words
|
||||
|
||||
char* keywd = strtok(line,"' \t\n\r\f");
|
||||
char* keyval = strtok(NULL,"' \t\n\r\f");
|
||||
|
||||
if (comm->me == 0) {
|
||||
if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval);
|
||||
if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval);
|
||||
}
|
||||
|
||||
// check for keywords with one value per element
|
||||
|
||||
if (strcmp(keywd,"elems") == 0 ||
|
||||
strcmp(keywd,"radelems") == 0 ||
|
||||
strcmp(keywd,"welems") == 0) {
|
||||
|
||||
if (nelementsflag == 0 || nwords != nelements+1)
|
||||
error->all(FLERR,"Incorrect SNAP parameter file");
|
||||
|
||||
if (strcmp(keywd,"elems") == 0) {
|
||||
for (int ielem = 0; ielem < nelements; ielem++) {
|
||||
char* elemtmp = keyval;
|
||||
int n = strlen(elemtmp) + 1;
|
||||
elements[ielem] = new char[n];
|
||||
strcpy(elements[ielem],elemtmp);
|
||||
keyval = strtok(NULL,"' \t\n\r\f");
|
||||
}
|
||||
elementsflag = 1;
|
||||
} else if (strcmp(keywd,"radelems") == 0) {
|
||||
for (int ielem = 0; ielem < nelements; ielem++) {
|
||||
radelem[ielem] = atof(keyval);
|
||||
keyval = strtok(NULL,"' \t\n\r\f");
|
||||
}
|
||||
radelemflag = 1;
|
||||
} else if (strcmp(keywd,"welems") == 0) {
|
||||
for (int ielem = 0; ielem < nelements; ielem++) {
|
||||
wjelem[ielem] = atof(keyval);
|
||||
keyval = strtok(NULL,"' \t\n\r\f");
|
||||
}
|
||||
wjelemflag = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// all other keywords take one value
|
||||
|
||||
if (nwords != 2)
|
||||
error->all(FLERR,"Incorrect SNAP parameter file");
|
||||
|
||||
if (strcmp(keywd,"nelems") == 0) {
|
||||
nelements = atoi(keyval);
|
||||
elements = new char*[nelements];
|
||||
memory->create(radelem,nelements,"mliap_snap_descriptor:radelem");
|
||||
memory->create(wjelem,nelements,"mliap_snap_descriptor:wjelem");
|
||||
nelementsflag = 1;
|
||||
} else if (strcmp(keywd,"rcutfac") == 0) {
|
||||
rcutfac = atof(keyval);
|
||||
rcutfacflag = 1;
|
||||
} else if (strcmp(keywd,"twojmax") == 0) {
|
||||
twojmax = atoi(keyval);
|
||||
twojmaxflag = 1;
|
||||
} else if (strcmp(keywd,"rfac0") == 0)
|
||||
rfac0 = atof(keyval);
|
||||
else if (strcmp(keywd,"rmin0") == 0)
|
||||
rmin0 = atof(keyval);
|
||||
else if (strcmp(keywd,"switchflag") == 0)
|
||||
switchflag = atoi(keyval);
|
||||
else if (strcmp(keywd,"bzeroflag") == 0)
|
||||
bzeroflag = atoi(keyval);
|
||||
else if (strcmp(keywd,"alloyflag") == 0)
|
||||
alloyflag = atoi(keyval);
|
||||
else if (strcmp(keywd,"wselfallflag") == 0)
|
||||
wselfallflag = atoi(keyval);
|
||||
else
|
||||
error->all(FLERR,"Incorrect SNAP parameter file");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bnormflag = alloyflag;
|
||||
|
||||
if (!rcutfacflag || !twojmaxflag || !nelementsflag ||
|
||||
!elementsflag || !radelemflag || !wjelemflag)
|
||||
error->all(FLERR,"Incorrect SNAP parameter file");
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
provide cutoff distance for two elements
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double MLIAPDescriptorSNAP::get_cutoff(int ielem, int jelem)
|
||||
{
|
||||
return (radelem[ielem] + radelem[jelem])*rcutfac;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
calculate maximum cutoff distance
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double MLIAPDescriptorSNAP::get_cutmax()
|
||||
{
|
||||
double cut;
|
||||
double cutmax = 0.0;
|
||||
for(int ielem = 0; ielem <= nelements; ielem++) {
|
||||
cut = 2.0*radelem[ielem]*rcutfac;
|
||||
if (cut > cutmax) cutmax = cut;
|
||||
return cutmax;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double MLIAPDescriptorSNAP::memory_usage()
|
||||
{
|
||||
double bytes = 0;
|
||||
|
||||
bytes += snaptr->memory_usage(); // SNA object
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_MLIAP_DESCRIPTOR_SNAP_H
|
||||
#define LMP_MLIAP_DESCRIPTOR_SNAP_H
|
||||
|
||||
#include "mliap_descriptor.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class MLIAPDescriptorSNAP : public MLIAPDescriptor {
|
||||
public:
|
||||
MLIAPDescriptorSNAP(LAMMPS*, char*);
|
||||
~MLIAPDescriptorSNAP();
|
||||
virtual void forward(int*, class NeighList*, double**);
|
||||
virtual void backward(class PairMLIAP*, class NeighList*, double**, int);
|
||||
virtual void init();
|
||||
virtual double get_cutoff(int, int);
|
||||
virtual double get_cutmax();
|
||||
virtual double memory_usage();
|
||||
|
||||
double rcutfac; // declared public to workaround gcc 4.9
|
||||
// compiler bug, manifest in KOKKOS package
|
||||
protected:
|
||||
class SNA* snaptr;
|
||||
void read_paramfile(char *);
|
||||
inline int equal(double* x,double* y);
|
||||
inline double dist2(double* x,double* y);
|
||||
|
||||
double *radelem; // element radii
|
||||
double *wjelem; // elements weights
|
||||
int twojmax, switchflag, bzeroflag, bnormflag;
|
||||
int alloyflag, wselfallflag;
|
||||
double rfac0, rmin0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "mliap_model.h"
|
||||
#include "pair_mliap.h"
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define MAXWORD 3
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename) : Pointers(lmp)
|
||||
{
|
||||
nelements = 0;
|
||||
coeffelem = NULL;
|
||||
read_coeffs(coefffilename);
|
||||
nonlinearflag = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPModel::~MLIAPModel()
|
||||
{
|
||||
memory->destroy(coeffelem);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
placeholder
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPModel::init()
|
||||
{
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPModel::read_coeffs(char *coefffilename)
|
||||
{
|
||||
|
||||
// open coefficient file on proc 0
|
||||
|
||||
FILE *fpcoeff;
|
||||
if (comm->me == 0) {
|
||||
fpcoeff = force->open_potential(coefffilename);
|
||||
if (fpcoeff == NULL) {
|
||||
char str[128];
|
||||
snprintf(str,128,"Cannot open MLIAPModel coefficient file %s",coefffilename);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
}
|
||||
|
||||
char line[MAXLINE],*ptr;
|
||||
int eof = 0;
|
||||
|
||||
int n;
|
||||
int nwords = 0;
|
||||
while (nwords == 0) {
|
||||
if (comm->me == 0) {
|
||||
ptr = fgets(line,MAXLINE,fpcoeff);
|
||||
if (ptr == NULL) {
|
||||
eof = 1;
|
||||
fclose(fpcoeff);
|
||||
} else n = strlen(line) + 1;
|
||||
}
|
||||
MPI_Bcast(&eof,1,MPI_INT,0,world);
|
||||
if (eof) break;
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
|
||||
// strip comment, skip line if blank
|
||||
|
||||
if ((ptr = strchr(line,'#'))) *ptr = '\0';
|
||||
nwords = atom->count_words(line);
|
||||
}
|
||||
if (nwords != 2)
|
||||
error->all(FLERR,"Incorrect format in MLIAPModel coefficient file");
|
||||
|
||||
// words = ptrs to all words in line
|
||||
// strip single and double quotes from words
|
||||
|
||||
char* words[MAXWORD];
|
||||
int iword = 0;
|
||||
words[iword] = strtok(line,"' \t\n\r\f");
|
||||
iword = 1;
|
||||
words[iword] = strtok(NULL,"' \t\n\r\f");
|
||||
|
||||
nelements = atoi(words[0]);
|
||||
nparams = atoi(words[1]);
|
||||
|
||||
// set up coeff lists
|
||||
|
||||
memory->create(coeffelem,nelements,nparams,"mliap_snap_model:coeffelem");
|
||||
|
||||
// Loop over nelements blocks in the coefficient file
|
||||
|
||||
for (int ielem = 0; ielem < nelements; ielem++) {
|
||||
for (int icoeff = 0; icoeff < nparams; icoeff++) {
|
||||
if (comm->me == 0) {
|
||||
ptr = fgets(line,MAXLINE,fpcoeff);
|
||||
if (ptr == NULL) {
|
||||
eof = 1;
|
||||
fclose(fpcoeff);
|
||||
} else n = strlen(line) + 1;
|
||||
}
|
||||
|
||||
MPI_Bcast(&eof,1,MPI_INT,0,world);
|
||||
if (eof)
|
||||
error->all(FLERR,"Incorrect format in coefficient file");
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
MPI_Bcast(line,n,MPI_CHAR,0,world);
|
||||
|
||||
nwords = atom->count_words(line);
|
||||
if (nwords != 1)
|
||||
error->all(FLERR,"Incorrect format in coefficient file");
|
||||
|
||||
iword = 0;
|
||||
words[iword] = strtok(line,"' \t\n\r\f");
|
||||
|
||||
coeffelem[ielem][icoeff] = atof(words[0]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (comm->me == 0) fclose(fpcoeff);
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double MLIAPModel::memory_usage()
|
||||
{
|
||||
double bytes = 0;
|
||||
|
||||
int n = atom->ntypes+1;
|
||||
bytes += nelements*nparams*sizeof(double); // coeffelem
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_MLIAP_MODEL_H
|
||||
#define LMP_MLIAP_MODEL_H
|
||||
|
||||
#include "pointers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class MLIAPModel : protected Pointers {
|
||||
public:
|
||||
MLIAPModel(LAMMPS*, char*);
|
||||
~MLIAPModel();
|
||||
virtual void gradient(class PairMLIAP*, class NeighList*, double**, double**, int)=0;
|
||||
virtual void init();
|
||||
virtual double memory_usage();
|
||||
int nelements; // # of unique elements
|
||||
int nonlinearflag; // 1 if gradient() requires escriptors
|
||||
int ndescriptors; // number of descriptors
|
||||
int nparams; // number of parameters per element
|
||||
|
||||
protected:
|
||||
void read_coeffs(char *);
|
||||
double **coeffelem; // element coefficients
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "mliap_model_linear.h"
|
||||
#include "pair_mliap.h"
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define MAXWORD 3
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename) :
|
||||
MLIAPModel(lmp, coefffilename)
|
||||
{
|
||||
nonlinearflag = 0;
|
||||
ndescriptors = nparams - 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPModelLinear::~MLIAPModelLinear(){}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Calculate model gradients w.r.t descriptors for each atom dE(B_i)/dB_i
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPModelLinear::gradient(PairMLIAP* pairmliap, NeighList* list, double **descriptors, double **beta, int eflag)
|
||||
{
|
||||
int i;
|
||||
int *type = atom->type;
|
||||
|
||||
for (int ii = 0; ii < list->inum; ii++) {
|
||||
i = list->ilist[ii];
|
||||
const int itype = type[i];
|
||||
const int ielem = pairmliap->map[itype];
|
||||
double* coeffi = coeffelem[ielem];
|
||||
|
||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
||||
beta[ii][icoeff] = coeffi[icoeff+1];
|
||||
|
||||
// add in contributions to global and per-atom energy
|
||||
// this is optional and has no effect on force calculation
|
||||
|
||||
if (eflag) {
|
||||
|
||||
// energy of atom I
|
||||
|
||||
double* coeffi = coeffelem[ielem];
|
||||
double etmp = coeffi[0];
|
||||
|
||||
// E_i = beta.B_i
|
||||
|
||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
||||
etmp += coeffi[icoeff+1]*descriptors[ii][icoeff];
|
||||
|
||||
pairmliap->e_tally(i,etmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_MLIAP_MODEL_LINEAR_H
|
||||
#define LMP_MLIAP_MODEL_LINEAR_H
|
||||
|
||||
#include "mliap_model.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class MLIAPModelLinear : public MLIAPModel {
|
||||
public:
|
||||
MLIAPModelLinear(LAMMPS*, char*);
|
||||
~MLIAPModelLinear();
|
||||
virtual void gradient(class PairMLIAP*, class NeighList*, double**, double**, int);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "mliap_model_quadratic.h"
|
||||
#include "pair_mliap.h"
|
||||
#include <cmath>
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "neigh_list.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define MAXWORD 3
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename) :
|
||||
MLIAPModel(lmp, coefffilename)
|
||||
{
|
||||
nonlinearflag = 1;
|
||||
ndescriptors = sqrt(2*nparams)-1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
MLIAPModelQuadratic::~MLIAPModelQuadratic(){}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Calculate model gradients w.r.t descriptors for each atom dE(B_i)/dB_i
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void MLIAPModelQuadratic::gradient(PairMLIAP* pairmliap, NeighList* list, double **descriptors, double **beta, int eflag)
|
||||
{
|
||||
int i;
|
||||
int *type = atom->type;
|
||||
|
||||
for (int ii = 0; ii < list->inum; ii++) {
|
||||
i = list->ilist[ii];
|
||||
const int itype = type[i];
|
||||
const int ielem = pairmliap->map[itype];
|
||||
double* coeffi = coeffelem[ielem];
|
||||
|
||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
||||
beta[ii][icoeff] = coeffi[icoeff+1];
|
||||
|
||||
int k = ndescriptors+1;
|
||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++) {
|
||||
double bveci = descriptors[ii][icoeff];
|
||||
beta[ii][icoeff] += coeffi[k]*bveci;
|
||||
k++;
|
||||
for (int jcoeff = icoeff+1; jcoeff < ndescriptors; jcoeff++) {
|
||||
double bvecj = descriptors[ii][jcoeff];
|
||||
beta[ii][icoeff] += coeffi[k]*bvecj;
|
||||
beta[ii][jcoeff] += coeffi[k]*bveci;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
// add in contributions to global and per-atom energy
|
||||
// this is optional and has no effect on force calculation
|
||||
|
||||
if (eflag) {
|
||||
|
||||
// energy of atom I
|
||||
|
||||
double* coeffi = coeffelem[ielem];
|
||||
double etmp = coeffi[0];
|
||||
|
||||
// E_i = beta.B_i + 0.5*B_i^t.alpha.B_i
|
||||
|
||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++)
|
||||
etmp += coeffi[icoeff+1]*descriptors[ii][icoeff];
|
||||
|
||||
// quadratic contributions
|
||||
|
||||
int k = ndescriptors+1;
|
||||
for (int icoeff = 0; icoeff < ndescriptors; icoeff++) {
|
||||
double bveci = descriptors[ii][icoeff];
|
||||
etmp += 0.5*coeffi[k++]*bveci*bveci;
|
||||
for (int jcoeff = icoeff+1; jcoeff < ndescriptors; jcoeff++) {
|
||||
double bvecj = descriptors[ii][jcoeff];
|
||||
etmp += coeffi[k++]*bveci*bvecj;
|
||||
}
|
||||
}
|
||||
pairmliap->e_tally(i,etmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LMP_MLIAP_MODEL_QUADRATIC_H
|
||||
#define LMP_MLIAP_MODEL_QUADRATIC_H
|
||||
|
||||
#include "mliap_model.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class MLIAPModelQuadratic : public MLIAPModel {
|
||||
public:
|
||||
MLIAPModelQuadratic(LAMMPS*, char*);
|
||||
~MLIAPModelQuadratic();
|
||||
virtual void gradient(class PairMLIAP*, class NeighList*, double**, double**, int);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,323 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <mpi.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "mliap_model_linear.h"
|
||||
#include "mliap_model_quadratic.h"
|
||||
#include "mliap_descriptor_snap.h"
|
||||
#include "pair_mliap.h"
|
||||
#include "atom.h"
|
||||
#include "force.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairMLIAP::PairMLIAP(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
single_enable = 0;
|
||||
restartinfo = 0;
|
||||
one_coeff = 1;
|
||||
manybody_flag = 1;
|
||||
|
||||
beta_max = 0;
|
||||
beta = NULL;
|
||||
descriptors = NULL;
|
||||
|
||||
model = NULL;
|
||||
descriptor = NULL;
|
||||
map = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
PairMLIAP::~PairMLIAP()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
memory->destroy(beta);
|
||||
memory->destroy(descriptors);
|
||||
|
||||
delete model;
|
||||
delete descriptor;
|
||||
|
||||
if (allocated) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
memory->destroy(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
This version is a straightforward implementation
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void PairMLIAP::compute(int eflag, int vflag)
|
||||
{
|
||||
ev_init(eflag,vflag);
|
||||
|
||||
// resize lists
|
||||
|
||||
if (beta_max < list->inum) {
|
||||
memory->grow(beta,list->inum,ndescriptors,"PairMLIAP:beta");
|
||||
memory->grow(descriptors,list->inum,ndescriptors,"PairMLIAP:descriptors");
|
||||
beta_max = list->inum;
|
||||
}
|
||||
|
||||
// compute descriptors, if needed
|
||||
|
||||
if (model->nonlinearflag || eflag)
|
||||
descriptor->forward(map, list, descriptors);
|
||||
|
||||
// compute E_i and beta_i = dE_i/dB_i for all i in list
|
||||
|
||||
model->gradient(this, list, descriptors, beta, eflag);
|
||||
|
||||
// calculate force contributions beta_i*dB_i/dR_j
|
||||
|
||||
descriptor->backward(this, list, beta, vflag);
|
||||
|
||||
// calculate stress
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMLIAP::allocate()
|
||||
{
|
||||
allocated = 1;
|
||||
int n = atom->ntypes;
|
||||
|
||||
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||
memory->create(map,n+1,"pair:map");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
global settings
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMLIAP::settings(int narg, char ** arg)
|
||||
{
|
||||
if (narg < 4)
|
||||
error->all(FLERR,"Illegal pair_style command");
|
||||
|
||||
// process keywords
|
||||
|
||||
int iarg = 0;
|
||||
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"model") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
if (strcmp(arg[iarg+1],"linear") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
model = new MLIAPModelLinear(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg+1],"quadratic") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
model = new MLIAPModelQuadratic(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else error->all(FLERR,"Illegal pair_style mliap command");
|
||||
} else if (strcmp(arg[iarg],"descriptor") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
if (strcmp(arg[iarg+1],"sna") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else error->all(FLERR,"Illegal pair_style mliap command");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more type pairs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMLIAP::coeff(int narg, char **arg)
|
||||
{
|
||||
if (narg < 3) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
if (!allocated) allocate();
|
||||
|
||||
char* type1 = arg[0];
|
||||
char* type2 = arg[1];
|
||||
char** elemtypes = &arg[2];
|
||||
|
||||
// insure I,J args are * *
|
||||
|
||||
if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0)
|
||||
error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
|
||||
// read args that map atom types to elements
|
||||
// map[i] = which element the Ith atom type is, -1 if not mapped
|
||||
// map[0] is not used
|
||||
|
||||
for (int i = 1; i <= atom->ntypes; i++) {
|
||||
char* elemname = elemtypes[i-1];
|
||||
int jelem;
|
||||
for (jelem = 0; jelem < descriptor->nelements; jelem++)
|
||||
if (strcmp(elemname,descriptor->elements[jelem]) == 0)
|
||||
break;
|
||||
|
||||
if (jelem < descriptor->nelements)
|
||||
map[i] = jelem;
|
||||
else if (strcmp(elemname,"NULL") == 0) map[i] = -1;
|
||||
else error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
}
|
||||
|
||||
// clear setflag since coeff() called once with I,J = * *
|
||||
|
||||
int n = atom->ntypes;
|
||||
for (int i = 1; i <= n; i++)
|
||||
for (int j = i; j <= n; j++)
|
||||
setflag[i][j] = 0;
|
||||
|
||||
// set setflag i,j for type pairs where both are mapped to elements
|
||||
|
||||
int count = 0;
|
||||
for (int i = 1; i <= n; i++)
|
||||
for (int j = i; j <= n; j++)
|
||||
if (map[i] >= 0 && map[j] >= 0) {
|
||||
setflag[i][j] = 1;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
|
||||
model->init();
|
||||
descriptor->init();
|
||||
|
||||
// consistency checks
|
||||
|
||||
ndescriptors = descriptor->ndescriptors;
|
||||
if (ndescriptors != model->ndescriptors)
|
||||
error->all(FLERR,"Incompatible model and descriptor definitions");
|
||||
if (descriptor->nelements != model->nelements)
|
||||
error->all(FLERR,"Incompatible model and descriptor definitions");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
add energy of atom i to global and per-atom energy
|
||||
this is called by MLIAPModel::gradient()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMLIAP::e_tally(int i, double evdwl)
|
||||
{
|
||||
if (eflag_global) eng_vdwl += evdwl;
|
||||
if (eflag_atom) eatom[i] += evdwl;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
add virial contribution into global and per-atom accumulators
|
||||
this is called by MLIAPDescriptor::backward()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMLIAP::v_tally(int i, int j,
|
||||
double fx, double fy, double fz,
|
||||
double delx, double dely, double delz)
|
||||
{
|
||||
double v[6];
|
||||
|
||||
if (vflag_either) {
|
||||
v[0] = delx*fx;
|
||||
v[1] = dely*fy;
|
||||
v[2] = delz*fz;
|
||||
v[3] = delx*fy;
|
||||
v[4] = delx*fz;
|
||||
v[5] = dely*fz;
|
||||
|
||||
if (vflag_global) {
|
||||
virial[0] += v[0];
|
||||
virial[1] += v[1];
|
||||
virial[2] += v[2];
|
||||
virial[3] += v[3];
|
||||
virial[4] += v[4];
|
||||
virial[5] += v[5];
|
||||
}
|
||||
|
||||
if (vflag_atom) {
|
||||
vatom[i][0] += 0.5*v[0];
|
||||
vatom[i][1] += 0.5*v[1];
|
||||
vatom[i][2] += 0.5*v[2];
|
||||
vatom[i][3] += 0.5*v[3];
|
||||
vatom[i][4] += 0.5*v[4];
|
||||
vatom[i][5] += 0.5*v[5];
|
||||
|
||||
vatom[j][0] += 0.5*v[0];
|
||||
vatom[j][1] += 0.5*v[1];
|
||||
vatom[j][2] += 0.5*v[2];
|
||||
vatom[j][3] += 0.5*v[3];
|
||||
vatom[j][4] += 0.5*v[4];
|
||||
vatom[j][5] += 0.5*v[5];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init specific to this pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void PairMLIAP::init_style()
|
||||
{
|
||||
if (force->newton_pair == 0)
|
||||
error->all(FLERR,"Pair style MLIAP requires newton pair on");
|
||||
|
||||
// need a full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init for one type pair i,j and corresponding j,i
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairMLIAP::init_one(int i, int j)
|
||||
{
|
||||
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
||||
return descriptor->get_cutoff(map[i],map[j]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
double PairMLIAP::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
||||
int n = atom->ntypes+1;
|
||||
bytes += n*n*sizeof(int); // setflag
|
||||
bytes += n*n*sizeof(double); // cutsq
|
||||
bytes += beta_max*ndescriptors*sizeof(double); // descriptors
|
||||
bytes += beta_max*ndescriptors*sizeof(double); // beta
|
||||
|
||||
bytes += descriptor->memory_usage(); // Descriptor object
|
||||
bytes += model->memory_usage(); // Model object
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
|
||||
PairStyle(mliap,PairMLIAP)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_MLIAP_H
|
||||
#define LMP_PAIR_MLIAP_H
|
||||
|
||||
#include "pair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairMLIAP : public Pair {
|
||||
public:
|
||||
PairMLIAP(class LAMMPS *);
|
||||
~PairMLIAP();
|
||||
virtual void compute(int, int);
|
||||
void settings(int, char **);
|
||||
virtual void coeff(int, char **);
|
||||
void e_tally(int, double);
|
||||
void v_tally(int, int,
|
||||
double, double, double,
|
||||
double, double, double);
|
||||
virtual void init_style();
|
||||
virtual double init_one(int, int);
|
||||
virtual double memory_usage();
|
||||
int *map; // mapping from atom types to elements
|
||||
|
||||
protected:
|
||||
virtual void allocate();
|
||||
|
||||
double** beta; // betas for all atoms in list
|
||||
double** descriptors; // descriptors for all atoms in list
|
||||
int ndescriptors; // number of descriptors
|
||||
int beta_max; // number of atoms allocated for beta, descriptors
|
||||
|
||||
class MLIAPModel* model;
|
||||
class MLIAPDescriptor* descriptor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -48,7 +48,7 @@ endif
|
|||
|
||||
PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \
|
||||
granular kim kokkos kspace latte manybody mc message misc \
|
||||
molecule mpiio mscg opt peri poems \
|
||||
mliap molecule mpiio mscg opt peri poems \
|
||||
python qeq replica rigid shock snap spin srd voronoi
|
||||
|
||||
PACKUSER = user-adios user-atc user-awpmd user-bocs user-cgdna user-cgsdk user-colvars \
|
||||
|
|
Loading…
Reference in New Issue