xtalui 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xtalui-0.1.0/LICENSE +21 -0
- xtalui-0.1.0/PKG-INFO +274 -0
- xtalui-0.1.0/README.md +243 -0
- xtalui-0.1.0/pyproject.toml +56 -0
- xtalui-0.1.0/setup.cfg +4 -0
- xtalui-0.1.0/src/xtalui/__init__.py +5 -0
- xtalui-0.1.0/src/xtalui/__main__.py +5 -0
- xtalui-0.1.0/src/xtalui/abacus_stru.py +197 -0
- xtalui-0.1.0/src/xtalui/app.py +977 -0
- xtalui-0.1.0/src/xtalui/cli.py +66 -0
- xtalui-0.1.0/src/xtalui/renderer.py +452 -0
- xtalui-0.1.0/src/xtalui/scene.py +433 -0
- xtalui-0.1.0/src/xtalui.egg-info/PKG-INFO +274 -0
- xtalui-0.1.0/src/xtalui.egg-info/SOURCES.txt +19 -0
- xtalui-0.1.0/src/xtalui.egg-info/dependency_links.txt +1 -0
- xtalui-0.1.0/src/xtalui.egg-info/entry_points.txt +2 -0
- xtalui-0.1.0/src/xtalui.egg-info/requires.txt +8 -0
- xtalui-0.1.0/src/xtalui.egg-info/top_level.txt +2 -0
- xtalui-0.1.0/tests/test_app.py +504 -0
- xtalui-0.1.0/tests/test_cli.py +57 -0
- xtalui-0.1.0/tests/test_renderer.py +594 -0
xtalui-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
xtalui-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xtalui
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Terminal crystal structure viewer with ASCII and Unicode rendering
|
|
5
|
+
Author-email: zhubonan@outlook.com
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/bonan-group/xtalui
|
|
8
|
+
Project-URL: Repository, https://github.com/bonan-group/xtalui
|
|
9
|
+
Project-URL: Issues, https://github.com/bonan-group/xtalui/issues
|
|
10
|
+
Project-URL: Releases, https://github.com/bonan-group/xtalui/releases
|
|
11
|
+
Keywords: ase,ascii,chemistry,crystal,terminal,tui
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
18
|
+
Classifier: Topic :: Terminals
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: ase>=3.23
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Requires-Dist: prompt_toolkit>=3.0
|
|
26
|
+
Requires-Dist: spglib>=2.5
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# xtalui
|
|
33
|
+
|
|
34
|
+
[](https://github.com/bonan-group/xtalui/actions/workflows/ci.yml)
|
|
35
|
+
[](https://pypi.org/project/xtalui/)
|
|
36
|
+
|
|
37
|
+
`xtalui` is a terminal-first crystal structure viewer for atomistic and crystalline structures.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
It renders structures directly in the terminal using:
|
|
42
|
+
|
|
43
|
+
- ASCII, Unicode, and Braille rendering for cell edges, bonds, and atoms
|
|
44
|
+
- depth-aware atom glyphs or element labels
|
|
45
|
+
- interactive camera controls without launching a GUI
|
|
46
|
+
- a single-command CLI: `xtal STRUCTURE_FILE [STRUCTURE_FILE ...]`
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Load structures through ASE
|
|
51
|
+
- Load self-contained ABACUS `STRU` files with explicit `LATTICE_VECTORS`
|
|
52
|
+
- Load multi-frame structure series supported by ASE
|
|
53
|
+
- Accept multiple input files and concatenate all frames into one trajectory series
|
|
54
|
+
- Show atoms, bonds, and the unit cell in the terminal
|
|
55
|
+
- Toggle between point and sphere atom rendering
|
|
56
|
+
- Display chemical formula, lattice vectors, cell lengths and angles, volume, and space group
|
|
57
|
+
- Show both lattice-frame `a/b/c` and Cartesian `x/y/z` direction widgets
|
|
58
|
+
- Show atomic positions and bond lengths in scrollable overlay panels
|
|
59
|
+
- Calibrate the terminal aspect ratio with a Braille circle test pattern
|
|
60
|
+
- Toggle labels, bonds, cell frame, color, sphere mode, and direction panels at runtime
|
|
61
|
+
- Autoplay continuous rotation directly in the terminal
|
|
62
|
+
- Autoplay multi-frame structure series directly in the terminal
|
|
63
|
+
- Align the view along `x`, `y`, or `z` with one keypress
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
Recommended for daily use: install `xtal` as a standalone `uv` tool so it is not tied to a project virtual environment.
|
|
68
|
+
|
|
69
|
+
Once the package is published on PyPI:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
uv tool install xtalui
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Directly from GitHub:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
uv tool install git+https://github.com/bonan-group/xtalui
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Standard `pip` installation from PyPI:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -m pip install xtalui
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Standard `pip` installation directly from GitHub:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
python -m pip install git+https://github.com/bonan-group/xtalui
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
From a local checkout:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone https://github.com/bonan-group/xtalui.git
|
|
97
|
+
cd xtalui
|
|
98
|
+
uv tool install --editable .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Local editable install with standard `pip`:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
git clone https://github.com/bonan-group/xtalui.git
|
|
105
|
+
cd xtalui
|
|
106
|
+
python -m pip install -e .
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
If `xtal` is not yet on your `PATH`, run:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
uv tool update-shell
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then you can launch the viewer directly:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
xtal examples/silicon_diamond.cif
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For development work inside the repository:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
uv venv --python /usr/bin/python3 .venv
|
|
125
|
+
uv sync --extra dev
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
You can also run it without activating the environment:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
uv run xtal --help
|
|
132
|
+
uv run python -m xtalui --help
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
uv sync --extra dev
|
|
139
|
+
uv run pytest -q
|
|
140
|
+
uv run ruff check .
|
|
141
|
+
uv run ruff format --check .
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Usage
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
uv run xtal structure.cif
|
|
148
|
+
uv run xtal frame1.xyz frame2.xyz
|
|
149
|
+
uv run xtal -n 1: trajectory.xyz
|
|
150
|
+
uv run xtal trajectory.xyz@::10 other.xyz@-5:
|
|
151
|
+
uv run xtal POSCAR -r 2 2 1
|
|
152
|
+
uv run xtal structure.cif -s 1e-3
|
|
153
|
+
uv run xtal structure.cif -c
|
|
154
|
+
uv run xtal STRU
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The repository also ships with generated sample structures:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
uv run xtal examples/silicon_diamond.cif
|
|
161
|
+
uv run xtal examples/gaas_zincblende.cif
|
|
162
|
+
uv run xtal examples/graphite_hexagonal.cif
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## CLI Options
|
|
166
|
+
|
|
167
|
+
- `PATH`: one or more structure files to open with ASE
|
|
168
|
+
- If multiple paths are given, all frames from all files are concatenated into one trajectory series in the order provided
|
|
169
|
+
- Append `@SLICE` to one filename to select a subset of frames from that file only, for example `traj.xyz@::5`
|
|
170
|
+
- `-n SLICE`, `--image-number SLICE`: pick individual image(s) from each input file using Python slice syntax like `0`, `1:`, `:10`, or `::2`
|
|
171
|
+
- `@SLICE` on a filename overrides `-n/--image-number` for that file
|
|
172
|
+
- `-r NX NY NZ`, `--repeat NX NY NZ`: repeat the structure along each lattice direction
|
|
173
|
+
- `--hide-cell`: start with the unit cell hidden
|
|
174
|
+
- `-s FLOAT`, `--symprec FLOAT`: set the symmetry tolerance used for space-group detection
|
|
175
|
+
- `-c`, `--color`: start with element colors enabled
|
|
176
|
+
|
|
177
|
+
## Controls
|
|
178
|
+
|
|
179
|
+
- `Left` / `Right`: rotate around Y
|
|
180
|
+
- `Up` / `Down`: rotate around X, or scroll the active overlay panel when one is open
|
|
181
|
+
- `x` / `y` / `z`: align the view along the Cartesian axes
|
|
182
|
+
- `a`: toggle automatic rotation
|
|
183
|
+
- `p`: toggle the atomic positions overlay
|
|
184
|
+
- `B`: toggle the bond-length overlay
|
|
185
|
+
- `t`: toggle automatic frame playback for multi-frame series
|
|
186
|
+
- `T`: toggle calibration mode
|
|
187
|
+
- `rXYZ`: rebuild the displayed structure as an in-app `XxYxZ` supercell, for example `r222`
|
|
188
|
+
- `[` / `]`: move backward or forward through a loaded structure series
|
|
189
|
+
- `j` / `k`: scroll the active overlay panel down or up
|
|
190
|
+
- `1`: toggle the `abc dirs` panel
|
|
191
|
+
- `2`: toggle the `xyz dirs` panel
|
|
192
|
+
- `Shift+Left` / `Shift+Right`: pan X
|
|
193
|
+
- `Shift+Up` / `Shift+Down`: pan Y
|
|
194
|
+
- `+` / `-`: zoom in/out
|
|
195
|
+
- `m`: toggle line mode between Braille and Unicode wireframe
|
|
196
|
+
- `b`: toggle bonds
|
|
197
|
+
- `c`: toggle unit cell
|
|
198
|
+
- `C`: toggle element colors
|
|
199
|
+
- `s`: toggle sphere mode for atoms
|
|
200
|
+
- `Left` / `Right` or `+` / `-` in calibration mode: decrease or increase the render aspect ratio
|
|
201
|
+
- `Ctrl-R`: reset the view camera and restore the launch repeat
|
|
202
|
+
- `l`: toggle labels
|
|
203
|
+
- `Esc`: cancel an in-progress repeat command
|
|
204
|
+
- `?`: toggle help
|
|
205
|
+
- `q`: quit
|
|
206
|
+
|
|
207
|
+
## Calibration
|
|
208
|
+
|
|
209
|
+
Press `T` to enter calibration mode. The main view is replaced by a Braille-rendered circle.
|
|
210
|
+
|
|
211
|
+
Adjust the aspect ratio with:
|
|
212
|
+
|
|
213
|
+
- `Left` / `Right`
|
|
214
|
+
- `+` / `-`
|
|
215
|
+
|
|
216
|
+
until the circle looks round in your terminal and font. The current value is shown in the footer as `aspect=...`.
|
|
217
|
+
|
|
218
|
+
Press `T` again to return to the structure view. The calibrated aspect ratio is then used by:
|
|
219
|
+
|
|
220
|
+
- the main crystal renderer
|
|
221
|
+
- the `abc dirs` panel
|
|
222
|
+
- the `xyz dirs` panel
|
|
223
|
+
|
|
224
|
+
## Overlay Panels
|
|
225
|
+
|
|
226
|
+
Press `p` to show atomic positions for the current frame. The table includes:
|
|
227
|
+
|
|
228
|
+
- atom index
|
|
229
|
+
- element symbol
|
|
230
|
+
- Cartesian coordinates
|
|
231
|
+
- direct (fractional) coordinates
|
|
232
|
+
|
|
233
|
+
Press `B` to show the bond-length overlay. Each row lists:
|
|
234
|
+
|
|
235
|
+
- the full indices of both atoms in the bond
|
|
236
|
+
- the bond length
|
|
237
|
+
- the periodic image offset used for that displayed bond
|
|
238
|
+
|
|
239
|
+
Both overlays are scrollable with:
|
|
240
|
+
|
|
241
|
+
- `Up` / `Down`
|
|
242
|
+
- `j` / `k`
|
|
243
|
+
|
|
244
|
+
The overlays are drawn over the main view, so opening them does not rescale the structure display.
|
|
245
|
+
|
|
246
|
+
## Atom Rendering
|
|
247
|
+
|
|
248
|
+
By default, atoms are shown as points. Press `s` to switch to sphere mode.
|
|
249
|
+
|
|
250
|
+
- In Unicode mode, spheres use a constant filled-circle glyph
|
|
251
|
+
- In Braille mode, spheres are rasterized on the Braille subcell grid
|
|
252
|
+
- In label mode, element labels are still drawn on top of the spheres
|
|
253
|
+
|
|
254
|
+
## Notes
|
|
255
|
+
|
|
256
|
+
- The Python package name is `xtalui`, while the installed CLI command is `xtal`.
|
|
257
|
+
- Space-group detection uses `spglib` through ASE-compatible structure data.
|
|
258
|
+
- Bond detection follows the ASE GUI heuristic: a periodic neighbor list with a `1.5x` covalent-radius cutoff.
|
|
259
|
+
- Color mode uses ASE Jmol-style element colors for atoms and atom labels.
|
|
260
|
+
- ABACUS `STRU` support is built in for files that include explicit `LATTICE_VECTORS`.
|
|
261
|
+
- `STRU` files that rely on `LATTICE_PARAMETER(S)` plus `latname` from a separate `INPUT` file are not supported.
|
|
262
|
+
- Braille mode is the default line renderer because it provides smoother terminal line quality.
|
|
263
|
+
- Example CIF files in [`examples/`](/home/bonan/appdir/atomtui/examples) are generated with ASE for common crystal prototypes.
|
|
264
|
+
|
|
265
|
+
## Release
|
|
266
|
+
|
|
267
|
+
Releases are tag-driven:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
git tag v0.1.0
|
|
271
|
+
git push origin v0.1.0
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The GitHub release workflow validates that the tag matches `project.version`, builds the package, publishes a GitHub Release, and uploads to PyPI.
|
xtalui-0.1.0/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# xtalui
|
|
2
|
+
|
|
3
|
+
[](https://github.com/bonan-group/xtalui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/xtalui/)
|
|
5
|
+
|
|
6
|
+
`xtalui` is a terminal-first crystal structure viewer for atomistic and crystalline structures.
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
It renders structures directly in the terminal using:
|
|
11
|
+
|
|
12
|
+
- ASCII, Unicode, and Braille rendering for cell edges, bonds, and atoms
|
|
13
|
+
- depth-aware atom glyphs or element labels
|
|
14
|
+
- interactive camera controls without launching a GUI
|
|
15
|
+
- a single-command CLI: `xtal STRUCTURE_FILE [STRUCTURE_FILE ...]`
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Load structures through ASE
|
|
20
|
+
- Load self-contained ABACUS `STRU` files with explicit `LATTICE_VECTORS`
|
|
21
|
+
- Load multi-frame structure series supported by ASE
|
|
22
|
+
- Accept multiple input files and concatenate all frames into one trajectory series
|
|
23
|
+
- Show atoms, bonds, and the unit cell in the terminal
|
|
24
|
+
- Toggle between point and sphere atom rendering
|
|
25
|
+
- Display chemical formula, lattice vectors, cell lengths and angles, volume, and space group
|
|
26
|
+
- Show both lattice-frame `a/b/c` and Cartesian `x/y/z` direction widgets
|
|
27
|
+
- Show atomic positions and bond lengths in scrollable overlay panels
|
|
28
|
+
- Calibrate the terminal aspect ratio with a Braille circle test pattern
|
|
29
|
+
- Toggle labels, bonds, cell frame, color, sphere mode, and direction panels at runtime
|
|
30
|
+
- Autoplay continuous rotation directly in the terminal
|
|
31
|
+
- Autoplay multi-frame structure series directly in the terminal
|
|
32
|
+
- Align the view along `x`, `y`, or `z` with one keypress
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Recommended for daily use: install `xtal` as a standalone `uv` tool so it is not tied to a project virtual environment.
|
|
37
|
+
|
|
38
|
+
Once the package is published on PyPI:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv tool install xtalui
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Directly from GitHub:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv tool install git+https://github.com/bonan-group/xtalui
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Standard `pip` installation from PyPI:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python -m pip install xtalui
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Standard `pip` installation directly from GitHub:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
python -m pip install git+https://github.com/bonan-group/xtalui
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
From a local checkout:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/bonan-group/xtalui.git
|
|
66
|
+
cd xtalui
|
|
67
|
+
uv tool install --editable .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Local editable install with standard `pip`:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/bonan-group/xtalui.git
|
|
74
|
+
cd xtalui
|
|
75
|
+
python -m pip install -e .
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If `xtal` is not yet on your `PATH`, run:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv tool update-shell
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Then you can launch the viewer directly:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
xtal examples/silicon_diamond.cif
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For development work inside the repository:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
uv venv --python /usr/bin/python3 .venv
|
|
94
|
+
uv sync --extra dev
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
You can also run it without activating the environment:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv run xtal --help
|
|
101
|
+
uv run python -m xtalui --help
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
uv sync --extra dev
|
|
108
|
+
uv run pytest -q
|
|
109
|
+
uv run ruff check .
|
|
110
|
+
uv run ruff format --check .
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Usage
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
uv run xtal structure.cif
|
|
117
|
+
uv run xtal frame1.xyz frame2.xyz
|
|
118
|
+
uv run xtal -n 1: trajectory.xyz
|
|
119
|
+
uv run xtal trajectory.xyz@::10 other.xyz@-5:
|
|
120
|
+
uv run xtal POSCAR -r 2 2 1
|
|
121
|
+
uv run xtal structure.cif -s 1e-3
|
|
122
|
+
uv run xtal structure.cif -c
|
|
123
|
+
uv run xtal STRU
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The repository also ships with generated sample structures:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
uv run xtal examples/silicon_diamond.cif
|
|
130
|
+
uv run xtal examples/gaas_zincblende.cif
|
|
131
|
+
uv run xtal examples/graphite_hexagonal.cif
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## CLI Options
|
|
135
|
+
|
|
136
|
+
- `PATH`: one or more structure files to open with ASE
|
|
137
|
+
- If multiple paths are given, all frames from all files are concatenated into one trajectory series in the order provided
|
|
138
|
+
- Append `@SLICE` to one filename to select a subset of frames from that file only, for example `traj.xyz@::5`
|
|
139
|
+
- `-n SLICE`, `--image-number SLICE`: pick individual image(s) from each input file using Python slice syntax like `0`, `1:`, `:10`, or `::2`
|
|
140
|
+
- `@SLICE` on a filename overrides `-n/--image-number` for that file
|
|
141
|
+
- `-r NX NY NZ`, `--repeat NX NY NZ`: repeat the structure along each lattice direction
|
|
142
|
+
- `--hide-cell`: start with the unit cell hidden
|
|
143
|
+
- `-s FLOAT`, `--symprec FLOAT`: set the symmetry tolerance used for space-group detection
|
|
144
|
+
- `-c`, `--color`: start with element colors enabled
|
|
145
|
+
|
|
146
|
+
## Controls
|
|
147
|
+
|
|
148
|
+
- `Left` / `Right`: rotate around Y
|
|
149
|
+
- `Up` / `Down`: rotate around X, or scroll the active overlay panel when one is open
|
|
150
|
+
- `x` / `y` / `z`: align the view along the Cartesian axes
|
|
151
|
+
- `a`: toggle automatic rotation
|
|
152
|
+
- `p`: toggle the atomic positions overlay
|
|
153
|
+
- `B`: toggle the bond-length overlay
|
|
154
|
+
- `t`: toggle automatic frame playback for multi-frame series
|
|
155
|
+
- `T`: toggle calibration mode
|
|
156
|
+
- `rXYZ`: rebuild the displayed structure as an in-app `XxYxZ` supercell, for example `r222`
|
|
157
|
+
- `[` / `]`: move backward or forward through a loaded structure series
|
|
158
|
+
- `j` / `k`: scroll the active overlay panel down or up
|
|
159
|
+
- `1`: toggle the `abc dirs` panel
|
|
160
|
+
- `2`: toggle the `xyz dirs` panel
|
|
161
|
+
- `Shift+Left` / `Shift+Right`: pan X
|
|
162
|
+
- `Shift+Up` / `Shift+Down`: pan Y
|
|
163
|
+
- `+` / `-`: zoom in/out
|
|
164
|
+
- `m`: toggle line mode between Braille and Unicode wireframe
|
|
165
|
+
- `b`: toggle bonds
|
|
166
|
+
- `c`: toggle unit cell
|
|
167
|
+
- `C`: toggle element colors
|
|
168
|
+
- `s`: toggle sphere mode for atoms
|
|
169
|
+
- `Left` / `Right` or `+` / `-` in calibration mode: decrease or increase the render aspect ratio
|
|
170
|
+
- `Ctrl-R`: reset the view camera and restore the launch repeat
|
|
171
|
+
- `l`: toggle labels
|
|
172
|
+
- `Esc`: cancel an in-progress repeat command
|
|
173
|
+
- `?`: toggle help
|
|
174
|
+
- `q`: quit
|
|
175
|
+
|
|
176
|
+
## Calibration
|
|
177
|
+
|
|
178
|
+
Press `T` to enter calibration mode. The main view is replaced by a Braille-rendered circle.
|
|
179
|
+
|
|
180
|
+
Adjust the aspect ratio with:
|
|
181
|
+
|
|
182
|
+
- `Left` / `Right`
|
|
183
|
+
- `+` / `-`
|
|
184
|
+
|
|
185
|
+
until the circle looks round in your terminal and font. The current value is shown in the footer as `aspect=...`.
|
|
186
|
+
|
|
187
|
+
Press `T` again to return to the structure view. The calibrated aspect ratio is then used by:
|
|
188
|
+
|
|
189
|
+
- the main crystal renderer
|
|
190
|
+
- the `abc dirs` panel
|
|
191
|
+
- the `xyz dirs` panel
|
|
192
|
+
|
|
193
|
+
## Overlay Panels
|
|
194
|
+
|
|
195
|
+
Press `p` to show atomic positions for the current frame. The table includes:
|
|
196
|
+
|
|
197
|
+
- atom index
|
|
198
|
+
- element symbol
|
|
199
|
+
- Cartesian coordinates
|
|
200
|
+
- direct (fractional) coordinates
|
|
201
|
+
|
|
202
|
+
Press `B` to show the bond-length overlay. Each row lists:
|
|
203
|
+
|
|
204
|
+
- the full indices of both atoms in the bond
|
|
205
|
+
- the bond length
|
|
206
|
+
- the periodic image offset used for that displayed bond
|
|
207
|
+
|
|
208
|
+
Both overlays are scrollable with:
|
|
209
|
+
|
|
210
|
+
- `Up` / `Down`
|
|
211
|
+
- `j` / `k`
|
|
212
|
+
|
|
213
|
+
The overlays are drawn over the main view, so opening them does not rescale the structure display.
|
|
214
|
+
|
|
215
|
+
## Atom Rendering
|
|
216
|
+
|
|
217
|
+
By default, atoms are shown as points. Press `s` to switch to sphere mode.
|
|
218
|
+
|
|
219
|
+
- In Unicode mode, spheres use a constant filled-circle glyph
|
|
220
|
+
- In Braille mode, spheres are rasterized on the Braille subcell grid
|
|
221
|
+
- In label mode, element labels are still drawn on top of the spheres
|
|
222
|
+
|
|
223
|
+
## Notes
|
|
224
|
+
|
|
225
|
+
- The Python package name is `xtalui`, while the installed CLI command is `xtal`.
|
|
226
|
+
- Space-group detection uses `spglib` through ASE-compatible structure data.
|
|
227
|
+
- Bond detection follows the ASE GUI heuristic: a periodic neighbor list with a `1.5x` covalent-radius cutoff.
|
|
228
|
+
- Color mode uses ASE Jmol-style element colors for atoms and atom labels.
|
|
229
|
+
- ABACUS `STRU` support is built in for files that include explicit `LATTICE_VECTORS`.
|
|
230
|
+
- `STRU` files that rely on `LATTICE_PARAMETER(S)` plus `latname` from a separate `INPUT` file are not supported.
|
|
231
|
+
- Braille mode is the default line renderer because it provides smoother terminal line quality.
|
|
232
|
+
- Example CIF files in [`examples/`](/home/bonan/appdir/atomtui/examples) are generated with ASE for common crystal prototypes.
|
|
233
|
+
|
|
234
|
+
## Release
|
|
235
|
+
|
|
236
|
+
Releases are tag-driven:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
git tag v0.1.0
|
|
240
|
+
git push origin v0.1.0
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The GitHub release workflow validates that the tag matches `project.version`, builds the package, publishes a GitHub Release, and uploads to PyPI.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "xtalui"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Terminal crystal structure viewer with ASCII and Unicode rendering"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{email = "zhubonan@outlook.com"}]
|
|
14
|
+
keywords = ["ase", "ascii", "chemistry", "crystal", "terminal", "tui"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Topic :: Scientific/Engineering :: Chemistry",
|
|
22
|
+
"Topic :: Terminals",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"ase>=3.23",
|
|
27
|
+
"numpy>=1.24",
|
|
28
|
+
"prompt_toolkit>=3.0",
|
|
29
|
+
"spglib>=2.5",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = ["pytest>=8.0", "ruff>=0.6"]
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
xtal = "xtalui.cli:main"
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/bonan-group/xtalui"
|
|
40
|
+
Repository = "https://github.com/bonan-group/xtalui"
|
|
41
|
+
Issues = "https://github.com/bonan-group/xtalui/issues"
|
|
42
|
+
Releases = "https://github.com/bonan-group/xtalui/releases"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools]
|
|
45
|
+
package-dir = {"" = "src"}
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.packages.find]
|
|
48
|
+
where = ["src"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
line-length = 120
|
|
52
|
+
target-version = "py310"
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
pythonpath = ["src"]
|
xtalui-0.1.0/setup.cfg
ADDED