diff --git a/sktools/src/sktools/skdef.py b/sktools/src/sktools/skdef.py index 22bfca39..5652cdbc 100644 --- a/sktools/src/sktools/skdef.py +++ b/sktools/src/sktools/skdef.py @@ -441,8 +441,6 @@ class OnecenterParameters(sc.ClassDict): `calculator`. """ - _PATTERN_DEFAULT = re.compile(r"^([a-z:]+(?:,[a-z:]+)*)$", re.IGNORECASE) - @classmethod def fromhsd(cls, root, query): """Returns one center parameters with substituted defaults.""" @@ -492,7 +490,8 @@ class TwocenterParameters(sc.ClassDict): `calculator`. """ - _PATTERN_DEFAULT = re.compile(r"^([a-z:]+)-([a-z:]+)$", re.IGNORECASE) + _PATTERN_DEFAULT = re.compile( + r"^([a-z][a-z0-9_]*)-([a-z][a-z0-9_]*)$", re.IGNORECASE) @classmethod def fromhsd(cls, root, query): @@ -504,7 +503,7 @@ def fromhsd(cls, root, query): name = node.tag match = cls._PATTERN_DEFAULT.match(name) if not match: - msg = "Invalid two center interaction '{}'".name + msg = "Invalid two center interaction '{}'".format(name) raise sc.SkgenException(msg) name1, name2 = match.groups() key = min(name1, name2), max(name1, name2)