Custodian IncorrectSmearingHandler should allow for total energy calculations for metals with ISMEAR = -5

I am not sure where to post this, since there is no custodian category, and since most custodian questions are found in the atomate category, I put it here.

In the recent update for VASP6 error handling (I noticed it in version 2021.1.8 in contrast to 2020.4.27), an IncorrectSmearingHandler class is introduced. I think this is generally a good idea and I want to thank @mkhorton and @rkingsbury for implementing this and the VASP6 update generally so quickly.

However, it is now not possible to use the tetrahedron method with Blöchl corrections (ISMEAR = -5) for accurate total energy calculations in metals, while it is still recommended to do so in the vasp wiki.

Also the code not only catches tetrahedron smearing with or without Blöchl corrections (-5 and -4) but also -1, -2, and -3, which do different things. These are rare cases and probably not run with custodian anyhow, but if ISMEAR is set to e.g. -2, it is probably best to assume the user knows what they are doing.

I would modify the check method to detect if a relaxation is performed by reading the NSW flag of the INCAR as well like this:

    def check(self):
        """
        Check for error.
        """
        try:
            v = Vasprun(self.output_filename)
            # check whether bandgap is zero, tetrahedron smearing was used
            # and relaxation is performed.
            if (v.eigenvalue_band_properties[0] == 0 and
                v.incar.get("ISMEAR", 1) < -3 and 
                v.incar.get("NSW", 0) < 1):
                return True
        except Exception:
            pass
        return False

Of course this still leaves the issue that forces will be wrong, and one might use the forces of a run even without it being a relaxation. Nevertheless, I feel that this additions limits the functionality as is more than necessary.

I also want to acknowledge that VASP itself prints an on-screen warning message now, even if no relaxation is performed. However, this is a warning, while in custodian, it is treated as an error that must be corrected.

Please let me know if I have to change my approach for static calculations (which I do with ISMEAR = -5 pretty consistently) or if there might be changes to the IncorrectSmearingHandler.
Cheers, Michael

1 Like

Hi @mwo, I created a new Custodian category and moved this post there.

1 Like

Hi @mwo, thank you for the feedback and your thoughtful reply. I’ve discussed your proposed solution with our team and we’re all supportive. The only change we’d request is to test NSW <=1 rather than NSW < 1, because NSW=1 is still a static calculation.

Would you be willing to open a pull request in custodian with this change? That will be the fastest way to get this updated. If that’s not something you’re comfortable doing, we will put it on our plate and hopefully get to it in the next week or two.

In addition or in parallel, another workaround you could consider (if you use atomate) is to remove IncorrectSmearingHandler() from the handler groups in /atomate/vasp/firetasks/run_calc.py. That would disable the handler during your calculations.

Please let us know if you can implement the change, or if you’d like us to handle it, and thanks again.

1 Like

Thanks for creating the category @mkhorton!

I just submitted a pull request (some checks seem to fail though :neutral_face:), thanks for answering so quickly to my suggestion and already discussing it with your team.

I also considered the workaround you suggested, but I think the code change is much cleaner and one has less to think about after a new install.

Cheers

1 Like