New bonds and angles after fix atom/swap

Hello Srivastav,

You can actually use the “set” command to update the topology information after fix bond/swap This can be done if you know the ids of the swapping partners and grouping them along with atoms that form angle/dihedral. Note , the angle coefficients has to previously defined in the data file.


Yes, the set command can be used to assign the correct bond types in a
static configuration at any point in the script, but it won't work
dynamically. To get the behavior you want, fix atom/swap would have to
do two things that it currently does not do when an atom type is

1. Change the value of bondy_type[i][m], for all bonds connected to atom i
2. Reneighbor

That latter can be handled by just adding another condition to the code:

current: if (unequal_cutoffs) {
new: if (unequal_cutoffs || atom->avec->bonds_allow) {

The first one is complicated, because there needs to be a mechanism to
input and store the desired bond_types in a general way. This is
something to consider for the future, but for now, I suggest
hardcoding the changes to the bond_type[i][m] entries right below the

atom->type[i] = jtype;

There are some subtleties with newton_bond and i < j that you will
have to take in to account.