Пример #1
0
def test_condense_from_molecule_fd_rmf_mulliken_h2o_fchk():
    # expected populations of H2O from fchk file
    expected_m = np.array([8, 1, 1]) - np.array(
        [3.49417097E-01, 3.25291762E-01, 3.25291141E-01])
    expected_0 = np.array([8, 1, 1]) - np.array(
        [-4.32227787E-01, 2.16114060E-01, 2.16113727E-01])
    expected_p = np.array([8, 1, 1]) - np.array(
        [-2.64833827E-01, -3.67583325E-01, -3.67582849E-01])
    molecule = []
    with path('chemtools.data', 'h2o_q+0_ub3lyp_ccpvtz.fchk') as file1:
        molecule.append(Molecule.from_file(file1))
    with path('chemtools.data', 'h2o_q-1_ub3lyp_ccpvtz.fchk') as file2:
        molecule.append(Molecule.from_file(file2))
    with path('chemtools.data', 'h2o_q+1_ub3lyp_ccpvtz.fchk') as file3:
        molecule.append(Molecule.from_file(file3))
    # check from_molecule linear
    model = CondensedConceptualDFT.from_molecule(molecule, "linear", "RMF",
                                                 "mulliken")
    check_condensed_reactivity(model, "linear", expected_0, expected_p,
                               expected_m, 10, 0.572546)
    # check from_molecule quadratic
    model = CondensedConceptualDFT.from_molecule(molecule, "quadratic", "RMF",
                                                 "mulliken")
    check_condensed_reactivity(model, "quadratic", expected_0, expected_p,
                               expected_m, 10, 0.572546)
Пример #2
0
def test_condense_from_molecule_fd_rmf_esp_h2o_fchk():
    # expected populations of H2O from fchk file
    expected_m = np.array([8, 1, 1]) - np.array(
        [4.14233893E-02, 4.79288419E-01, 4.79288192E-01])
    expected_0 = np.array([8, 1, 1]) - np.array(
        [-7.00779373E-01, 3.50389629E-01, 3.50389744E-01])
    expected_p = np.array([8, 1, 1]) - np.array(
        [-5.81613550E-01, -2.09193820E-01, -2.09192630E-01])
    molecule = []
    with path('chemtools.data', 'h2o_q+0_ub3lyp_ccpvtz.fchk') as file1:
        molecule.append(Molecule.from_file(file1))
    with path('chemtools.data', 'h2o_q-1_ub3lyp_ccpvtz.fchk') as file2:
        molecule.append(Molecule.from_file(file2))
    with path('chemtools.data', 'h2o_q+1_ub3lyp_ccpvtz.fchk') as file3:
        molecule.append(Molecule.from_file(file3))
    # check from_molecule linear
    model = CondensedConceptualDFT.from_molecule(molecule, "linear", "RMF",
                                                 "esp")
    check_condensed_reactivity(model, "linear", expected_0, expected_p,
                               expected_m, 10, 0.572546)
    # check from_molecule quadratic
    model = CondensedConceptualDFT.from_molecule(molecule, "quadratic", "RMF",
                                                 "esp")
    check_condensed_reactivity(model, "quadratic", expected_0, expected_p,
                               expected_m, 10, 0.572546)
Пример #3
0
def test_condense_from_molecule_fd_rmf_npa_h2o_fchk():
    # expected populations of H2O from fchk file
    expected_m = np.array([8, 1, 1]) - np.array(
        [-3.64452391E-02, 5.18222784E-01, 5.18222455E-01])
    expected_0 = np.array([8, 1, 1]) - np.array(
        [-9.00876494E-01, 4.50438267E-01, 4.50438227E-01])
    expected_p = np.array([8, 1, 1]) - np.array(
        [-1.11332869E+00, 5.66635486E-02, 5.66651430E-02])
    molecule = []
    with path('chemtools.data', 'h2o_q+0_ub3lyp_ccpvtz.fchk') as file1:
        molecule.append(Molecule.from_file(file1))
    with path('chemtools.data', 'h2o_q-1_ub3lyp_ccpvtz.fchk') as file2:
        molecule.append(Molecule.from_file(file2))
    with path('chemtools.data', 'h2o_q+1_ub3lyp_ccpvtz.fchk') as file3:
        molecule.append(Molecule.from_file(file3))
    # check from_molecule linear
    model = CondensedConceptualDFT.from_molecule(molecule, "linear", "RMF",
                                                 "npa")
    check_condensed_reactivity(model, "linear", expected_0, expected_p,
                               expected_m, 10, 0.572546)
    # check from_molecule quadratic
    model = CondensedConceptualDFT.from_molecule(molecule, "quadratic", "RMF",
                                                 "npa")
    check_condensed_reactivity(model, "quadratic", expected_0, expected_p,
                               expected_m, 10, 0.572546)
Пример #4
0
def test_condense_quadratic_from_molecule_fmr_mbis_ch4_fchk():
    # expected populations of CH4 computed with HORTON
    with path('chemtools.data', 'ch4_uhf_ccpvdz.fchk') as fname:
        mol = Molecule.from_file(fname)
    expected = np.array(
        [6.46038055, 0.88489494, 0.88492901, 0.88493897, 0.88492396])
    # check from_molecule
    model = CondensedConceptualDFT.from_molecule(mol, "quadratic", "FMR",
                                                 "mbis")
    check_condensed_reactivity(model, "quadratic", expected, None, None, 10,
                               0.736396)
    # check from_molecule given as a list
    model = CondensedConceptualDFT.from_molecule([mol], "quadratic", "FMR",
                                                 "mbis")
    check_condensed_reactivity(model, "quadratic", expected, None, None, 10,
                               0.736396)
    # check from_molecule & passing grid
    grid = MolecularGrid(mol.coordinates, mol.numbers, mol.pseudo_numbesr,
                         'insane', 3, False)
    model = CondensedConceptualDFT.from_molecule(mol,
                                                 "quadratic",
                                                 "FMR",
                                                 "mbis",
                                                 grid=grid)
    check_condensed_reactivity(model, "quadratic", expected, None, None, 10,
                               0.736396)
    # check from_molecule given as a list & passing grid
    model = CondensedConceptualDFT.from_molecule([mol],
                                                 "quadratic",
                                                 "FMR",
                                                 "mbis",
                                                 grid=grid)
    check_condensed_reactivity(model, "quadratic", expected, None, None, 10,
                               0.736396)
Пример #5
0
def test_condense_linear_from_molecule_fmr_h_ch4_wfn():
    # expected populations of CH4 computed with HORTON
    with path('chemtools.data', 'ch4_uhf_ccpvdz.wfn') as fname:
        mol = Molecule.from_file(fname)
    expected = np.array(
        [6.11301651, 0.97175462, 0.97175263, 0.9717521, 0.97174353])
    # check from_molecule
    model = CondensedConceptualDFT.from_molecule(mol, "linear", "FMR", "h")
    check_condensed_reactivity(model, "linear", expected, None, None, 10,
                               0.736396)
    # check from_molecule given as a list
    model = CondensedConceptualDFT.from_molecule([mol], "linear", "FMR", "h")
    check_condensed_reactivity(model, "linear", expected, None, None, 10,
                               0.736396)
    # check from_molecule & passing grid
    grid = MolecularGrid(mol.coordinates, mol.numbers, mol.pseudo_numbesr,
                         'insane', 3, False)
    model = CondensedConceptualDFT.from_molecule(mol,
                                                 "linear",
                                                 "FMR",
                                                 "h",
                                                 grid=grid)
    check_condensed_reactivity(model, "linear", expected, None, None, 10,
                               0.736396)
    # check from_molecule given as a list & passing grid
    model = CondensedConceptualDFT.from_molecule([mol],
                                                 "linear",
                                                 "FMR",
                                                 "h",
                                                 grid=grid)
    check_condensed_reactivity(model, "linear", expected, None, None, 10,
                               0.736396)
