marrink-lab / bentopy

Packs stuff in boxes
4 stars 0 forks source link

Add a `keep` option for setting the segment center #24

Open ma3ke opened 3 months ago

ma3ke commented 3 months ago

In addition to the auto/value for setting the center, it would be wonderful to have a keep option. This would set the center for some axis to be taken as the geometric center across that axis directly from the structure.

For instance, if the geometric center for the z-axis in some gro file is 5.0 nm, the two following expressions should behave identically:

The motivation for such a feature is that some segment structure files are already centered in some meaningful manner. A prime example would be membrane protein structures that are centered over the bilayer center.

Implementing this properly will take some consideration, however. Though the auto/value centering was not trivial with respect to the interactions of different notions of offsets in different parts of the program, the flow of information is still rather similar. On the other hand, the keep directive would require knowledge of the structure at points in the program where that information is not already available. Though I don't think it is not a terrible hard change, it may reach deeper and touch more parts. It could, perhaps, prompt a refactor of the Segment and Space classes. I'll think about it a bit more.

Originally posted by @ma3ke in https://github.com/marrink-lab/bentopy/issues/23#issuecomment-2112164292