예제 #1
0
 def test_ts_construct(self):
     ts_ins = TSConstruct(self.reactant_ic, self.product_ic)
     ts_ins.auto_select_ic()
     ts_ins.create_ts_state(start_with="product", flex_sin=False)
     result = deepcopy(ts_ins.ts)
     ts_ins.create_ts_state(start_with="reactant", flex_sin=False)
     result_2 = deepcopy(ts_ins.ts)
     # print result_2.ic_values
     ref_tar_ic = ts_ins._reactant.ic_values * 0.5 + ts_ins._product.ic_values * 0.5
     assert np.allclose(ref_tar_ic, result.target_ic)
     assert np.allclose(result.target_ic, result_2.target_ic)
     # assert np.allclose(
     #     result.ic_values[:4], result.target_ic[:4], atol=1e-6)
     # TODO: need to check structure
     # assert np.allclose(
     #     result_2.ic_values[:4], result_2.target_ic[:4], atol=1e-6)
     assert_allclose(result.ic_values[:16],
                     result_2.ic_values[:16],
                     atol=1e-3)
     ts_ins.select_key_ic(1)
     assert ts_ins.key_ic_counter == 1
     assert np.allclose(ts_ins.ts.ic_values[:2][::-1],
                        result_2.ic_values[:2])
     assert np.allclose(ts_ins.ts._cc_to_ic_gradient[1],
                        result_2._cc_to_ic_gradient[0])
예제 #2
0
 def test_ts_create(self):
     ts_ins = TSConstruct(self.reactant_ic, self.product_ic)
     ts_ins.auto_select_ic()
     ts_ins.create_ts_state(start_with="reactant")
     ts_ins.select_key_ic(3, 4)
     assert isinstance(ts_ins.ts.ic[0], type(ts_ins.product.ic[3]))
     assert isinstance(ts_ins.product.ic[3], type(ts_ins.ts.ic[0]))
     assert isinstance(ts_ins.ts.ic[1], type(ts_ins.product.ic[4]))
     assert isinstance(ts_ins.product.ic[4], type(ts_ins.ts.ic[1]))
     assert ts_ins.ts.key_ic_number == 2
     new_ins = TSConstruct(self.reactant_ic, self.product_ic)
     assert new_ins is not ts_ins
     new_ins.auto_generate_ts()
     new_ins.select_key_ic(3, 4)
     assert np.allclose(new_ins.ts.ic_values, ts_ins.ts.ic_values)
     assert isinstance(new_ins.ts, ReducedInternal)