diffcalc.ub.crystal¶
Crystal lattice information.
A module defining crystal lattice class and auxiliary methods for calculating crystal plane geometric properties.
Classes
|
Class containing crystal lattice information and auxiliary routines. |
- class diffcalc.ub.crystal.Crystal(name: str, system: str | None = None, a: float | None = None, b: float | None = None, c: float | None = None, alpha: float | None = None, beta: float | None = None, gamma: float | None = None)[source]¶
Class containing crystal lattice information and auxiliary routines.
Contains the lattice parameters and calculated B matrix for the crystal under test. Also Calculates the distance between planes at a given hkl value.
- name¶
Crystal name.
- Type:
str
- a1¶
Crystal lattice parameter.
- Type:
float
- a2¶
Crystal lattice parameter.
- Type:
float
- a3¶
Crystal lattice parameter.
- Type:
float
- alpha1¶
Crystal lattice angle.
- Type:
float
- alpha2¶
Crystal lattice angle.
- Type:
float
- alpha3¶
Crystal lattice angle.
- Type:
float
- system¶
Crystal system name.
- Type:
str
- B¶
B matrix.
- Type:
np.ndarray
- Attributes:
asdictSerialise the crystal into a JSON compatible dictionary.
Methods
get_hkl_plane_angle(hkl1, hkl2)Calculate the angle between crystal lattice planes.
Calculate distance between crystal lattice planes.
Get all crystal name and crystal lattice parameters.
Get crystal name and non-redundant set of crystal lattice parameters.
Create a new crystal lattice and calculates B matrix.
- Parameters:
name (str) – Crystal name.
system (Optional[float], default = None) – Crystal lattice type.
a (Optional[float], default = None) – Crystal lattice parameter.
b (Optional[float], default = None) – Crystal lattice parameter.
c (Optional[float], default = None) – Crystal lattice parameter.
alpha (Optional[float], default = None) – Crystal lattice angle.
beta (Optional[float], default = None) – Crystal lattice angle.
gamma (Optional[float], default = None) – Crystal lattice angle.
- Attributes:
asdictSerialise the crystal into a JSON compatible dictionary.
Methods
get_hkl_plane_angle(hkl1, hkl2)Calculate the angle between crystal lattice planes.
Calculate distance between crystal lattice planes.
Get all crystal name and crystal lattice parameters.
Get crystal name and non-redundant set of crystal lattice parameters.
- get_lattice() Tuple[str, float, float, float, float, float, float][source]¶
Get all crystal name and crystal lattice parameters.
- Returns:
Crystal name and crystal lattice parameters.
- Return type:
Tuple[str, float, float, float, float, float, float]
- get_lattice_params() Tuple[str, Tuple[float, ...]][source]¶
Get crystal name and non-redundant set of crystal lattice parameters.
- Returns:
Crystal name and minimal set of parameters for the crystal lattice system.
- Return type:
Tuple[str, Tuple[float, …]]
- get_hkl_plane_distance(hkl: Tuple[float, float, float]) float[source]¶
Calculate distance between crystal lattice planes.
- Parameters:
hkl (Tuple[float, float, float]) – Miller indices of the lattice plane.
- Returns:
Crystal lattice plane distance.
- Return type:
float
- get_hkl_plane_angle(hkl1: Tuple[float, float, float], hkl2: Tuple[float, float, float]) float[source]¶
Calculate the angle between crystal lattice planes.
- Parameters:
hkl1 (Tuple[float, float, float]) – Miller indices of the first lattice plane.
hkl2 (Tuple[float, float, float]) – Miller indices of the second lattice plane.
- Returns:
The angle between the crystal lattice planes in degrees.
- Return type:
float
- property asdict: Dict[str, Any]¶
Serialise the crystal into a JSON compatible dictionary.
Note, because the class automatically assumes all angles are in degrees, the returned angles alpha, beta and gamma are given in degrees such that the dictionary can be directly unpacked as is.
- Returns:
Dictionary containing properties of crystal class. Can be directly unpacked to recreate Crystal object, i.e. Crystal(**returned_dict).
- Return type:
Dict[str, Any]