From 2e149bd5b135f6bee72b498374645e52f341a8be Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 00:16:21 -0600 Subject: [PATCH 01/16] Use a base class to test pts --- tests/python/unit_tests/test_property_type.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/python/unit_tests/test_property_type.py diff --git a/tests/python/unit_tests/test_property_type.py b/tests/python/unit_tests/test_property_type.py new file mode 100644 index 00000000..3d0dc175 --- /dev/null +++ b/tests/python/unit_tests/test_property_type.py @@ -0,0 +1,33 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +class BaseTestPropertyType(unittest.TestCase): + def setUp(self): + self.pt = None + self.input_labels = None + self.result_labels = None + + def test_inputs(self): + if self.pt: + self.assertEqual(len(self.pt.inputs()), len(self.input_labels)) + for label in self.input_labels: + self.assertIn(label, self.pt.inputs()) + + def test_results(self): + if self.pt: + self.assertEqual(len(self.pt.results()), len(self.result_labels)) + for label in self.result_labels: + self.assertIn(label, self.pt.results()) \ No newline at end of file From 6a3e1d25ad079f4ca64f12a65020ef23c917a8b9 Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 00:18:09 -0600 Subject: [PATCH 02/16] Update energy pt tests --- tests/python/unit_tests/energy/test_energy.py | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/python/unit_tests/energy/test_energy.py b/tests/python/unit_tests/energy/test_energy.py index 09c327cd..f7b620d2 100644 --- a/tests/python/unit_tests/energy/test_energy.py +++ b/tests/python/unit_tests/energy/test_energy.py @@ -13,19 +13,16 @@ # limitations under the License. import simde -import pluginplay -import unittest +from test_property_type import BaseTestPropertyType -class TestEnergy(unittest.TestCase): - def test_energy_pt(self): - pt = simde.Energy() - self.assertIn('Chemical System', pt.inputs()) - self.assertIn('Energy', pt.results()) +class TestEnergy(BaseTestPropertyType): + def setUp(self): + self.pt = simde.Energy() + self.input_labels= ['Chemical System'] + self.result_labels = ['Energy'] - def test_aoenergy_pt(self): - pt = simde.AOEnergy() - self.assertIn('Chemical System', pt.inputs()) - self.assertIn('AOs', pt.inputs()) - self.assertEqual(len(pt.inputs()), 2) - self.assertIn('Energy', pt.results()) - self.assertEqual(len(pt.results()), 1) +class TestAOEnergy(BaseTestPropertyType): + def setUp(self): + self.pt = simde.AOEnergy() + self.input_labels= ['Chemical System', 'AOs'] + self.result_labels = ['Energy'] \ No newline at end of file From b094870777b830d738a41b5fe59ef8be5abcf450 Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 00:18:32 -0600 Subject: [PATCH 03/16] Update basis set pt tests --- .../python/unit_tests/basis_set/test_basis_set.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/python/unit_tests/basis_set/test_basis_set.py b/tests/python/unit_tests/basis_set/test_basis_set.py index 69c8d887..d94d404b 100644 --- a/tests/python/unit_tests/basis_set/test_basis_set.py +++ b/tests/python/unit_tests/basis_set/test_basis_set.py @@ -13,12 +13,10 @@ # limitations under the License. import simde -import unittest +from test_property_type import BaseTestPropertyType -class TestBasisSet(unittest.TestCase): - def test_molecular_basis_set_pt(self): - pt = simde.MolecularBasisSet() - self.assertIn('Molecule', pt.inputs()) - self.assertEqual(len(pt.inputs()), 1) - self.assertIn('Molecular Basis Set', pt.results()) - self.assertEqual(len(pt.results()), 1) \ No newline at end of file +class TestMolecularBasisSet(BaseTestPropertyType): + def setUp(self): + self.pt = simde.MolecularBasisSet() + self.input_labels= ['Molecule'] + self.result_labels = ['Molecular Basis Set'] \ No newline at end of file From 028779e328d8bbce24713298075144abb3cb8236 Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 00:26:03 -0600 Subject: [PATCH 04/16] Export atomic basis set bindings --- src/python/basis_set/export_basis_set.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/python/basis_set/export_basis_set.hpp b/src/python/basis_set/export_basis_set.hpp index 11f52540..fd530b12 100644 --- a/src/python/basis_set/export_basis_set.hpp +++ b/src/python/basis_set/export_basis_set.hpp @@ -17,10 +17,19 @@ #pragma once #include "../export_simde.hpp" #include +#include #include namespace simde { +inline void export_atomic_basis_set_from_z(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomicBasisSetFromZ, m); +} + +inline void export_atomic_basis_set_from_sym(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomicBasisSetFromSym, m); +} + inline void export_molecular_basis_set(python_module_reference m) { EXPORT_PROPERTY_TYPE(MolecularBasisSet, m); } From 9d8f89a111d021f4c54c9ecdd35f58b994d7ef20 Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 00:27:09 -0600 Subject: [PATCH 05/16] Export atom pts --- src/python/atoms/export_atoms.hpp | 72 +++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/python/atoms/export_atoms.hpp diff --git a/src/python/atoms/export_atoms.hpp b/src/python/atoms/export_atoms.hpp new file mode 100644 index 00000000..94f5a9e5 --- /dev/null +++ b/src/python/atoms/export_atoms.hpp @@ -0,0 +1,72 @@ +/* + * Copyright 2023 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include "../export_simde.hpp" +#include +#include + +namespace simde { + +inline void export_atomfromz(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomFromZ, m); +} + +inline void export_atomfromsym(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomFromSym, m); +} + +inline void export_atomdenfromz(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomDenFromZ, m); +} + +inline void export_atomdenfromsym(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomDenFromSym, m); +} + +inline void export_elecconfigfromz(python_module_reference m) { + EXPORT_PROPERTY_TYPE(ElecConfigFromZ, m); +} + +inline void export_elecconfigfromsym(python_module_reference m) { + EXPORT_PROPERTY_TYPE(ElecConfigFromSym, m); +} + +inline void export_fracconfigfromz(python_module_reference m) { + EXPORT_PROPERTY_TYPE(FracConfigFromZ, m); +} + +inline void export_fracconfigfromsym(python_module_reference m) { + EXPORT_PROPERTY_TYPE(FracConfigFromSym, m); +} + +inline void export_fullconfigfromz(python_module_reference m) { + EXPORT_PROPERTY_TYPE(FullConfigFromZ, m); +} + +inline void export_fullconfigfromsym(python_module_reference m) { + EXPORT_PROPERTY_TYPE(FullConfigFromSym, m); +} + +inline void export_symbolfromz(python_module_reference m) { + EXPORT_PROPERTY_TYPE(SymbolFromZ, m); +} + +inline void export_zfromsymbol(python_module_reference m) { + EXPORT_PROPERTY_TYPE(ZFromSymbol, m); +} + +} // namespace simde From 97b3f59b0ae699c2f7fde365bc04ae90b4976d7e Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 01:00:42 -0600 Subject: [PATCH 06/16] Add density pt bindings --- src/python/density/export_density.hpp | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/python/density/export_density.hpp diff --git a/src/python/density/export_density.hpp b/src/python/density/export_density.hpp new file mode 100644 index 00000000..52034409 --- /dev/null +++ b/src/python/density/export_density.hpp @@ -0,0 +1,40 @@ +/* + * Copyright 2023 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include "../export_simde.hpp" +#include +#include + +namespace simde { + +inline void export_scf_density(python_module_reference m) { + EXPORT_PROPERTY_TYPE(SCFDensity, m); +} + +inline void export_initial_density(python_module_reference m) { + EXPORT_PROPERTY_TYPE(InitialDensity, m); +} + +inline void export_scf_guess_density(python_module_reference m) { + EXPORT_PROPERTY_TYPE(SCFGuessDensity, m); +} + +inline void export_scf_density_step(python_module_reference m) { + EXPORT_PROPERTY_TYPE(SCFDensityStep, m); +} + +} // namespace simde From f225f2851c1cc51f518d8e9d7c1c9c227112856b Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 01:01:38 -0600 Subject: [PATCH 07/16] Add derivative pt bindings --- src/python/derivative/export_derivative.hpp | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/python/derivative/export_derivative.hpp diff --git a/src/python/derivative/export_derivative.hpp b/src/python/derivative/export_derivative.hpp new file mode 100644 index 00000000..895ed0ea --- /dev/null +++ b/src/python/derivative/export_derivative.hpp @@ -0,0 +1,32 @@ +/* + * Copyright 2023 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include "../export_simde.hpp" +#include +#include + +namespace simde { + +inline void export_aoenergynucleargradient(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AOEnergyNuclearGradient, m); +} + +inline void export_aoenergynuclearhessian(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AOEnergyNuclearHessian, m); +} + +} // namespace simde From 7f3821feb8498312850b724c1a9307782534a5ee Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 01:02:32 -0600 Subject: [PATCH 08/16] Add bindings for operator pts --- src/python/operators/export_operators.hpp | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/python/operators/export_operators.hpp diff --git a/src/python/operators/export_operators.hpp b/src/python/operators/export_operators.hpp new file mode 100644 index 00000000..a5ab79c3 --- /dev/null +++ b/src/python/operators/export_operators.hpp @@ -0,0 +1,32 @@ +/* + * Copyright 2023 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include "../export_simde.hpp" +#include +#include + +namespace simde { + +inline void export_fock_op(python_module_reference m) { + EXPORT_PROPERTY_TYPE(FockOp, m); +} + +inline void export_system_hamiltonian(python_module_reference m) { + EXPORT_PROPERTY_TYPE(SystemHamiltonian, m); +} + +} // namespace simde From dc06bddf7320570492f738d9ce570e6910b7ae7a Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 01:06:46 -0600 Subject: [PATCH 09/16] Export added bindings --- src/python/module.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/python/module.cpp b/src/python/module.cpp index eaf734f4..05a11c06 100644 --- a/src/python/module.cpp +++ b/src/python/module.cpp @@ -14,19 +14,44 @@ * limitations under the License. */ +#include "atoms/export_atoms.hpp" #include "basis_set/export_basis_set.hpp" +#include "density/export_density.hpp" +#include "derivative/export_derivative.hpp" #include "energy/export_energy.hpp" #include "export_simde.hpp" +#include "operators/export_operators.hpp" namespace simde { PYBIND11_MODULE(simde, m) { m.doc() = "PySimDE: Python bindings for the Simulation development environment"; - + export_atomfromz(m); + export_atomfromsym(m); + export_atomdenfromz(m); + export_atomdenfromsym(m); + export_elecconfigfromz(m); + export_elecconfigfromsym(m); + export_fracconfigfromz(m); + export_fracconfigfromsym(m); + export_fullconfigfromz(m); + export_fullconfigfromsym(m); + export_symbolfromz(m); + export_zfromsymbol(m); export_energy(m); export_aoenergy(m); + export_aoenergynucleargradient(m); + export_aoenergynuclearhessian(m); + export_atomic_basis_set_from_z(m); + export_atomic_basis_set_from_sym(m); export_molecular_basis_set(m); + export_scf_density(m); + export_initial_density(m); + export_scf_guess_density(m); + export_scf_density_step(m); + export_fock_op(m); + export_system_hamiltonian(m); } } // namespace simde From c018dda0827eff7e004e0923ac264d1dc84e1ad5 Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 01:08:11 -0600 Subject: [PATCH 10/16] Add python unit tests --- tests/python/unit_tests/atoms/__init__.py | 13 +++ tests/python/unit_tests/atoms/test_atoms.py | 88 +++++++++++++++++++ .../unit_tests/basis_set/test_basis_set.py | 12 +++ tests/python/unit_tests/density/__init__.py | 13 +++ tests/python/unit_tests/density/test_atoms.py | 40 +++++++++ .../python/unit_tests/derivative/__init__.py | 13 +++ .../unit_tests/derivative/test_derivative.py | 37 ++++++++ tests/python/unit_tests/operators/__init__.py | 13 +++ .../unit_tests/operators/test_operators.py | 28 ++++++ 9 files changed, 257 insertions(+) create mode 100644 tests/python/unit_tests/atoms/__init__.py create mode 100644 tests/python/unit_tests/atoms/test_atoms.py create mode 100644 tests/python/unit_tests/density/__init__.py create mode 100644 tests/python/unit_tests/density/test_atoms.py create mode 100644 tests/python/unit_tests/derivative/__init__.py create mode 100644 tests/python/unit_tests/derivative/test_derivative.py create mode 100644 tests/python/unit_tests/operators/__init__.py create mode 100644 tests/python/unit_tests/operators/test_operators.py diff --git a/tests/python/unit_tests/atoms/__init__.py b/tests/python/unit_tests/atoms/__init__.py new file mode 100644 index 00000000..dbacb651 --- /dev/null +++ b/tests/python/unit_tests/atoms/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. \ No newline at end of file diff --git a/tests/python/unit_tests/atoms/test_atoms.py b/tests/python/unit_tests/atoms/test_atoms.py new file mode 100644 index 00000000..0ef09b1a --- /dev/null +++ b/tests/python/unit_tests/atoms/test_atoms.py @@ -0,0 +1,88 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import simde +from test_property_type import BaseTestPropertyType + +class TestAtomFromZ(BaseTestPropertyType): + def setUp(self): + self.pt = simde.AtomFromZ() + self.input_labels = ['Atom ID'] + self.result_labels = ['Atom'] + +class TestAtomFromSym(BaseTestPropertyType): + def setUp(self): + self.pt = simde.AtomFromSym() + self.input_labels = ['Atom ID'] + self.result_labels = ['Atom'] + +class TestAtomDenFromZ(BaseTestPropertyType): + def setUp(self): + self.pt = simde.AtomDenFromZ() + self.input_labels = ['Atom ID'] + self.result_labels = ['Atomic Density'] + +class TestAtomDenFromSym(BaseTestPropertyType): + def setUp(self): + self.pt = simde.AtomDenFromSym() + self.input_labels = ['Atom ID'] + self.result_labels = ['Atomic Density'] + +class TestElecConfigFromZ(BaseTestPropertyType): + def setUp(self): + self.pt = simde.ElecConfigFromZ() + self.input_labels = ['Atom ID'] + self.result_labels = ['Electronic Configuration'] + +class TestElecConfigFromSym(BaseTestPropertyType): + def setUp(self): + self.pt = simde.ElecConfigFromSym() + self.input_labels = ['Atom ID'] + self.result_labels = ['Electronic Configuration'] + +class TestFracConfigFromZ(BaseTestPropertyType): + def setUp(self): + self.pt = simde.FracConfigFromZ() + self.input_labels = ['Atom ID'] + self.result_labels = ['Electronic Configuration'] + +class TestFracConfigFromSym(BaseTestPropertyType): + def setUp(self): + self.pt = simde.FracConfigFromSym() + self.input_labels = ['Atom ID'] + self.result_labels = ['Electronic Configuration'] + +class TestFullConfigFromZ(BaseTestPropertyType): + def setUp(self): + self.pt = simde.FullConfigFromZ() + self.input_labels = ['Atom ID'] + self.result_labels = ['Electronic Configuration'] + +class TestFullConfigFromSym(BaseTestPropertyType): + def setUp(self): + self.pt = simde.FullConfigFromSym() + self.input_labels = ['Atom ID'] + self.result_labels = ['Electronic Configuration'] + +class testSymbolFromZ(BaseTestPropertyType): + def setUp(self): + self.pt = simde.SymbolFromZ() + self.input_labels = ['Z'] + self.result_labels = ['Symbol'] + +class testZFromSymbol(BaseTestPropertyType): + def setUp(self): + self.pt = simde.ZFromSymbol() + self.input_labels = ['Symbol'] + self.result_labels = ['Z'] \ No newline at end of file diff --git a/tests/python/unit_tests/basis_set/test_basis_set.py b/tests/python/unit_tests/basis_set/test_basis_set.py index d94d404b..69d47b8b 100644 --- a/tests/python/unit_tests/basis_set/test_basis_set.py +++ b/tests/python/unit_tests/basis_set/test_basis_set.py @@ -15,6 +15,18 @@ import simde from test_property_type import BaseTestPropertyType +class TestAtomicBasisSetFromZ(BaseTestPropertyType): + def setUp(self): + self.pt = simde.AtomicBasisSetFromZ() + self.input_labels= ['Atom ID'] + self.result_labels = ['Atomic Basis Set'] + +class TestAtomicBasisSetFromSym(BaseTestPropertyType): + def setUp(self): + self.pt = simde.AtomicBasisSetFromSym() + self.input_labels= ['Atom ID'] + self.result_labels = ['Atomic Basis Set'] + class TestMolecularBasisSet(BaseTestPropertyType): def setUp(self): self.pt = simde.MolecularBasisSet() diff --git a/tests/python/unit_tests/density/__init__.py b/tests/python/unit_tests/density/__init__.py new file mode 100644 index 00000000..dbacb651 --- /dev/null +++ b/tests/python/unit_tests/density/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. \ No newline at end of file diff --git a/tests/python/unit_tests/density/test_atoms.py b/tests/python/unit_tests/density/test_atoms.py new file mode 100644 index 00000000..a14b74c0 --- /dev/null +++ b/tests/python/unit_tests/density/test_atoms.py @@ -0,0 +1,40 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import simde +from test_property_type import BaseTestPropertyType + +class TestSCFDensity(BaseTestPropertyType): + def setUp(self): + self.pt = simde.SCFDensity() + self.input_labels = ['Phi0'] + self.result_labels = ['Density'] + +class TestInitialDensity(BaseTestPropertyType): + def setUp(self): + self.pt = simde.InitialDensity() + self.input_labels = ['Hamiltonian'] + self.result_labels = ['Density'] + +class TestSCFGuessDensity(BaseTestPropertyType): + def setUp(self): + self.pt = simde.SCFGuessDensity() + self.input_labels = ['Hamiltonian', 'Input Space'] + self.result_labels = ['Output Density'] + +class TestSCFDensityStep(BaseTestPropertyType): + def setUp(self): + self.pt = simde.SCFDensityStep() + self.input_labels = ['Hamiltonian', 'Input Space'] + self.result_labels = ['Output Density'] \ No newline at end of file diff --git a/tests/python/unit_tests/derivative/__init__.py b/tests/python/unit_tests/derivative/__init__.py new file mode 100644 index 00000000..dbacb651 --- /dev/null +++ b/tests/python/unit_tests/derivative/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. \ No newline at end of file diff --git a/tests/python/unit_tests/derivative/test_derivative.py b/tests/python/unit_tests/derivative/test_derivative.py new file mode 100644 index 00000000..1f9b920f --- /dev/null +++ b/tests/python/unit_tests/derivative/test_derivative.py @@ -0,0 +1,37 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import simde +import pluginplay +import unittest + +class TestEnergy(unittest.TestCase): + def test_aoenergynucleargradient_pt(self): + pt = simde.AOEnergyNuclearGradient() + self.assertIn('AOs', pt.inputs()) + self.assertIn('Chemical System', pt.inputs()) + self.assertIn('Arg 1', pt.inputs()) + self.assertEqual(len(pt.inputs()), 3) + self.assertIn('Derivative', pt.results()) + self.assertEqual(len(pt.results()), 1) + + def test_aoenergynuclearhessian_pt(self): + pt = simde.AOEnergyNuclearHessian() + self.assertIn('AOs', pt.inputs()) + self.assertIn('Chemical System', pt.inputs()) + self.assertIn('Arg 1', pt.inputs()) + self.assertIn('Arg 2', pt.inputs()) + self.assertEqual(len(pt.inputs()), 4) + self.assertIn('Derivative', pt.results()) + self.assertEqual(len(pt.results()), 1) diff --git a/tests/python/unit_tests/operators/__init__.py b/tests/python/unit_tests/operators/__init__.py new file mode 100644 index 00000000..dbacb651 --- /dev/null +++ b/tests/python/unit_tests/operators/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. \ No newline at end of file diff --git a/tests/python/unit_tests/operators/test_operators.py b/tests/python/unit_tests/operators/test_operators.py new file mode 100644 index 00000000..40febc5e --- /dev/null +++ b/tests/python/unit_tests/operators/test_operators.py @@ -0,0 +1,28 @@ +# Copyright 2023 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import simde +from test_property_type import BaseTestPropertyType + +class TestFockOp(BaseTestPropertyType): + def setUp(self): + self.pt = simde.FockOp() + self.input_labels= ['Electronic Hamiltonian', 'One Electron Density'] + self.result_labels = ['Fock operator'] + +class TestSystemHamiltonian(BaseTestPropertyType): + def setUp(self): + self.pt = simde.SystemHamiltonian() + self.input_labels= ['Chemical System'] + self.result_labels = ['Hamiltonian'] From 6d8f19633f40ec155f9ae358ab5199ff75772769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Murat=20Ke=C3=A7eli?= Date: Tue, 12 Dec 2023 14:13:48 -0600 Subject: [PATCH 11/16] merge pt exports Co-authored-by: Jonathan M. Waldrop --- src/python/atoms/export_atoms.hpp | 35 +------------------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/src/python/atoms/export_atoms.hpp b/src/python/atoms/export_atoms.hpp index 94f5a9e5..0033fa92 100644 --- a/src/python/atoms/export_atoms.hpp +++ b/src/python/atoms/export_atoms.hpp @@ -21,51 +21,18 @@ namespace simde { -inline void export_atomfromz(python_module_reference m) { +inline void export_atoms(python_module_reference m) { EXPORT_PROPERTY_TYPE(AtomFromZ, m); -} - -inline void export_atomfromsym(python_module_reference m) { EXPORT_PROPERTY_TYPE(AtomFromSym, m); -} - -inline void export_atomdenfromz(python_module_reference m) { EXPORT_PROPERTY_TYPE(AtomDenFromZ, m); -} - -inline void export_atomdenfromsym(python_module_reference m) { EXPORT_PROPERTY_TYPE(AtomDenFromSym, m); -} - -inline void export_elecconfigfromz(python_module_reference m) { EXPORT_PROPERTY_TYPE(ElecConfigFromZ, m); -} - -inline void export_elecconfigfromsym(python_module_reference m) { EXPORT_PROPERTY_TYPE(ElecConfigFromSym, m); -} - -inline void export_fracconfigfromz(python_module_reference m) { EXPORT_PROPERTY_TYPE(FracConfigFromZ, m); -} - -inline void export_fracconfigfromsym(python_module_reference m) { EXPORT_PROPERTY_TYPE(FracConfigFromSym, m); -} - -inline void export_fullconfigfromz(python_module_reference m) { EXPORT_PROPERTY_TYPE(FullConfigFromZ, m); -} - -inline void export_fullconfigfromsym(python_module_reference m) { EXPORT_PROPERTY_TYPE(FullConfigFromSym, m); -} - -inline void export_symbolfromz(python_module_reference m) { EXPORT_PROPERTY_TYPE(SymbolFromZ, m); -} - -inline void export_zfromsymbol(python_module_reference m) { EXPORT_PROPERTY_TYPE(ZFromSymbol, m); } From b450a88974fe80776ae5c754f7acf10ada276ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Murat=20Ke=C3=A7eli?= Date: Tue, 12 Dec 2023 14:14:02 -0600 Subject: [PATCH 12/16] merge pt exports Co-authored-by: Jonathan M. Waldrop --- src/python/basis_set/export_basis_set.hpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/python/basis_set/export_basis_set.hpp b/src/python/basis_set/export_basis_set.hpp index fd530b12..5c46eb50 100644 --- a/src/python/basis_set/export_basis_set.hpp +++ b/src/python/basis_set/export_basis_set.hpp @@ -22,15 +22,9 @@ namespace simde { -inline void export_atomic_basis_set_from_z(python_module_reference m) { +inline void export_basis_set(python_module_reference m) { EXPORT_PROPERTY_TYPE(AtomicBasisSetFromZ, m); -} - -inline void export_atomic_basis_set_from_sym(python_module_reference m) { EXPORT_PROPERTY_TYPE(AtomicBasisSetFromSym, m); -} - -inline void export_molecular_basis_set(python_module_reference m) { EXPORT_PROPERTY_TYPE(MolecularBasisSet, m); } From 219eeb6152fb774675d11004f6f3b6a282edd6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Murat=20Ke=C3=A7eli?= Date: Tue, 12 Dec 2023 14:14:18 -0600 Subject: [PATCH 13/16] merge pt exports Co-authored-by: Jonathan M. Waldrop --- src/python/density/export_density.hpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/python/density/export_density.hpp b/src/python/density/export_density.hpp index 52034409..c44423ca 100644 --- a/src/python/density/export_density.hpp +++ b/src/python/density/export_density.hpp @@ -21,19 +21,10 @@ namespace simde { -inline void export_scf_density(python_module_reference m) { +inline void export_density(python_module_reference m) { EXPORT_PROPERTY_TYPE(SCFDensity, m); -} - -inline void export_initial_density(python_module_reference m) { EXPORT_PROPERTY_TYPE(InitialDensity, m); -} - -inline void export_scf_guess_density(python_module_reference m) { EXPORT_PROPERTY_TYPE(SCFGuessDensity, m); -} - -inline void export_scf_density_step(python_module_reference m) { EXPORT_PROPERTY_TYPE(SCFDensityStep, m); } From 38267821b54f7386861103ee052a0a55a924a2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Murat=20Ke=C3=A7eli?= Date: Tue, 12 Dec 2023 14:14:29 -0600 Subject: [PATCH 14/16] merge pt exports Co-authored-by: Jonathan M. Waldrop --- src/python/operators/export_operators.hpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/python/operators/export_operators.hpp b/src/python/operators/export_operators.hpp index a5ab79c3..ff68322a 100644 --- a/src/python/operators/export_operators.hpp +++ b/src/python/operators/export_operators.hpp @@ -21,11 +21,8 @@ namespace simde { -inline void export_fock_op(python_module_reference m) { +inline void export_operators(python_module_reference m) { EXPORT_PROPERTY_TYPE(FockOp, m); -} - -inline void export_system_hamiltonian(python_module_reference m) { EXPORT_PROPERTY_TYPE(SystemHamiltonian, m); } From d5e0e2d962a9bb25b1db01d853d9d2ab561b058f Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 14:17:48 -0600 Subject: [PATCH 15/16] Merge pt exports --- src/python/derivative/export_derivative.hpp | 5 +--- src/python/energy/export_energy.hpp | 3 --- src/python/module.cpp | 29 ++++----------------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/src/python/derivative/export_derivative.hpp b/src/python/derivative/export_derivative.hpp index 895ed0ea..6404a78a 100644 --- a/src/python/derivative/export_derivative.hpp +++ b/src/python/derivative/export_derivative.hpp @@ -21,11 +21,8 @@ namespace simde { -inline void export_aoenergynucleargradient(python_module_reference m) { +inline void export_derivative(python_module_reference m) { EXPORT_PROPERTY_TYPE(AOEnergyNuclearGradient, m); -} - -inline void export_aoenergynuclearhessian(python_module_reference m) { EXPORT_PROPERTY_TYPE(AOEnergyNuclearHessian, m); } diff --git a/src/python/energy/export_energy.hpp b/src/python/energy/export_energy.hpp index d8d42c1d..757e207b 100644 --- a/src/python/energy/export_energy.hpp +++ b/src/python/energy/export_energy.hpp @@ -23,9 +23,6 @@ namespace simde { inline void export_energy(python_module_reference m) { EXPORT_PROPERTY_TYPE(Energy, m); -} - -inline void export_aoenergy(python_module_reference m) { EXPORT_PROPERTY_TYPE(AOEnergy, m); } diff --git a/src/python/module.cpp b/src/python/module.cpp index 05a11c06..fe15744b 100644 --- a/src/python/module.cpp +++ b/src/python/module.cpp @@ -27,31 +27,12 @@ namespace simde { PYBIND11_MODULE(simde, m) { m.doc() = "PySimDE: Python bindings for the Simulation development environment"; - export_atomfromz(m); - export_atomfromsym(m); - export_atomdenfromz(m); - export_atomdenfromsym(m); - export_elecconfigfromz(m); - export_elecconfigfromsym(m); - export_fracconfigfromz(m); - export_fracconfigfromsym(m); - export_fullconfigfromz(m); - export_fullconfigfromsym(m); - export_symbolfromz(m); - export_zfromsymbol(m); + export_atoms(m); + export_basis_set(m); + export_density(m); + export_derivative(m); export_energy(m); - export_aoenergy(m); - export_aoenergynucleargradient(m); - export_aoenergynuclearhessian(m); - export_atomic_basis_set_from_z(m); - export_atomic_basis_set_from_sym(m); - export_molecular_basis_set(m); - export_scf_density(m); - export_initial_density(m); - export_scf_guess_density(m); - export_scf_density_step(m); - export_fock_op(m); - export_system_hamiltonian(m); + export_operators(m); } } // namespace simde From ae0cfdf3cd995405c2f423f88344ec9f8a1a0160 Mon Sep 17 00:00:00 2001 From: Murat Keceli Date: Tue, 12 Dec 2023 15:13:48 -0600 Subject: [PATCH 16/16] Use base class for testing --- .../unit_tests/derivative/test_derivative.py | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/python/unit_tests/derivative/test_derivative.py b/tests/python/unit_tests/derivative/test_derivative.py index 1f9b920f..edde00d3 100644 --- a/tests/python/unit_tests/derivative/test_derivative.py +++ b/tests/python/unit_tests/derivative/test_derivative.py @@ -16,22 +16,14 @@ import pluginplay import unittest -class TestEnergy(unittest.TestCase): - def test_aoenergynucleargradient_pt(self): - pt = simde.AOEnergyNuclearGradient() - self.assertIn('AOs', pt.inputs()) - self.assertIn('Chemical System', pt.inputs()) - self.assertIn('Arg 1', pt.inputs()) - self.assertEqual(len(pt.inputs()), 3) - self.assertIn('Derivative', pt.results()) - self.assertEqual(len(pt.results()), 1) +class TestAOEnergyNuclearGradient(unittest.TestCase): + def setUp(self): + self.pt = simde.AOEnergyNuclearGradient() + self.input_labels = ['AOs', 'Chemical System', 'Arg 1'] + self.return_labels = ['Derivative'] - def test_aoenergynuclearhessian_pt(self): - pt = simde.AOEnergyNuclearHessian() - self.assertIn('AOs', pt.inputs()) - self.assertIn('Chemical System', pt.inputs()) - self.assertIn('Arg 1', pt.inputs()) - self.assertIn('Arg 2', pt.inputs()) - self.assertEqual(len(pt.inputs()), 4) - self.assertIn('Derivative', pt.results()) - self.assertEqual(len(pt.results()), 1) +class TestAOEnergyNuclearHessian(unittest.TestCase): + def setUp(self): + self.pt = simde.AOEnergyNuclearHessian() + self.input_labels = ['AOs', 'Chemical System', 'Arg 1', 'Arg 2'] + self.return_labels = ['Derivative']