From 20619965371be13e17a30b5eb90582574f67045d Mon Sep 17 00:00:00 2001 From: ebanyas Date: Tue, 20 Aug 2024 17:08:43 -0700 Subject: [PATCH] added custom warning class for tpiba conversion (for later filtering in Caffeinator) --- pymatgen/io/espresso/caffeinator.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pymatgen/io/espresso/caffeinator.py b/pymatgen/io/espresso/caffeinator.py index 824db5f..f888732 100644 --- a/pymatgen/io/espresso/caffeinator.py +++ b/pymatgen/io/espresso/caffeinator.py @@ -101,7 +101,7 @@ def _caffeinate_kpoints(kpoints): "\nWarning: VASP's cartesian coordinates cannot be fully " "converted to tpiba coordinates without an accompanying " "POSCAR file! Use the following k-points at your own risk."), - CaffeinationWarning) + CartesianWarning) #TODO: Make warning pretty #TODO: Return logic @@ -184,11 +184,6 @@ def _convert_explicit_k(kpoints): "card."), CaffeinationWarning) #TODO: Make warning pretty - #TODO: - # Caffeinator can swap out the occupations tag for something else - # reasonable. - # Define a unique warning category so that the two k-point warnings - # defined in this module can be easily filtered? return option, grid, shift, k, weights, labels def _caffeinate_poscar(poscar, ibrav:bool = False): @@ -256,3 +251,12 @@ class CaffeinationWarning(Warning): """ Warning class for caffeination """ + +class CartesianWarning(CaffeinationWarning): + """ + Warning class for tpiba conversion + """ + def __init__(self, message): + self.message = message + def __str__(self): + return str(self.message)