Minor changes

This commit is contained in:
Matteo Giantomassi 2024-07-27 14:42:01 +02:00
parent 9864141da0
commit e2adb8d9f7
3 changed files with 33 additions and 33 deletions

View File

@ -62,7 +62,7 @@ jobs:
cp abipy/data/managers/gh_manager.yml $HOME/.abinit/abipy/manager.yml cp abipy/data/managers/gh_manager.yml $HOME/.abinit/abipy/manager.yml
cp abipy/data/managers/gh_scheduler.yml $HOME/.abinit/abipy/scheduler.yml cp abipy/data/managers/gh_scheduler.yml $HOME/.abinit/abipy/scheduler.yml
# FIXME TEMPORARY HACK # FIXME TEMPORARY HACK
#pip install git+https://github.com/gmatteo/pymatgen.git@master pip install git+https://github.com/gmatteo/pymatgen.git@master -U
- name: Build docs with Sphinx - name: Build docs with Sphinx
run: | run: |

View File

@ -51,7 +51,7 @@ jobs:
cp abipy/data/managers/gh_manager.yml $HOME/.abinit/abipy/manager.yml cp abipy/data/managers/gh_manager.yml $HOME/.abinit/abipy/manager.yml
cp abipy/data/managers/gh_scheduler.yml $HOME/.abinit/abipy/scheduler.yml cp abipy/data/managers/gh_scheduler.yml $HOME/.abinit/abipy/scheduler.yml
# FIXME TEMPORARY HACK # FIXME TEMPORARY HACK
#pip install git+https://github.com/gmatteo/pymatgen.git@master pip install git+https://github.com/gmatteo/pymatgen.git@master -U
- name: pytest - name: pytest
run: | run: |

View File

