-
Notifications
You must be signed in to change notification settings - Fork 68
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
Replace ase ExpCellFilter
with FrechetCellFilter
in StructOptimizer
#101
Merged
Conversation
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
janosh
added
fix
Bug fix PRs
ase
Atomic simulation environment
relax
Structure optimization
labels
Dec 7, 2023
This was referenced Dec 7, 2023
Just out of curiosity, I understand the improvement in the SiO2's phonon band structure (especially around optic modes) comes better relaxed cell. So, do |
@lan496 Yes, slightly different (and much faster): from ase.filters import ExpCellFilter, FrechetCellFilter
from pymatgen.core import Structure
from chgnet import ROOT
from chgnet.model import CHGNet, StructOptimizer
relaxer = StructOptimizer()
chgnet = CHGNet.load()
structure = Structure.from_file(f"{ROOT}/examples/mp-18767-LiMnO2.cif")
structure.perturb(0.1)
for ase_filter in (ExpCellFilter, FrechetCellFilter):
result = relaxer.relax(structure, verbose=False, ase_filter=ase_filter)
print(
f"\n{ase_filter.__name__} took {len(result['trajectory'])} steps. Relaxed structure:"
)
print(result["final_structure"]) ExpCellFilter took 52 steps. Relaxed structure:
Full Formula (Li2 Mn2 O4)
Reduced Formula: LiMnO2
abc : 2.872010 4.650813 5.834364
angles: 89.984000 90.166300 89.959166
pbc : True True True
Sites (8)
# SP a b c magmom
--- ---- --------- --------- -------- ----------
0 Li+ 0.466097 0.471908 0.378517 0.00247121
1 Li+ 0.979868 0.970313 0.606578 0.00228718
2 Mn3+ 0.484925 0.498502 0.859377 3.87809
3 Mn3+ 0.984186 0.998235 0.126078 3.87656
4 O2- 0.483681 0.009578 0.350723 0.0461
5 O2- -0.012445 0.497563 0.093668 0.0405012
6 O2- 0.484366 -0.001507 0.89173 0.0405898
7 O2- 0.982041 0.509921 0.634653 0.0462106
FrechetCellFilter took 26 steps. Relaxed structure:
Full Formula (Li2 Mn2 O4)
Reduced Formula: LiMnO2
abc : 2.876522 4.657650 5.839542
angles: 90.012820 90.017011 90.010059
pbc : True True True
Sites (8)
# SP a b c magmom
--- ---- --------- --------- -------- ----------
0 Li+ 0.452761 0.467844 0.381994 0.00225034
1 Li+ 0.976853 0.965974 0.60083 0.0018343
2 Mn3+ 0.487451 0.500263 0.862042 3.87584
3 Mn3+ 0.987112 0.997857 0.123798 3.89048
4 O2- 0.483031 0.008843 0.349475 0.0478891
5 O2- -0.008411 0.502525 0.095111 0.0408283
6 O2- 0.489891 -7.2e-05 0.890263 0.0426996
7 O2- 0.984032 0.51128 0.637812 0.0465174
|
@janosh Thank you for your detail script. Glad to hear the new filter is working well! |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ase
'sExpCellFilter.get_forces
returns inconsistent gradients with central differences which was fixed in a newFrechetCellFilter
added by @lan496 in https://gitlab.com/ase/ase/-/merge_requests/3024. See https://gitlab.com/ase/ase/-/issues/1321 for bug details.This PR replaces
ExpCellFilter
withFrechetCellFilter
inStructOptimizer.relax()
.I see a noticeable improvement in CHGNet phonon predictions for SiO2 from this change alone (everything else kept fixed). That's PBE (minus non-analytical correction) in blue and CHGNet in red.
ExpCellFilter (old)
FrechetCellFilter (new)