Skip to content

Commit

Permalink
Make c surface an option.
Browse files Browse the repository at this point in the history
  • Loading branch information
knc6 committed Apr 25, 2024
1 parent 191c6ce commit 105160b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion jarvis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Version number."""

__version__ = "2024.4.10"
__version__ = "2024.4.20"

import os

Expand Down
40 changes: 22 additions & 18 deletions jarvis/analysis/defects/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ def __init__(
atoms=None,
indices=[0, 0, 1],
layers=3,
thickness=25,
thickness=None,
vacuum=18.0,
tol=1e-10,
from_conventional_structure=True,
use_thickness_c=True,
):
"""Initialize the class.
Expand Down Expand Up @@ -67,6 +68,7 @@ def __init__(
self.vacuum = vacuum
self.layers = layers
self.thickness = thickness
self.use_thickness_c = use_thickness_c
# Note thickness overwrites layers

def to_dict(self):
Expand Down Expand Up @@ -147,24 +149,26 @@ def make_surface(self):
cartesian=True,
)
if self.thickness is not None and (self.thickness) > 0:
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
if not self.use_thickness_c:
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
else:
self.layers = int(self.thickness / new_atoms.lattice.c) + 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name="jarvis-tools",
version="2024.4.10",
version="2024.4.20",
long_description=long_d,
install_requires=[
"numpy>=1.20.1",
Expand Down

0 comments on commit 105160b

Please sign in to comment.