• R/O
  • SSH
  • HTTPS

molby: Commit


Commit MetaInfo

Revision606 (tree)
Time2016-09-09 09:48:46
Authortoshinagata1964

Log Message

Creating cube file failed when very small electron density (<1e-100) appeared. Fixed.

Change Summary

Incremental Difference

--- trunk/MolLib/Molecule.c (revision 605)
+++ trunk/MolLib/Molecule.c (revision 606)
@@ -11658,8 +11658,15 @@
1165811658 /* On Windows, the "%e" format writes the exponent in 3 digits, but
1165911659 this is not standard. So we avoid using %e */
1166011660 Double d = cp->dp[n++];
11661- int exponent = (int)floor(log10(fabs(d)));
11662- Double base = d * pow(10, -1.0 * exponent);
11661+ int exponent;
11662+ Double base;
11663+ if (d >= -1.0e-90 && d <= 1.0e-90) {
11664+ exponent = 0;
11665+ base = 0.0;
11666+ } else {
11667+ exponent = (int)floor(log10(fabs(d)));
11668+ base = d * pow(10, -1.0 * exponent);
11669+ }
1166311670 fprintf(fp, " %8.5fe%+03d", base, exponent);
1166411671 /* fprintf(fp, " %12.5e", d); */
1166511672 if (k == cp->nz - 1 || k % 6 == 5)
Show on old repository browser