File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -409,7 +409,11 @@ std::string Crystal::GetFormula() const
409
409
{
410
410
if (pos!=velts.begin ()) s<<" " ;
411
411
float nb=pos->second ;
412
- if (abs (round (nb)-nb)<0.005 ) s<<pos->first <<int (round (nb));
412
+ if (abs (round (nb)-nb)<0.005 )
413
+ {
414
+ if (int (round (nb))==1 ) s<<pos->first ;
415
+ else s<<pos->first <<int (round (nb));
416
+ }
413
417
else s<<pos->first <<nb;
414
418
}
415
419
return s.str ();
Original file line number Diff line number Diff line change 24
24
#include < iterator>
25
25
#include < algorithm>
26
26
#include < iomanip>
27
+ #include < ctime>
27
28
28
29
#include " ObjCryst/Quirks/VFNStreamFormat.h"
29
30
#include " ObjCryst/ObjCryst/Molecule.h"
@@ -2206,8 +2207,12 @@ std::string Molecule::GetFormula() const
2206
2207
{
2207
2208
if (pos!=velts.begin ()) s<<" " ;
2208
2209
float nb=pos->second ;
2209
- if ((abs (nb)-nb)<0.01 ) s<<pos->first <<int (round (nb));
2210
- else s<<pos->first <<nb;
2210
+ if (abs (round (nb)-nb)<0.005 )
2211
+ {
2212
+ if (int (round (nb))==1 ) s<<pos->first ;
2213
+ else s<<pos->first <<int (round (nb));
2214
+ }
2215
+ else s<<pos->first <<nb;
2211
2216
}
2212
2217
return s.str ();
2213
2218
}
You can’t perform that action at this time.
0 commit comments