From 1c724a8e87b18c26bdd59dc00bd5403fd58638a0 Mon Sep 17 00:00:00 2001 From: Colton Hicks Date: Thu, 8 Aug 2024 19:20:59 -0700 Subject: [PATCH] Added program version parser for CREST stdout. --- qcparse/parsers/crest.py | 11 +++++++++++ tests/data/crest_stdout.txt | 23 +++++++++++++++++++++++ tests/test_crest.py | 6 ++++++ 3 files changed, 40 insertions(+) create mode 100644 qcparse/parsers/crest.py create mode 100644 tests/data/crest_stdout.txt create mode 100644 tests/test_crest.py diff --git a/qcparse/parsers/crest.py b/qcparse/parsers/crest.py new file mode 100644 index 0000000..2c3fd14 --- /dev/null +++ b/qcparse/parsers/crest.py @@ -0,0 +1,11 @@ +from .utils import regex_search + + +def parse_version_string(string: str) -> str: + """Parse version string from CREST stdout. + + Matches format of 'crest --version' on command line. + """ + regex = r"Version (\d+\.\d+\.\d+)," + match = regex_search(regex, string) + return match.group(1) diff --git a/tests/data/crest_stdout.txt b/tests/data/crest_stdout.txt new file mode 100644 index 0000000..7fdf3ac --- /dev/null +++ b/tests/data/crest_stdout.txt @@ -0,0 +1,23 @@ + + ╔════════════════════════════════════════════╗ + ║ ___ ___ ___ ___ _____ ║ + ║ / __| _ \ __/ __|_ _| ║ + ║ | (__| / _|\__ \ | | ║ + ║ \___|_|_\___|___/ |_| ║ + ║ ║ + ║ Conformer-Rotamer Ensemble Sampling Tool ║ + ║ based on the xTB methods ║ + ║ ║ + ╚════════════════════════════════════════════╝ + Version 3.0.1, Mon May 6 18:43:33 UTC 2024 + commit (1782d7d) compiled by 'runner@fv-az772-53' + + Cite work conducted with this code as + + • P.Pracht, F.Bohle, S.Grimme, PCCP, 2020, 22, 7169-7192. + • S.Grimme, JCTC, 2019, 15, 2847-2862. + • P.Pracht, S.Grimme, C.Bannwarth, F.Bohle, S.Ehlert, + G.Feldmann, J.Gorges, M.Müller, T.Neudecker, C.Plett, + S.Spicher, P.Steinbach, P.Wesołowski, F.Zeller, + J. Chem. Phys., 2024, 160, 114110. + \ No newline at end of file diff --git a/tests/test_crest.py b/tests/test_crest.py new file mode 100644 index 0000000..be61752 --- /dev/null +++ b/tests/test_crest.py @@ -0,0 +1,6 @@ +from qcparse.parsers.crest import parse_version_string + + +def test_parse_version_string(test_data_dir): + text = (test_data_dir / "crest_stdout.txt").read_text() + assert parse_version_string(text) == "3.0.1"