Esempio n. 1
0
def test_example_hf_compare():
    required = [context.get_fn('examples/hf_compare/compare.py'),
                context.get_fn('examples/hf_compare/compare_rt.py')]
    expected = ['compare.log']
    cmd = './compare.py %s > compare.log' % context.get_fn('test/helium_hf_sto3g.fchk')
    cmd += '; horton-regression-test.py ./compare_rt.py'
    check_script_in_tmp(cmd, required, expected)
Esempio n. 2
0
def test_example_hamiltonian_internal_ao():
    required = [context.get_fn('examples/hamiltonian/dump_internal_ao.py'),
                context.get_fn('examples/hamiltonian/load_internal_ao.py')]
    expected = ['hamiltonian_ao.h5']
    check_script_in_tmp('horton-regression-test.py ./dump_internal_ao.py; '
                        'horton-regression-test.py ./load_internal_ao.py',
                        required, expected)
Esempio n. 3
0
def test_example_ap1rog_extham_n2():
    required = [context.get_fn('examples/ap1rog/external_hamiltonian_n2_dense.py'),
                context.get_fn('examples/hf_dft/rhf_n2_dense.py')]
    expected = ['checkpoint.h5', 'n2-scf.molden', 'n2-scf.h5',
                'n2-cas8-8.FCIDUMP', 'n2-hamiltonian-cas8-8.h5', 'n2.FCIDUMP',
                'n2-hamiltonian.h5']
    check_script_in_tmp('./rhf_n2_dense.py; ./external_hamiltonian_n2_dense.py', required, expected)
Esempio n. 4
0
def test_hamiltonian_internal_ao():
    required = [
        context.get_fn('examples/hamiltonian/dump_internal_ao.py'),
        context.get_fn('examples/hamiltonian/load_internal_ao.py')
    ]
    expected = ['hamiltonian_ao.h5']
    check_script_in_tmp('./dump_internal_ao.py; ./load_internal_ao.py',
                        required, expected)
Esempio n. 5
0
def test_example_ap1rog_water_cholesky_321g_restart():
    required = [
        context.get_fn('examples/ap1rog/water_cholesky_3-21g.py'),
        context.get_fn('examples/ap1rog/restart_water_cholesky_3-21g.py')
    ]
    expected = ['checkpoint.h5']
    check_script_in_tmp(
        './water_cholesky_3-21g.py; ./restart_water_cholesky_3-21g.py',
        required, expected)
Esempio n. 6
0
def test_example_hamiltonian_internal_ao():
    required = [
        context.get_fn('examples/hamiltonian/dump_internal_ao.py'),
        context.get_fn('examples/hamiltonian/load_internal_ao.py')
    ]
    expected = ['hamiltonian_ao.h5']
    check_script_in_tmp(
        'horton-regression-test.py ./dump_internal_ao.py; '
        'horton-regression-test.py ./load_internal_ao.py', required, expected)
Esempio n. 7
0
def test_example_hf_compare():
    required = [
        context.get_fn('examples/hf_compare/compare.py'),
        context.get_fn('examples/hf_compare/compare_rt.py')
    ]
    expected = ['compare.log']
    cmd = './compare.py %s > compare.log' % context.get_fn(
        'test/helium_hf_sto3g.fchk')
    cmd += '; horton-regression-test.py ./compare_rt.py'
    check_script_in_tmp(cmd, required, expected)
Esempio n. 8
0
def test_example_ap1rog_extham_h2():
    required = [
        context.get_fn('examples/ap1rog/external_hamiltonian_h2_cholesky.py'),
        context.get_fn('examples/hf_dft/rhf_h2_cholesky.py')
    ]
    expected = [
        'checkpoint.h5', 'h2-scf.molden', 'h2-scf.h5', 'h2-hamiltonian.h5'
    ]
    check_script_in_tmp(
        './rhf_h2_cholesky.py; ./external_hamiltonian_h2_cholesky.py',
        required, expected)
