def determine_convex_hull(formation_en_grid):
"""
Wraps the scipy.spatial ConvexHull algo for our purposes.
For now only for 2D phase diagrams
Adds the points [1.0, 0.0] and [0.0, 1.0], because in material science these
are always there.
:params: formation_en_grid: list of points in phase space [[x, formation_energy]]
:returns: a hul datatype
"""
import numpy as np
from scipy.spatial import ConvexHull
# TODO multi d
# check if endpoints are in
if [1.0, 0.0] not in formation_en_grid:
formation_en_grid.append([1.0, 0.0])
if [0.0, 0.0] not in formation_en_grid:
formation_en_grid.append([0.0, 0.0])
points = np.array(formation_en_grid)
hull = ConvexHull(points)
return hull
评论列表
文章目录