Skip to content

An example to call SNAP routine #57

Open
@qzhu2017

Description

Here is an example to compute the SNAP descriptor

   Fe   Cr   Ni   Co
 1.000
    8.6838020000000000    0.0000000000000000    0.0000000000000000
    0.0000000000000000   11.6856200000000001    0.0000000000000000
    0.0000000000000000    0.0000000000000000   15.7084440000000001
   Fe   Cr   Ni   Co
   24   24   24   24
Direct
    0.7482575028771959   -0.0816076511130775    0.3883573700870691     Fe1
    0.5343281663953185    0.0288952575900979    0.3132773685286716     Fe2
    0.5622318426882603    0.2385316311843103    0.1511473701660075     Fe3
    0.7481285271128937    0.7766134787884598    0.7153413794517141     Fe4
    0.3321333213263039   -0.0855795413508226    0.7144947010665091     Fe5
    0.5391762732498968    0.0335597084279653    0.4714349810840590     Fe6
    0.3313652245871106    0.1336403203253229    0.5499914568241132     Fe7
    0.1363354438528193    0.2537109712621153    0.3041714379858374     Fe8
    0.1454385993600499    0.2468178838606766    0.4724108893280582     Fe9
    0.5615259306925698    0.2338652121154034    0.3182250259796578    Fe10
    0.3454569784064630    0.3612765090769681    0.3863215223608398    Fe11
   -0.0802360532863370    0.5788670177534441    0.2252648320864880    Fe12
    0.5579307312626428    0.4554880271650114    0.3094004727648391    Fe13
    0.3435684047148934    0.5635533245133763    0.2321312028104120    Fe14
    0.7354808412259976    0.1289208445936116    0.7146665831447087    Fe15
    0.1303046753023618    0.2432605201949062    0.6314304586756014    Fe16
   -0.0711457953555367    0.3532247326200921    0.7198230454906928    Fe17
    0.3516052070279815    0.1294257386428790    0.7233498110952301    Fe18
    0.3292382760454464    0.3580854075350731    0.7128777363308549    Fe19
   -0.0755287833600996    0.5873817563809195    0.5544374732468729    Fe20
    0.3316001447292327    0.5713980088347901    0.5521126089891525    Fe21
   -0.0808023950799431    0.5789440354897729    0.3809066002972669    Fe22
    0.1301457587356322    0.6830694477486005    0.3042682012298608    Fe23
    0.1136251148978293    0.6809471812364257    0.4710231006966699    Fe24
   -0.0629766777271062    0.7822109567143207    0.0620468838288503     Cr1
    0.3420241502512379   -0.0818901350548794    0.0666151275072184     Cr2
   -0.0589433061693484    0.7896928019223627    0.8762675666666920     Cr3
    0.1481033307760817    0.0170644775373493   -0.0166913412938926     Cr4
   -0.0802710609937905    0.1389228812848612    0.8747397259715858     Cr5
    0.3324960656634041   -0.0846104015020170    0.8779354594255167     Cr6
    0.5380719182680581    0.0240461353355663   -0.0110061824073727     Cr7
    0.1242439659494770    0.0195702068011796    0.1633280801077433     Cr8
    0.5622894211544667    0.0306807854439901    0.1504019112268535     Cr9
   -0.0707330729097693    0.1248363373103010    0.0638242718374907    Cr10
    0.1224302442639756    0.2551854330365013   -0.0231583726561332    Cr11
    0.3326480728141890    0.1330096306400516    0.0601577088093512    Cr12
    0.3252204506735644    0.3380650748526822    0.0563682182652846    Cr13
    0.7349822117086502    0.3440185458709080    0.8717731686219208    Cr14
    0.1206856167379220    0.4500865165904762   -0.0281405338428173    Cr15
    0.7331811572857142    0.5612753110232919    0.8688066112722559    Cr16
    0.3390323731471538    0.3499454885577317    0.8772988591358890    Cr17
    0.5579123061534568    0.4578464814019282   -0.0166411135310410    Cr18
    0.3436731975233889    0.5644698355756905    0.8742495437485724    Cr19
    0.1127261998834151    0.4451248628656417    0.1599833821860396    Cr20
    0.7480548266761495    0.5674718157872668    0.0624883024696781    Cr21
    0.1228551733445788    0.6794889787619314   -0.0161173824727643    Cr22
    0.3418433538673498    0.5537250056051798    0.0612010966840509    Cr23
    0.5440416536443370    0.6905572832250236   -0.0073627279697467    Cr24
    0.3350986123359331    0.1266787727138141    0.8795524241611709     Ni1
   -0.0549199532647106    0.1238659138325566    0.2494416378859676     Ni2
    0.3528212642342605    0.1327349340471451    0.2386697243851778     Ni3
    0.1425205226927099    0.2378692786518816    0.1421649400793611     Ni4
   -0.0715646211187220    0.3375533347824078    0.0606942991934784     Ni5
    0.5312212323588216    0.2429669970442304   -0.0114670810170632     Ni6
    0.1226594065594771    0.0317491070221349    0.6413047657680162     Ni7
    0.3187129324229180    0.1414302364786806    0.3880607143521026     Ni8
   -0.0787332553183502    0.3481098991752256    0.2333814857792408     Ni9
    0.3374696935743123    0.3441537547857966    0.2199963280895294    Ni10
    0.5406456757074839    0.4580210549376071    0.1386298986710587    Ni11
    0.1275282416618896    0.6776679371740653    0.1449710741560399    Ni12
    0.5407285886988210    0.6823206642009582    0.1449869891632806    Ni13
    0.1202618392266429    0.0341061064795877    0.7945153574727071    Ni14
    0.5436996375550709    0.0126254319411379    0.8078075715201327    Ni15
    0.1509776478091048    0.2482375774670064    0.8035359835767311    Ni16
    0.5267992061541708    0.2384725842531248    0.8045545440401353    Ni17
    0.5358804818442429    0.4561777637814682    0.4772477783286492    Ni18
    0.5275350589522885    0.4516953315271248    0.6431700046166252    Ni19
    0.1212637045386341    0.4564430470954901    0.7983158612017842    Ni20
    0.1092871532538397    0.6684395008566084    0.6430044885413221    Ni21
    0.1359070600642438    0.6692148127356530    0.7985004752857763    Ni22
    0.5260668080640255    0.6670934019761040    0.6326291770209704    Ni23
    0.5278229512833205    0.6699576060149141    0.7988888014624491    Ni24
    0.3247598229439133   -0.0728384116546662    0.3938123979688886     Co1
   -0.0781391607040326   -0.0817373832111604    0.2259218035853838     Co2
    0.1363861129030809    0.0293432440897445    0.3136771535105578     Co3
    0.3365184973125827   -0.0862230673254821    0.2320147049574102     Co4
    0.7477300841267455   -0.0729075564668370    0.5596633250244263     Co5
    0.1181878628738886    0.0220193708164394    0.4799889791757860     Co6
    0.7315355647215356    0.1390041777843195    0.5585295399085995     Co7
    0.3088589537163560    0.7846370154086818    0.5560423425770242     Co8
    0.5596154771838419    0.0103439098652874    0.6362635280744547     Co9
   -0.0614055916981986    0.1478654962252752    0.4016209371214616    Co10
   -0.0847649451242670    0.3488980473436583    0.4066067905898254    Co11
    0.5360244280097588    0.2380635344979556    0.4683290082709656    Co12
    0.1154908875167812    0.4579286336540124    0.3099473124136292    Co13
    0.5321563066500133    0.2357846652552454    0.6340901746856659    Co14
    0.7427449405225960    0.3583626713858571    0.5621632543617942    Co15
    0.1180116727672971    0.4500728245484621    0.4755410529521575    Co16
    0.1249867281635394    0.4639642569243224    0.6349432190737669    Co17
    0.3241045799984845    0.3533736335769946    0.5600631100063125    Co18
    0.3350226087605406    0.5706817438869312    0.3891830406627162    Co19
    0.5259942591966054    0.6907395585343353    0.3089058343397984    Co20
    0.5117700749049783    0.6953999873348612    0.4733320499471494    Co21
    0.5257627937624557    0.4601527347286665    0.8000856100069491    Co22
    0.7353564717389918    0.5652793775597701    0.7147175111678788    Co23
    0.3195558811681796    0.5677105707698864    0.7078931560630702    Co24
