tut:void_vol
Table of Contents
How to calculate volume between points
Task
We had to calculate volume of obtained voids in the structure of copper GB highlighted by pink, blue and green
The shapes of voids are irregular.
Solution
ConvexHull() method from scipy.spatial
# Read the structure file
from siman.calc_manage import smart_structure_read
st = smart_structure_read('path_to_POSCAR')
#create lists with atomic coordinates of corner atoms of our voids
pink = [73,83,87,104,107,113]
green = [97,104,105,106,107,108,113,206,207,208]
blue = [83,85,87,112,113,114]
for void, name in zip([pink,blue,green],['pink','blue','green']):
pts_list=[]
for at in void:
pts_list.append(list(st.xcart[at]))
#find the volume of space between points
import scipy.spatial as ss
import numpy as np
hull = ss.ConvexHull(pts_list)
print(f'Volume of {name} void: {hull.volume:.2f} A^3')
Output
Volume of pink void: 8.73 A^3 Volume of blue void: 8.47 A^3 Volume of green void: 25.02 A^3
tut/void_vol.txt · Last modified: 2023/04/03 16:08 by a.boev
