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

[WIP] Better handling of large, flexible systems and meta-GGAs/hybrids #177

Closed
wants to merge 12 commits into from
Closed

Conversation

Andrew-S-Rosen
Copy link
Member

@Andrew-S-Rosen Andrew-S-Rosen commented Nov 14, 2021

Background

I have opened a PR for a number of additions to the VASP error handlers in Custodian. These new INCAR switches are based on my personal experience carrying out tens of thousands of DFT relaxations for metal-organic frameworks (https://materialsproject.org/mofs), albeit not via the use of Custodian. In most cases, I have tried to ensure that no changes are made to existing INCAR swaps. Rather, if the existing INCAR swaps do not resolve the issue, I have added new backup options.

I have labeled this WIP for a few reasons: 1) I need to write unittests for this, but I figured I'd see if there's any interest before I do a deep dive on the testing. 2) I'd like to test this out for a bit in production calculations to make sure nothing unusual crops up. Let's consider this the start of a conversation.

Below, I outline the proposed changes. I can also split this into multiple PRs if preferred.

Main Changes

  • zbrent: This error is perhaps the most important one I have addressed. Currently, Custodian switches to IBRION = 1 and copies CONTCAR to POSCAR. For materials that are large and have flexible structures, this is rarely sufficient. There is still too much numerical noise in the forces when this error occurs near the local minimum in the PES. A fallback option of tightening EDIFF to 1e-6 (if it was larger than this value) and increasing NELMIN to 6 is applied. These ensure that the forces are of higher quality. I have also created a new vtst_enabled variable, which gives the user an option to support VTST-related INCAR swaps if they have a VASP build with VTST. I've set vtst_enabled = False as the default for compatibility purposes. However, if vtst_enabled is set to True, the optimizer will switch to FIRE. In my experience, FIRE with the modified EDIFF and NELMIN has worked every single time to fix the ZBRENT issue, and I have received it hundreds of times.

  • grad_not_orth: Depending on how you've compiled VASP, the Algo = All SCF convergence algorithm can sometimes lead to grad_not_orth errors. It's extremely machine and compilation-dependent. Switching to any other major SCF convergence algorithm resolves the issue in these cases. So, I've added a swap from All to Fast if this error comes up (unless dealing with meta-GGAs/hybrids, as discussed below). Related to Better EDWAV error fix #92. Also, I don't think changing ISMEAR is the way to go here.

  • posmap: There was no self.error_count["posmap"] += 1 line despite there being an if/elif switch based on the error count. I have added that in now. I'm not sure the second loop was ever reached?

  • real_optlay: Currently, this INCAR swap implicitly assumes the user has set LREAL = Auto, but there is no guarantee this is the case. The LREAL = Auto --> True [for large systems] --> False chain now only takes place if LREAL != False in the first place.

Additionally, a few important changes were made to the SCF ladder in NonConvergingErrorHandler:

  • If a meta-GGA functional is used, go straight to Algo = All. This is recommended in the VASP manual (https://www.vasp.at/wiki/index.php/METAGGA) and some of the meta-GGAs (e.g. the Minnesota functionals) explicitly say to set Algo = All for proper convergence. The MPScanRelaxSet already uses Algo = All as the default, but other users may not be so careful.
  • If a hybrid functional is used, do not set Algo = Fast or VeryFast. Hybrid calculations do not support these algorithms even though no warning is printed (https://www.vasp.at/wiki/index.php/LHFCALC). Instead, do Algo = All if it's not already set. MPHSERelaxSet already uses Algo = All. In principle, if Algo = All doesn't work, one could switch to Algo = Damped with TIME = 0.5 per the VASP manual, but given the high cost of hybrids, I do not know that this is advisable in general and so I have left it as a comment.

Makes changes to:
zbrent: more accurate forces if existing swap fails
grad_not_orth: don't use Algo = All if this appears, unless you have a meta-GGA/hybrid
posmap: the error counter wasn't updated
SCF ladder: have a separate ladder for meta-GGAs and hybrids, which shouldn't be using VeryFast/Fast
Apply formatting
Copy CONTCAR to POSCAR every time that ZBRENT occurs
Only consider changing ALGO if ISMEAR didn't fix it
== True --> is True
Don't edit sections I didn't touch
Account for the possibility that the user specified METAGGA = False or LHFCALC = False
- Don't switch to LREAL = True if LREAL = False was already set
- More logical .get() default options consistent with VASP defaults
@Andrew-S-Rosen
Copy link
Member Author

This got a little larger than planned. I'm going to split this into multiple issues/PRs.

@Andrew-S-Rosen Andrew-S-Rosen deleted the rosen-vasp branch December 2, 2021 20:55
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.

1 participant