-
Notifications
You must be signed in to change notification settings - Fork 2
Adds building E_xc and V_xc via LibXC #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
212fe4f
g2g seems to work
ryanmrichard c839021
backup
ryanmrichard 2bc90b8
density2grid works (I think)
ryanmrichard 1a10cb9
Merge branch 'master' into density_on_grid
ryanmrichard 77f24a1
fix warnings
ryanmrichard b8b8edb
it freaking works!!!!
ryanmrichard 07a7009
vxc done too!!!
ryanmrichard 75f021a
Merge branch 'master' into xc
ryanmrichard 279dfb9
fix warnings
ryanmrichard bdf5ef7
fix warning
ryanmrichard db61df0
Update CMakeLists.txt
ryanmrichard 2c683dc
make libxc optional
ryanmrichard 9ec7114
jonathan's suggestions
ryanmrichard 6184b12
formatting
ryanmrichard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * 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 "xc.hpp" | ||
| #include <simde/integration_grids/collocation_matrix.hpp> | ||
|
|
||
| namespace scf::xc { | ||
| namespace { | ||
| const auto desc = R"( | ||
|
|
||
| AO CollocationMatrix | ||
| ----------------- | ||
| )"; | ||
|
|
||
| } // namespace | ||
|
|
||
| using pt = simde::AOCollocationMatrix; | ||
|
|
||
| MODULE_CTOR(AOsOnGrid) { | ||
| satisfies_property_type<pt>(); | ||
| description(desc); | ||
| } | ||
|
|
||
| MODULE_RUN(AOsOnGrid) { | ||
| const auto& [grid, ao_basis] = pt::unwrap_inputs(inputs); | ||
| auto n_points = grid.size(); | ||
| auto n_aos = ao_basis.n_aos(); | ||
| using float_type = double; | ||
|
|
||
| tensorwrapper::allocator::Eigen<float_type> allocator(get_runtime()); | ||
| tensorwrapper::shape::Smooth matrix_shape{n_aos, n_points}; | ||
| tensorwrapper::layout::Physical layout(matrix_shape); | ||
| auto buffer = allocator.allocate(layout); | ||
|
|
||
| std::vector<std::size_t> idx{0, 0}; | ||
| for(const auto& atomic_basis : ao_basis) { | ||
| for(const auto& shell_i : atomic_basis) { | ||
| assert(shell_i.l() == 0); // only s is supported for now | ||
| const auto& cg = shell_i.contracted_gaussian(); | ||
| for(; idx[1] < n_points; ++idx[1]) { | ||
| float_type ao_value = 0.0; | ||
| for(const auto& prim : cg) { | ||
| // TODO: update when eval accounts for normalization | ||
| const auto val = prim.evaluate(grid.at(idx[1]).point()); | ||
| const auto exponent = prim.exponent(); | ||
| auto norm = std::sqrt(std::pow(2.0 * exponent / M_PI, 1.5)); | ||
| ao_value += norm * val; | ||
| } | ||
| buffer->set_elem(idx, ao_value); | ||
| } | ||
| idx[0] += shell_i.size(); | ||
| idx[1] = 0; | ||
| } | ||
| } | ||
| simde::type::tensor collocation_matrix(matrix_shape, std::move(buffer)); | ||
| auto rv = results(); | ||
| return pt::wrap_results(rv, std::move(collocation_matrix)); | ||
| }; | ||
|
|
||
| } // namespace scf::xc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.