def test_pyscf_to_afqmc_incorporate_result(): import os from generic import NexusError,obj from simulation import Simulation from test_pyscf_simulation import get_pyscf_sim other = Simulation() scf = get_pyscf_sim() sim = get_pyscf_to_afqmc_sim() try: sim.incorporate_result('unknown',None,other) raise TestFailed except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try result = obj( chkfile = os.path.join(scf.locdir,'scf.chk'), ) assert(sim.input.input==None) sim.incorporate_result('wavefunction',result,scf) assert(sim.input.input=='scf.chk') clear_all_sims()
def test_convert4qmc_incorporate_result(): from generic import NexusError,obj from simulation import Simulation from gamess import Gamess from pyscf_sim import Pyscf from quantum_package import QuantumPackage from test_gamess_simulation import get_gamess_sim from test_pyscf_simulation import get_pyscf_sim from test_quantum_package_simulation import get_quantum_package_sim other = Simulation() gms = get_gamess_sim('rhf') Gamess.ericfmt = None gms_result = obj( location = './rhf/rhf.out', mos = 0, norbitals = 0, outfile = './rhf/rhf.out', scftyp = 'rohf', vec = None, ) pscf = get_pyscf_sim() pscf_result = obj( h5_file = './scf.h5', ) qp = get_quantum_package_sim() QuantumPackage.qprc = None qp_result = obj( outfile = './qp_savewf.out', ) sim_start = get_convert4qmc_sim() sim = sim_start.copy() try: sim.incorporate_result('unknown',None,other) raise TestFailed except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try # incorporate orbitals from gamess sim = sim_start.copy() assert(sim.input_code is None) assert(sim.input.gamess_ascii is None) assert(sim.job.app_command=='convert4qmc') sim.incorporate_result('orbitals',gms_result,gms) assert(sim.input_code=='gamess') assert(sim.input.gamess_ascii=='../rhf/rhf.out') assert(sim.job.app_command=='convert4qmc -gamessAscii ../rhf/rhf.out') # incorporate orbitals from pyscf sim = sim_start.copy() assert(sim.input_code is None) assert(sim.input.pyscf is None) sim.incorporate_result('orbitals',pscf_result,pscf) assert(sim.input_code=='pyscf') assert(sim.input.pyscf=='../scf.h5') # incorporate orbitals from quantum package sim = sim_start.copy() assert(sim.input_code is None) assert(sim.input.qp is None) sim.incorporate_result('orbitals',qp_result,qp) assert(sim.input_code=='qp') assert(sim.input.qp=='../qp_savewf.out') clear_all_sims()