Skip to content
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

Collinear spin GGA kernel #424

Merged
merged 3 commits into from
Apr 21, 2021
Merged

Collinear spin GGA kernel #424

merged 3 commits into from
Apr 21, 2021

Conversation

mfherbst
Copy link
Member

No description provided.

Copy link
Member

@antoine-levitt antoine-levitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM... indeed quite messy but at least relatively well localized. Biggest gripe is these libxc_spinindex functions.

src/terms/xc.jl Outdated Show resolved Hide resolved
src/terms/xc.jl Show resolved Hide resolved
src/terms/xc.jl Show resolved Hide resolved
src/terms/xc.jl Outdated Show resolved Hide resolved
src/terms/xc.jl Outdated Show resolved Hide resolved
σ_real[2, :, :, :] .+= ∇ρ_real[1, :, :, :, α] .* ∇ρ_real[2, :, :, :, α]
σ_real[3, :, :, :] .+= ∇ρ_real[2, :, :, :, α] .* ∇ρ_real[2, :, :, :, α]
σ_real[tσ(1, 2), :, :, :] .+= ∇ρ_real[1, :, :, :, α] .* ∇ρ_real[2, :, :, :, α]
σ_real[tσ(2, 2), :, :, :] .+= ∇ρ_real[2, :, :, :, α] .* ∇ρ_real[2, :, :, :, α]
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this is quite messy due to the multiple formats used. It's a bit better in the densities branch, so we should really try to merge the branches, but I understand if you don't want to do it yet. Once it's done, it would be good to document more clearly (maybe with variable names) what arrays are in "DFTK format" [i,j,k,sigma] and which are in "libxc" format [sigmatau,i,j,k]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we should add one extra layer of indirection on top of the returned terms object, which does the mapping and adds the strange (1/2) factor automatically, only returning a view into the 3D real-space grid. That could help to make the contractions more readable (because it's just elementwise multiplications and sums so no further indexing needed), but it hides which indices are contiguous.

Copy link
Member Author

@mfherbst mfherbst Apr 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave that for next time when I'll merge the branches, but I think this might be the way to go.

src/terms/xc.jl Outdated Show resolved Hide resolved
src/terms/xc.jl Show resolved Hide resolved
test/kernel.jl Show resolved Hide resolved
src/terms/xc.jl Outdated Show resolved Hide resolved
@mfherbst mfherbst merged commit 65ac300 into master Apr 21, 2021
@mfherbst mfherbst deleted the gga_kspin branch April 21, 2021 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants