Skip to content

Commit

Permalink
Added program version parser for CREST stdout.
Browse files Browse the repository at this point in the history
  • Loading branch information
coltonbh committed Aug 9, 2024
1 parent a973a40 commit 1c724a8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
11 changes: 11 additions & 0 deletions qcparse/parsers/crest.py
Original file line number Diff line number Diff line change
@@ -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)
23 changes: 23 additions & 0 deletions tests/data/crest_stdout.txt
Original file line number Diff line number Diff line change
@@ -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.

6 changes: 6 additions & 0 deletions tests/test_crest.py
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 1c724a8

Please sign in to comment.