Esempio n. 9
0
def test_example_ap1rog_extham_n2():
    required = [
        context.get_fn('examples/ap1rog/external_hamiltonian_n2_dense.py'),
        context.get_fn('examples/hf_dft/rhf_n2_dense.py')
    ]
    expected = [
        'checkpoint.h5', 'n2-scf.molden', 'n2-scf.h5', 'n2-cas8-8.FCIDUMP',
        'n2-hamiltonian-cas8-8.h5', 'n2.FCIDUMP', 'n2-hamiltonian.h5'
    ]
    check_script_in_tmp(
        './rhf_n2_dense.py; ./external_hamiltonian_n2_dense.py', required,
        expected)
Esempio n. 10
0
def test_example_rhf_n2_dense():
    required = [context.get_fn('examples/hf_dft/rhf_n2_dense.py')]
    expected = [
        'n2-scf.molden', 'n2-scf.h5', 'n2-cas8-8.FCIDUMP',
        'n2-hamiltonian-cas8-8.h5', 'n2.FCIDUMP', 'n2-hamiltonian.h5'
    ]
    check_script_in_tmp('./rhf_n2_dense.py', required, expected)
Esempio n. 11
0
def test_example_rhf_water_dense():
    required = [context.get_fn('examples/hf_dft/rhf_water_dense.py')]
    expected = [
        'water-scf.h5', 'water-scf.molden', 'water.FCIDUMP',
        'water-hamiltonian.h5'
    ]
    check_script_in_tmp('./rhf_water_dense.py', required, expected)
Esempio n. 12
0
def write_random_lta_cube(dn, fn_cube):
    sys = System.from_file(context.get_fn('test/lta_gulp.cif'))
    ugrid = UniformGrid(np.zeros(3, float), sys.cell.rvecs*0.1, np.array([10, 10, 10]), np.array([1, 1, 1]))
    cube_data = np.random.uniform(0, 1, ugrid.shape)
    sys.update_grid(ugrid)
    sys.extra['cube_data'] = cube_data
    sys.to_file(os.path.join(dn, fn_cube))
    return sys
Esempio n. 13
0
def write_random_lta_cube(dn, fn_cube):
    sys = System.from_file(context.get_fn('test/lta_gulp.cif'))
    ugrid = UniformGrid(np.zeros(3, float), sys.cell.rvecs * 0.1,
                        np.array([10, 10, 10]), np.array([1, 1, 1]))
    cube_data = np.random.uniform(0, 1, ugrid.shape)
    sys.update_grid(ugrid)
    sys.extra['cube_data'] = cube_data
    sys.to_file(os.path.join(dn, fn_cube))
    return sys
Esempio n. 14
0
def test_example_oe_water():
    required = [context.get_fn('examples/orbital_entanglement/water.py')]
    expected = [
        'i12.dat', 'checkpoint.h5', 's1.dat', 'orbital_entanglement.png'
    ]
    check_script_in_tmp(
        './water.py; horton-entanglement.py 0.001; '
        'horton-entanglement.py 0.001 1 3;'
        'horton-entanglement.py 0.0001 10', required, expected)
Esempio n. 15
0
def write_random_lta_cube(dn, fn_cube):
    '''Write a randomized cube file'''
    # start from an existing cube file
    mol = IOData.from_file(context.get_fn('test/lta_gulp.cif'))
    # Define a uniform grid with only 1000 points, to make the tests fast.
    ugrid = UniformGrid(np.zeros(3, float), mol.cell.rvecs*0.1, np.array([10, 10, 10]), np.array([1, 1, 1]))
    # Write to the file dn/fn_cube
    mol.cube_data = np.random.uniform(0, 1, ugrid.shape)
    mol.grid = ugrid
    mol.to_file(os.path.join(dn, fn_cube))
    return mol
