diff --git a/source/source_relax/bfgs.cpp b/source/source_relax/bfgs.cpp index d105dc2791..814669bd51 100644 --- a/source/source_relax/bfgs.cpp +++ b/source/source_relax/bfgs.cpp @@ -30,11 +30,16 @@ void BFGS::allocate(const int _size) force0 = std::vector(3*size, 0.0); force = std::vector>(size, ModuleBase::Vector3(0.0, 0.0, 0.0)); steplength = std::vector(size, 0.0); + is_initialized = true; } void BFGS::relax_step(const ModuleBase::matrix& _force,UnitCell& ucell) { + if(!is_initialized) + { + allocate(ucell.nat); + } GetPos(ucell,pos); GetPostaud(ucell,pos_taud); ucell.ionic_position_updated = true; diff --git a/source/source_relax/bfgs.h b/source/source_relax/bfgs.h index b8872c979f..ae83173562 100644 --- a/source/source_relax/bfgs.h +++ b/source/source_relax/bfgs.h @@ -24,6 +24,7 @@ class BFGS double maxstep;//every movement smaller than maxstep double largest_grad; int size;//number of atoms + bool is_initialized=false; std::vector steplength;//the length of atoms displacement std::vector> H;//Hessian matrix diff --git a/source/source_relax/ions_move_cg.cpp b/source/source_relax/ions_move_cg.cpp index eec0009764..05e18c4b7f 100644 --- a/source/source_relax/ions_move_cg.cpp +++ b/source/source_relax/ions_move_cg.cpp @@ -2,6 +2,7 @@ #include "ions_move_basic.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" + using namespace Ions_Move_Basic; double Ions_Move_CG::RELAX_CG_THR = -1.0; // default is 0.5 @@ -169,7 +170,7 @@ void Ions_Move_CG::start(UnitCell &ucell, const ModuleBase::matrix &force, const < RELAX_CG_THR) // cg to bfgs by pengfei 13-8-8 { Ions_Move_Basic::relax_method[0] = "bfgs"; - Ions_Move_Basic::relax_method[1] = "2"; + Ions_Move_Basic::relax_method[1] = "1"; } Ions_Move_Basic::best_xxx = steplength; } diff --git a/toolchain/scripts/stage1/install_openmpi.sh b/toolchain/scripts/stage1/install_openmpi.sh index 6656fb9a97..6798e8ef17 100755 --- a/toolchain/scripts/stage1/install_openmpi.sh +++ b/toolchain/scripts/stage1/install_openmpi.sh @@ -91,7 +91,12 @@ case "${with_openmpi}" in # else # EXTRA_CONFIGURE_FLAGS="" # fi - ./configure CFLAGS="${CFLAGS}" \ + ./configure \ + CC=gcc \ + CXX=g++ \ + FC=gfortran \ + F77=gfortran \ + CFLAGS="${CFLAGS}" \ --prefix=${pkg_install_dir} \ --libdir="${pkg_install_dir}/lib" \ --with-libevent=internal \