|
1 | | -from __future__ import annotations |
2 | | - |
3 | | -from . import _core |
4 | | -from . import _nnkp |
5 | | -from . import _win |
6 | 1 | from ._amn import * |
7 | 2 | from ._eig import * |
8 | | -from ._wout import parse_iteration_info |
9 | | - |
10 | | - |
11 | | -__all__ = [ |
12 | | - 'parse_iteration_info', |
13 | | -] |
14 | | - |
15 | | - |
16 | | -def parse_win(string: str) -> dict: |
17 | | - """ |
18 | | - Parse WIN |
19 | | -
|
20 | | - Arguments: |
21 | | - string: the WIN text |
22 | | -
|
23 | | - Returns: |
24 | | - the parsed WIN |
25 | | - """ |
26 | | - comments = _core.extract_comments(string) |
27 | | - parameters = _core.parse_parameters(_core.extract_parameters(string)) |
28 | | - blocks = _core.parse_blocks(_core.extract_blocks(string)) |
29 | | - |
30 | | - parsed_win = { |
31 | | - 'comments': comments, |
32 | | - 'parameters': parameters, |
33 | | - 'blocks': blocks, |
34 | | - } |
35 | | - if 'unit_cell_cart' in blocks: |
36 | | - parsed_win['unit_cell_cart'] =_win.parse_unit_cell(blocks['unit_cell_cart']) |
37 | | - if 'atoms_cart' in blocks: |
38 | | - parsed_win['atoms_cart'] = _win.parse_atoms(blocks['atoms_cart']) |
39 | | - if 'atoms_frac' in blocks: |
40 | | - parsed_win['atoms_frac'] = _win.parse_atoms(blocks['atoms_frac']) |
41 | | - if 'projections' in blocks: |
42 | | - parsed_win['projections'] = _win.parse_projections(blocks['projections']) |
43 | | - if 'kpoints' in blocks: |
44 | | - parsed_win['kpoints'] =_win.parse_kpoints(blocks['kpoints']) |
45 | | - |
46 | | - return parsed_win |
47 | | - |
48 | | - |
49 | | -def parse_nnkp(string: str) -> dict: |
50 | | - """ |
51 | | - Parse NNKP |
52 | | -
|
53 | | - Arguments: |
54 | | - string: the NNKP text |
55 | | -
|
56 | | - Returns: |
57 | | - the parsed NNKP |
58 | | - """ |
59 | | - comments = _core.extract_comments(string) |
60 | | - parameters = _core.parse_parameters(_core.extract_parameters(string)) |
61 | | - blocks = _core.parse_blocks(_core.extract_blocks(string)) |
62 | | - |
63 | | - parsed_nnkp = { |
64 | | - 'comments': comments, |
65 | | - 'parameters': parameters, |
66 | | - 'blocks': blocks, |
67 | | - 'direct_lattice': _nnkp.parse_direct_lattice(blocks['real_lattice']), |
68 | | - 'reciprocal_lattice': _nnkp.parse_reciprocal_lattice(blocks['recip_lattice']), |
69 | | - 'kpoints': _nnkp.parse_kpoints(blocks['kpoints']), |
70 | | - 'exclude_bands': _nnkp.parse_exclude_bands(blocks['exclude_bands']), |
71 | | - } |
72 | | - if 'projections' in 'blocks': |
73 | | - parsed_nnkp['projections'] = _nnkp.parse_projections(blocks['projections']) |
74 | | - if 'spinor_projections' in blocks: |
75 | | - parsed_nnkp['spinor_projections'] = _nnkp.parse_spinor_projections(blocks['spinor_projections']) |
76 | | - |
77 | | - return parsed_nnkp |
| 3 | +from ._nnkp import * |
| 4 | +from ._win import * |
| 5 | +from ._wout import * |
0 commit comments