
AMDG alfC wrote:
I managed to make CONVERSION_FACTOR definitions to work between to unit systems (atomic and SI). I definied atomic system by following the si example. I can manage to transform lengths (probably because they are base dimensions in both systems, but when I try to do the same for energies (that is a base_dimension only in the atomic system) I can't compile the line with the declaration "en3".
The first question is why the first ...CONVERSION_FACTOR doesn't work in the two directions (as it did for lengths). second, why the second ...CONVERSION_FACTOR doesn't help to compile en3.
BOOST_UNITS_DEFINE_CONVERSION_FACTOR( atomic::hartree_energy_base_unit, si::energy, double, 4.359744e-18 );
//compiles but doesn't help for en3 BOOST_UNITS_DEFINE_CONVERSION_FACTOR( si::energy, atomic::hartree_energy_base_unit, double, 1./4.359744e-18 );
This should not compile. I'll look into it. You probably need to fragment it into SI base units. If you could provide either the error message, or even better, the definition of the atomic system, I could help more.
int main(){ quantitysi::length l1(1.*si::meter); //works quantitysi::length l2(1.*atomic::bohr); //works quantityatomic::length l3(1.*atomic::bohr); //works quantityatomic::length l4(1.*si::meter); //works
quantitysi::energy en1(1.*si::joules); //works quantitysi::energy en2(1.*atomic::hartree); //works quantityatomic::energy en3(1.*atomic::hartree); //work quantityatomic::energy en4(1.*si::joules); //does not work, compilation error return 0; }
In Christ, Steven Watanabe