mosdef-hub/foyer

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

bc118 opened this issue · 3 comments

bc118 commented

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:

  • FF_conversion.xlsx file has the conversions done manually in Excel, which was then input into the FF file. This was also used for checking the GOMC FF file (toluene/NVT_toluene_FF.inp) as this form is the same as the original FF units.

  • The FF XML is located in the FFs directory (FFs/toluene_trappe-ua.xml). The units input here were from the above Excel sheet.

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

  • foyer 0.8.0
  • Python 3.8.0
  • Which operating system? Mac
bc118 commented

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!!

You should call that company and complain lol

bc118 commented

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.