Skip to content

Commit

Permalink
vacuum as new parameter for heteroribbon
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrederiksen committed Nov 8, 2023
1 parent e2a8e27 commit a0ba8b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sisl/geom/nanoribbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class _heteroribbon_section(CompositeGeometrySection):
atoms: Atom = None
bond: float = None
kind: str = "armchair"
vacuum: float = 20.0
shift_quantum: bool = False
on_lone_atom: str = field(default="ignore", repr=False)
invert_first: bool = field(default=False, repr=False)
Expand Down Expand Up @@ -422,7 +423,7 @@ def _offset_from_center(self, align, prev):

def build_section(self, prev):
new_section = nanoribbon(
bond=self.bond, atoms=self.atoms, width=self.W, kind=self.kind
bond=self.bond, atoms=self.atoms, width=self.W, kind=self.kind, vacuum=self.vacuum,
)

align, offset = self._align_offset(prev, new_section)
Expand Down Expand Up @@ -511,15 +512,15 @@ def add_section(self, geom, new_section):
new_min = new_section[:, self.trans_ax].min()
new_max = new_section[:, self.trans_ax].max()
if new_min < 0:
cell_offset = -new_min + 14
cell_offset = -new_min + self.vacuum
geom = geom.add_vacuum(cell_offset, self.trans_ax)
move = np.zeros(3)
move[self.trans_ax] = cell_offset
geom = geom.move(move)
new_section = new_section.move(move)
if new_max > geom.cell[1, 1]:
geom = geom.add_vacuum(
new_max - geom.cell[self.trans_ax, self.trans_ax] + 14, self.trans_ax
new_max - geom.cell[self.trans_ax, self.trans_ax] + self.vacuum, self.trans_ax
)

self.xyz = new_section.xyz
Expand Down

0 comments on commit a0ba8b5

Please sign in to comment.