diff --git a/src/aiidalab_qe/app/configuration/basic/basic.py b/src/aiidalab_qe/app/configuration/basic/basic.py
index 6976e298d..57e25d037 100644
--- a/src/aiidalab_qe/app/configuration/basic/basic.py
+++ b/src/aiidalab_qe/app/configuration/basic/basic.py
@@ -45,6 +45,10 @@ def render(self):
(self._model, "spin_type"),
(self.spin_type, "value"),
)
+ self.spin_type.observe(
+ self._on_spin_type_change,
+ "value",
+ )
# Spin-Orbit calculation
self.spin_orbit = ipw.ToggleButtons(style={"description_width": "initial"})
@@ -68,6 +72,29 @@ def render(self):
(self.protocol, "value"),
)
+ self.warning = ipw.HTML(
+ value="""
+
+
+ Warning: detected multiples atoms with different tags.
+ You may be interested in an antiferromagnetic system. Note that
+ default starting magnetic moments do not distinguish tagged
+ atoms and are set to the same value.
+
+
+ Please go to Advanced settings and override the default
+ values, specifying appropriate starting magnetization for each
+ species (e.g. with different signs for an antiferromagnetic
+ configuration).
+
+
+ """,
+ layout=ipw.Layout(display="none"),
+ )
+
self.children = [
InAppGuide(identifier="basic-settings"),
ipw.HTML("""
@@ -140,9 +167,16 @@ def render(self):
(at the price of longer/costlier calculations).
"""),
+ self.warning,
]
self.rendered = True
def _on_input_structure_change(self, _):
self.refresh(specific="structure")
+
+ def _on_spin_type_change(self, _):
+ if self._model.spin_type == "collinear" and self._model.has_tags:
+ self.warning.layout.display = "flex"
+ else:
+ self.warning.layout.display = "none"
diff --git a/src/aiidalab_qe/app/configuration/basic/model.py b/src/aiidalab_qe/app/configuration/basic/model.py
index e9e826741..f526e547d 100644
--- a/src/aiidalab_qe/app/configuration/basic/model.py
+++ b/src/aiidalab_qe/app/configuration/basic/model.py
@@ -1,13 +1,16 @@
import traitlets as tl
-from aiida import orm
from aiidalab_qe.app.parameters import DEFAULT_PARAMETERS
+from aiidalab_qe.common.mixins import HasInputStructure
from aiidalab_qe.common.panel import ConfigurationSettingsModel
DEFAULT: dict = DEFAULT_PARAMETERS # type: ignore
-class BasicConfigurationSettingsModel(ConfigurationSettingsModel):
+class BasicConfigurationSettingsModel(
+ ConfigurationSettingsModel,
+ HasInputStructure,
+):
title = "Basic settings"
identifier = "workchain"
@@ -15,8 +18,6 @@ class BasicConfigurationSettingsModel(ConfigurationSettingsModel):
"input_structure",
]
- input_structure = tl.Union([tl.Instance(orm.StructureData)], allow_none=True)
-
protocol_options = tl.List(
trait=tl.Tuple(tl.Unicode(), tl.Unicode()),
default_value=[
diff --git a/src/aiidalab_qe/common/mixins.py b/src/aiidalab_qe/common/mixins.py
index fa43a1632..e6629a3e4 100644
--- a/src/aiidalab_qe/common/mixins.py
+++ b/src/aiidalab_qe/common/mixins.py
@@ -26,6 +26,13 @@ def has_structure(self):
def has_pbc(self):
return not self.has_structure or any(self.input_structure.pbc)
+ @property
+ def has_tags(self):
+ return any(
+ not kind_name.isalpha()
+ for kind_name in self.input_structure.get_kind_names()
+ )
+
class HasModels(t.Generic[T]):
def __init__(self):