diff --git a/jarvis/__init__.py b/jarvis/__init__.py index afffb341..c6964e76 100644 --- a/jarvis/__init__.py +++ b/jarvis/__init__.py @@ -1,6 +1,6 @@ """Version number.""" -__version__ = "2024.4.10" +__version__ = "2024.4.20" import os diff --git a/jarvis/analysis/defects/surface.py b/jarvis/analysis/defects/surface.py index 7a52b74e..224e9f0f 100644 --- a/jarvis/analysis/defects/surface.py +++ b/jarvis/analysis/defects/surface.py @@ -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. @@ -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): @@ -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]]) diff --git a/setup.py b/setup.py index 4a03d57a..5dc2d10d 100644 --- a/setup.py +++ b/setup.py @@ -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",