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

changing the labels of periodicity widget #933

Merged
merged 11 commits into from
Nov 28, 2024
27 changes: 18 additions & 9 deletions src/aiidalab_qe/common/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,12 @@ def __init__(self, title="", **kwargs):
)
self.periodicity = ipw.RadioButtons(
options=[
"xyz",
"xy",
"x",
"molecule",
("3D (bulk systems)", "xyz"),
("2D (surfaces, slabs, ...)", "xy"),
("1D (wires)", "x"),
("0D (molecules)", "molecule"),
],
value="xyz",
description="Periodicty: ",
layout={"width": "initial"},
)
self.select_periodicity = ipw.Button(
Expand Down Expand Up @@ -507,6 +506,16 @@ def __init__(self, title="", **kwargs):
ipw.HTML(
"<b>Define periodicity</b>",
),
ipw.HTML("""
<p>Select the periodicity of your system.</p>
<p style="font-weight: bold; color: #1f77b4;">NOTE:</p>

<ul style="padding-left: 2em; list-style-type: disc;">
<li>For <b>2D</b> systems (e.g., surfaces, slabs), the non-periodic direction must be the third lattice vector (z-axis).</li>
<li>For <b>1D</b> systems (e.g., wires), the periodic direction must be the first lattice vector (x-axis).</li>

</ul>
"""),
self.periodicity,
self.select_periodicity,
],
Expand Down Expand Up @@ -612,10 +621,10 @@ def _reset_all_tags(self, _=None):
def _select_periodicity(self, _=None):
"""Select periodicity."""
periodicity_options = {
"xyz": (True, True, True),
"xy": (True, True, False),
"x": (True, False, False),
"molecule": (False, False, False),
"3D": (True, True, True),
"2D": (True, True, False),
"1D": (True, False, False),
"Molecule": (False, False, False),
}
new_structure = deepcopy(self.structure)
new_structure.set_pbc(periodicity_options[self.periodicity.value])
Expand Down
Loading