from pyxtal_ff.descriptors.SNAP import SO4_Bispectrum
from ase.io import read
import time

test = read('POSCAR', format='vasp')
print(test)
lmax, rcut = 3, 5.0
weights = {'Co': 0.6,
           'Cr': 0.4,
           'Fe': 0.7,
           'Ni': 0.5}
f = SO4_Bispectrum(weights, 
                   lmax = lmax, 
                   rcut = rcut, 
                   derivative = True, #dxdr
                   stress = True, #rdxdr
                  )
x = f.calculate(test)
for key, item in x.items(): 
    if type(item) == list:
        print(key, type(item), len(item))
    else:
        print(key, type(item), item.shape)

Executing the above script should give you the following output

Atoms(symbols='Co24Cr24Fe24Ni24', pbc=True, cell=[8.683802, 11.68562, 15.708444])
x <class 'numpy.ndarray'> (96, 30)
dxdr <class 'numpy.ndarray'> (3026, 30, 3)
elements <class 'list'> 96
seq <class 'numpy.ndarray'> (3026, 2)
rdxdr <class 'numpy.ndarray'> (3026, 30, 3, 3)

list of output:

  • x: N_atoms * N_descriptors
  • dxdr: [N_distance_pairs, N_descriptors, 3]
  • elements: [N_atoms]
  • seq: [N_distance_pairs, 2]
  • rdxdr: [N_distance_pairs, N_descriptors, 3, 3]

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions