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
6 changes: 3 additions & 3 deletions .github/workflows/scripts/generate_reference_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ SRC="src/chemcache"
ATOM="${SRC}/atoms"
BASES="${SRC}/bases"
MOLES="${SRC}/molecules"
ATOM_DEN="${SRC}/density"
EXP_SRC="experimental/src/chemcache"
ATOM_DEN="${EXP_SRC}/atomic_densities"
ELEC_CONFIGS="${EXP_SRC}/electronic_configurations"

# Activate virtual environment
Expand All @@ -48,5 +48,5 @@ python ${SCRIPTS_DIR}/generate_molecules.py ${MOLECULES} ${MOLES} -r
echo "Calling ${SCRIPTS_DIR}/generate_densities.py ${DENSITIES} ${ATOM_DEN} -r"
python ${SCRIPTS_DIR}/generate_densities.py ${DENSITIES} ${ATOM_DEN} -r

echo "Calling ${SCRIPTS_DIR}/generate_elec_configs.py ${ATOMIC_INFO} ${ELEC_CONFIGS}"
python ${SCRIPTS_DIR}/generate_elec_configs.py ${ATOMIC_INFO} ${ELEC_CONFIGS}
# echo "Calling ${SCRIPTS_DIR}/generate_elec_configs.py ${ATOMIC_INFO} ${ELEC_CONFIGS}"
# python ${SCRIPTS_DIR}/generate_elec_configs.py ${ATOMIC_INFO} ${ELEC_CONFIGS}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ toolchain.cmake

# Recommended directory for downloading basis sets
reference_data/basis_sets
!reference_data/basis_set/defaults
!reference_data/basis_set/default
6,603 changes: 0 additions & 6,603 deletions reference_data/atomic_densities/default/3-21g.dat

This file was deleted.

1,914 changes: 0 additions & 1,914 deletions reference_data/atomic_densities/default/6-31g.dat

This file was deleted.

3,572 changes: 0 additions & 3,572 deletions reference_data/atomic_densities/default/6-31g_star.dat

This file was deleted.

24,312 changes: 0 additions & 24,312 deletions reference_data/atomic_densities/default/aug-cc-pvtz.dat

This file was deleted.

2 changes: 1 addition & 1 deletion reference_data/basis_sets/default/sto-3g.nw
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#----------------------------------------------------------------------
# Basis Set Exchange
# Version 0.10
# Version 0.11
# https://www.basissetexchange.org
#----------------------------------------------------------------------
# Basis set: STO-3G
Expand Down
2 changes: 2 additions & 0 deletions src/chemcache/chemcache_mm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "atoms/atoms.hpp"
#include "bases/bases.hpp"
#include "chemcache/chemcache_mm.hpp"
#include "density/density.hpp"
#include "hydrocarbons/hydrocarbons.hpp"
#include "molecules/molecules.hpp"

