-
Notifications
You must be signed in to change notification settings - Fork 652
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
Add a method to copy a Universe #1249
Comments
A lazy first effort (and probably valid for most cases) would be to read filenames and just recreate a Universe off those files, but a much better and rigorous approach is to properly copy the potentially modified objects. Another thing to bear in mind is whether we're doing deep copies or shallow copies of things. This will be most notable when dealing with numpy arrays, and are we copying a view of the data (ie making a copy of a pointer for ourselves) or making an independent copy of the array. Probably better to make sure we're making copies of the numpy arrays. Definitely worth making Similarly, if we can copy a trajectory, we are much closer to serialising, so that's also a huge step towards our parallel efforts. |
I guess we might want to have a |
I very much like the idea of adding We could start with a highly experimental version, which just does what probably most people have been doing when they cloned a universe: just re-read from files. Add |
Duplicate of #1029 |
I didn't know that GitHub knows how to mark issues as duplicates! Are there other magic words for issue comments ... ? |
This issue follows a comment by @kain88-de: #1027 (comment)
Copying a
Universe
, while is looks easy, can go wrong in multiple ways. When copying aUniverse
, one must think about, at least, these things:A
copy
method inUniverse
would streamline the copy.One way to implement such method would be to have a
copy
method in readers, topologies, and auxiliaries. The standard case would be implemented in the base class. Specific case, like the memory reader, would overwrite the method.Being able to copy AtomGroups and to attach them to a copy of a universe could also come handy, but is out of scope of the proposal.
The text was updated successfully, but these errors were encountered: