src/AFQMC/Wavefunctions/WavefunctionFactory.cpp
/*
 * Read Initial walker from file.
*/
Read Initial walker from file.
Read Initial walker from file .
void WavefunctionFactory::getInitialGuess(hdf_archive& dump, std::string& name, int NMO, int NAEA, int NAEB, WALKER_TYPES walker_type)
{
  auto guess = initial_guess.find(name);
  if( guess == initial_guess.end() ) {
    auto newg = initial_guess.insert(
              std::make_pair(name,boost::multi::array<ComplexType,3>({2,NMO,NAEA})));
    if(!newg.second)
      APP_ABORT(" Error: Problems adding new initial guess. \n");
    using ma::conj;
    std::fill_n((newg.first)->second.origin(),2*NMO*NAEA,ComplexType(0.0,0.0));
    {
      boost::multi::array<ComplexType,2> Psi0Alpha({NMO,NAEA});
      if(!dump.readEntry(Psi0Alpha, "Psi0_alpha")) {
        app_error()<<" Error in WavefunctionFactory: Initial wavefunction Psi0_alpha not found. \n";
        APP_ABORT("");
      }
      for(int i = 0; i < NMO; i++)
        for(int j = 0; j < NAEA; j++)
          ((newg.first)->second)[0][i][j] = Psi0Alpha[i][j];
    }
    if(walker_type==COLLINEAR) {
      boost::multi::array<ComplexType,2> Psi0Beta({NMO,NAEB});
      if(!dump.readEntry(Psi0Beta, "Psi0_beta")) {
        app_error()<<" Error in WavefunctionFactory: Initial wavefunction Psi0_beta not found. \n";
        APP_ABORT("");
      }
      for(int i = 0; i < NMO; i++)
        for(int j = 0; j < NAEB; j++)
          ((newg.first)->second)[1][i][j] = Psi0Beta[i][j];
    }
  } else
    APP_ABORT(" Error: Problems adding new initial guess, already exists. \n");
}
void WavefunctionFactory :: getInitialGuess ( hdf_archive & dump , std :: string & name , int NMO , int NAEA , int NAEB , WALKER_TYPES walker_type ) { auto guess = initial_guess . find ( name ) ; if ( guess == initial_guess . end ( ) ) { auto newg = initial_guess . insert ( std :: make_pair ( name , boost :: multi :: array < ComplexType , 3 > ( { 2 , NMO , NAEA } ) ) ) ; if ( ! newg . second ) APP_ABORT ( " \n " ) ; using ma :: conj ; std :: fill_n ( ( newg . first ) -> second . origin ( ) , 2 * NMO * NAEA , ComplexType ( 0.0 , 0.0 ) ) ; { boost :: multi :: array < ComplexType , 2 > Psi0Alpha ( { NMO , NAEA } ) ; if ( ! dump . readEntry ( Psi0Alpha , " " ) ) { app_error ( ) << " \n " ; APP_ABORT ( " " ) ; } for ( int i = 0 ; i < NMO ; i ++ ) for ( int j = 0 ; j < NAEA ; j ++ ) ( ( newg . first ) -> second ) [ 0 ] [ i ] [ j ] = Psi0Alpha [ i ] [ j ] ; } if ( walker_type == COLLINEAR ) { boost :: multi :: array < ComplexType , 2 > Psi0Beta ( { NMO , NAEB } ) ; if ( ! dump . readEntry ( Psi0Beta , " " ) ) { app_error ( ) << " \n " ; APP_ABORT ( " " ) ; } for ( int i = 0 ; i < NMO ; i ++ ) for ( int j = 0 ; j < NAEB ; j ++ ) ( ( newg . first ) -> second ) [ 1 ] [ i ] [ j ] = Psi0Beta [ i ] [ j ] ; } } else APP_ABORT ( " \n " ) ; }
Read Initial walker from file.
Read Initial walker from file .