diff --git a/include/simde/chemical_system/atomic_density_matrix.hpp b/include/simde/chemical_system/atomic_density_matrix.hpp new file mode 100644 index 00000000..5aea1f0b --- /dev/null +++ b/include/simde/chemical_system/atomic_density_matrix.hpp @@ -0,0 +1,52 @@ +/* + * Copyright 2025 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 "simde/types.hpp" +#include + +namespace simde { + +/** @brief The property for a module that returns an atom based on an + * identifying feature (e.g. symbol or atomic number). + */ +template +DECLARE_TEMPLATED_PROPERTY_TYPE(AtomicDensityMatrix, InputType); + +template +TEMPLATED_PROPERTY_TYPE_INPUTS(AtomicDensityMatrix, InputType) { + using input_t = const InputType&; + auto rv = pluginplay::declare_input().add_field("Atom ID"); + rv.at("Atom ID").set_description("The identifying feature of the atom"); + return rv; +} + +template +TEMPLATED_PROPERTY_TYPE_RESULTS(AtomicDensityMatrix, InputType) { + std::string result_name = "Atomic Density Matrix"; + auto rv = pluginplay::declare_result().add_field(result_name); + rv.at(result_name).set_description("The requested Atomic Density Matrix"); + return rv; +} + +/// Typedef for a module that returns density matrices based on atomic number +using AtomicDensityMatrixFromZ = AtomicDensityMatrix; + +/// Typedef for a module that returns density matrices from a string (e.g. +/// atomic symbol) +using AtomicDensityMatrixFromSym = AtomicDensityMatrix; + +} // namespace simde diff --git a/include/simde/chemical_system/chemical_system.hpp b/include/simde/chemical_system/chemical_system.hpp index 55d77c8a..dc74bdd5 100644 --- a/include/simde/chemical_system/chemical_system.hpp +++ b/include/simde/chemical_system/chemical_system.hpp @@ -17,5 +17,6 @@ #pragma once #include #include +#include #include #include diff --git a/include/simde/density/density.hpp b/include/simde/density/density.hpp new file mode 100644 index 00000000..f96c2d90 --- /dev/null +++ b/include/simde/density/density.hpp @@ -0,0 +1,18 @@ +/* + * Copyright 2025 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 \ No newline at end of file diff --git a/include/simde/density/initial_density.hpp b/include/simde/density/initial_density.hpp new file mode 100644 index 00000000..b1ae6d81 --- /dev/null +++ b/include/simde/density/initial_density.hpp @@ -0,0 +1,38 @@ +/* + * Copyright 2025 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 "simde/types.hpp" +#include + +namespace simde { + +/** @brief The property for a module that returns an initial Electronic density + */ +DECLARE_PROPERTY_TYPE(InitialDensity); + +PROPERTY_TYPE_INPUTS(InitialDensity) { + using hamiltonian_type = const type::hamiltonian&; + return pluginplay::declare_input().template add_field( + "Hamiltonian"); +} + +PROPERTY_TYPE_RESULTS(InitialDensity) { + using density_type = simde::type::decomposable_e_density; + return pluginplay::declare_result().add_field("Density"); +} + +} // namespace simde diff --git a/include/simde/simde.hpp b/include/simde/simde.hpp index c5edf0ab..b0308471 100644 --- a/include/simde/simde.hpp +++ b/include/simde/simde.hpp @@ -17,6 +17,7 @@ #pragma once #include #include +#include #include #include #include diff --git a/src/python/chemical_system/export_chemical_system.hpp b/src/python/chemical_system/export_chemical_system.hpp index 9c016a0d..36a0a67b 100644 --- a/src/python/chemical_system/export_chemical_system.hpp +++ b/src/python/chemical_system/export_chemical_system.hpp @@ -24,6 +24,8 @@ namespace simde { inline void export_chemical_system(python_module_reference m) { EXPORT_PROPERTY_TYPE(AtomFromZ, m); EXPORT_PROPERTY_TYPE(AtomFromSym, m); + EXPORT_PROPERTY_TYPE(AtomicDensityMatrixFromZ, m); + EXPORT_PROPERTY_TYPE(AtomicDensityMatrixFromSym, m); EXPORT_PROPERTY_TYPE(SymbolFromZ, m); EXPORT_PROPERTY_TYPE(ZFromSymbol, m); EXPORT_PROPERTY_TYPE(MoleculeFromString, m); diff --git a/tests/cxx/unit_tests/chemical_system/atomic_density_matrix.cpp b/tests/cxx/unit_tests/chemical_system/atomic_density_matrix.cpp new file mode 100644 index 00000000..cbd7871d --- /dev/null +++ b/tests/cxx/unit_tests/chemical_system/atomic_density_matrix.cpp @@ -0,0 +1,23 @@ +/* + * Copyright 2025 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. + */ + +#include "../test_property_type.hpp" +#include + +TEST_CASE("Atomic Density Matrix") { + test_property_type( + {"Atom ID"}, {"Atomic Density Matrix"}); +} diff --git a/tests/cxx/unit_tests/density/initial_density.cpp b/tests/cxx/unit_tests/density/initial_density.cpp new file mode 100644 index 00000000..e364fe7c --- /dev/null +++ b/tests/cxx/unit_tests/density/initial_density.cpp @@ -0,0 +1,24 @@ +/* + * Copyright 2022 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. + */ + +#include "../test_property_type.hpp" +#include + +using init_density = simde::InitialDensity; + +TEST_CASE("Initial Density") { + test_property_type({"Hamiltonian"}, {"Density"}); +} diff --git a/tests/python/unit_tests/chemical_system/test_chemical_system.py b/tests/python/unit_tests/chemical_system/test_chemical_system.py index 5673c2c7..340ce62a 100644 --- a/tests/python/unit_tests/chemical_system/test_chemical_system.py +++ b/tests/python/unit_tests/chemical_system/test_chemical_system.py @@ -32,6 +32,22 @@ def setUp(self): self.result_labels = ['Atom'] +class TestAtomicDensityMatrixFromZ(BaseTestPropertyType): + + def setUp(self): + self.pt = simde.AtomicDensityMatrixFromZ() + self.input_labels = ['Atom ID'] + self.result_labels = ['Atomic Density Matrix'] + + +class TestAtomicDensityMatrixFromSym(BaseTestPropertyType): + + def setUp(self): + self.pt = simde.AtomicDensityMatrixFromSym() + self.input_labels = ['Atom ID'] + self.result_labels = ['Atomic Density Matrix'] + + class testSymbolFromZ(BaseTestPropertyType): def setUp(self):