Example #1
0
def test_script_convert_g03():
    with tmpdir(
            'horton.scripts.test.test_atomdb.test_script_convert_g03') as dn:
        copy_atom_output('atom_001_001_hf_sto3g.fchk', 1, 0, 2, dn,
                         'atom.fchk')
        copy_atom_output('atom_001_002_hf_sto3g.fchk', 1, -1, 1, dn,
                         'atom.fchk')
        copy_atom_output('atom_008_007_hf_sto3g.fchk', 8, +1, 4, dn,
                         'atom.fchk')
        copy_atom_output('atom_008_008_hf_sto3g.fchk', 8, 0, 3, dn,
                         'atom.fchk')
        copy_atom_output('atom_008_009_hf_sto3g.fchk', 8, -1, 2, dn,
                         'atom.fchk')
        make_fake_run_script('g03', dn)
        check_script('horton-atomdb.py convert', dn)
        # check presence of files
        fns = [
            'atoms.h5',
            'dens_001__h.png',
            'rdens_001__h.png',
            'fukui_001__h.png',
            'rfukui_001__h.png',
            'dens_008__o.png',
            'rdens_008__o.png',
            'fukui_008__o.png',
            'rfukui_008__o.png',
        ]
        check_files(dn, fns)
        # load proatomdb file and check some contents
        padb = ProAtomDB.from_file(os.path.join(dn, 'atoms.h5'))
        assert padb.get_numbers() == [1, 8]
        assert padb.get_charges(1) == [0, -1]
        assert padb.get_charges(8) == [+1, 0, -1]
Example #2
0
def test_script_convert_g03():
    with tmpdir("horton.scripts.test.test_atomdb.test_script_convert_g03") as dn:
        copy_atom_output("atom_001_001_hf_sto3g.fchk", 1, 0, 2, dn, "atom.fchk")
        copy_atom_output("atom_001_002_hf_sto3g.fchk", 1, -1, 1, dn, "atom.fchk")
        copy_atom_output("atom_008_007_hf_sto3g.fchk", 8, +1, 4, dn, "atom.fchk")
        copy_atom_output("atom_008_008_hf_sto3g.fchk", 8, 0, 3, dn, "atom.fchk")
        copy_atom_output("atom_008_009_hf_sto3g.fchk", 8, -1, 2, dn, "atom.fchk")
        make_fake_run_script("g03", dn)
        check_script("horton-atomdb.py convert", dn)
        # check presence of files
        fns = [
            "atoms.h5",
            "dens_001__h.png",
            "rdens_001__h.png",
            "fukui_001__h.png",
            "rfukui_001__h.png",
            "dens_008__o.png",
            "rdens_008__o.png",
            "fukui_008__o.png",
            "rfukui_008__o.png",
        ]
        check_files(dn, fns)
        # load proatomdb file and check some contents
        padb = ProAtomDB.from_file(os.path.join(dn, "atoms.h5"))
        assert padb.get_numbers() == [1, 8]
        assert padb.get_charges(1) == [0, -1]
        assert padb.get_charges(8) == [+1, 0, -1]
Example #3
0
def test_script_convert_g09():
    with tmpdir('horton.scripts.test.test_atomdb.test_script_convert_g09') as dn:
        copy_atom_output('atom_014_013_hf_lan.fchk', 14, +1, 2, dn, 'atom.fchk')
        make_fake_run_script('g09', dn)
        check_script('horton-atomdb.py convert --grid medium', dn)
        # check presence of files
        fns = ['atoms.h5', 'dens_014_si.png', 'rdens_014_si.png', 'fukui_014_si.png', 'rfukui_014_si.png']
        check_files(dn, fns)
        # load proatomdb file and check some contents
        padb = ProAtomDB.from_file(os.path.join(dn, 'atoms.h5'))
        assert padb.get_numbers() == [14]
        assert padb.get_charges(14) == [+1]
        assert padb.get_rgrid(14).size == 49
