mosdef-hub / foyer

A package for atom-typing as well as applying and disseminating forcefields
https://foyer.mosdef.org
MIT License
117 stars 76 forks source link

Parametrized structure has non-zero charge. #501

Closed thangckt closed 8 months ago

thangckt commented 2 years ago

Dear developers,

I try to apply the OPLSss forcefield to PPC polymer with SMILES string is 'CCCOC(=O)O' image

After energy-minimize, I get warning "UserWarning: Parametrized structure has non-zero charge.Structure's total charge: -0.33999999999999914"

Is this reasonable to use this structure? and how to get a zero-charge structure?

I also try with the PS polymer ('C-CC1=CC=CC=C1'), and also get a non-charge structure. Can you give a help on this issue. Thank you so much.

CalCraven commented 1 year ago

I think this is an issue with your forcefield. Do you expect this to be an overall neutral molecule? If so, some of the SMARTS you're using to match atomtypes could be executed improperly and giving you the wrong atom types. If you're using the prepackaged OPLSAA forcefield, you might be getting parameters that aren't meant for those atoms, so you should read the descriptions for each atomtype to see if it makes sense. You can also tune them slightly to get a net zero charge if that makes sense for your system (i.e. a certain groups charge shouldn't effect the behavior you're trying to study much).

If you run a simulation with just this, the periodic boundary will cause this to explode due to long range charge forces, which is why they warning is there to make sure mean to get a charged molecule.