Defining groups and fixes in a loop


I would like to define multiple groups and assign those to multiple fixes. Is this an acceptable way of looping and defining or is there a more LAMMPS way of doing it?

label mol_loop
variable mol_i loop 5 12
    group grp_${mol_i} molecule ${mol_i}
    fix smd_${mol_i} grp_${mol_i} smd cvel 10.0 NULL NULL 0.0
next ${mol_i}
jump mol_loop

Thank you for the input!

Best regards,

I don’t know any. The only issue here is that you have to watch out for the limit of 32 groups total (with “all” being one of them). To work around this, you would have to implement a new fix, fix smd/chunk or something similar.