Example #4
0
def test_script_convert_g09():
    with tmpdir("horton.scripts.test.test_atomdb.test_script_convert_g09") as dn:
        copy_atom_output("atom_014_013_hf_lan.fchk", 14, +1, 2, dn, "atom.fchk")
        make_fake_run_script("g09", dn)
        check_script("horton-atomdb.py convert --grid medium", dn)
        # check presence of files
        fns = ["atoms.h5", "dens_014_si.png", "rdens_014_si.png", "fukui_014_si.png", "rfukui_014_si.png"]
        check_files(dn, fns)
        # load proatomdb file and check some contents
        padb = ProAtomDB.from_file(os.path.join(dn, "atoms.h5"))
        assert padb.get_numbers() == [14]
        assert padb.get_charges(14) == [+1]
        assert padb.get_rgrid(14).size == 49
Example #5
0
def test_script_convert_g09():
    with tmpdir('horton.scripts.test.test_atomdb.test_script_convert_g09') as dn:
        copy_atom_output('atom_014_013_hf_lan.fchk', 14, +1, 2, dn, 'atom.fchk')
        make_fake_run_script('g09', dn)
        check_script('horton-atomdb.py convert --grid medium', dn)
        # check presence of files
        fns = ['atoms.h5', 'dens_014_si.png', 'rdens_014_si.png', 'fukui_014_si.png', 'rfukui_014_si.png']
        check_files(dn, fns)
        # load proatomdb file and check some contents
        padb = ProAtomDB.from_file(os.path.join(dn, 'atoms.h5'))
        assert padb.get_numbers() == [14]
        assert padb.get_charges(14) == [+1]
        assert padb.get_rgrid(14).size == 49
Example #6
0
def test_script_convert_cp2k():
    with tmpdir('horton.scripts.test.test_atomdb.test_script_convert_cp2k') as dn:
        copy_atom_output('atom_op2.cp2k.out', 8, +2, 3, dn, 'atom.cp2k.out')
        copy_atom_output('atom_op1.cp2k.out', 8, +1, 4, dn, 'atom.cp2k.out')
        copy_atom_output('atom_o.cp2k.out',   8,  0, 2, dn, 'atom.cp2k.out')
        copy_atom_output('atom_om1.cp2k.out', 8, -1, 1, dn, 'atom.cp2k.out')
        copy_atom_output('atom_om2.cp2k.out', 8, -2, 0, dn, 'atom.cp2k.out')
        make_fake_run_script('cp2k', dn)
        check_script('horton-atomdb.py convert', dn)
        # check presence of files
        fns = ['atoms.h5', 'dens_008__o.png', 'rdens_008__o.png', 'fukui_008__o.png', 'rfukui_008__o.png']
        check_files(dn, fns)
        # load proatomdb file and check some contents
        padb = ProAtomDB.from_file(os.path.join(dn, 'atoms.h5'))
        assert padb.get_numbers() == [8]
        assert padb.get_charges(8) == [+2, +1, 0, -1, -2]
        assert not padb.get_record(8, -2).safe
        assert padb.get_rgrid(8).size == 71
Example #7
0
def test_script_convert_cp2k():
    with tmpdir('horton.scripts.test.test_atomdb.test_script_convert_cp2k') as dn:
        copy_atom_output('atom_op2.cp2k.out', 8, +2, 3, dn, 'atom.cp2k.out')
        copy_atom_output('atom_op1.cp2k.out', 8, +1, 4, dn, 'atom.cp2k.out')
        copy_atom_output('atom_o.cp2k.out',   8,  0, 2, dn, 'atom.cp2k.out')
        copy_atom_output('atom_om1.cp2k.out', 8, -1, 1, dn, 'atom.cp2k.out')
        copy_atom_output('atom_om2.cp2k.out', 8, -2, 0, dn, 'atom.cp2k.out')
        make_fake_run_script('cp2k', dn)
        check_script('horton-atomdb.py convert', dn)
        # check presence of files
        fns = ['atoms.h5', 'dens_008__o.png', 'rdens_008__o.png', 'fukui_008__o.png', 'rfukui_008__o.png']
        check_files(dn, fns)
        # load proatomdb file and check some contents
        padb = ProAtomDB.from_file(os.path.join(dn, 'atoms.h5'))
        assert padb.get_numbers() == [8]
        assert padb.get_charges(8) == [+2, +1, 0, -1, -2]
        assert not padb.get_record(8, -2).safe
        assert padb.get_rgrid(8).size == 71