mbuild icon indicating copy to clipboard operation
mbuild copied to clipboard

Better representations of compound hierarchy

Open mattwthompson opened this issue 6 years ago • 3 comments

Some methods for interrogating other features of the hierarchy would be useful. The hierarchy behaves well, but we only have a few methods (mycompound.children, .parent .particles, maybe others?) for poking around. For example, one may wish to measure a compound's vertical height, i.e. "how many children down do I need to go until I reach particles?"

Sometimes I want to just "look" at my compound. Producing a full visualization is not tractable due to the size of most systems but it would be useful for smaller components, i.e. single molecules or looking at an individual monomer in a polymer. These sorts of methods and attributes would mostly help with debugging but I think they would be valuable additions.

mattwthompson avatar Jan 17 '19 20:01 mattwthompson

Trevor had worked on a "visualize the compound hierarchy" feature a while back but I can't find it on his fork: https://github.com/Jonestj1/mbuild

In general, it should be very possible to create a to_networkx for the hierarchy as opposed to the bond graph. Then you have all of the tools to interrogate the graph at your finger tips.

ctk3b avatar Jan 17 '19 22:01 ctk3b

I think I found it. It's old but enough to draw something from.

https://github.com/mosdef-hub/mbuild/blob/e24fe1405fe09fc45cd2e05abb6c6311012c077e/mbuild/compound.py#L194

mattwthompson avatar Jan 18 '19 11:01 mattwthompson

This is still an important issue that should be addressed. Most work has been focused on the total bond graph, but not the hierarchy. It should be simple enough to iterate through the children of a compound and create a node structure similar to this image

CalCraven avatar Aug 10 '22 19:08 CalCraven

Solved by #1096

daico007 avatar Mar 16 '23 10:03 daico007