Tutorials#

Here we will learn some bvlain routines on the example of NaVPO\(_4\)F compound (see fig. 1 below)

NaVPO4F_iso.png

Figure 1. Crystal structure of KTP-structured NaVPO\(_4\)F. Black spheres are Na\(^{+}\) ions

How it is supposed to work#

The sequence of steps for calculation is following:

  1. Import class from the package from bvlain import Lain

  2. Define the calculator calc = Lain()

  3. Read structure calc.read_file('file.cif')

  4. Define parameters for BVSE distribution calculation params = {'some_param': some_value, ...}

  5. Calculate BVSE distribution calc.bvse_distribution(**params)

  6. After the last step we have the distribution

  7. Apply method on the top of this distribution: calc.percolation_analysis(encut = 5.0), etc.

Note: methods depending on BVSE distribution won’t work before calc.bvse_distribution(**params) is invoked

Import#

[1]:
from bvlain import Lain

Calculation of BVSE distribution#

[2]:
file = '/Users/artemdembitskiy/Downloads/NaVPO4F.cif' # your .cif file, only ordered structures allowed

calc = Lain(verbose = True)        # define calculator
calc.read_file(file) # read structure

# define params
params = {
    'mobile_ion': 'Na1+',
    'r_cut': 10.0,
    'resolution': 0.2,
    'k': 100
}

_ = calc.bvse_distribution(**params) # calculate bvse distribution
getting BVSE distribution...
        collecting force field parameters... Na | charge: 1.0
        collecting neighbors...
distribution is ready

Percolation analysis#

[8]:
calc.percolation_barriers(encut = 5.0)
[8]:
{'E_1D': 0.166, 'E_2D': 0.4395, 'E_3D': 0.4492}

That’s it. As you could see, there is a quite low activation threshold for 1D percolation (see fig.2). At 0.45 eV the percolation network becomes 3-dimensional (not shown). Note that the percolation thresholds are found with 0.01 eV precision.

Write .grd file for VESTA 3.0#

[9]:
calc.write_grd(file)

map_1D.png

Figure 2. Na\(^+\) 1D percolation trajectory in VPO\(_4\)F framework. Black spheres are Na\(^{+}\) ions

BVS mismatch#

Also we can check if assigned oxidation states are in agreement with crystal structure. It can be done with Lain.mismatch method that calculates Bond Valence sum mismatch.

[10]:
table = calc.mismatch(r_cut = 4.0)
print(table.to_string())
   atom     x/a     y/b     z/c  formal_charge       bvs  mismatch