Пример #6
0
def test_condense_linear_from_file_fmr_mbis_ch4_fchk():
    # expected populations of CH4 computed with HORTON
    with path('chemtools.data', 'ch4_uhf_ccpvdz.fchk') as fname:
        model1 = CondensedConceptualDFT.from_file(fname, "linear", "FMR",
                                                  "mbis")
        model2 = CondensedConceptualDFT.from_file([fname], "linear", "FMR",
                                                  "mbis")
        mol = Molecule.from_file(fname)
        grid = MolecularGrid(mol.coordinates, mol.numbers, mol.pseudo_numbesr,
                             'insane', 3, False)
        model3 = CondensedConceptualDFT.from_file(fname,
                                                  "linear",
                                                  "FMR",
                                                  "mbis",
                                                  grid=grid)
        model4 = CondensedConceptualDFT.from_file([fname],
                                                  "linear",
                                                  "FMR",
                                                  "mbis",
                                                  grid=grid)
    expected = np.array(
        [6.46038055, 0.88489494, 0.88492901, 0.88493897, 0.88492396])
    # check using fname given as a string
    check_condensed_reactivity(model1, "linear", expected, None, None, 10,
                               0.736396)
    # check using fname given as a list
    check_condensed_reactivity(model2, "linear", expected, None, None, 10,
                               0.736396)
    # check using fname as a string & passing grid
    check_condensed_reactivity(model3, "linear", expected, None, None, 10,
                               0.736396)
    # check using fname as a list & passing grid
    check_condensed_reactivity(model4, "linear", expected, None, None, 10,
                               0.736396)
Пример #7
0
def test_condense_linear_from_file_fmr_h_ch4_fchk():
    # expected populations of CH4 computed with HORTON
    with path('chemtools.data', 'ch4_uhf_ccpvdz.fchk') as fname:
        model1 = CondensedConceptualDFT.from_file(fname, "linear", "FMR", "h")
        model2 = CondensedConceptualDFT.from_file([fname], "linear", "FMR",
                                                  "h")
        mol = Molecule.from_file(fname)
        grid = MolecularGrid.from_molecule(mol, specs='insane', rotate=False)
        model3 = CondensedConceptualDFT.from_file(fname,
                                                  "linear",
                                                  "FMR",
                                                  "h",
                                                  grid=grid)
        model4 = CondensedConceptualDFT.from_file([fname],
                                                  "linear",
                                                  "FMR",
                                                  "h",
                                                  grid=grid)
    expected = np.array(
        [6.11301651, 0.97175462, 0.97175263, 0.9717521, 0.97174353])
    # check using fname given as a string
    check_condensed_reactivity(model1, "linear", expected, None, None, 10,
                               0.736396)
    # check using fname given as a list
    check_condensed_reactivity(model2, "linear", expected, None, None, 10,
                               0.736396)
    # check using fname as a string & passing grid
    check_condensed_reactivity(model3, "linear", expected, None, None, 10,
                               0.736396)
    # check using fname as a list & passing grid
    check_condensed_reactivity(model4, "linear", expected, None, None, 10,
                               0.736396)
Пример #8
0
def test_condense_quadratic_from_file_fmr_mbis_ch4_wfn():
    # expected populations of CH4 computed with HORTON
    with path('chemtools.data', 'ch4_uhf_ccpvdz.wfn') as fname:
        model1 = CondensedConceptualDFT.from_file(fname, "quadratic", "FMR", "mbis")
        model2 = CondensedConceptualDFT.from_file([fname], "quadratic", "FMR", "mbis")
    expected = np.array([6.46038055, 0.88489494, 0.88492901, 0.88493897, 0.88492396])
    # check using fname given as a string
    check_condensed_reactivity(model1, "quadratic", expected, None, None, 10)
    # check using fname given as a list
    check_condensed_reactivity(model2, "quadratic", expected, None, None, 10)
Пример #9
0
def test_condense_from_file_fd_rmf_mulliken_h2o_fchk():
    # expected populations of H2O from fchk file
    expected_m = np.array([8, 1, 1]) - np.array([ 3.49417097E-01, 3.25291762E-01, 3.25291141E-01])
    expected_0 = np.array([8, 1, 1]) - np.array([-4.32227787E-01, 2.16114060E-01, 2.16113727E-01])
    expected_p = np.array([8, 1, 1]) - np.array([-2.64833827E-01,-3.67583325E-01,-3.67582849E-01])
    with path('chemtools.data', 'h2o_q+0_ub3lyp_ccpvtz.fchk') as file1:
        with path('chemtools.data', 'h2o_q-1_ub3lyp_ccpvtz.fchk') as file2:
            with path('chemtools.data', 'h2o_q+1_ub3lyp_ccpvtz.fchk') as file3:
                fname = [file1, file2, file3]
                model1 = CondensedConceptualDFT.from_file(fname, "linear", "RMF", "mulliken")
                model2 = CondensedConceptualDFT.from_file(fname, "quadratic", "RMF", "mulliken")
    # check from_file linear
    check_condensed_reactivity(model1, "linear", expected_0, expected_p, expected_m, 10)
    # check from_file quadratic
    check_condensed_reactivity(model2, "quadratic", expected_0, expected_p, expected_m, 10)
