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

Copying of molecule objects loaded from custom xyz files fails #49

Closed
YHordijk opened this issue Oct 25, 2023 · 1 comment · Fixed by #48
Closed

Copying of molecule objects loaded from custom xyz files fails #49

YHordijk opened this issue Oct 25, 2023 · 1 comment · Fixed by #48
Assignees
Labels
bug Something isn't working

Comments

@YHordijk
Copy link
Contributor

When loading a molecule using TCutility.molecule.load we capture information about the molecule and the atoms in their respective flags attribute. Because flags is a TCutility.results.result.Result object there will be issues whenever you call the copy method of the molecule. This method is very often used (for example in workflows) and we therefore should fix this. One way of fixing it is to overload the __reduce__ method of the TCutility.results.result.Result class. This method should return a single string specifying the name and namespace of the class. This then tells copy.deepcopy (which plams uses) what the class is supposed to be.

@YHordijk YHordijk added the bug Something isn't working label Oct 25, 2023
@YHordijk YHordijk self-assigned this Oct 25, 2023
@YHordijk YHordijk linked a pull request Oct 25, 2023 that will close this issue
@YHordijk
Copy link
Contributor Author

I have added a test-case. You can see that it will pass if we define the __reduce__ method, but will fail if we do not define it. There seems to be some weird stuff going on under the hood of copy.deepcopy, but I don't know enough about the deeper parts of Python to fully understand it. Documentation is also a bit complicated a scarce about this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant