Skip to content

Commit

Permalink
PT for electrostatic interactions (#153)
Browse files Browse the repository at this point in the history
* add mo typedef

* Adds property type for electrostatic energy
  • Loading branch information
ryanmrichard authored Dec 3, 2024
1 parent 16769ca commit 09de695
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
49 changes: 49 additions & 0 deletions include/simde/energy/electrostatic_energy.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2024 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 <pluginplay/property_type/property_type.hpp>
#include <simde/types.hpp>

namespace simde {

template<typename ObjectType, typename PotentialType>
DECLARE_TEMPLATED_PROPERTY_TYPE(ElectrostaticEnergy, ObjectType, PotentialType);

template<typename ObjectType, typename PotentialType>
TEMPLATED_PROPERTY_TYPE_INPUTS(ElectrostaticEnergy, ObjectType, PotentialType) {
using object_type = const ObjectType&;
using potential_type = const PotentialType&;
auto rv = pluginplay::declare_input()
.add_field<object_type>("Objects")
.template add_field<potential_type>("Potential");
rv["Objects"].set_description("The objects interacting with the potential");
rv["Potential"].set_description(
"The electrostatic potential (or the objects generating the potential)");
return rv;
}

template<typename ObjectType, typename PotentialType>
TEMPLATED_PROPERTY_TYPE_RESULTS(ElectrostaticEnergy, ObjectType,
PotentialType) {
auto rv = pluginplay::declare_result().add_field<double>("Energy");
return rv;
}

using charge_charge_interaction =
ElectrostaticEnergy<type::charges, type::charges>;

} // namespace simde
1 change: 1 addition & 0 deletions include/simde/energy/energy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
#pragma once

#include <simde/energy/ao_energy.hpp>
#include <simde/energy/electrostatic_energy.hpp>
#include <simde/energy/total_energy.hpp>
3 changes: 3 additions & 0 deletions include/simde/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ using tensor = tensorwrapper::Tensor;

// --------------------- Fundamental Types -------------------------------------

/// Typedef of the class used to hold a set of point charges
using charges = chemist::Charges<double>;

/// Typedef of the class used to describe an electron
using electron = chemist::Electron;

Expand Down
11 changes: 10 additions & 1 deletion tests/cxx/unit_tests/energy/energy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@
*/

#include "../test_property_type.hpp"
#include <simde/energy/total_energy.hpp>
#include <simde/energy/energy.hpp>

using namespace simde;

TEST_CASE("TotalEnergy") {
test_property_type<TotalEnergy>({"Chemical System"}, {"Energy"});
}

TEST_CASE("AOEnergy") {
test_property_type<AOEnergy>({"AOs", "Chemical System"}, {"Energy"});
}

TEST_CASE("ElectrostaticEnergy<charges, charges>") {
test_property_type<charge_charge_interaction>({"Objects", "Potential"},
{"Energy"});
}

0 comments on commit 09de695

Please sign in to comment.