Skip to content

Commit

Permalink
Fix surface layers.
Browse files Browse the repository at this point in the history
  • Loading branch information
knc6 committed Apr 25, 2024
1 parent 1381a0e commit 191c6ce
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion jarvis/analysis/defects/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,24 @@ def make_surface(self):
cartesian=True,
)
if self.thickness is not None and (self.thickness) > 0:
self.layers = int(self.thickness / new_atoms.lattice.c) + 1
new_lat = new_atoms.lattice_mat # lat_lengths()
a1 = new_lat[0]
a2 = new_lat[1]
a3 = new_lat[2]
new_lat = np.array(
[
a1,
a2,
np.cross(a1, a2)
* np.dot(a3, np.cross(a1, a2))
/ norm(np.cross(a1, a2)) ** 2,
]
)

a3 = new_lat[2]
self.layers = int(self.thickness / np.linalg.norm(a3)) + 1
# print("self.layers", self.layers)
# self.layers = int(self.thickness / new_atoms.lattice.c) + 1
# dims=get_supercell_dims(new_atoms,enforce_c_size=self.thickness)
# print ('dims=',dims,self.layers)
# surf_atoms = new_atoms.make_supercell_matrix([1, 1, dims[2]])
Expand Down

0 comments on commit 191c6ce

Please sign in to comment.