"""Ideal vertex coordinates for reference coordination geometries.
Coordinates are centred on the origin and at unit distance, matching the
conventions used by pymatgen's chemenv module from which they were
originally extracted.
"""
from __future__ import annotations
import numpy as np
REFERENCE_GEOMETRIES: dict[str, np.ndarray] = {
# CN=4
"Tetrahedron": np.array([
[0.5773502691896257, -0.5773502691896257, -0.5773502691896257],
[-0.5773502691896257, 0.5773502691896257, -0.5773502691896257],
[-0.5773502691896257, -0.5773502691896257, 0.5773502691896257],
[0.5773502691896257, 0.5773502691896257, 0.5773502691896257],
]),
# CN=5
"Trigonal bipyramid": np.array([
[0.0, 1.0, 0.0],
[0.8660254037844386, -0.5, 0.0],
[-0.8660254037844386, -0.5, 0.0],
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
]),
"Square pyramid": np.array([
[1.0, 0.0, 0.0],
[-1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, -1.0, 0.0],
[0.0, 0.0, 1.0],
]),
# CN=6
"Octahedron": np.array([
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
[1.0, 0.0, 0.0],
[-1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, -1.0, 0.0],
]),
"Trigonal prism": np.array([
[-0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.0, 0.7559289460184545, 0.6546536707079771],
[-0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.0, 0.7559289460184545, -0.6546536707079771],
]),
# CN=7
"Pentagonal bipyramid": np.array([
[1.0, 0.0, 0.0],
[0.30901699437494745, 0.9510565162951535, 0.0],
[-0.8090169943749473, 0.5877852522924732, 0.0],
[-0.8090169943749476, -0.587785252292473, 0.0],
[0.30901699437494723, -0.9510565162951536, 0.0],
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
]),
"Square-face capped trigonal prism": np.array([
[-0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.0, 0.7559289460184545, 0.6546536707079771],
[-0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.0, 0.7559289460184545, -0.6546536707079771],
[0.0, -1.0, 0.0],
]),
"Face-capped octahedron": np.array([
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
[1.0, 0.0, 0.0],
[-1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, -1.0, 0.0],
[0.5773502691896257, 0.5773502691896257, 0.5773502691896257],
]),
# CN=8
"Cube": np.array([
[-0.5773502691896257, -0.5773502691896257, -0.5773502691896257],
[0.5773502691896257, -0.5773502691896257, -0.5773502691896257],
[-0.5773502691896257, 0.5773502691896257, -0.5773502691896257],
[-0.5773502691896257, -0.5773502691896257, 0.5773502691896257],
[-0.5773502691896257, 0.5773502691896257, 0.5773502691896257],
[0.5773502691896257, -0.5773502691896257, 0.5773502691896257],
[0.5773502691896257, 0.5773502691896257, -0.5773502691896257],
[0.5773502691896257, 0.5773502691896257, 0.5773502691896257],
]),
"Square antiprism": np.array([
[0.0, 0.859532503769496, 0.5110810845293938],
[0.0, -0.859532503769496, 0.5110810845293938],
[0.859532503769496, 0.0, 0.5110810845293938],
[-0.859532503769496, 0.0, 0.5110810845293938],
[0.6077812620656623, 0.6077812620656623, -0.5110810845293938],
[0.6077812620656623, -0.6077812620656623, -0.5110810845293938],
[-0.6077812620656623, 0.6077812620656623, -0.5110810845293938],
[-0.6077812620656623, -0.6077812620656623, -0.5110810845293938],
]),
"Square-face bicapped trigonal prism": np.array([
[-0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.0, 0.7559289460184545, 0.6546536707079771],
[-0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.0, 0.7559289460184545, -0.6546536707079771],
[0.8660254037844386, 0.5, 0.0],
[-0.8660254037844386, 0.5, 0.0],
]),
"Triangular-face bicapped trigonal prism": np.array([
[-0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, 0.6546536707079771],
[0.0, 0.7559289460184545, 0.6546536707079771],
[-0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.6546536707079771, -0.37796447300922725, -0.6546536707079771],
[0.0, 0.7559289460184545, -0.6546536707079771],
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
]),
"Dodecahedron with triangular faces": np.array([
[-0.5, 0.0, -0.783930924235],
[0.5, 0.0, -0.783930924235],
[0.0, -0.644584273224, -0.20556156585599994],
[0.0, 0.644584273224, -0.20556156585599994],
[-0.644584273224, 0.0, 0.20556156585100005],
[0.644584273224, 0.0, 0.20556156585100005],
[0.0, -0.5, 0.783930924235],
[0.0, 0.5, 0.783930924235],
]),
"Hexagonal bipyramid": np.array([
[1.0, 0.0, 0.0],
[0.5000000000000001, 0.8660254037844386, 0.0],
[-0.4999999999999998, 0.8660254037844387, 0.0],
[-1.0, 1.2246467991473532e-16, 0.0],
[-0.5000000000000004, -0.8660254037844384, 0.0],
[0.5000000000000001, -0.8660254037844386, 0.0],
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
]),
"Bicapped octahedron (opposed cap faces)": np.array([
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
[1.0, 0.0, 0.0],
[-1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, -1.0, 0.0],
[0.5773502691896257, 0.5773502691896257, 0.5773502691896257],
[-0.5773502691896257, -0.5773502691896257, -0.5773502691896257],
]),
"Bicapped octahedron (cap faces with one atom in common)": np.array([
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
[1.0, 0.0, 0.0],
[-1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, -1.0, 0.0],
[0.5773502691896257, 0.5773502691896257, 0.5773502691896257],
[0.5773502691896257, -0.5773502691896257, -0.5773502691896257],
]),
"Bicapped octahedron (cap faces with one edge in common)": np.array([
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0],
[1.0, 0.0, 0.0],
[-1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, -1.0, 0.0],
[0.5773502691896257, -0.5773502691896257, 0.5773502691896257],
[0.5773502691896257, -0.5773502691896257, -0.5773502691896257],
]),
}
for _arr in REFERENCE_GEOMETRIES.values():
_arr.flags.writeable = False
[docs]
def get_reference_geometry(name: str) -> np.ndarray:
"""Return the ideal vertex coordinates for a named reference geometry.
Args:
name: The geometry name, e.g. ``'Octahedron'``, ``'Tetrahedron'``.
Returns:
An Nx3 array of ideal vertex coordinates centred on the origin.
Raises:
KeyError: If the name is not a recognised geometry.
"""
return REFERENCE_GEOMETRIES[name].copy()