Expand All @@ -31,6 +32,7 @@ void load_modules(pluginplay::ModuleManager& mm) {
// Add subcollection load calls here
atom_mods::load_modules(mm);
bases_mods::load_modules(mm);
density_mods::load_modules(mm);
hydrocarbons::load_modules(mm);
molecule_mods::load_modules(mm);

Expand Down
54 changes: 54 additions & 0 deletions src/chemcache/density/density.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.
*/

/*
* This file is autogenerated by: generate_densities.py
*
* NOTE: Any modifications made in this file will be lost next time
* generate_basis.py is run.
*/

#pragma once
#include <pluginplay/pluginplay.hpp>

namespace chemcache {

// Module declarations will go here
DECLARE_MODULE(sad_density);
DECLARE_MODULE(sto_dash_3g_atom_density_matrix);

namespace density_mods {

inline void set_defaults(pluginplay::ModuleManager& mm) {
// Default submodules within this subcollection will be set here
mm.change_submod("sto-3g SAD density", "Atomic Basis",
"sto-3g atomic basis");
mm.change_submod("sto-3g SAD density", "Atomic Density",
"sto-3g atomic density matrix");
}

inline void load_modules(pluginplay::ModuleManager& mm) {
// Modules will be added to the ModuleManager here
mm.add_module<sad_density>("sto-3g SAD density");
mm.add_module<sto_dash_3g_atom_density_matrix>(
"sto-3g atomic density matrix");

set_defaults(mm);
}

} // namespace density_mods

} // namespace chemcache
87 changes: 87 additions & 0 deletions src/chemcache/density/sad_density.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* 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 "density.hpp"
#include <simde/simde.hpp>

namespace chemcache {

using sad_rho_pt = simde::InitialDensity;
using atomic_den_pt = simde::AtomicDensityMatrixFromZ;
using atomic_basis_pt = simde::AtomicBasisSetFromZ;
using aobs_t = simde::type::ao_basis_set;
using cmos_t = simde::type::cmos;
using aos_t = simde::type::aos;
using density_t = simde::type::decomposable_e_density;
using tensor_t = simde::type::tensor;

namespace {

// Pull out nuclear-nuclear interaction term, if there is one.
struct GrabNuclear : chemist::qm_operator::OperatorVisitor {
using V_en_type = simde::type::V_en_type;

GrabNuclear() : chemist::qm_operator::OperatorVisitor(false) {}

void run(const V_en_type& V_en) { m_pv = &V_en; }

const V_en_type* m_pv = nullptr;
};

} // namespace

MODULE_CTOR(sad_density) {
satisfies_property_type<sad_rho_pt>();
add_submodule<atomic_den_pt>("Atomic Density");
add_submodule<atomic_basis_pt>("Atomic Basis");
}

MODULE_RUN(sad_density) {
const auto& [H] = sad_rho_pt::unwrap_inputs(inputs);
auto& atom_dm_mod = submods.at("Atomic Density");
auto& atom_bs_mod = submods.at("Atomic Basis");

// get atomic info from H
GrabNuclear visitor;
H.visit(visitor);
if(visitor.m_pv == nullptr)
throw std::runtime_error("No nuclear terms for SAD density generation");
const auto nuclei = visitor.m_pv->rhs_particle();

// Aggregate basis sets and tensors from centers
aobs_t aobs;
std::vector<simde::type::tensor> tensors(nuclei.size());
for(std::size_t ni = 0; ni < nuclei.size(); ++ni) {
auto Z = nuclei[ni].Z();
tensors[ni] = atom_dm_mod.run_as<atomic_den_pt>(Z);
auto ci = atom_bs_mod.run_as<atomic_basis_pt>(Z);
for(auto i : {0, 1, 2}) ci.center().coord(i) = nuclei[ni].coord(i);
aobs.add_center(ci);
}

// Stack density matrices and scale
auto rho = tensorwrapper::utilities::block_diagonal_matrix(tensors);
rho("i, j") = rho("i, j") * 0.5;

aos_t aos(aobs);
cmos_t cmos(tensor_t{}, aos, tensor_t{});
density_t d(rho, cmos);

auto rv = results();
return sad_rho_pt::wrap_results(rv, d);
}

} // namespace chemcache
61 changes: 61 additions & 0 deletions src/chemcache/density/sto_dash_3g/sto_dash_3g.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* 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.
*/

/*
* This file is autogenerated by: generate_densities.py
*
* NOTE: Any modifications made in this file will be lost next time
* generate_densities.py is run.
*/

#include "../density.hpp"
#include "sto_dash_3g.hpp"

namespace chemcache {

using atomic_den_pt = simde::AtomicDensityMatrixFromZ;
using udouble = tensorwrapper::types::udouble;

static constexpr auto module_desc = R"(
sto-3g atomic density matrices
------------------------------

This module returns precomputed atomic densities in this basis set.
This module was autogenerated.
)";

MODULE_CTOR(sto_dash_3g_atom_density_matrix) {
description(module_desc);
satisfies_property_type<atomic_den_pt>();
add_input<bool>("With UQ?").set_default(false);
}

MODULE_RUN(sto_dash_3g_atom_density_matrix) {
const auto& [Z] = atomic_den_pt::unwrap_inputs(inputs);
const auto is_uncertain = inputs.at("With UQ?").value<bool>();
auto& rt = this->get_runtime();

simde::type::tensor result;
if(is_uncertain) {
result = sto_dash_3g_atom_density_matrix_<udouble>(Z, rt);
} else {
result = sto_dash_3g_atom_density_matrix_<double>(Z, rt);
}
auto rv = results();
return atomic_den_pt::wrap_results(rv, result);
}

} // namespace chemcache
49 changes: 49 additions & 0 deletions src/chemcache/density/sto_dash_3g/sto_dash_3g.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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.
*/

/*
* This file is autogenerated by: generate_densities.py
*
* NOTE: Any modifications made in this file will be lost next time
* generate_densities.py is run.
*/

#pragma once
#include <simde/simde.hpp>

namespace chemcache {

template<typename FloatType>
simde::type::tensor sto_dash_3g_atom_density_matrix_(
simde::type::atomic_number Z, parallelzone::runtime::RuntimeView& rt) {
using shape_t = tensorwrapper::shape::Smooth;
using allocator_t = tensorwrapper::allocator::Eigen<FloatType>;
using rank2_il_t = typename allocator_t::rank2_il;

allocator_t d_a(rt);
switch(Z) {
case(1): {
shape_t shape{1, 1};
auto buffer = d_a.construct(rank2_il_t{{1.00000000}});
return simde::type::tensor(shape, std::move(buffer));
}
default: {
throw std::out_of_range("Atomic Density not available for Z");
}
}
}

} // namespace chemcache
Loading