Skip to content

Adding new bonds and angles with custom updater #1867

Answered by joaander
nmendiboure asked this question in Support
Discussion options

You must be logged in to vote

HOOMD's snapshot data structure is not Pythonic - it is a thin wrapper around a C++ data structure. You cannot overwrite the .group attribute because it is managed by C++.

To expand the group array, first set the new N:

snapshot_data.N += number_of_entries

Now the snapshot_data.group array is larger and you can write to its contents with:

snapshot_data.group[:] = np.asarray(groups, dtype=np.uint32)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@nmendiboure
Comment options

Answer selected by nmendiboure
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants