Esempio n. 1
0
    def test_finite_diff_with_water_2(self):
        with path("saddle.optimizer.test.data", "water.xyz") as mol_path:
            mol = Utils.load_file(mol_path)
        red_int = ReducedInternal(mol.coordinates, mol.numbers, 0, 1)
        red_int.auto_select_ic()
        with path("saddle.optimizer.test.data", "water_old.fchk") as fchk_file:
            red_int.energy_from_fchk(fchk_file)
        assert red_int.energy - 75.99264142 < 1e-6
        red_int.select_key_ic(0)
        ref_v = np.array([
            [-1.00000000e00, -4.17292908e-16, 0.00000000e00],
            [2.10951257e-16, -4.69422035e-01, -8.82973926e-01],
            [3.39185671e-16, -8.82973926e-01, 4.69422035e-01],
        ])
        ref_v2 = np.dot(ref_v, ref_v.T)
        assert np.allclose(ref_v2, np.dot(red_int.vspace, red_int.vspace.T))
        red_int.set_vspace(ref_v)
        wt_p1 = PathPoint(red_int=red_int)
        step = [-0.001, 0, 0]
        wt_p2 = wt_p1.copy()
        wt_p2.update_coordinates_with_delta_v(step)
        # fchk file is for -0.001
        with path("saddle.optimizer.test.data",
                  "water_new_2.fchk") as fchk_file_new:
            wt_p2._instance.energy_from_fchk(fchk_file_new)

        wt_p2._instance.align_vspace(wt_p1._instance)
        assert np.allclose(wt_p1.vspace, wt_p2.vspace)
        result = PathPoint._calculate_finite_diff_h(wt_p1, wt_p2, -0.001)
        assert np.allclose(result, wt_p1._instance.v_hessian[:, 0], atol=1e-2)
Esempio n. 2
0
 def test_get_delta_v(self):
     with path("saddle.test.data", "water.xyz") as mol_path:
         mol = Utils.load_file(mol_path)
     ri_mol = ReducedInternal(mol.coordinates, mol.numbers, 0, 1)
     ri_mol.add_bond(1, 0)
     ri_mol.add_bond(1, 2)
     ri_mol.add_angle(0, 1, 2)
     ri_mol.set_key_ic_number(1)
     vp_ref = np.array(
         [
             [-1.00000000e00, 1.52461867e-16, -2.25191203e-16],
             [-1.57750703e-16, 3.51986473e-01, 9.36005087e-01],
             [-1.73472348e-16, -9.36005087e-01, 3.51986473e-01],
         ]
     )
     ri_mol.set_vspace(vp_ref)
     print(ri_mol.vspace)
     assert np.allclose(ri_mol.vspace, vp_ref)
     v_change = np.array([-0.2, 0.07039729, 0.18720102])
     ic_change = np.dot(ri_mol.vspace, v_change)
     assert np.allclose(ic_change, np.array([0.2, 0.2, 0.0]))
     ri_mol.update_to_new_structure_with_delta_v(v_change)
     assert np.allclose(
         ri_mol.ic_values, np.array([2.01413724, 2.01413724, 1.9106340176])
     )
Esempio n. 3
0
 def test_set_new_vspace(self):
     with path("saddle.test.data", "water.xyz") as mol_path:
         mol = Utils.load_file(mol_path)
     ri_mol = ReducedInternal(mol.coordinates, mol.numbers, 0, 1)
     ri_mol.add_bond(1, 0)
     ri_mol.add_bond(1, 2)
     ri_mol.add_angle(0, 1, 2)
     ri_mol.set_key_ic_number(1)
     new_vp = np.eye(3)
     ri_mol.set_vspace(new_vp)
     assert np.allclose(ri_mol.vspace, np.eye(3))