diff --git a/src/python/atoms/export_atoms.hpp b/src/python/atoms/export_atoms.hpp new file mode 100644 index 00000000..0033fa92 --- /dev/null +++ b/src/python/atoms/export_atoms.hpp @@ -0,0 +1,39 @@ +/* + * 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_atoms(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomFromZ, m); + EXPORT_PROPERTY_TYPE(AtomFromSym, m); + EXPORT_PROPERTY_TYPE(AtomDenFromZ, m); + EXPORT_PROPERTY_TYPE(AtomDenFromSym, m); + EXPORT_PROPERTY_TYPE(ElecConfigFromZ, m); + EXPORT_PROPERTY_TYPE(ElecConfigFromSym, m); + EXPORT_PROPERTY_TYPE(FracConfigFromZ, m); + EXPORT_PROPERTY_TYPE(FracConfigFromSym, m); + EXPORT_PROPERTY_TYPE(FullConfigFromZ, m); + EXPORT_PROPERTY_TYPE(FullConfigFromSym, m); + EXPORT_PROPERTY_TYPE(SymbolFromZ, m); + EXPORT_PROPERTY_TYPE(ZFromSymbol, m); +} + +} // namespace simde diff --git a/src/python/basis_set/export_basis_set.hpp b/src/python/basis_set/export_basis_set.hpp index 11f52540..5c46eb50 100644 --- a/src/python/basis_set/export_basis_set.hpp +++ b/src/python/basis_set/export_basis_set.hpp @@ -17,11 +17,14 @@ #pragma once #include "../export_simde.hpp" #include +#include #include namespace simde { -inline void export_molecular_basis_set(python_module_reference m) { +inline void export_basis_set(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AtomicBasisSetFromZ, m); + EXPORT_PROPERTY_TYPE(AtomicBasisSetFromSym, m); EXPORT_PROPERTY_TYPE(MolecularBasisSet, m); } diff --git a/src/python/density/export_density.hpp b/src/python/density/export_density.hpp new file mode 100644 index 00000000..c44423ca --- /dev/null +++ b/src/python/density/export_density.hpp @@ -0,0 +1,31 @@ +/* + * 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_density(python_module_reference m) { + EXPORT_PROPERTY_TYPE(SCFDensity, m); + EXPORT_PROPERTY_TYPE(InitialDensity, m); + EXPORT_PROPERTY_TYPE(SCFGuessDensity, m); + EXPORT_PROPERTY_TYPE(SCFDensityStep, m); +} + +} // namespace simde diff --git a/src/python/derivative/export_derivative.hpp b/src/python/derivative/export_derivative.hpp new file mode 100644 index 00000000..6404a78a --- /dev/null +++ b/src/python/derivative/export_derivative.hpp @@ -0,0 +1,29 @@ +/* + * 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_derivative(python_module_reference m) { + EXPORT_PROPERTY_TYPE(AOEnergyNuclearGradient, m); + EXPORT_PROPERTY_TYPE(AOEnergyNuclearHessian, m); +} + +} // namespace simde 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 eaf734f4..fe15744b 100644 --- a/src/python/module.cpp +++ b/src/python/module.cpp @@ -14,19 +14,25 @@ * 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_atoms(m); + export_basis_set(m); + export_density(m); + export_derivative(m); export_energy(m); - export_aoenergy(m); - export_molecular_basis_set(m); + export_operators(m); } } // namespace simde diff --git a/src/python/operators/export_operators.hpp b/src/python/operators/export_operators.hpp new file mode 100644 index 00000000..ff68322a --- /dev/null +++ b/src/python/operators/export_operators.hpp @@ -0,0 +1,29 @@ +/* + * 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_operators(python_module_reference m) { + EXPORT_PROPERTY_TYPE(FockOp, m); + EXPORT_PROPERTY_TYPE(SystemHamiltonian, m); +} + +} // namespace simde 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 69c8d887..69d47b8b 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,22 @@ # 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 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() + self.input_labels= ['Molecule'] + self.result_labels = ['Molecular Basis Set'] \ No newline at end of file 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..edde00d3 --- /dev/null +++ b/tests/python/unit_tests/derivative/test_derivative.py @@ -0,0 +1,29 @@ +# 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 TestAOEnergyNuclearGradient(unittest.TestCase): + def setUp(self): + self.pt = simde.AOEnergyNuclearGradient() + self.input_labels = ['AOs', 'Chemical System', 'Arg 1'] + self.return_labels = ['Derivative'] + +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'] 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 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'] 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