-
Notifications
You must be signed in to change notification settings - Fork 17
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
use displayed_structure to create selection info #371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @superstar54, I think there is an issue with this approach.
The displayed_structure
does not actually correspond to the "real" structure. So does the selection of atoms, etc.
One needs to make sure that the indexes selected for the displayed_structure
are mapped to the structure
and vice-versa.
That is the most complicated part here (I think).
Yes, this is the tricky part. In the case of the
In this |
Unfortunately, this is not always good. Because structure editors typically operate on the real atoms, not the virtual ones. So if you call an atom deletion, you don't want to attempt deleting the virtual atoms. Otherwise, things will crash. However, I see the need to compute the distance (angles, dihedrals) across the replicas. This can be done by operating on the virtual atoms (your approach). A possible solution would be to have two selections: @cpignedoli implemented an alternative approach in #373. I asked him to remove it from the PR since the "right way" doesn't look obvious. |
Two selections are not necessary, because the Another solution could be adding the validation of the This applies to the The validation is straightforward, the |
I don't think this is true in this particular case, nor in general. The reason to go from a data object to a subset of data could be simply due to convenience. See my reasoning below for this particular case.
Why add this validation to the editor, if this can be done once in the viewer? I think it makes more sense that the viewer already provides the correct selection. In the current approach, one could add an arbitrary number of editors, so this is not clear to me why every one of those should handle the selection if they are not supposed to act on the virtual atoms.
This we must fix.
I agree that the validation is straightforward, I just don't understand why you want to pass the |
Good point! I will implement validation in this way. |
@cpignedoli, @superstar54 and I discussed the selection handling. The draft schema below is what we've agreed on: |
I slightly changed my mind in part recovering what @yakutovicha was suggesting. Please @superstar54 and @yakutovicha consider this:
Thus I propose updating the skecth that we discussed as follows This allows me to make a selection in the sometimes more intuitive supercell representation |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Here are the changes:
I implemented what @cpignedoli suggested. However, the line for |
I agree we just have to decide how to pass the "unit cell atoms" set to the editors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @superstar54. A few comments:
- I thought we agreed to not convert the field where we type in formulas to the list of indices. That could simplify some logic. Also, some users complained that they were not happy with the disappearance of the formula.
- Related to the previous: I think we should display the
displayed_selection
along withunit cell atoms
.
@superstar54 any progress here? Let me know if I should take over this PR. |
Last two weeks have been very busy. I will work on this today. |
remove wrong_syntax line Co-authored-by: Aliaksandr Yakutovich <[email protected]>
remove wrong_syntax line Co-authored-by: Aliaksandr Yakutovich <[email protected]>
for more information, see https://pre-commit.ci
@danielhollas I can reassure you that we do not touch the handling cells. It is only about atom selection. |
I must admit that structure multiplication is not working as expected in the tests. It seems that the button is not always clicked. Instead of clicking, one should put a number there ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem:
after an edit operation the list of selected atoms /display atoms, should be updated according to what is defined in structures.py in the corresponding edit function. For example, after "copy" of a selection, the user should see highlighted automatically the newly added atoms. This is crucial to be able afterward to move correctly and easily the atoms. This is not the case anymore: after an edit operation, the selected /display atoms are reset.
Also, add "sleep" before pressing "Apply selection". Otherwise, the button is oftern pressed too fast.
@cpignedoli, your concern was addressed in f2d5f19. Please test it again and let me know if everything works as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything I tested was working.
Please in replace "Selected atoms" with "Select atoms" in the field where we enter the selection (e.g. x>2)
done in a2fd1e7 |
|
||
# if atom is selected from nglview, shift to selection tab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yakutovicha why was this code deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember the exact motivation. I think it is because the trait doesn't have to be set by nglview. If it is set elsewhere, the switching will still occur, which might be unwanted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense. Thanks!
…ption (#429) PR #371 broke the `configuration_tabs` option of the `StructureDataViewer`. In the latest release, no configuration tabs are displayed when this option is passed to the class constructor. Co-authored-by: Aliaksandr Yakutovich <[email protected]>
fixes #361
fixes #413
Since selection can only be applied to the
displayed_structure
, I replaced theself.structure
byself.displayed_structure
.