def test_pyscf_to_afqmc_get_result(): from generic import NexusError,obj sim = get_pyscf_to_afqmc_sim() sim.input.output = 'afqmc.h5' try: sim.get_result('unknown',None) raise FailedTest except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try result_ref = obj( h5_file = './runs/afqmc.h5', ) result = sim.get_result('wavefunction',None) assert(object_eq(result,result_ref)) result = sim.get_result('hamiltonian',None) assert(object_eq(result,result_ref)) clear_all_sims()
def test_chgcar_file(): import os from fileio import XsfFile from fileio import PoscarFile from fileio import ChgcarFile tpath = testing.setup_unit_test_output_directory('fileio','test_chgcarfile') files = get_files() empty = ChgcarFile() assert(not empty.is_valid()) # get reference poscar and xsf files p = PoscarFile(files['VO2_R_48.POSCAR']) x = XsfFile(files['VO2_R_48_dens.xsf']) # create and test reference chgcar file ref = ChgcarFile() ref.incorporate_xsf(x) assert(ref.is_valid()) assert(object_eq(ref.poscar,p)) # test read f = ChgcarFile(files['VO2_R_48_dens.CHGCAR']) assert(f.is_valid()) assert(object_eq(f,ref)) # test write outfile = os.path.join(tpath,'test.CHGCAR') f.write(outfile) f2 = ChgcarFile(outfile) assert(f2.is_valid()) assert(object_eq(f2,ref))
def check_empty_settings(): settings(command_line=False, ) settings.command_line = True nexus_core.command_line = True check_settings_core_noncore() # nexus core sets basic run stages and Pseudopotentials object assert (nexus_core.stages_set == set( nexus_core_defaults.primary_modes)) assert (isinstance(nexus_core.pseudopotentials, Pseudopotentials)) assert (len(nexus_core.pseudopotentials) == 0) nexus_core.stages_set = set() nexus_core.stages = [] nexus_core.pseudopotentials = None assert (object_eq(nexus_core, nexus_core_defaults)) # nexus noncore sets Pseudopotentials and BasisSets objects assert (isinstance(nexus_noncore.pseudopotentials, Pseudopotentials)) assert (len(nexus_noncore.pseudopotentials) == 0) assert (isinstance(nexus_noncore.basissets, BasisSets)) assert (len(nexus_noncore.basissets) == 0) nnc_defaults = obj(nexus_noncore_defaults, nexus_core_noncore_defaults) nexus_noncore.pseudopotentials = None nexus_noncore.basissets = None assert (object_eq(nexus_noncore, nnc_defaults)) # other settings objects should be at default also aux_defaults()
def test_convert4qmc_get_result(): from generic import NexusError,obj sim = get_convert4qmc_sim() try: sim.get_result('unknown',None) raise FailedTest except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try result = sim.get_result('orbitals',None) result_ref = obj( location = './runs/sample.wfj.xml', ) assert(object_eq(result,result_ref)) result = sim.get_result('particles',None) result_ref = obj( location = './runs/sample.structure.xml', ) assert(object_eq(result,result_ref)) clear_all_sims()
def test_xsffile_density(): import os import numpy as np from fileio import XsfFile tpath = testing.setup_unit_test_output_directory('fileio','test_xsffile_density') files = get_files() ref = XsfFile(files['VO2_R_48.xsf']) grid = 3,5,7 dens = 0.01*np.arange(np.prod(grid),dtype=float) dens.shape=grid ref.add_density(ref.primvec,dens,add_ghost=True) assert(ref.is_valid()) f = XsfFile(files['VO2_R_48_dens.xsf']) assert(f.is_valid()) assert(object_eq(f,ref)) d = f.get_density().values assert(isinstance(d,np.ndarray)) assert(d.shape==(4,6,8)) outfile = os.path.join(tpath,'test_density.xsf') f.write(outfile) f2 = XsfFile(outfile) assert(f2.is_valid()) assert(object_eq(f2,ref))
def test_namespaces(): from nexus_base import nexus_core,nexus_core_defaults from nexus_base import nexus_noncore,nexus_noncore_defaults from nexus_base import nexus_core_noncore,nexus_core_noncore_defaults assert('runs' in nexus_core_defaults) assert('basis_dir' in nexus_noncore_defaults) assert('pseudo_dir' in nexus_core_noncore_defaults) assert(object_eq(nexus_core,nexus_core_defaults)) assert(object_eq(nexus_noncore,nexus_noncore_defaults)) assert(object_eq(nexus_core_noncore,nexus_core_noncore_defaults))
def test_parallelotope_grid_initialization(): from testing import object_eq from grid_functions import ParallelotopeGrid pgrids = [] p1 = ParallelotopeGrid( shape=(6, ), axes=[[1]], ) pgrids.append(p1) p2 = ParallelotopeGrid( cells=(5, ), axes=[[1]], ) pgrids.append(p2) p3 = ParallelotopeGrid( dr=(0.2, ), axes=[[1]], ) pgrids.append(p2) p4 = ParallelotopeGrid( shape=(5, ), axes=[[1]], centered=True, ) pgrids.append(p4) p5 = ParallelotopeGrid( cells=(5, ), axes=[[1]], centered=True, ) pgrids.append(p5) p6 = ParallelotopeGrid( dr=(0.2, ), axes=[[1]], centered=True, ) pgrids.append(p6) assert (object_eq(p1, p2)) assert (object_eq(p1, p3)) assert (object_eq(p4, p5)) assert (object_eq(p4, p6))
def test_incorporate_result(): from generic import obj tpath = testing.setup_unit_test_output_directory('pwscf_simulation','test_incorporate_result',**pseudo_inputs) sim = get_pwscf_sim('scf') sim_start = sim.to_obj().copy() assert(object_eq(sim.to_obj(),sim_start)) # charge density result = obj( locdir = sim.locdir, ) sim.incorporate_result('charge_density',result,None) assert(object_eq(sim.to_obj(),sim_start)) # restart sim.incorporate_result('restart',result,None) c = sim.input.control assert(c.restart_mode=='restart') del c.restart_mode assert(object_eq(sim.to_obj(),sim_start)) # structure altered_structure = sim.system.structure.copy() altered_structure.pos += 0.1 result = obj( structure = altered_structure, ) sim.incorporate_result('structure',result,None) sim_ref = sim_start.copy() pos_ref = sim_ref.system.structure.delete('pos')+0.1 sim_ref.input.atomic_positions.delete('positions') pos = sim.system.structure.delete('pos') apos = sim.input.atomic_positions.delete('positions') assert(value_eq(pos,pos_ref)) assert(value_eq(apos,pos_ref)) assert(object_eq(sim.to_obj(),sim_ref)) clear_all_sims() restore_nexus()
def test_grid_cell_indices(): import numpy as np from testing import value_eq, object_eq from grid_functions import ParallelotopeGrid from grid_functions import SpheroidGrid from grid_functions import SpheroidSurfaceGrid p = ParallelotopeGrid( cells=(10, 10), axes=[[1, 0, 0], [1, 1, 1]], ) pc = ParallelotopeGrid(cells=(10, 10), axes=[[1, 0, 0], [1, 1, 1]], centered=True) s = SpheroidGrid( cells=(10, 10), axes=[[1, 0, 0], [1, 1, 1]], ) sc = SpheroidGrid( cells=(10, 10), axes=[[1, 0, 0], [1, 1, 1]], centered=True, ) c = SpheroidSurfaceGrid( cells=(10, 10), axes=[[1, 0, 0], [1, 1, 0], [1, 1, 1]], ) cc = SpheroidSurfaceGrid( cells=(10, 10), axes=[[1, 0, 0], [1, 1, 0], [1, 1, 1]], centered=True, ) imap = np.arange(100, dtype=int) assert ((pc.cell_indices() == imap).all()) assert ((p.cell_indices(pc.r) == imap).all()) assert ((sc.cell_indices() == imap).all()) assert ((s.cell_indices(sc.r) == imap).all()) assert ((cc.cell_indices() == imap).all()) assert ((c.cell_indices(cc.r) == imap).all()) indices = { 1: np.arange(5, dtype=int), 2: np.arange(5**2, dtype=int), 3: np.arange(5**3, dtype=int), } grids = get_grids() props = get_props() for name in sorted(grids.keys()): p = props[name] if p.centered: g = grids[name].copy() gref = g.copy() assert (value_eq(g.cell_indices(), indices[p.grid_dim])) assert (object_eq(g, gref))
def test_grid_inside(): from testing import value_eq, object_eq from grid_functions import ParallelotopeGrid from grid_functions import SpheroidGrid from grid_functions import SpheroidSurfaceGrid grids = get_grids() props = get_props() def shift_and_test_inside(g, p, upoints, d, sign): us = upoints.copy() us[:, d] += ushift ps = g.points_from_unit(us) ps_ref = ps.copy() inside = g.inside(ps) assert (value_eq(ps, ps_ref)) if isinstance(g, SpheroidSurfaceGrid): assert (inside.all()) elif isinstance(g, SpheroidGrid): if d == 0: assert (not inside.any()) # radial coord else: assert (inside.all()) # angular coords #end if elif isinstance(g, ParallelotopeGrid): if g.bconds[d] == 'o': assert (not inside.any()) elif g.bconds[d] == 'p': assert (inside.all()) else: assert (1 == 0) #end if else: assert (1 == 0) #end if #end def shift_and_test_inside for name in sorted(grids.keys()): p = props[name] g = grids[name].copy() gref = g.copy() # all grid points should be in the domain points = g.points assert (g.inside(points).all()) # points shifted out of the domain should be outside ushift = 1.0 if not p.centered: ushift += 1e-6 #end if upoints = g.unit_points() for d in range(p.grid_dim): shift_and_test_inside(g, p, upoints, d, 1) shift_and_test_inside(g, p, upoints, d, -1) #end for # object should not change assert (object_eq(g, gref))
def test_pw2qmcpack_get_result(): from generic import NexusError,obj sim = get_pw2qmcpack_sim() try: sim.get_result('unknown',None) raise FailedTest except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try result = sim.get_result('orbitals',None) result_ref = obj( h5file = './runs/pwscf_output/pwscf.pwscf.h5', ptcl_xml = './runs/pwscf_output/pwscf.ptcl.xml', wfs_xml = './runs/pwscf_output/pwscf.wfs.xml', ) assert(object_eq(result,result_ref)) clear_all_sims()
def test_pw2qmcpack_input_write(): import os from generic import obj from qmcpack_converters import Pw2qmcpackInput tpath = testing.setup_unit_test_output_directory('qmcpack_converter_input','test_pw2qmcpack_input_write') infile_path = os.path.join(tpath,'p2q.in') open(infile_path,'w').write(pw2qmcpack_in) write_path = os.path.join(tpath,'p2q_write.in') pi_write = Pw2qmcpackInput(infile_path) pi_write.write(write_path) pi_read = Pw2qmcpackInput(write_path) pi_ref = obj( inputpp = obj( prefix = 'pwscf', outdir = 'pwscf_output', ), ) assert(object_eq(pi_read.to_obj(),pi_ref))
def test_get_result(): from generic import NexusError,obj sim = get_quantum_package_sim() try: sim.get_result('unknown',None) raise FailedTest except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try sim.input.run_control.save_for_qmcpack = True result = sim.get_result('orbitals',None) result_ref = obj( outfile = './runs/qp_savewf.out', ) assert(object_eq(result,result_ref)) clear_all_sims()
def test_ppset(): from generic import obj from pseudopotential import ppset ppset_ref = obj(pseudos=obj(bfd=obj( gamess=obj(C='C.BFD.gms'), pwscf=obj(C='C.BFD.upf'), qmcpack=obj(C='C.BFD.xml'), ), ), ) ppset( label='bfd', gamess=['C.BFD.gms'], pwscf=['C.BFD.upf'], qmcpack=['C.BFD.xml'], ) o = ppset.to_obj() assert (object_eq(o, ppset_ref)) assert (ppset.supports_code('pwscf')) assert (ppset.supports_code('gamess')) assert (ppset.supports_code('vasp')) assert (ppset.supports_code('qmcpack')) assert (ppset.has_set('bfd'))
def check_agree(o1, o2=None): if id(o) not in distinct: distinct[id(o)] = o #end if if o2 is None: o2 = o.copy() #end if assert (object_eq(o1, o2, bypass=True)) assert (not object_neq(o1, o2, bypass=True))
def test_incorporate_result(): import os import shutil from numpy import array from generic import obj tpath = testing.setup_unit_test_output_directory( 'vasp_simulation', 'test_incorporate_result', **pseudo_inputs) sim = setup_vasp_sim(tpath, identifier='diamond', files=True) pcfile = os.path.join(tpath, 'diamond_POSCAR') ccfile = os.path.join(tpath, sim.identifier + '.CONTCAR') assert (sim.locdir.strip('/') == tpath.strip('/')) shutil.copy2(pcfile, ccfile) assert (os.path.exists(ccfile)) result = sim.get_result('structure', None) sim2 = setup_vasp_sim(tpath) pid = id(sim2.input.poscar) sim2.incorporate_result('structure', result, None) assert (id(sim2.input.poscar) != pid) poscar_ref = obj( axes=array([[3.57, 3.57, 0.], [0., 3.57, 3.57], [3.57, 0., 3.57]], dtype=float), coord='cartesian', description=None, dynamic=None, elem=['C'], elem_count=[16], pos=array([[0., 0., 0.], [0.8925, 0.8925, 0.8925], [1.785, 1.785, 0.], [2.6775, 2.6775, 0.8925], [0., 1.785, 1.785], [0.8925, 2.6775, 2.6775], [1.785, 3.57, 1.785], [2.6775, 4.4625, 2.6775], [1.785, 0., 1.785], [2.6775, 0.8925, 2.6775], [3.57, 1.785, 1.785], [4.4625, 2.6775, 2.6775], [1.785, 1.785, 3.57], [2.6775, 2.6775, 4.4625], [3.57, 3.57, 3.57], [4.4625, 4.4625, 4.4625]], dtype=float), scale=1.0, vel=None, vel_coord=None, ) assert (object_eq(sim2.input.poscar.to_obj(), poscar_ref)) clear_all_sims() restore_nexus()
def check_vs_serial_reference(gi, name): from generic import obj sr = obj(get_serial_references()[name]) sg = gi.serial() same = object_eq(sg, sr) if not same: print('\n' + name + ' differs') testing.print_diff(sr, sg) #end if assert (same)
def test_grid_copy(): from copy import deepcopy from testing import object_eq grids = get_grids() grids_check = 'p22c s22c c23c'.split() for name in grids_check: g = grids[name] gc = deepcopy(g) assert (object_eq(gc, g)) assert (id(gc.points) != id(g.points)) gc = g.copy() assert (object_eq(gc, g)) assert (id(gc.points) != id(g.points)) gc = g.copy(shallow=True) assert (object_eq(gc, g)) assert (id(gc.points) == id(g.points))
def test_empty_init(): from generic import obj from pyscf_input import PyscfInput,generate_pyscf_input ref = obj( addendum = None, allow_not_set = set([]), checkpoint = False, keywords = set([]), prefix = None, save_qmc = False, template = None, values = obj(), ) pi = PyscfInput() assert(object_eq(pi.to_obj(),ref)) pi2 = generate_pyscf_input() assert(isinstance(pi2,PyscfInput)) assert(object_eq(pi,pi2))
def test_get_result(): import os from generic import NexusError, obj from nexus_base import nexus_core tpath = testing.setup_unit_test_output_directory('gamess_simulation', 'test_get_result', divert=True) nexus_core.runs = '' sim = get_gamess_sim('rhf') assert (sim.locdir.rstrip('/') == os.path.join(tpath, 'rhf').rstrip('/')) sim.create_directories() sim.write_inputs() if not os.path.exists(sim.imresdir): os.makedirs(sim.imresdir) #end if analyzer = sim.analyzer_type(sim) analyzer.save(os.path.join(sim.imresdir, sim.analyzer_image)) try: sim.get_result('unknown', None) raise FailedTest except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try result = sim.get_result('orbitals', None) result_ref = obj( location='rhf/rhf.out', mos=0, norbitals=0, outfile='rhf/rhf.out', scftyp='rohf', vec=None, ) result.location = result.location.replace(tpath, '').lstrip('/') result.outfile = result.outfile.replace(tpath, '').lstrip('/') assert (object_eq(result, result_ref)) clear_all_sims() restore_nexus()
def test_grid_reset(): from testing import object_eq from generic import obj from grid_functions import ParallelotopeGrid from grid_functions import SpheroidGrid from grid_functions import SpheroidSurfaceGrid grid_inputs = [ (ParallelotopeGrid, obj(cells=(5, 6), axes=[[1, 0, 0], [1, 1, 0]])), (SpheroidGrid, obj(cells=(5, 6), axes=[[1, 0, 0], [1, 1, 0]])), (SpheroidSurfaceGrid, obj(cells=(5, 6), axes=[[1, 0, 0], [1, 1, 0], [1, 1, 1]])), ] for grid_type, inputs in grid_inputs: empty_grid = grid_type() grid = grid_type(**inputs) grid_copy = grid.copy() grid.reset() assert (object_eq(grid, empty_grid)) grid.initialize(**inputs) assert (object_eq(grid, grid_copy))
def test_get_result(): from generic import NexusError tpath = testing.setup_unit_test_output_directory('pwscf_simulation','test_get_result',**pseudo_inputs) sim = get_pwscf_sim('scf') try: sim.get_result('unknown',None) raise FailedTest except NexusError: None except FailedTest: failed() except Exception as e: failed(str(e)) #end try result = sim.get_result('charge_density',None) result2 = sim.get_result('restart',None) assert(object_eq(result,result2)) result_ref = dict( locdir = 'scf', outdir = 'scf/pwscf_output', location = 'scf/pwscf_output/pwscf.save/charge-density.dat', spin_location = 'scf/pwscf_output/pwscf.save/spin-polarization.dat', ) assert(set(result.keys())==set(result_ref.keys())) for k,path in result.items(): path = path.replace(tpath,'').lstrip('/') assert(path==result_ref[k]) #end for result = sim.get_result('orbitals',None) result_ref = dict( location = 'scf/pwscf_output/pwscf.wfc1', ) assert(set(result.keys())==set(result_ref.keys())) for k,path in result.items(): path = path.replace(tpath,'').lstrip('/') assert(path==result_ref[k]) #end for clear_all_sims() restore_nexus()
def test_pyscf_to_afqmc_input_init(): from qmcpack_converters import PyscfToAfqmcInput from qmcpack_converters import generate_pyscf_to_afqmc_input # empty init pi = PyscfToAfqmcInput() assert (pi.is_valid()) assert (set(pi.keys()) == set(PyscfToAfqmcInput.input_defaults.keys())) for v in pi: assert (v is None or v == False or v == 'pyscf_to_afqmc.py') #end for pi2 = generate_pyscf_to_afqmc_input() assert (pi2.is_valid()) assert (object_eq(pi2, pi)) # simple init pi = generate_pyscf_to_afqmc_input( input='scf.chk', output='afqmc.h5', cholesky_threshold=1e-5, verbose=True, ) assert (pi.is_valid()) assert (pi.input == 'scf.chk') assert (pi.output == 'afqmc.h5') assert (value_eq(pi.cholesky_threshold, 1e-5)) assert (value_eq(pi.verbose, True)) pi2 = generate_pyscf_to_afqmc_input( i='scf.chk', o='afqmc.h5', t=1e-5, v=True, ) assert (pi2.is_valid()) assert (object_eq(pi2, pi))
def test_rename(): from generic import obj from physical_system import generate_physical_system sys = generate_physical_system( units='A', axes=[[1.785, 1.785, 0.], [0., 1.785, 1.785], [1.785, 0., 1.785]], elem=['C1', 'C2'], posu=[[0.00, 0.00, 0.00], [0.25, 0.25, 0.25]], tiling=[[1, -1, 1], [1, 1, -1], [-1, 1, 1]], C1=4, C2=4, ) ref = sys assert (object_eq(ref.valency, obj(C1=4, C2=4))) assert (list(ref.structure.elem) == 4 * ['C1', 'C2']) assert (ref.particles.count_ions() == 8) assert (ref.particles.count_ions(species=True) == (8, 2)) ref = sys.folded_system assert (object_eq(ref.valency, obj(C1=4, C2=4))) assert (list(ref.structure.elem) == ['C1', 'C2']) assert (ref.particles.count_ions() == 2) assert (ref.particles.count_ions(species=True) == (2, 2)) sys.rename(C1='C', C2='C') ref = sys assert (object_eq(ref.valency, obj(C=4))) assert (list(ref.structure.elem) == 8 * ['C']) assert (ref.particles.count_ions() == 8) assert (ref.particles.count_ions(species=True) == (8, 1)) ref = sys.folded_system assert (object_eq(ref.valency, obj(C=4))) assert (list(ref.structure.elem) == 2 * ['C']) assert (ref.particles.count_ions() == 2) assert (ref.particles.count_ions(species=True) == (2, 1))
def test_empty_init(): from generic import obj from qmcpack_analyzer import QmcpackAnalyzer qa = QmcpackAnalyzer() qa_ref = obj(info=obj( analyzed=False, data_loaded=False, error=None, failed=False, initialized=False, nindent=0, savefile='', savefilepath='./', request=obj( calculations=set([]), #data_sources = set(['opt', 'stat', 'dmc', 'storeconfig', 'traces', 'scalar']), destination='.', dm_settings=None, equilibration=None, group_num=None, methods=set(['opt', 'rmc', 'dmc', 'vmc']), ndmc_blocks=1000, output=set(['averages', 'samples']), quantities=set([ 'mpc', 'localenergy', 'nonlocalecp', 'acceptratio', 'spindensity', 'kinetic', 'blockweight', 'structurefactor', 'localecp', 'density', 'kecorr', 'energydensity', 'localenergy_sq', 'blockcpu', 'dm1b', 'localpotential', 'elecelec', 'ionion' ]), savefile='', source='./qmcpack.in.xml', traces=False, warmup_calculations=set([]), ), )) data_sources_ref = set( ['opt', 'stat', 'dmc', 'storeconfig', 'traces', 'scalar']) req = qa.info.request data_sources = req.data_sources del req.data_sources assert (len(data_sources - data_sources_ref) == 0) assert (object_eq(qa.to_obj(), qa_ref))
def test_generate(): from generic import obj from pwscf_postprocessors import generate_projwfc_input pi = generate_projwfc_input( prefix='pwscf', outdir='pwscf_output', ) pi_ref = obj(projwfc=obj( prefix='pwscf', outdir='pwscf_output', ), ) assert (object_eq(pi.to_obj(), pi_ref))
def test_pw2qmcpack_input_generate(): from generic import obj from qmcpack_converters import generate_pw2qmcpack_input pi = generate_pw2qmcpack_input( prefix='pwscf', outdir='pwscf_output', ) pi_ref = obj(inputpp=obj( prefix='pwscf', outdir='pwscf_output', write_psir=False, ), ) assert (object_eq(pi.to_obj(), pi_ref))
def test_twist_average_analysis(): import os from generic import obj from qmcpack_analyzer import QmcpackAnalyzer tpath = testing.setup_unit_test_output_directory( test='qmcpack_analyzer', subtest='test_twist_average_analysis', file_sets=['diamond_twist'], ) # test analysis of twist averaged vmc data infile = os.path.join(tpath, 'diamond_twist/vmc/vmc.in') qa = QmcpackAnalyzer(infile, analyze=True, equilibration=5) qa_keys = 'info wavefunction vmc qmc bundled_analyzers'.split() assert (set(qa.keys()) == set(qa_keys)) ba = qa.bundled_analyzers ba_keys = [0, 1, 2, 3] assert (set(ba.keys()) == set(ba_keys)) for n in ba_keys: assert (isinstance(ba[n], QmcpackAnalyzer)) #end for qa2 = ba[2] qa2_keys = 'info wavefunction vmc qmc'.split() assert (set(qa2.keys()) == set(qa2_keys)) le_twists = obj() for n in ba_keys: le_twists[n] = ba[n].qmc[0].scalars.LocalEnergy.mean #end for le_twists_ref = obj({ 0: -10.477644724210526, 1: -11.54064069741053, 2: -11.547046178357895, 3: -11.809361818642103, }) assert (object_eq(le_twists, le_twists_ref)) le_avg = qa.qmc[0].scalars.LocalEnergy.mean le_avg_ref = -11.343673354655264 assert (value_eq(le_avg, le_avg_ref))
def system_same(s1, s2, pseudized=True, tiled=False): same = True keys = ('net_charge', 'net_spin', 'pseudized', 'particles') o1 = s1.obj(keys) o2 = s2.obj(keys) qsame = object_eq(o1, o2) vsame = True if pseudized: vsame = s1.valency == s2.valency #end if ssame = structure_same(s1.structure, s2.structure) fsame = True if tiled: fsame = system_same(s1.folded_system, s2.folded_system) #end if same = qsame and vsame and ssame and fsame return same
def test_convert4qmc_input_generate(): from generic import obj from qmcpack_converters import generate_convert4qmc_input ci = generate_convert4qmc_input( gamess='gamess.out', hdf5=True, ) ci_ref = obj( add_3body_J=False, add_cusp=False, app_name='convert4qmc', casino=None, ci=None, first=None, gamess='gamess.out', gamess_ascii=None, gamess_fmo=None, gamess_xml=None, gaussian=None, gridtype=None, hdf5=True, ion_tag=None, last=None, multidet=None, natural_orbitals=None, no_jastrow=False, opt_det_coeffs=False, orbitals=None, prefix=None, production=False, psi_tag=None, pyscf=None, qp=None, read_initial_guess=None, size=None, target_state=None, threshold=None, vsvb=None, zero_ci=False, ) assert (object_eq(ci.to_obj(), ci_ref))