Esempio n. 16
0
def write_random_lta_cube(dn, fn_cube):
    '''Write a randomized cube file'''
    # start from an existing cube file
    mol = IOData.from_file(context.get_fn('test/lta_gulp.cif'))
    # Define a uniform grid with only 1000 points, to make the tests fast.
    ugrid = UniformGrid(np.zeros(3, float), mol.cell.rvecs * 0.1,
                        np.array([10, 10, 10]), np.array([1, 1, 1]))
    # Write to the file dn/fn_cube
    mol.cube_data = np.random.uniform(0, 1, ugrid.shape)
    mol.grid = ugrid
    mol.to_file(os.path.join(dn, fn_cube))
    return mol
Esempio n. 17
0
def test_example_even_tempered_li():
    check_script('./even_tempered_li.py',
                 context.get_fn('examples/hamiltonian'))
Esempio n. 18
0
def test_example_rhf_water_cholesky():
    required = [context.get_fn('examples/hf_dft/rhf_water_cholesky.py')]
    expected = ['water.h5', 'water.molden']
    check_script_in_tmp('./rhf_water_cholesky.py', required, expected)
Esempio n. 19
0
def test_example_rhf_h2_cholesky():
    required = [context.get_fn('examples/hf_dft/rhf_h2_cholesky.py')]
    expected = ['h2-scf.molden', 'h2-scf.h5', 'h2-hamiltonian.h5']
    check_script_in_tmp('./rhf_h2_cholesky.py', required, expected)
Esempio n. 20
0
def test_example_ptb_h2_cc_pvdz():
    required = [
        context.get_fn('examples/perturbation_theory/ptb_h2_cc-pvdz.py')
    ]
    expected = ['checkpoint.h5']
    check_script_in_tmp('./ptb_h2_cc-pvdz.py', required, expected)
Esempio n. 21
0
def test_example_ptb_water_def2_svpd():
    required = [
        context.get_fn('examples/perturbation_theory/ptb_water_def2-svpd.py')
    ]
    expected = ['checkpoint.h5']
    check_script_in_tmp('./ptb_water_def2-svpd.py', required, expected)
Esempio n. 22
0
def test_example_uks_methyl_numgga():
    required = [context.get_fn('examples/hf_dft/uks_methyl_numgga.py')]
    expected = ['methyl.h5']
    check_script_in_tmp('./uks_methyl_numgga.py', required, expected)
Esempio n. 23
0
def test_example_rks_water_numgga():
    required = [context.get_fn('examples/hf_dft/rks_water_numgga.py')]
    expected = ['water.h5']
    check_script_in_tmp('./rks_water_numgga.py', required, expected)
Esempio n. 24
0
def test_example_expectation_r():
    check_script('./expectation_r.py', context.get_fn('examples/grid'))
Esempio n. 25
0
def test_example_ap1rog_hubbard():
    required = [context.get_fn('examples/ap1rog/hubbard.py')]
    expected = ['checkpoint.h5']
    check_script_in_tmp('./hubbard.py', required, expected)
Esempio n. 26
0
def test_hamiltonian_fcidump_ao():
    required = [context.get_fn('examples/hamiltonian/dump_fcidump_ao.py'),
                context.get_fn('examples/hamiltonian/load_fcidump_ao.py')]
    expected = ['hamiltonian_ao.FCIDUMP']
    check_script_in_tmp('./dump_fcidump_ao.py; ./load_fcidump_ao.py', required, expected)
Esempio n. 27
0
def test_hamiltonian_internal_ao_fcidump():
    required = [context.get_fn('examples/hamiltonian/dump_internal_ao_fcidump.py')]
    expected = ['hamiltonian_ao_fcidump.h5']
    check_script_in_tmp('./dump_internal_ao_fcidump.py', required, expected)
Esempio n. 28
0
def test_example_hubbard():
    check_script('./hubbard.py', context.get_fn('examples/hamiltonian'))
Esempio n. 29
0
def test_example_hf_compare():
    required = [context.get_fn('examples/hf_compare/compare.py')]
    expected = []
    check_script_in_tmp('./compare.py %s' % context.get_fn('test/helium_hf_sto3g.fchk'), required, expected)
Esempio n. 30
0
def test_example_wpart():
    required = [context.get_fn('examples/wpart/becke.py')]
    expected = ['charges.txt']
    check_script_in_tmp('./becke.py', required, expected)