Пример #10
0
def test_condense_from_file_fd_rmf_npa_h2o_fchk():
    # expected populations of H2O from fchk file
    expected_m = np.array([8, 1, 1]) - np.array([-3.64452391E-02, 5.18222784E-01, 5.18222455E-01])
    expected_0 = np.array([8, 1, 1]) - np.array([-9.00876494E-01, 4.50438267E-01, 4.50438227E-01])
    expected_p = np.array([8, 1, 1]) - np.array([-1.11332869E+00, 5.66635486E-02, 5.66651430E-02])
    with path('chemtools.data', 'h2o_q+0_ub3lyp_ccpvtz.fchk') as file1:
        with path('chemtools.data', 'h2o_q-1_ub3lyp_ccpvtz.fchk') as file2:
            with path('chemtools.data', 'h2o_q+1_ub3lyp_ccpvtz.fchk') as file3:
                fname = [file1, file2, file3]
                # check from_file linear
                model1 = CondensedConceptualDFT.from_file(fname, "linear", "RMF", "npa")
                model2 = CondensedConceptualDFT.from_file(fname, "quadratic", "RMF", "npa")
    check_condensed_reactivity(model1, "linear", expected_0, expected_p, expected_m, 10)
    # check from_file quadratic
    check_condensed_reactivity(model2, "quadratic", expected_0, expected_p, expected_m, 10)
Пример #11
0
def test_condense_from_file_fd_rmf_esp_h2o_fchk():
    # expected populations of H2O from fchk file
    expected_m = np.array([8, 1, 1]) - np.array([ 4.14233893E-02, 4.79288419E-01, 4.79288192E-01])
    expected_0 = np.array([8, 1, 1]) - np.array([-7.00779373E-01, 3.50389629E-01, 3.50389744E-01])
    expected_p = np.array([8, 1, 1]) - np.array([-5.81613550E-01,-2.09193820E-01,-2.09192630E-01])
    with path('chemtools.data', 'h2o_q+0_ub3lyp_ccpvtz.fchk') as file1:
        with path('chemtools.data', 'h2o_q-1_ub3lyp_ccpvtz.fchk') as file2:
            with path('chemtools.data', 'h2o_q+1_ub3lyp_ccpvtz.fchk') as file3:
                fname = [file1, file2, file3]
                # check from_file linear
                model1 = CondensedConceptualDFT.from_file(fname, "linear", "RMF", "esp")
                model2 = CondensedConceptualDFT.from_file(fname, "quadratic", "RMF", "esp")
    check_condensed_reactivity(model1, "linear", expected_0, expected_p, expected_m, 10)
    # check from_file quadratic
    check_condensed_reactivity(model2, "quadratic", expected_0, expected_p, expected_m, 10)
Пример #12
0
def test_condense_quadratic_from_molecule_fmr_mbis_ch4_wfn():
    # expected populations of CH4 computed with HORTON
    with path('chemtools.data', 'ch4_uhf_ccpvdz.wfn') as fname:
        molecule = Molecule.from_file(fname)
    expected = np.array(
        [6.46038055, 0.88489494, 0.88492901, 0.88493897, 0.88492396])
    # check from_molecule given as a string
    model = CondensedConceptualDFT.from_molecule(molecule, "quadratic", "FMR",
                                                 "mbis")
    check_condensed_reactivity(model, "quadratic", expected, None, None, 10,
                               0.736396)
    # check from_molecule given as a list
    model = CondensedConceptualDFT.from_molecule([molecule], "quadratic",
                                                 "FMR", "mbis")
    check_condensed_reactivity(model, "quadratic", expected, None, None, 10,
                               0.736396)