Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add shift options when building dual surface #8

Merged
merged 1 commit into from
Mar 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add shift options when building dual surface
  • Loading branch information
daico007 committed Jan 13, 2022
commit b7184b0e22afffefc0cec19a994c665ffba097d5
8 changes: 7 additions & 1 deletion surface_coatings/monolayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,19 @@ class DualMonolayer(mb.Compound):
separation: float, optional, default=0.8
The separation between the two surfaces.
"""
def __init__(self, top, bottom, separation=0.8):
def __init__(self, top, bottom, separation=0.8, shift=False):
super(DualMonolayer, self).__init__()
top.spin(np.pi, around=[0, 1, 0])

bot_box = bottom.get_boundingbox()
z_val = bot_box.lengths[2]
top.translate([0, 0, z_val + separation])

if shift:
top.translate([bottom.pos[0] - top.pos[0],
bottom.pos[1] - top.pos[1],
0])

if (top.name and bottom.name) and (top.name != bottom.name):
self.add(top, label=top.name)
self.add(bottom, label=bottom.name)
Expand Down