Esempio n. 31
0
def test_example_uhf_methyl_dense():
    required = [context.get_fn('examples/hf_dft/uhf_methyl_dense.py')]
    expected = ['methyl.h5', 'methyl.molden']
    check_script_in_tmp('./uhf_methyl_dense.py', required, expected)
Esempio n. 32
0
def test_example_hydrogen_ring():
    required = [context.get_fn('examples/hamiltonian/hydrogen_ring.py')]
    expected = ['ring.xyz']
    check_script_in_tmp('./hydrogen_ring.py', required, expected)
Esempio n. 33
0
def test_example_uks_methyl_numgga():
    required = [context.get_fn('examples/hf_dft/uks_methyl_numgga.py')]
    expected = ['methyl.h5']
    check_script_in_tmp('./uks_methyl_numgga.py', required, expected)
Esempio n. 34
0
def test_example_ap1rog_extham_h2():
    required = [context.get_fn('examples/ap1rog/external_hamiltonian_h2_cholesky.py'),
                context.get_fn('examples/hf_dft/rhf_h2_cholesky.py')]
    expected = ['checkpoint.h5', 'h2-scf.molden', 'h2-scf.h5',
                'h2-hamiltonian.h5']
    check_script_in_tmp('./rhf_h2_cholesky.py; ./external_hamiltonian_h2_cholesky.py', required, expected)
Esempio n. 35
0
def copy_files(dn, fns):
    for fn in fns:
        shutil.copy(context.get_fn(os.path.join('test', fn)),
                    os.path.join(dn, fn))
Esempio n. 36
0
def get_proatomdb_cp2k():
    '''Return a proatomdb of pseudo oxygens and one silicon for testing purposes'''
    fns = glob(context.get_fn('test/atom_*.cp2k.out'))
    return ProAtomDB.from_files(fns)
Esempio n. 37
0
def test_example_first():
    required = [context.get_fn('examples/getting_started/first.py')]
    expected = ['water.h5']
    check_script_in_tmp('./first.py', required, expected)
Esempio n. 38
0
def get_proatomdb_hf_sto3g():
    '''Return a proatomdb of H and O at hf/sto-3g for testing purposes'''
    fns = glob(context.get_fn('test/atom_???_???_hf_sto3g.fchk'))
    return ProAtomDB.from_files(fns)
Esempio n. 39
0
def test_example_hydrogen_ring():
    required = [context.get_fn('examples/hamiltonian/hydrogen_ring.py')]
    expected = ['ring.xyz']
    check_script_in_tmp('./hydrogen_ring.py', required, expected)
Esempio n. 40
0
def get_proatomdb_hf_lan():
    '''Return a proatomdb of H, O, Si at hf/LANL2MB for testing purposes'''
    fns = glob(context.get_fn('test/atom_???_???_hf_lan.fchk'))
    return ProAtomDB.from_files(fns)
Esempio n. 41
0
def test_example_uhf_methyl_dense():
    required = [context.get_fn('examples/hf_dft/uhf_methyl_dense.py')]
    expected = ['methyl.h5', 'methyl.molden']
    check_script_in_tmp('./uhf_methyl_dense.py', required, expected)
Esempio n. 42
0
def test_example_rhf_h2_cholesky():
    required = [context.get_fn('examples/hf_dft/rhf_h2_cholesky.py')]
    expected = ['h2-scf.molden', 'h2-scf.h5', 'h2-hamiltonian.h5']
    check_script_in_tmp('./rhf_h2_cholesky.py', required, expected)
Esempio n. 43
0
def test_example_rhf_water_cholesky():
    required = [context.get_fn('examples/hf_dft/rhf_water_cholesky.py')]
    expected = ['water.h5', 'water.molden']
    check_script_in_tmp('./rhf_water_cholesky.py', required, expected)
Esempio n. 44
0
def test_context():
    fn = context.get_fn("basis/sto-3g.nwchem")
    assert os.path.isfile(fn)
    fns = context.glob("basis/*.nwchem")
    assert fn in fns
