From adca6d172759c93d9014d9e8789d3be4f84d0635 Mon Sep 17 00:00:00 2001 From: Jaron Krogel Date: Thu, 30 Sep 2021 07:48:53 -0400 Subject: [PATCH] nexus: fix convert4qmc usage --- nexus/lib/qmcpack_converters.py | 10 ++++------ nexus/tests/unit/test_qmcpack_converter_simulations.py | 6 ++++-- nexus/tests/unit/test_qmcpack_simulation.py | 7 +++++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/nexus/lib/qmcpack_converters.py b/nexus/lib/qmcpack_converters.py index f4c66562dc..09867ac56e 100644 --- a/nexus/lib/qmcpack_converters.py +++ b/nexus/lib/qmcpack_converters.py @@ -799,10 +799,8 @@ def get_result(self,result_name,sim): wfn_file,ptcl_file = self.list_output_files() if result_name=='orbitals': result.location = os.path.join(self.locdir,wfn_file) - if self.input.hdf5==True: - orbfile = self.get_prefix()+'.orbs.h5' - result.orbfile = os.path.join(self.locdir,orbfile) - #end if + orbfile = self.get_prefix()+'.orbs.h5' + result.orbfile = os.path.join(self.locdir,orbfile) elif result_name=='particles': result.location = os.path.join(self.locdir,ptcl_file) else: @@ -841,7 +839,7 @@ def incorporate_result(self,result_name,result,sim): self.input_code = 'pyscf' if result_name=='orbitals': orbpath = os.path.relpath(result.h5_file,self.locdir) - input.pyscf = orbpath + input.orbitals = orbpath else: implemented = False #end if @@ -849,7 +847,7 @@ def incorporate_result(self,result_name,result,sim): self.input_code = 'qp' if result_name=='orbitals': orbpath = os.path.relpath(result.outfile,self.locdir) - input.qp = orbpath + input.orbitals = orbpath else: implemented = False #end if diff --git a/nexus/tests/unit/test_qmcpack_converter_simulations.py b/nexus/tests/unit/test_qmcpack_converter_simulations.py index 0704ab4176..ba82d7bc1b 100644 --- a/nexus/tests/unit/test_qmcpack_converter_simulations.py +++ b/nexus/tests/unit/test_qmcpack_converter_simulations.py @@ -251,6 +251,7 @@ def test_convert4qmc_get_result(): result_ref = obj( location = './runs/sample.wfj.xml', + orbfile = './runs/sample.orbs.h5', ) assert(object_eq(result,result_ref)) @@ -338,7 +339,7 @@ def test_convert4qmc_incorporate_result(): sim.incorporate_result('orbitals',pscf_result,pscf) assert(sim.input_code=='pyscf') - assert(sim.input.pyscf=='../scf.h5') + assert(sim.input.orbitals=='../scf.h5') # incorporate orbitals from quantum package sim = sim_start.copy() @@ -349,7 +350,8 @@ def test_convert4qmc_incorporate_result(): sim.incorporate_result('orbitals',qp_result,qp) assert(sim.input_code=='qp') - assert(sim.input.qp=='../qp_savewf.out') + #assert(sim.input.qp=='../qp_savewf.out') + assert(sim.input.orbitals=='../qp_savewf.out') clear_all_sims() #end def test_convert4qmc_incorporate_result diff --git a/nexus/tests/unit/test_qmcpack_simulation.py b/nexus/tests/unit/test_qmcpack_simulation.py index 2a3fdaa523..4c8f7c7237 100644 --- a/nexus/tests/unit/test_qmcpack_simulation.py +++ b/nexus/tests/unit/test_qmcpack_simulation.py @@ -272,7 +272,8 @@ def test_incorporate_result(): result = c4q_orb.get_result('orbitals',None) - wfn_file = os.path.join(tpath,'c4q_orbitals.wfj.xml') + wfn_file = os.path.join(tpath,'c4q_orbitals.wfj.xml') + wfn_file2 = os.path.join(tpath,'c4q_orbitals.orbs.h5') input = sim.input.copy() dset = input.get('determinantset') dset.href = 'orbs.h5' @@ -281,6 +282,8 @@ def test_incorporate_result(): input.qmcsystem = qs input.write(wfn_file) assert(os.path.exists(wfn_file)) + open(wfn_file2,'w').write('fake') + assert(os.path.exists(wfn_file2)) from qmcpack_input import QmcpackInput inp = QmcpackInput(wfn_file) @@ -291,7 +294,7 @@ def test_incorporate_result(): sim.incorporate_result('orbitals',result,c4q_orb) dset = sim.input.get('determinantset') - assert(dset.href=='orbs.h5') + assert(dset.href=='c4q_orbitals.orbs.h5') # incorporate qmcpack jastrow