Fix bond/react delete atoms

reacted_rxn1.data_template (808 Bytes)
rxn1_map (221 Bytes)
unreacted_rxn1.data_template (728 Bytes)
Sorry for disturbing you again. I am using Fix bond/react command for combining two molecules as one. However, the reaction goes well and I got no error but when i try to delete the additional flying hydrogen from the reaction, I got error “Invalid template IDs.”

I have gone through the manual but I didn’t able to understand how to do it. From the manual I understand, the atom in the pre-reaction template which I need to delete can still be included in the post-reaction template. So, includeded it in post also and in pre-reaction template it was bonded to ring but after reaction (i.e., in post-reaction template) it was bonded to none.

Please help me how to delete that atom? I am attaching the pre-reaction template, post-reaction template and map file.

Finally, I found the error and simulation runs fine now. However, i got new issue that initially the system is charged neutral, then when after using deleteIDs in map file, the system charge becomes negative. Although, i have used rescaled charges yes in fix bond/react command. As per my understanding the rescale charges rescale the partial atomic charges so that the initial and final charge remains same. Then, why here the system becomes negatively charge?

Is this the bug? Because after delete of atoms using map file in fix bond/react, the rescale charges keyword can’t able to rescale it to the charges system have initially. Jacob sir kindly check it because i think it is the bug because if rescale charges can’t able to keep the total system charges then what is its other uses?

If you want to get Jake’s attention by sending him a notification along with your message, you should use an “at-mention” using his username, i.e. @jrgissing

But keep in mind that people are volunteering their time here. So if anybody is too busy, it can take a while until you get a response.

Thanks for this report. Looks like I did not include logic for correctly rescaling charges while also deleting atoms. Please find a quick fix attached that should solve your issue. these files were tested on LAMMPS version 8 Feb 2023.
fix_bond_react.cpp (174.7 KB)
fix_bond_react.h (10.2 KB)

Thank you sir for replying. Sorry, yesterday my college hpc was down. I will check it today and will inform you if got any other issues. Thank you once again axel sir and jacob sir.

I have used the file that you share. I go to lammps src directory and simply replace the file. But it doesn’t work for me. Do i need to recompile the lammps after replacing the file, you have porovided?

Yes, you will need to recompile LAMMPS after updating the code.

Sir, I tried with recompiling also. But it doesn’t work for me.
Analysis-3.rar (2.6 MB)
I have attaaxhed the files. If you go to 1st run/crosslinking, you will see is neutrally charged but after cross-linking, the output is negatively charged.

The issue is that there is no ‘Charges’ section in your post-reaction template, so ‘fix bond/react’ is assuming that you don’t want to update charges. I will most likely update this behavior to avoid this issue in the future, but for now you could add a ‘Charges’ section with dummy values to your post-reaction templates.

Sorry sir for replying so late. But, it worked. I have to uninstall the lammps then reinstall it. Recompiling wont worked for med. But anyway it worked. Thank you so much sir.