lammps icon indicating copy to clipboard operation
lammps copied to clipboard

[BUG] _Possible errors in unit conversion factors and/or units documentation_

Open tadmor opened this issue 5 years ago • 3 comments

Summary

As part of the extension of the OpenKIM testing framework to support LAMMPS simulator models, I have written a program to convert units between the LAMMPS unit systems. To conform to LAMMPS, I have used physical constants from NIST (https://physics.nist.gov/cuu/Constants/Table/allascii.txt). To test my code, I verified that I could reproduce the conversion factors given in update.cpp in the LAMMPS code. I get agreement for almost all factors, but there are several discrepancies that I would like to bring to your attention. These may be due to documentation errors on the LAMMPS units page site or bugs in update.cpp.

Here is a summary of the discrepancies I see:

  1. Electron system (mvv2e factor). According to the LAMMPS documentation, the velocity units in electron are "Bohr/atomic time units [1.03275e-15 seconds]" (note this is not the standard atomic time units). See:

https://sourceforge.net/p/lammps/mailman/lammps-users/thread/[email protected]/

With this definition, I get a value of mvv2e = 1.0. However, the value in update.cpp is mvv2e = 1.06657236. This value is obtained if the velocity is in Bohr/femtosecond not Bohr/atu_electron. So it appears that either the documentation is wrong or the value in update.ccp is wrong.

  1. Electron system (ftm2v factor). Same issue as in item 1. With the velocity in "Bohr/atomic time units 1.03275e-15 seconds]", I obtain ftm2v = 0.968288666437. Whereas the value in update.cpp is ftm2v = 0.937582899. As in 1, the value in update.cpp is obtained if the velocity is taken to be bohr/fs.

  2. Electron system (vxmu2f). The units documentation does not provide dynamic viscosity units for the electron system. If I guess that the units are Pascal*second, then I get vxmu2f = 32.9114634037. The value in update.cpp is vxmu2f = 3.39893149e1. As in item 1, this discrepancy is corrected if the velocity is taken to be bohr/fs. (Note in addition to dynamic viscosity, the LAMMPS documentation page also does not provide units for the electron system for torque (I guessed hartree), and density (I guessed amu/bohr^3), and should be provided.)

  3. Micro system (qe2f). Based on the units reported in the LAMMPS documentation, I get a value of qe2f = 1000.0. The value in update.cpp is qe2f = 1.0. The factor of 1000 probably comes from the force unit which is picogram-micrometer/microsecond^2 for this system. A possible error in update.cpp is that picogram is 10^-12 relative to a gram, but 10^-15 relative to kg (which is the base SI unit). In any case, I don't see an error on my end.

  4. Nano system (qe2f). Based on the units reported in the LAMMPS documentation, I get a value of qe2f = 160.21766208. The value in update.cpp is qe2f = 1.0. The difference is 100*1.6021766208. The 100 probably comes from a similar issue as in item 4, and the 1.6021766208 term comes from the electron charge. According to the LAMMPS documentation, charge for the nano system is in "multiple of electron charge (1.0 is a proton)", so to obtain a force in "attogram-nanometer/nanosecond^2" it is necessary to multiply by the electron charge. This appears to be missing in the update.cpp expression.

LAMMPS Version and Platform

The LAMMPS code was not run, only comparisons were made to values in update.cpp. The version is 28 Feb 2019.

tadmor avatar Mar 24 '19 12:03 tadmor

@tadmor thanks for carefully checking and reporting this. i am assigning this to @sjplimp since the units setting is something that he has been handling in the past, so he should be in the best position to determine where the discrepancies originate from.

akohlmey avatar Mar 25 '19 11:03 akohlmey

@sjplimp this should be added to your TODO list

akohlmey avatar Jan 08 '20 21:01 akohlmey

I also see the same problem on the electron units. This makes me a little bit confused when I was trying to do some tests. I agree that the documentation might be wrong and the velocity unit should be Bohr/fs.

Yi-FanLi avatar Mar 08 '23 20:03 Yi-FanLi