@@ -328,15 +328,24 @@ void KEDF_ML::NN_forward(const double * const * prho, ModulePW::PW_Basis *pw_rho
328328
329329void KEDF_ML::loadVector (std::string filename, std::vector<double > &data)
330330{
331- std::vector<long unsigned int > cshape = {(long unsigned ) this ->cal_tool ->nx };
332- bool fortran_order = false ;
333- npy::LoadArrayFromNumpy (filename, cshape, fortran_order, data);
331+ npy::npy_data<double > d = npy::read_npy<double >(filename);
332+ data = d.data ;
333+ // ========== For old version of npy.hpp ==========
334+ // std::vector<long unsigned int> cshape = {(long unsigned) this->cal_tool->nx};
335+ // bool fortran_order = false;
336+ // npy::LoadArrayFromNumpy(filename, cshape, fortran_order, data);
334337}
335338
336339void KEDF_ML::dumpVector (std::string filename, const std::vector<double > &data)
337340{
338- const long unsigned cshape[] = {(long unsigned ) this ->cal_tool ->nx }; // shape
339- npy::SaveArrayAsNumpy (filename, false , 1 , cshape, data);
341+ npy::npy_data_ptr<double > d;
342+ d.data_ptr = data.data ();
343+ d.shape = {(long unsigned ) this ->cal_tool ->nx };
344+ d.fortran_order = false ; // optional
345+ npy::write_npy (filename, d);
346+ // ========== For old version of npy.hpp ==========
347+ // const long unsigned cshape[] = {(long unsigned) this->cal_tool->nx}; // shape
348+ // npy::SaveArrayAsNumpy(filename, false, 1, cshape, data);
340349}
341350
342351/* *
0 commit comments