diff --git a/include/caffe/layers/molgrid_data_layer.hpp b/include/caffe/layers/molgrid_data_layer.hpp index e0c8149305f..6c2908e6df4 100644 --- a/include/caffe/layers/molgrid_data_layer.hpp +++ b/include/caffe/layers/molgrid_data_layer.hpp @@ -678,6 +678,11 @@ class MolGridDataLayer : public BaseDataLayer { template static string xyz_to_string(T x, T y, T z) { + //avoid negative zeros in string representation + if(x == 0) x = 0; + if(y == 0) y = 0; + if(z == 0) z = 0; + std::stringstream ss; ss << std::fixed << std::setprecision(3) << x; std::string rounded_x = ss.str();