Adding new bonds and angles with custom updater #1867
-
Hello ! I'm currently trying to create a new bond between 2 beads of 2 different polymers if they are close by a certain distance. I'm using a Custom.Action class and the
As I understand it, I can only modify existing elements, but not add new ones... Am I missing something that would allow me to define new bonds and angles, or do I need to convert my snapshot to a gsd snapshot and start a new simulation from there?
Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
HOOMD's snapshot data structure is not Pythonic - it is a thin wrapper around a C++ data structure. You cannot overwrite the To expand the group array, first set the new N:
Now the
|
Beta Was this translation helpful? Give feedback.
-
I would also welcome contributions that add a Python API to create particles/bonds/dihedrals/etc.. See the proposal in #1535. |
Beta Was this translation helpful? Give feedback.
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:
Now the
snapshot_data.group
array is larger and you can write to its contents with: