def test_unsupported_method(self, driver_type): """test unsupported methods""" for method in [MethodType.RKS, MethodType.ROKS, MethodType.UKS]: driver = ElectronicStructureMoleculeDriver( self._molecule, basis="sto3g", method=method, driver_type=driver_type ) with self.assertRaises(UnsupportMethodError): _ = driver.run()
def test_driver(self, config): """test driver""" driver_type, hf_energy = config driver = ElectronicStructureMoleculeDriver( self._molecule, basis="sto3g", driver_type=driver_type ) driver_result = driver.run() electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, hf_energy, places=5)
def test_invalid_kwarg(self): """test invalid kwarg""" driver = ElectronicStructureMoleculeDriver( self._molecule, basis="sto3g", driver_type=ElectronicStructureDriverType.PYSCF, driver_kwargs={"max_cycle": 0}, ) with self.assertRaises(ValueError): _ = driver.run()
def test_unsupported_method(self, driver_type): """test unsupported methods""" for method in [MethodType.RKS, MethodType.ROKS, MethodType.UKS]: driver = ElectronicStructureMoleculeDriver( self._molecule, basis="sto3g", method=method, driver_type=driver_type ) with self.assertRaises(UnsupportMethodError): try: _ = driver.run() except MissingOptionalLibraryError as ex: self.skipTest(str(ex))
def test_driver(self, config): """test driver""" driver_type, hf_energy = config driver = ElectronicStructureMoleculeDriver( self._molecule, basis="sto3g", driver_type=driver_type ) try: driver_result = driver.run() except MissingOptionalLibraryError as ex: self.skipTest(str(ex)) electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, hf_energy, places=5)
def setUp(self): super().setUp() driver = ElectronicStructureMoleculeDriver( TestDriver.MOLECULE, driver_type=ElectronicStructureDriverType.PSI4) self.driver_result = driver.run()