0    Na  0.7735  0.2784  0.3557              1  0.727085 -0.272915
1    Na  0.2265  0.7784  0.6443              1  0.727085 -0.272915
2    Na  0.7265  0.2784  0.8557              1  0.727085 -0.272915
3    Na  0.2735  0.7784  0.1443              1  0.727085 -0.272915
4    Na  0.7942  0.0479  0.1034              1  0.793218 -0.206782
5    Na  0.2058  0.5479  0.8966              1  0.793218 -0.206782
6    Na  0.7058  0.0479  0.6034              1  0.793218 -0.206782
7    Na  0.2942  0.5479  0.3966              1  0.793218 -0.206782
8     V  0.4992  0.0064  0.3828              3  2.736372 -0.263628
9     V  0.5008  0.5064  0.6172              3  2.736372 -0.263628
10    V  0.0008  0.0064  0.8828              3  2.736372 -0.263628
11    V  0.9992  0.5064  0.1172              3  2.736372 -0.263628
12    V  0.2506  0.2509  0.2415              3  2.690837 -0.309163
13    V  0.7494  0.7509  0.7585              3  2.690837 -0.309163
14    V  0.2494  0.2509  0.7415              3  2.690837 -0.309163
15    V  0.7506  0.7509  0.2585              3  2.690837 -0.309163
16    P  0.3393  0.2642  0.4917              5  4.762002 -0.237998
17    P  0.6607  0.7642  0.5083              5  4.762002 -0.237998
18    P  0.1607  0.2642  0.9917              5  4.762002 -0.237998
19    P  0.8393  0.7642  0.0083              5  4.762002 -0.237998
20    P  0.5017  0.5053  0.1829              5  4.819918 -0.180082
21    P  0.4983  0.0053  0.8171              5  4.819918 -0.180082
22    P  0.9983  0.5053  0.6829              5  4.819918 -0.180082
23    P  0.0017  0.0053  0.3171              5  4.819918 -0.180082
24    O  0.5046  0.1593  0.4772             -2  1.882046 -0.117954
25    O  0.4954  0.6593  0.5228             -2  1.882046 -0.117954
26    O  0.9954  0.1593  0.9772             -2  1.882046 -0.117954
27    O  0.0046  0.6593  0.0228             -2  1.882046 -0.117954
28    O  0.4674  0.3876  0.4985             -2  1.842362 -0.157638
29    O  0.5326  0.8876  0.5015             -2  1.842362 -0.157638
30    O  0.0326  0.3876  0.9985             -2  1.842362 -0.157638
31    O  0.9674  0.8876  0.0015             -2  1.842362 -0.157638
32    O  0.1923  0.2743  0.3959             -2  1.789972 -0.210028
33    O  0.8077  0.7743  0.6041             -2  1.789972 -0.210028
34    O  0.3077  0.2743  0.8959             -2  1.789972 -0.210028
35    O  0.6923  0.7743  0.1041             -2  1.789972 -0.210028
36    O  0.2051  0.2406  0.5891             -2  1.749525 -0.250475
37    O  0.7949  0.7406  0.4109             -2  1.749525 -0.250475
38    O  0.2949  0.2406  0.0891             -2  1.749525 -0.250475
39    O  0.7051  0.7406  0.9109             -2  1.749525 -0.250475
40    O  0.3104  0.5339  0.1131             -2  1.865734 -0.134266
41    O  0.6896  0.0339  0.8869             -2  1.865734 -0.134266
42    O  0.1896  0.5339  0.6131             -2  1.865734 -0.134266
43    O  0.8104  0.0339  0.3869             -2  1.865734 -0.134266
44    O  0.6928  0.4885  0.1125             -2  1.794946 -0.205054
45    O  0.3072  0.9885  0.8875             -2  1.794946 -0.205054
46    O  0.8072  0.4885  0.6125             -2  1.794946 -0.205054
47    O  0.1928  0.9885  0.3875             -2  1.794946 -0.205054
48    O  0.5288  0.6173  0.2592             -2  1.844736 -0.155264
49    O  0.4712  0.1173  0.7408             -2  1.844736 -0.155264
50    O  0.9712  0.6173  0.7592             -2  1.844736 -0.155264
51    O  0.0288  0.1173  0.2408             -2  1.844736 -0.155264
52    O  0.4633  0.3898  0.2529             -2  1.816623 -0.183377
53    O  0.5367  0.8898  0.7471             -2  1.816623 -0.183377
54    O  0.0367  0.3898  0.7529             -2  1.816623 -0.183377
55    O  0.9633  0.8898  0.2471             -2  1.816623 -0.183377
56    F  0.5094  0.8728  0.2730             -1  0.998247 -0.001753
57    F  0.4906  0.3728  0.7270             -1  0.998247 -0.001753
58    F  0.9906  0.8728  0.7730             -1  0.998247 -0.001753
59    F  0.0094  0.3728  0.2270             -1  0.998247 -0.001753
60    F  0.4915  0.1279  0.2614             -1  0.945241 -0.054759
61    F  0.5085  0.6279  0.7386             -1  0.945241 -0.054759
62    F  0.0085  0.1279  0.7614             -1  0.945241 -0.054759
63    F  0.9915  0.6279  0.2386             -1  0.945241 -0.054759