11#include < iostream>
22#include < iomanip>
3+ #include < limits>
34#include " atom.h"
45#include " domain.h"
56#include " comm.h"
@@ -83,7 +84,7 @@ ana_st (double & max,
8384 const vector<double > & vec,
8485 const int & nloc)
8586{
86- if (vec. size () == 0 ) return ;
87+ if (nloc == 0 ) return ;
8788 max = vec[0 ];
8889 min = vec[0 ];
8990 sum = vec[0 ];
@@ -347,7 +348,7 @@ void PairNNP::compute(int eflag, int vflag)
347348 std_f.resize (std_f_.size ());
348349 for (int dd = 0 ; dd < std_f_.size (); ++dd) std_f[dd] = std_f_[dd];
349350#endif
350- double min = 0 , max = 0 , avg = 0 ;
351+ double min = numeric_limits< double >:: max () , max = 0 , avg = 0 ;
351352 ana_st (max, min, avg, std_f, nlocal);
352353 int all_nlocal = 0 ;
353354 MPI_Reduce (&nlocal, &all_nlocal, 1 , MPI_INT, MPI_SUM, 0 , world);
@@ -369,7 +370,8 @@ void PairNNP::compute(int eflag, int vflag)
369370 std_e.resize (std_e_.size ());
370371 for (int dd = 0 ; dd < std_e_.size (); ++dd) std_e[dd] = std_e_[dd];
371372#endif
372- min = max = avg = 0 ;
373+ max = avg = 0 ;
374+ min = numeric_limits<double >::max ();
373375 ana_st (max, min, avg, std_e, nlocal);
374376 double all_e_min = 0 , all_e_max = 0 , all_e_avg = 0 ;
375377 MPI_Reduce (&min, &all_e_min, 1 , MPI_DOUBLE, MPI_MIN, 0 , world);
0 commit comments