Esempio n. 45
0
def test_example_oe_water():
    required = [context.get_fn('examples/orbital_entanglement/water.py')]
    expected = ['i12.dat', 'checkpoint.h5', 's1.dat', 'orbital_entanglement.png']
    check_script_in_tmp('./water.py; horton-entanglement.py 0.001; '
                        'horton-entanglement.py 0.001 1 3;'
                        'horton-entanglement.py 0.0001 10', required, expected)
Esempio n. 46
0
def test_example_hf_compare():
    required = [context.get_fn('examples/hf_compare/compare.py')]
    expected = []
    check_script_in_tmp(
        './compare.py %s' % context.get_fn('test/helium_hf_sto3g.fchk'),
        required, expected)
Esempio n. 47
0
def test_example_rks_water_numgga():
    required = [context.get_fn('examples/hf_dft/rks_water_numgga.py')]
    expected = ['water.h5']
    check_script_in_tmp('./rks_water_numgga.py', required, expected)
Esempio n. 48
0
def test_example_expectation_r():
    check_script('./expectation_r.py', context.get_fn('examples/grid'))
Esempio n. 49
0
def test_example_hubbard():
    check_script('./hubbard.py', context.get_fn('examples/hamiltonian'))
Esempio n. 50
0
def test_example_first():
    required = [context.get_fn('examples/getting_started/first.py')]
    expected = ['water.h5']
    check_script_in_tmp('./first.py', required, expected)
Esempio n. 51
0
def test_example_wpart():
    required = [context.get_fn('examples/wpart/becke.py')]
    expected = ['charges.txt']
    check_script_in_tmp('./becke.py', required, expected)
Esempio n. 52
0
def test_example_even_tempered_li():
    check_script('./even_tempered_li.py', context.get_fn('examples/hamiltonian'))
Esempio n. 53
0
def test_example_ptb_water_def2_svpd():
    required = [context.get_fn('examples/perturbation_theory/ptb_water_def2-svpd.py')]
    expected = ['checkpoint.h5']
    check_script_in_tmp('./ptb_water_def2-svpd.py', required, expected)
Esempio n. 54
0
def test_example_rhf_n2_dense():
    required = [context.get_fn('examples/hf_dft/rhf_n2_dense.py')]
    expected = ['n2-scf.molden', 'n2-scf.h5', 'n2-cas8-8.FCIDUMP',
                'n2-hamiltonian-cas8-8.h5', 'n2.FCIDUMP', 'n2-hamiltonian.h5']
    check_script_in_tmp('./rhf_n2_dense.py', required, expected)
Esempio n. 55
0
def test_example_ap1rog_hubbard():
    required = [context.get_fn('examples/ap1rog/hubbard.py')]
    expected = ['checkpoint.h5']
    check_script_in_tmp('./hubbard.py', required, expected)
Esempio n. 56
0
def test_example_pt_mp2_water_431g():
    check_script('./mp2_water_4-31g.py',
                 context.get_fn('examples/perturbation_theory'))
Esempio n. 57
0
def test_example_pt_mp2_water_cc_pvdz():
    check_script('./mp2_water_cc-pvdz.py',
                 context.get_fn('examples/perturbation_theory'))
Esempio n. 58
0
def test_example_pt_mp2_water_def2_svpd():
    check_script('./mp2_water_def2-svpd.py',
                 context.get_fn('examples/perturbation_theory'))
Esempio n. 59
0
def copy_files(dn, fns):
    for fn in fns:
        shutil.copy(context.get_fn(os.path.join('test', fn)), os.path.join(dn, fn))
Esempio n. 60
0
def test_example_rhf_water_dense():
    required = [context.get_fn('examples/hf_dft/rhf_water_dense.py')]
    expected = ['water-scf.h5', 'water-scf.molden', 'water.FCIDUMP',
                'water-hamiltonian.h5']
    check_script_in_tmp('./rhf_water_dense.py', required, expected)