@ -40,7 +40,7 @@ __all__ = [
] ]
__yaml = YAML() _yaml = YAML()
def straceback() -> str: def straceback() -> str:
@ -179,14 +179,14 @@ class AbinitEvent(yaml.YAMLObject):
return 0 return 0
@yaml_object(__yaml) @yaml_object(_yaml)
class AbinitComment(AbinitEvent): class AbinitComment(AbinitEvent):
"""Base class for Comment events""" """Base class for Comment events"""
yaml_tag = '!COMMENT' yaml_tag = '!COMMENT'
color = "blue" color = "blue"
@yaml_object(__yaml) @yaml_object(_yaml)
class AbinitError(AbinitEvent): class AbinitError(AbinitEvent):
"""Base class for Error events""" """Base class for Error events"""
yaml_tag = '!ERROR' yaml_tag = '!ERROR'
@ -200,14 +200,14 @@ class AbinitYamlError(AbinitError):
""" """
@yaml_object(__yaml) @yaml_object(_yaml)
class AbinitBug(AbinitEvent): class AbinitBug(AbinitEvent):
"""Base class for Bug events""" """Base class for Bug events"""
yaml_tag = '!BUG' yaml_tag = '!BUG'
color = "red" color = "red"
@yaml_object(__yaml) @yaml_object(_yaml)
class AbinitWarning(AbinitEvent): class AbinitWarning(AbinitEvent):
""" """
Base class for Warning events (the most important class). Base class for Warning events (the most important class).
@ -232,19 +232,19 @@ class AbinitYamlWarning(AbinitCriticalWarning):
############################### ###############################
@yaml_object(__yaml) @yaml_object(_yaml)
class ScfConvergenceWarning(AbinitCriticalWarning): class ScfConvergenceWarning(AbinitCriticalWarning):
"""Warning raised when the GS SCF cycle did not converge.""" """Warning raised when the GS SCF cycle did not converge."""
yaml_tag = '!ScfConvergenceWarning' yaml_tag = '!ScfConvergenceWarning'
@yaml_object(__yaml) @yaml_object(_yaml)
class NscfConvergenceWarning(AbinitCriticalWarning): class NscfConvergenceWarning(AbinitCriticalWarning):
"""Warning raised when the GS NSCF cycle did not converge.""" """Warning raised when the GS NSCF cycle did not converge."""
yaml_tag = '!NscfConvergenceWarning' yaml_tag = '!NscfConvergenceWarning'
@yaml_object(__yaml) @yaml_object(_yaml)
class RelaxConvergenceWarning(AbinitCriticalWarning): class RelaxConvergenceWarning(AbinitCriticalWarning):
"""Warning raised when the structural relaxation did not converge.""" """Warning raised when the structural relaxation did not converge."""
yaml_tag = '!RelaxConvergenceWarning' yaml_tag = '!RelaxConvergenceWarning'
@ -256,13 +256,13 @@ class RelaxConvergenceWarning(AbinitCriticalWarning):
# yaml_tag = u'!PhononConvergenceWarning' # yaml_tag = u'!PhononConvergenceWarning'
@yaml_object(__yaml) @yaml_object(_yaml)
class QPSConvergenceWarning(AbinitCriticalWarning): class QPSConvergenceWarning(AbinitCriticalWarning):
"""Warning raised when the QPS iteration (GW) did not converge.""" """Warning raised when the QPS iteration (GW) did not converge."""
yaml_tag = '!QPSConvergenceWarning' yaml_tag = '!QPSConvergenceWarning'
@yaml_object(__yaml) @yaml_object(_yaml)
class HaydockConvergenceWarning(AbinitCriticalWarning): class HaydockConvergenceWarning(AbinitCriticalWarning):
"""Warning raised when the Haydock method (BSE) did not converge.""" """Warning raised when the Haydock method (BSE) did not converge."""
yaml_tag = '!HaydockConvergenceWarning' yaml_tag = '!HaydockConvergenceWarning'
@ -447,9 +447,9 @@ class EventsParser:
filename = os.path.abspath(filename) filename = os.path.abspath(filename)
report = EventReport(filename) report = EventReport(filename)
w = WildCard("*Error|*Warning|*Comment|*Bug|*ERROR|*WARNING|*COMMENT|*BUG") #w = WildCard("*Error|*Warning|*Comment|*Bug|*ERROR|*WARNING|*COMMENT|*BUG")
import warnings #import warnings
warnings.simplefilter('ignore', yaml.error.UnsafeLoaderWarning) #warnings.simplefilter('ignore', yaml.error.UnsafeLoaderWarning)
with YamlTokenizer(filename) as tokens: with YamlTokenizer(filename) as tokens:
for doc in tokens: for doc in tokens:
@ -780,22 +780,22 @@ class DilatmxErrorHandler(ErrorHandler):
return self.FIXED return self.FIXED
def handle_input_event(self, abiinput, outdir, event): def handle_input_event(self, abi_input, outdir, event):
try: try:
old_abiinput = abiinput.deepcopy() old_abiinput = abi_input.deepcopy()
# Read the last structure dumped by ABINIT before aborting. # Read the last structure dumped by ABINIT before aborting.
filepath = outdir.has_abiext("DILATMX_STRUCT.nc") filepath = outdir.has_abiext("DILATMX_STRUCT.nc")
last_structure = Structure.from_file(filepath) last_structure = Structure.from_file(filepath)
abiinput.set_structure(last_structure) abi_input.set_structure(last_structure)
#FIXME restart from DEN files not always working with interpolation #FIXME restart from DEN files not always working with interpolation
return Correction(self, self.compare_inputs(abiinput, old_abiinput), event, reset=True) return Correction(self, self.compare_inputs(abi_input, old_abiinput), event, reset=True)
# return Correction(self, self.compare_inputs(abiinput, old_abiinput), event, event=False) # return Correction(self, self.compare_inputs(abi_input, old_abiinput), event, event=False)
except Exception as exc: except Exception as exc:
logger.warning('Error while trying to apply the handler {}.'.format(str(self)), exc) logger.warning('Error while trying to apply the handler {}.'.format(str(self)), exc)
return None return None
@yaml_object(__yaml) @yaml_object(_yaml)
class TolSymError(AbinitError): class TolSymError(AbinitError):
""" """
Class of errors raised by Abinit when it cannot detect the symmetries of the system. Class of errors raised by Abinit when it cannot detect the symmetries of the system.
@ -838,19 +838,19 @@ class TolSymErrorHandler(ErrorHandler):
task.log_correction(event, "Increasing tolsym from %s to %s" % (old_tolsym, new_tolsym)) task.log_correction(event, "Increasing tolsym from %s to %s" % (old_tolsym, new_tolsym))
return self.FIXED return self.FIXED
def handle_input_event(self, abiinput, outdir, event): def handle_input_event(self, abi_input, outdir, event):
try: try:
old_abiinput = abiinput.deepcopy() old_abiinput = abi_input.deepcopy()
old_tolsym = abiinput["tolsym"] old_tolsym = abi_input["tolsym"]
new_tolsym = 1e-6 if old_tolsym is None else old_tolsym * 10 new_tolsym = 1e-6 if old_tolsym is None else old_tolsym * 10
abiinput.set_vars(tolsym=new_tolsym) abi_input.set_vars(tolsym=new_tolsym)
return Correction(self, self.compare_inputs(abiinput, old_abiinput), event, reset=False) return Correction(self, self.compare_inputs(abi_input, old_abiinput), event, reset=False)
except Exception as exc: except Exception as exc:
logger.warning('Error while trying to apply the handler {}.'.format(str(self)), exc) logger.warning('Error while trying to apply the handler {}.'.format(str(self)), exc)
return None return None
@yaml_object(__yaml) @yaml_object(_yaml)
class MemanaError(AbinitError): class MemanaError(AbinitError):
""" """
Class of errors raised by the memory analyzer. Class of errors raised by the memory analyzer.
@ -872,17 +872,17 @@ class MemanaErrorHandler(ErrorHandler):
task.log_correction(event, "Find MemanaError. Setting mem_test to 0 in input file.") task.log_correction(event, "Find MemanaError. Setting mem_test to 0 in input file.")
return self.FIXED return self.FIXED
def handle_input_event(self, abiinput, outdir, event): def handle_input_event(self, abi_input, outdir, event):
try: try:
old_abiinput = abiinput.deepcopy() old_abiinput = abi_input.deepcopy()
abiinput.set_vars(mem_test=0) abi_input.set_vars(mem_test=0)
return Correction(self, self.compare_inputs(abiinput, old_abiinput), event, reset=False) return Correction(self, self.compare_inputs(abi_input, old_abiinput), event, reset=False)
except Exception as exc: except Exception as exc:
logger.warning('Error while trying to apply the handler {}.'.format(str(self)), exc) logger.warning('Error while trying to apply the handler {}.'.format(str(self)), exc)
return None return None
@yaml_object(__yaml) @yaml_object(_yaml)
class MemoryError(AbinitError): class MemoryError(AbinitError):
""" """
This error occurs when a checked allocation fails in Abinit This error occurs when a checked allocation fails in Abinit
@ -903,7 +903,7 @@ class MemoryErrorHandler(ErrorHandler):
task.manager.increase_resources() task.manager.increase_resources()
return self.FIXED return self.FIXED
def handle_input_event(self, abiinput, outdir, event): def handle_input_event(self, abi_input, outdir, event):
""" """
Shouldn't do anything on the input Shouldn't do anything on the input
""" """