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

Phonons docs #953

Merged
merged 30 commits into from
Feb 5, 2024
Merged

Phonons docs #953

merged 30 commits into from
Feb 5, 2024

Conversation

antoine-levitt
Copy link
Member

No description provided.

@antoine-levitt antoine-levitt marked this pull request as ready for review February 2, 2024 16:29
@antoine-levitt
Copy link
Member Author

@mfherbst not up for review yet, still ongoing with Etienne

Comment on lines 316 to 322
# By default kpoints_phonon has only kpoints
kpoints_phonon = IdDict{Tuple{Vec3{T}, Int},
NamedTuple{(:kpt, :equivalent_kpt), Tuple{Kpoint, Kpoint}}}()
for kpt in kpoints
key = _kpoint_phonon_key(kpt.coordinate, kpt.spin)
kpoints_phonon[key] = (; kpt, equivalent_kpt=kpt)
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure about how to do this properly… Feels bloated.

Copy link
Collaborator

@epolack epolack Feb 2, 2024

Choose a reason for hiding this comment

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

And fails for ForwardDiff because of round. 93c0777

src/transfer.jl Outdated
Comment on lines 39 to 42
Note that `kpt_out` does not have to belong to `basis_out` as long as it is equivalent to
some other point in it, i.e, `kpt_in = kpt_out + ΔG`.
Beware: `ψk_out` can lose information if the shift `ΔG` is large or if the `G_vectors`
differ between `k`-points.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@antoine-levitt if that's what you had in mind.

@epolack
Copy link
Collaborator

epolack commented Feb 2, 2024

Otherwise (pending the awful kpoint memoisation stuff), I think @mfherbst can take a peek at it.

@antoine-levitt
Copy link
Member Author

Didn't we say we could get rid of memoization by doing get_kpoint_from_equivalent(kcoord, equiv_kpoint) and just translating the G vectors from the equivalent kpoint?

@epolack
Copy link
Collaborator

epolack commented Feb 3, 2024

Yep, sorry I forgot. Will change that.

@epolack
Copy link
Collaborator

epolack commented Feb 3, 2024

I think I still need to recompute the mapping each time. So it would still be costly. Or did I miss something?

@antoine-levitt
Copy link
Member Author

We should be able to deduce it from the one of the old kpoint, no? I'm not super concerned about it being very efficient, worse case we just recompute everything...

@epolack
Copy link
Collaborator

epolack commented Feb 5, 2024

Done. Less awful than I thought it would be, but lots of conversions.
I did not find how not to do them.

src/transfer.jl Outdated
Comment on lines 198 to 201
# Mapping is the same as if created from scratch, although it is not ordered.
mapping = map(CartesianIndices(basis.fft_size)[equivalent_kpt.mapping]) do G
linear[CartesianIndex(mod1.(Tuple(G + CartesianIndex(ΔG...)), basis.fft_size))]
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

That means we can not use a k-point of Kpoint with a k-point of get_kpoint. Is that ok? Or should I sort this list, so it should be equivalent?

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean we can't use it? Everything looks fine and consistent to me, we don't assume ordering anywhere? Maybe just add to Kpoint's docstring that it's not assumed to be ordered? (we do assume ordering of G_vectors(basis) however)

Copy link
Collaborator

Choose a reason for hiding this comment

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

In 04ec78c, if I do not replace Kpoint(…) by get_kpoint, the tests fails, the order of the FFT arrays become inconsistent.
I will add doc to Kpoint.

@antoine-levitt
Copy link
Member Author

Good to merge for me when you want @epolack

@epolack
Copy link
Collaborator

epolack commented Feb 5, 2024

I'm good with it, thanks!

@antoine-levitt antoine-levitt enabled auto-merge (squash) February 5, 2024 14:04
@antoine-levitt antoine-levitt merged commit 28a0212 into master Feb 5, 2024
5 of 7 checks passed
@antoine-levitt antoine-levitt deleted the doc_phonons branch February 5, 2024 15:33
@mfherbst
Copy link
Member

mfherbst commented Feb 5, 2024

Nice, looks good.

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.

3 participants