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

Add a function that will flatten a Compound, but group connected components #1108

Closed
chrisiacovella opened this issue Apr 25, 2023 · 0 comments
Assignees

Comments

@chrisiacovella
Copy link
Contributor

chrisiacovella commented Apr 25, 2023

Flattening a Compound removes all hierarchy; it would be good to have a function that will still perform a similar operation but provide an additional level associated with which molecules are connected.

For example, take the following compound:

Compound, 28 particles, 18 bonds, 4 children

> ├── [C x 1], 1 particles, 0 bonds, 0 children
> ├── [Compound x 1], 3 particles, 2 bonds, 1 children
> │   └── [tip3p x 1], 3 particles, 2 bonds, 3 children
> │       ├── [H2 x 1], 1 particles, 1 bonds, 0 children
> │       ├── [H3 x 1], 1 particles, 1 bonds, 0 children
> │       └── [O1 x 1], 1 particles, 2 bonds, 0 children
> └── [Compound x 2], 12 particles, 8 bonds, 4 children
>     └── [Compound x 4], 3 particles, 2 bonds, 1 children
>         └── [tip3p x 1], 3 particles, 2 bonds, 3 children
>             ├── [H2 x 1], 1 particles, 1 bonds, 0 children
>             ├── [H3 x 1], 1 particles, 1 bonds, 0 children
>             └── [O1 x 1], 1 particles, 2 bonds, 0 children

And condense it to:

Compound, 28 particles, 18 bonds, 10 children

> ├── [C x 1], 1 particles, 0 bonds, 0 children
> └── [tip3p x 9], 3 particles, 2 bonds, 3 children
>     ├── [H2 x 1], 1 particles, 1 bonds, 0 children
>     ├── [H3 x 1], 1 particles, 1 bonds, 0 children
>     └── [O1 x 1], 1 particles, 2 bonds, 0 children

This could be very useful for complex construction, where the hierarchy is useful for simplifying construction, but makes it harder to manipulate the Compound later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant