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

how to stop PositiveEnergyErrorHandler #639

Closed
YuanbinLiu opened this issue Dec 8, 2023 · 4 comments
Closed

how to stop PositiveEnergyErrorHandler #639

YuanbinLiu opened this issue Dec 8, 2023 · 4 comments

Comments

@YuanbinLiu
Copy link

We need to do VASP calculations re high-energy structures whose energy is above 0. How to disable PositiveEnergyErrorHandler? Otherwise, the calculation cannot stop.

@JaGeo
Copy link
Member

JaGeo commented Dec 8, 2023

Hey @YuanbinLiu ,

You can use the kwargs for run vasp:

run_vasp_kwargs : dict

Specificially, you have to pass a dict with the handlers:

handlers: Sequence[ErrorHandler] = _DEFAULT_HANDLERS,

@utf
Copy link
Member

utf commented Dec 8, 2023

Customising the custodian error handlers is possible using the run_vasp_kwargs of the BaseVaspMaker. For example, to include all the default error handlers except PositiveEnergyErrorHandler you can do:

from custodian.vasp.handlers import (
    FrozenJobErrorHandler,
    IncorrectSmearingHandler,
    LargeSigmaHandler,
    MeshSymmetryErrorHandler,
    NonConvergingErrorHandler,
    PotimErrorHandler,
    StdErrHandler,
    UnconvergedErrorHandler,
    VaspErrorHandler,
)

custom_handlers = (
    VaspErrorHandler(),
    MeshSymmetryErrorHandler(),
    UnconvergedErrorHandler(),
    NonConvergingErrorHandler(),
    PotimErrorHandler(),
    FrozenJobErrorHandler(),
    StdErrHandler(),
    LargeSigmaHandler(),
    IncorrectSmearingHandler(),
)

job = RelaxMaker(run_vasp_kwargs={"handlers": custom_handlers}).make(structure)

Alternatively, if you want to adjust the handlers for all VASP calculations in a flow, you can do:

from atomate2.vasp.jobs.base import BaseVaspMaker

flow = DoubleRelaxMaker().make(structure)
flow.update_maker_kwargs(
    {"_set": {"run_vasp_kwargs->handlers": custom_handlers}},
    dict_mod=True,
    class_filter=BaseVaspMaker
)

@JaGeo
Copy link
Member

JaGeo commented Dec 8, 2023

@utf thanks for the detailed answer. (maybe also something for the documentation as I assume this might be a frequently asked question in the future?)

@YuanbinLiu
Copy link
Author

Thanks all, it works for me

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

No branches or pull requests

3 participants