Index: kernel/include/IMP/internal/units.h =================================================================== --- kernel/include/IMP/internal/units.h (revision 495) +++ kernel/include/IMP/internal/units.h (working copy) @@ -39,9 +39,9 @@ v_=o.v_; float factor= std::pow(10.0, static_cast(diff)); v_*=factor; - IMP_assert((get_normalized_value() -o.get_normalized_value()) - <= .09 * std::max(get_normalized_value(), - o.get_normalized_value()), + IMP_assert(std::abs(get_normalized_value() -o.get_normalized_value()) + <= .09 * std::abs(std::max(get_normalized_value(), + o.get_normalized_value())), "Mismatch after scaling"); } bool is_default() const { @@ -395,8 +395,8 @@ // want it for conversions extern IMPDLLEXPORT const ExponentialNumber<23> NA; -extern IMPDLLEXPORT const ExponentialNumber<3> JoulesPerKiloCalorie; -extern IMPDLLEXPORT const ExponentialNumber<-4> KiloCaloriesPerJoule; +extern IMPDLLEXPORT const ExponentialNumber<3> JOULES_PER_KCAL; +extern IMPDLLEXPORT const ExponentialNumber<-4> KCALS_PER_JOULE; /** \function convert_to_kcal Convert from MKS units to kcal units @@ -409,20 +409,15 @@ KCalPerMolUnit convert_to_kcal(MKSUnit j) { return KCalPerMolUnit(j.get_exponential_value() - *KiloCaloriesPerJoule*NA); + *KCALS_PER_JOULE*NA); } template KCalPerMolUnit convert_to_kcal(MKSUnit j) { - std::cout << j.get_exponential_value() << "*" - << KiloCaloriesPerJoule << "*" - << NA - << "*" << internal::ExponentialNumber<-10>(1) << std::endl; internal::ExponentialNumber en(j.get_exponential_value() - *KiloCaloriesPerJoule*NA + *KCALS_PER_JOULE*NA *internal::ExponentialNumber<-10>(1)); - std::cout << "en is " << en << std::endl; return KCalPerMolUnit(en); } @@ -430,14 +425,14 @@ MKSUnit convert_to_mks(KCalPerMolUnit o) { return MKSUnit(o.get_exponential_value() - *JoulesPerKiloCalorie/NA); + *JOULES_PER_KCAL/NA); } template MKSUnit convert_to_mks(KCalPerMolUnit o) { return MKSUnit(o.get_exponential_value() - *JoulesPerKiloCalorie/NA + *JOULES_PER_KCAL/NA *internal::ExponentialNumber<10>(1)); } Index: kernel/src/internal/constants.cpp =================================================================== --- kernel/src/internal/constants.cpp (revision 495) +++ kernel/src/internal/constants.cpp (working copy) @@ -21,8 +21,8 @@ const Kelvin T(297.15); -const ExponentialNumber<3> JoulesPerKiloCalorie(4.1868); -const ExponentialNumber<-4> KiloCaloriesPerJoule(2.388459); +const ExponentialNumber<3> JOULES_PER_KCAL(4.1868); +const ExponentialNumber<-4> KCALS_PER_JOULE(2.388459); } // namespace internal