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

Structure importers: cannot import the same structure twice. #381

Closed
cpignedoli opened this issue Nov 10, 2022 · 2 comments · May be fixed by #549
Closed

Structure importers: cannot import the same structure twice. #381

cpignedoli opened this issue Nov 10, 2022 · 2 comments · May be fixed by #549
Assignees
Milestone

Comments

@cpignedoli
Copy link
Member

Suppose I have two importers: "from file" and "SMILES":

If I do the following:

  1. Create a molecule from SMILES C=C, I will obtain the correct C2H4 molecule
  2. After that, I import the file.xyz, and the molecule will be correctly replaced by the uploaded structure.
  3. Then, switching back to SMILES and pressing "Generate molecule" will do nothing because the SMILES string is unchanged.
  4. Modifying the SMILES string to another value (C for instance) correctly provides a new molecule.
  5. Additionally, if I go back to "Import from computer" and re-import the same file. xyz, it will do nothing again. If I import a different file, it will work.

It seems to be related to the traits notification problem. Since the trait somehow keeps the same value it does not notifies the structure update.

Additional observation.

For an unknown reason the information about the change of the structure trait of an importer doesn't go to the input_structure of the manager, even though it should:

dlink((importer, "structure"), (self, "input_structure"))

@danielhollas
Copy link
Contributor

I think the fix for this is to always assign None to the structure traitlets at the beginning of any structure import / creation operation. Unrelated to this problem, I always found it confusing when the structure is not reset when e.g. the upload or import operation fails.

@cpignedoli
Copy link
Member Author

The issue is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment