Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luthaf/extended-xyz
https://github.com/luthaf/extended-xyz
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/luthaf/extended-xyz
- Owner: Luthaf
- Created: 2021-08-03T16:40:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-04T17:20:28.000Z (almost 3 years ago)
- Last Synced: 2024-11-09T04:39:07.905Z (2 months ago)
- Language: C++
- Size: 144 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Extended XYZ formal grammar and parser
This repository contains a [BNF-like formal grammar](extended-xyz.bnf) for the
extended XYZ format, created from the plain text specification at
https://github.com/libAtoms/extxyz.It also contains a parser for this grammar implemented in C, and a Python
binding to the C parser.**Installing the Python module**:
```bash
python setup.py install
# or
pip install .
```Example usage:
```python
from exyz import parse_comment_lineline = (
'Properties=species:S:1:pos:R:3 s=string s2="test \\" string" b=T r=3.42 i=-33 '
+ 'a_i=[3, 4, 5] a_r=[-22, 4.2] a_b="T T F" a_s={a b c}'
)
properties, info = parse_comment_line(line)print("Atomic properties:")
print(properties.to_dict())
# output:
# {'species': {'type': 'string', 'count': 1}, 'pos': {'type': 'real', 'count': 3}}print("\nFrame properties:")
print(info.to_dict())
# output:
# {'s': 'string', 's2': 'test " string', 'b': True, 'r': 3.42, 'i': -33,
# 'a_i': array([3, 4, 5]), 'a_r': array([-22. , 4.2]),
# 'a_b': array([ True, True, False]), 'a_s': array(['a', 'b', 'c'], dtype='