mosdef-hub / foyer

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

Possible 4-5 sig fig rounding error in foyer XML to structure.bonds.k or structure.angles.k. #448

Closed bc118 closed 2 years ago

bc118 commented 3 years ago

Bug summary

I'm honestly not sure how much effort should go into this since it's a 4-5th sig fig. This will likely not change the simulation results in a noticeable manner, but we wanted to post this anyway.

When converting from foyer XML to structure.bonds.k or structure.angles.k., there appears to be a factor of like 1.00067 off on the k constants. This was noticed when I manually converted the original units to the XML format; then, ran mbuild/foyer and checked them against the GOMC FF file (toluene/NVT_toluene_FF.inp), which are mostly in the original units. Please see the code below for the code that I was using:

Note: the mBuild charmm_writer.py file (mbuild-dev/mbuild/mbuild/formats/charmm_writer.py) uses the structure.bonds.k or structure.angles.k commands, so I believe the error is originating from Parmed or other associated software. I assume this is a rounding/sig fig issue somewhere during a unit conversion outside of the MoSDeF software.

Code to reproduce the behavior See attached zip file Rounding_issue_example.zip

Software versions

bc118 commented 2 years ago

I think I found the source of the error. My TI-89 provides the wrong unit conversion for kcal to kJ. being 4.1868 which should be 4.184. Therefore, I think the calculation in this software are spot on. This is the first error I found in my TI-89!!

daico007 commented 2 years ago

You should call that company and complain lol

bc118 commented 2 years ago

I posted an issue on the TI website.

Correction per @joaander: it is not an error in TI, but using a different standard.

This conversion is not wrong. The 4.1868 value is just an International Steam Table calorie (1929) definition, while the 4.184 value is the Thermochemical calorie definition.