Skip to content

Commit

Permalink
reuse center_slab func
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed May 16, 2024
1 parent 28e20b1 commit b607536
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pymatgen/core/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,10 +1153,7 @@ def get_slab(

# Center the slab layer around the vacuum
if self.center_slab:
# TODO: (DanielYang59): use following center_slab
# slab = center_slab(slab)
c_center = np.mean([coord[2] for coord in struct.frac_coords])
struct.translate_sites(list(range(len(struct))), [0, 0, 0.5 - c_center])
struct = center_slab(struct)

# Reduce to primitive cell
if self.primitive:
Expand Down Expand Up @@ -1207,7 +1204,7 @@ def get_slabs(
repair: bool = False,
) -> list[Slab]:
"""Generate slabs with shift values calculated from the internal
gen_possible_terminations method. If the user decide to avoid breaking
gen_possible_terminations func. If the user decide to avoid breaking
any polyhedral bond (by setting `bonds`), any shift value that do so
would be filtered out.
Expand Down Expand Up @@ -1242,7 +1239,7 @@ def gen_possible_terminations(ftol: float) -> list[float]:
frac_coords = self.oriented_unit_cell.frac_coords
n_atoms: int = len(frac_coords)

# Skip clusterring when there is only one atom
# Skip clustering when there is only one atom
if n_atoms == 1:
# Put the atom to the center
termination = frac_coords[0][2] + 0.5
Expand Down

0 comments on commit b607536

Please sign in to comment.