Skip to content

Commit 940476b

Browse files
committed
bug fix
1 parent 1601737 commit 940476b

File tree

1 file changed

+12
-3
lines changed
  • src/aiidalab_qe/app/result/components/summary

1 file changed

+12
-3
lines changed

src/aiidalab_qe/app/result/components/summary/model.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,19 @@ def _generate_report_parameters(self):
200200
"positions": "atomic positions",
201201
"positions_cell": "full geometry",
202202
}
203-
constraints = 'None'
204-
if 'fixed_atoms' in structure.base.attributes.all:
205-
constraints = 'There are fixed atoms'
206203

204+
# check for fixed atoms
205+
constraints = 'None'
206+
fixed_atoms = structure.base.attributes.all.get('fixed_atoms', None)
207+
if fixed_atoms is not None:
208+
has_fixed = any(
209+
any((int(v) == 0) for v in row if v is not None)
210+
for row in fixed_atoms
211+
)
212+
# True if any element equals 0 (works for (N,3), (N,), or nested lists)
213+
if has_fixed:
214+
constraints = "There are fixed atoms"
215+
207216
report |= {
208217
"basic_settings": {
209218
"relaxed": relax_value_mapping.get(basic["relax_type"], "off"),

0 commit comments

Comments
 (0)