Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions include/simde/chemical_system/atomic_density_matrix.hpp
Original file line number Diff line number Diff line change
@@ -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 <pluginplay/pluginplay.hpp>

namespace simde {

/** @brief The property for a module that returns an atom based on an
* identifying feature (e.g. symbol or atomic number).
*/
template<typename InputType>
DECLARE_TEMPLATED_PROPERTY_TYPE(AtomicDensityMatrix, InputType);

template<typename InputType>
TEMPLATED_PROPERTY_TYPE_INPUTS(AtomicDensityMatrix, InputType) {
using input_t = const InputType&;
auto rv = pluginplay::declare_input().add_field<input_t>("Atom ID");
Comment thread
ryanmrichard marked this conversation as resolved.
rv.at("Atom ID").set_description("The identifying feature of the atom");
return rv;
}

template<typename InputType>
TEMPLATED_PROPERTY_TYPE_RESULTS(AtomicDensityMatrix, InputType) {
std::string result_name = "Atomic Density Matrix";
auto rv = pluginplay::declare_result().add_field<type::tensor>(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<type::atomic_number>;

/// Typedef for a module that returns density matrices from a string (e.g.
/// atomic symbol)
using AtomicDensityMatrixFromSym = AtomicDensityMatrix<type::atomic_symbol>;

} // namespace simde
1 change: 1 addition & 0 deletions include/simde/chemical_system/chemical_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
#pragma once
#include <simde/chemical_system/Z_from_symbol.hpp>
#include <simde/chemical_system/atom.hpp>
#include <simde/chemical_system/atomic_density_matrix.hpp>
#include <simde/chemical_system/molecule_from_string.hpp>
#include <simde/chemical_system/symbol_from_Z.hpp>
18 changes: 18 additions & 0 deletions include/simde/density/density.hpp
Original file line number Diff line number Diff line change
@@ -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 <simde/density/initial_density.hpp>
38 changes: 38 additions & 0 deletions include/simde/density/initial_density.hpp
Original file line number Diff line number Diff line change
@@ -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 <pluginplay/pluginplay.hpp>

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_type>(
"Hamiltonian");
}

PROPERTY_TYPE_RESULTS(InitialDensity) {
using density_type = simde::type::decomposable_e_density;
return pluginplay::declare_result().add_field<density_type>("Density");
}

} // namespace simde
1 change: 1 addition & 0 deletions include/simde/simde.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#pragma once
#include <simde/basis_set/basis_set.hpp>
#include <simde/chemical_system/chemical_system.hpp>
#include <simde/density/density.hpp>
#include <simde/energy/energy.hpp>
#include <simde/evaluate_braket/evaluate_braket.hpp>
#include <simde/numerical_methods/numerical_methods.hpp>
Expand Down
2 changes: 2 additions & 0 deletions src/python/chemical_system/export_chemical_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
23 changes: 23 additions & 0 deletions tests/cxx/unit_tests/chemical_system/atomic_density_matrix.cpp
Original file line number Diff line number Diff line change
@@ -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 <simde/chemical_system/atomic_density_matrix.hpp>

TEST_CASE("Atomic Density Matrix") {
test_property_type<simde::AtomicDensityMatrixFromZ>(
{"Atom ID"}, {"Atomic Density Matrix"});
}
24 changes: 24 additions & 0 deletions tests/cxx/unit_tests/density/initial_density.cpp
Original file line number Diff line number Diff line change
@@ -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 <simde/density/initial_density.hpp>

using init_density = simde::InitialDensity;

TEST_CASE("Initial Density") {
test_property_type<init_density>({"Hamiltonian"}, {"Density"});
}
16 changes: 16 additions & 0 deletions tests/python/unit_tests/chemical_system/test_chemical_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down