Skip to content

Conversation

cpignedoli
Copy link
Member

@cpignedoli cpignedoli commented Sep 17, 2025

connected to aiidalab/aiidalab-widgets-base#706
Constraints on x,y,z for each atom are stored in the ASE array 'fixed_atoms' .
image
image
The additional column is not present in case no constraints were specified

I need help (I would prefer in a separate PR), e.g. @edan-bainglass @superstar54, to add some warning logics:
If I load a structure that has constraints and I try to do phonons-related properties, I should get a warning. The warning can disappear only if 1)I remove the constraints, and 2) I do an additional geo-opt.

We should think about how to make this editor more general, including other types of constraints

Copy link

codecov bot commented Sep 17, 2025

Codecov Report

❌ Patch coverage is 21.87500% with 125 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.29%. Comparing base (22e0b0e) to head (0b94534).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/aiidalab_qe/common/widgets.py 12.12% 116 Missing ⚠️
...qe/app/result/components/viewer/structure/model.py 68.00% 8 Missing ⚠️
src/aiidalab_qe/workflows/__init__.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1397      +/-   ##
==========================================
- Coverage   72.40%   71.29%   -1.12%     
==========================================
  Files         109      109              
  Lines        7317     7468     +151     
==========================================
+ Hits         5298     5324      +26     
- Misses       2019     2144     +125     
Flag Coverage Δ
python-3.11 71.26% <21.87%> (-1.12%) ⬇️
python-3.9 71.29% <21.87%> (-1.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# Try to get fixed_atoms from AiiDA StructureData attributes
fixed_atoms = None
try:
fixed_atoms = self.structure.base.attributes.all['fixed_atoms']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you do something like fixed_atoms = self.structure.base.attributes.all.get('fixed_atoms', None) ?

chemical_symbols = ase_atoms.get_chemical_symbols()
tags = ase_atoms.get_tags()

def fmt_free(mask):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here, you can put a condition if mask is not an instance , mask = (0,0,0) and then you do return f"({' '.join('✓' if val else 'x' for val in mask)})"

self.input_selection = deepcopy(self.selection)


class AddingFixedAtomsEditor(ipw.VBox):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could name this editor, as ConstraintEditor , so in the future new constraints as implemented

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @AndresOrtegaGuerrero, thanks for the comments.
image
I have in mind how to modify the Editor to allow for other constraints, such as "distance", "torsion",..., but before we can do so, we would need such features implemented in the aiida plugin. Anyone willing to take the challenge @mbercx @superstar54 @edan-bainglass @AndresOrtegaGuerrero ?
We will also have to think about some warnings, since in QE, with symmetries, constraints can break the optimization.

@cpignedoli
Copy link
Member Author

Tables in the editor and in the result page now look like this:
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants