-
Notifications
You must be signed in to change notification settings - Fork 89
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
Implement stresses without unfold_bz #511
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
03f6c31
Stresses without unfold_bz
jaemolihm d623830
Increase kgrid in stresses test
jaemolihm c23ddd8
Enable MPI for stresses test
jaemolihm d7180d4
Rename symmetrize_tensor to symmetrize_stresses
jaemolihm 39aa683
review
jaemolihm d5460fb
runtests organization
jaemolihm 3324ccb
Add doc on symmetrization
jaemolihm 1ccda15
Fix stresses test for MPI
jaemolihm 682ba70
Merge branch 'master' into stresses_sym
mfherbst 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 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 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 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 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 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ using Test | |
using DFTK | ||
using ForwardDiff | ||
import FiniteDiff | ||
using MPI | ||
include("testcases.jl") | ||
|
||
# Hellmann-Feynman stress | ||
|
@@ -12,7 +13,7 @@ include("testcases.jl") | |
Si = ElementPsp(silicon.atnum, psp=load_psp(silicon.psp)) | ||
atoms = [Si => silicon.positions] | ||
model = model_DFT(lattice, atoms, [:lda_x, :lda_c_vwn]; symmetries) | ||
kgrid = [2, 2, 1] | ||
kgrid = [3, 3, 1] | ||
mfherbst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Ecut = 7 | ||
PlaneWaveBasis(model; Ecut, kgrid) | ||
end | ||
|
@@ -42,7 +43,7 @@ include("testcases.jl") | |
stresses = compute_stresses(scfres) | ||
@test isapprox(stresses, compute_stresses(scfres_nosym), atol=1e-10) | ||
|
||
dir = randn(3, 3) | ||
dir = MPI.bcast(randn(3, 3), 0, MPI.COMM_WORLD) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch! We should probably do this in PlaneWaveBasis, make sure all parameters (including Model) are the same on all processors... |
||
|
||
dE_stresses = dot(dir, stresses) * scfres.basis.model.unit_cell_volume | ||
ref_recompute = FiniteDiff.finite_difference_derivative(0.0) do ε | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean for f to be linear in this context? I would just say "consider a k-dependent quantity of interest (energy, density, force...). f is assumed to transform in a particular way under the symmetry: f(S(k)) = S(f(k)) where the action of S on f depends on the particular f."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your writing is clear. What I meant was that S is a linear function.