struct
asext.struct
¶
Functions:
-
strain_struct–Apply engineering strain to an ASE Atoms structure along lattice vectors a, b, c.
-
perturb_struct–Perturb the atoms by random displacements. This method adds random displacements to the atomic positions. See more
-
slice_struct–Slice structure into the first subcell by given numbers along a, b, c (cell vector) directions.
-
align_struct_min_pos–Align min atoms position to the min cell corner (0,0,0)
-
set_vacuum–This function sets vacuum along cell vectors a, b, c.
-
check_bad_box_extxyz–Check structure in extxyz file whether it has bad box.
-
check_bad_box–Check if a simulation box is "bad" based on given criteria.
strain_struct(struct_in: Atoms, strains: list = [0, 0, 0]) -> Atoms
¶
Apply engineering strain to an ASE Atoms structure along lattice vectors a, b, c.
Parameters:
-
struct(Atoms) –ASE Atoms object.
-
strains(list[float], default:[0, 0, 0]) –Engineering strains [ε_a, ε_b, ε_c]. New_length = old_length * (1 + ε).
Returns:
-
atoms(Atoms) –New strained structure with scaled cell and atom positions.
perturb_struct(struct: Atoms, std_disp: float) -> Atoms
¶
Perturb the atoms by random displacements. This method adds random displacements to the atomic positions. See more
slice_struct(struct_in: Atoms, slice_num=(1, 1, 1), tol=1e-05) -> Atoms
¶
Slice structure into the first subcell by given numbers along a, b, c (cell vector) directions.
align_struct_min_pos(struct: Atoms) -> Atoms
¶
Align min atoms position to the min cell corner (0,0,0)
set_vacuum(struct_in: Atoms, distances: list = [0.0, 0.0, 0.0]) -> Atoms
¶
This function sets vacuum along cell vectors a, b, c.
Parameters:
-
struct(Atoms) –ASE Atoms object to add vacuum.
-
distances(list, default:[0.0, 0.0, 0.0]) –Distances to add along cell vectors a, b, c (not x, y, z dims in Cartersian axes). Must be a list of 3 floats.
Returns:
-
struct(Atoms) –A new Atoms object with an expanded cell and centered atoms.
Notes
atoms.center()sets vacuum on both sides of the cell along the specified axis. So the total vacuum is twice the input value. This function is different in that, it set total vacuum equal to the input value.
check_bad_box_extxyz(extxyz_file: str, criteria: dict = {'length_ratio': 100, 'wrap_ratio': 0.5, 'tilt_ratio': 0.5}) -> list[int]
¶
Check structure in extxyz file whether it has bad box. Return: a file remarking the bad box frames.
check_bad_box(struct: Atoms, criteria: dict = {'length_ratio': 20, 'wrap_ratio': 0.5, 'tilt_ratio': 0.5}) -> bool
¶
Check if a simulation box is "bad" based on given criteria.
Args:¶
struct : ase.Atoms
Atoms object containing the atomic structure.
criteria : dict
A dictionary of criteria to check, which contains pairs of {'criteria_name': threshold_value}.
Available criteria:
- length_ratio: The ratio of the longest to the shortest cell vector.
- Formula: max(|a|, |b|, |c|) / min(|a|, |b|, |c|)
- Prevents highly elongated simulation boxes.
- wrap_ratio: Checks if one cell vector component is excessively wrapped around another.
- Formula: [b_x / a_x, c_y / b_y, c_x / a_x]
- Prevents excessive skewing.
- tilt_ratio: Measures tilting of cell vectors relative to their axes.
- Formula: [b_x / b_y, c_y / c_z, c_x / c_z]
- Avoids excessive tilting that may disrupt periodic boundaries.
Returns:¶
is_bad : bool True if the simulation box violates any of the given criteria, otherwise False.
Raises:¶
RuntimeError If an unknown criterion key is provided.