schrodinger / pymol-open-source

Open-source foundation of the user-sponsored PyMOL molecular visualization system.
https://pymol.org/
Other
1.15k stars 275 forks source link

Add atom object name on the `cmd.get_model()` returned model #380

Closed pslacerda closed 1 month ago

pslacerda commented 1 month ago

Now cmd.get_model() returns an atom model with the object name on it. I didn't want to use the object variable because it is a built-in, however I thought that any other name would be misleading.

JarrettSJohnson commented 1 month ago

Aside from the compilation errors, I'm wondering if this is the right approach. Wouldn't each atom's object name be duplicated (wasted space)? Would it make sense to have the name be stored per-object/model rather than per-atom?

pslacerda commented 1 month ago

I had this doubt and thought that resn is duplicate all over atoms, specially for polymers and decided to replicate.

And I'm not sure if the same happens when the string is built from the C API, but Python's strings of the same value share the same memory space.

pslacerda commented 1 month ago

I decided to return the object name on the atom model because it's convenient. It would be even more if it worked on iterate.

JarrettSJohnson commented 1 month ago

Thanks for the PR!