aseview 0.0.1__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.
- aseview-0.0.1/.github/workflows/docs.yml +64 -0
- aseview-0.0.1/.github/workflows/publish.yml +72 -0
- aseview-0.0.1/.gitignore +90 -0
- aseview-0.0.1/LICENSE +21 -0
- aseview-0.0.1/MANIFEST.in +4 -0
- aseview-0.0.1/PKG-INFO +322 -0
- aseview-0.0.1/README.md +268 -0
- aseview-0.0.1/aseview/__init__.py +10 -0
- aseview-0.0.1/aseview/__main__.py +6 -0
- aseview-0.0.1/aseview/cli.py +468 -0
- aseview-0.0.1/aseview/hessian_parsers.py +209 -0
- aseview-0.0.1/aseview/jupyter.py +134 -0
- aseview-0.0.1/aseview/static/js/aseview.js +211 -0
- aseview-0.0.1/aseview/static/js/styles.js +629 -0
- aseview-0.0.1/aseview/static/js/vendor/OrbitControls.js +1045 -0
- aseview-0.0.1/aseview/static/js/vendor/TrackballControls.js +723 -0
- aseview-0.0.1/aseview/static/js/vendor/gif.js +3 -0
- aseview-0.0.1/aseview/static/js/vendor/gif.worker.js +3 -0
- aseview-0.0.1/aseview/static/js/vendor/gifshot.js +2825 -0
- aseview-0.0.1/aseview/static/js/vendor/three.min.js +6 -0
- aseview-0.0.1/aseview/templates/molecular_viewer.html +3016 -0
- aseview-0.0.1/aseview/templates/normal_viewer.html +2529 -0
- aseview-0.0.1/aseview/templates/overlay_viewer.html +2414 -0
- aseview-0.0.1/aseview/utils.py +75 -0
- aseview-0.0.1/aseview/wrapper.py +876 -0
- aseview-0.0.1/aseview.egg-info/PKG-INFO +322 -0
- aseview-0.0.1/aseview.egg-info/SOURCES.txt +68 -0
- aseview-0.0.1/aseview.egg-info/dependency_links.txt +1 -0
- aseview-0.0.1/aseview.egg-info/entry_points.txt +3 -0
- aseview-0.0.1/aseview.egg-info/requires.txt +11 -0
- aseview-0.0.1/aseview.egg-info/top_level.txt +1 -0
- aseview-0.0.1/docs/api/molecular-viewer.md +212 -0
- aseview-0.0.1/docs/api/normal-viewer.md +198 -0
- aseview-0.0.1/docs/api/overlay-viewer.md +239 -0
- aseview-0.0.1/docs/assets/examples/ethanol.xyz +11 -0
- aseview-0.0.1/docs/assets/examples/water.xyz +5 -0
- aseview-0.0.1/docs/assets/viewers/benzene_glossy.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/caffeine.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/carbon_nanotube.html +7574 -0
- aseview-0.0.1/docs/assets/viewers/copper_fcc.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/ethanol_charges.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/ethanol_neon.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/gold_surface.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/graphene.html +7574 -0
- aseview-0.0.1/docs/assets/viewers/nacl_crystal.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/normal_modes.html +7574 -0
- aseview-0.0.1/docs/assets/viewers/overlay_colormap.html +4770 -0
- aseview-0.0.1/docs/assets/viewers/overlay_conformers.html +4770 -0
- aseview-0.0.1/docs/assets/viewers/phosphine_charges.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/silicon_crystal.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/trajectory.html +7868 -0
- aseview-0.0.1/docs/assets/viewers/water.html +7868 -0
- aseview-0.0.1/docs/cli-reference.md +177 -0
- aseview-0.0.1/docs/demo.html +304 -0
- aseview-0.0.1/docs/examples/basic.md +99 -0
- aseview-0.0.1/docs/examples/normal-modes.md +98 -0
- aseview-0.0.1/docs/examples/overlay.md +100 -0
- aseview-0.0.1/docs/examples/solid-state.md +372 -0
- aseview-0.0.1/docs/examples/trajectory.md +84 -0
- aseview-0.0.1/docs/file-formats.md +199 -0
- aseview-0.0.1/docs/generate_examples.py +517 -0
- aseview-0.0.1/docs/getting-started/installation.md +50 -0
- aseview-0.0.1/docs/getting-started/quickstart.md +91 -0
- aseview-0.0.1/docs/index.md +55 -0
- aseview-0.0.1/docs/js-module.md +503 -0
- aseview-0.0.1/docs/stylesheets/extra.css +13 -0
- aseview-0.0.1/mkdocs.yml +69 -0
- aseview-0.0.1/pyproject.toml +58 -0
- aseview-0.0.1/setup.cfg +4 -0
- aseview-0.0.1/uv.lock +6888 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- 'mkdocs.yml'
|
|
10
|
+
- 'aseview/**'
|
|
11
|
+
- '.github/workflows/docs.yml'
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
pages: write
|
|
17
|
+
id-token: write
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: "pages"
|
|
21
|
+
cancel-in-progress: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
fetch-depth: 0
|
|
31
|
+
|
|
32
|
+
- name: Setup Python
|
|
33
|
+
uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: '3.11'
|
|
36
|
+
|
|
37
|
+
- name: Install dependencies
|
|
38
|
+
run: |
|
|
39
|
+
pip install mkdocs-material pymdown-extensions
|
|
40
|
+
pip install numpy ase
|
|
41
|
+
pip install -e .
|
|
42
|
+
|
|
43
|
+
- name: Generate example viewers
|
|
44
|
+
run: |
|
|
45
|
+
python docs/generate_examples.py
|
|
46
|
+
|
|
47
|
+
- name: Build documentation
|
|
48
|
+
run: mkdocs build
|
|
49
|
+
|
|
50
|
+
- name: Upload artifact
|
|
51
|
+
uses: actions/upload-pages-artifact@v3
|
|
52
|
+
with:
|
|
53
|
+
path: ./site
|
|
54
|
+
|
|
55
|
+
deploy:
|
|
56
|
+
environment:
|
|
57
|
+
name: github-pages
|
|
58
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
needs: build
|
|
61
|
+
steps:
|
|
62
|
+
- name: Deploy to GitHub Pages
|
|
63
|
+
id: deployment
|
|
64
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
target:
|
|
9
|
+
description: 'Publish target'
|
|
10
|
+
required: true
|
|
11
|
+
default: 'testpypi'
|
|
12
|
+
type: choice
|
|
13
|
+
options:
|
|
14
|
+
- testpypi
|
|
15
|
+
- pypi
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.11'
|
|
28
|
+
|
|
29
|
+
- name: Install build tools
|
|
30
|
+
run: pip install build
|
|
31
|
+
|
|
32
|
+
- name: Build sdist and wheel
|
|
33
|
+
run: python -m build
|
|
34
|
+
|
|
35
|
+
- uses: actions/upload-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: dist
|
|
38
|
+
path: dist/
|
|
39
|
+
|
|
40
|
+
publish-testpypi:
|
|
41
|
+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi'
|
|
42
|
+
needs: build
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
environment: testpypi
|
|
45
|
+
permissions:
|
|
46
|
+
id-token: write
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/download-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: dist
|
|
51
|
+
path: dist/
|
|
52
|
+
|
|
53
|
+
- name: Publish to TestPyPI
|
|
54
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
55
|
+
with:
|
|
56
|
+
repository-url: https://test.pypi.org/legacy/
|
|
57
|
+
|
|
58
|
+
publish-pypi:
|
|
59
|
+
if: github.event_name == 'release'
|
|
60
|
+
needs: build
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
environment: pypi
|
|
63
|
+
permissions:
|
|
64
|
+
id-token: write
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/download-artifact@v4
|
|
67
|
+
with:
|
|
68
|
+
name: dist
|
|
69
|
+
path: dist/
|
|
70
|
+
|
|
71
|
+
- name: Publish to PyPI
|
|
72
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
aseview-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Jupyter Notebook
|
|
50
|
+
.ipynb_checkpoints/
|
|
51
|
+
|
|
52
|
+
# IPython
|
|
53
|
+
profile_default/
|
|
54
|
+
ipython_config.py
|
|
55
|
+
|
|
56
|
+
# pyenv
|
|
57
|
+
.python-version
|
|
58
|
+
|
|
59
|
+
# Environments
|
|
60
|
+
.env
|
|
61
|
+
.venv
|
|
62
|
+
env/
|
|
63
|
+
venv/
|
|
64
|
+
ENV/
|
|
65
|
+
env.bak/
|
|
66
|
+
venv.bak/
|
|
67
|
+
|
|
68
|
+
# IDE
|
|
69
|
+
.vscode/
|
|
70
|
+
.idea/
|
|
71
|
+
*.swp
|
|
72
|
+
*.swo
|
|
73
|
+
*~
|
|
74
|
+
|
|
75
|
+
# macOS
|
|
76
|
+
.DS_Store
|
|
77
|
+
.AppleDouble
|
|
78
|
+
.LSOverride
|
|
79
|
+
|
|
80
|
+
# Thumbnails
|
|
81
|
+
._*
|
|
82
|
+
|
|
83
|
+
# Project specific
|
|
84
|
+
*.html
|
|
85
|
+
!aseview/templates/*.html
|
|
86
|
+
!docs/*.html
|
|
87
|
+
*.xyz
|
|
88
|
+
*.cif
|
|
89
|
+
*.json
|
|
90
|
+
!pyproject.toml
|
aseview-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mingi Kang
|
|
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.
|
aseview-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aseview
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A molecular viewer for ASE (Atomic Simulation Environment) data
|
|
5
|
+
Author-email: Mingi Kang <kangmg@kentech.ac.kr>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 Mingi Kang
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/kangmg/aseview
|
|
29
|
+
Project-URL: Repository, https://github.com/kangmg/aseview
|
|
30
|
+
Project-URL: Documentation, https://kangmg.github.io/aseview
|
|
31
|
+
Project-URL: Bug Tracker, https://github.com/kangmg/aseview/issues
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Science/Research
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Requires-Python: >=3.9
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
License-File: LICENSE
|
|
43
|
+
Requires-Dist: numpy
|
|
44
|
+
Requires-Dist: ase
|
|
45
|
+
Requires-Dist: ipywidgets
|
|
46
|
+
Requires-Dist: jupyter
|
|
47
|
+
Requires-Dist: typer>=0.9.0
|
|
48
|
+
Requires-Dist: rich>=13.0.0
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: pytest; extra == "dev"
|
|
51
|
+
Requires-Dist: black; extra == "dev"
|
|
52
|
+
Requires-Dist: flake8; extra == "dev"
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
|
|
55
|
+
# aseview
|
|
56
|
+
|
|
57
|
+
Molecular structure viewer for ASE (Atomic Simulation Environment).
|
|
58
|
+
|
|
59
|
+
**Status: pre-alpha**
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install aseview
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For development:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
git clone https://github.com/kangmg/aseview.git
|
|
71
|
+
cd aseview
|
|
72
|
+
pip install -e .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## CLI Usage
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Basic usage
|
|
79
|
+
aseview molecule.xyz
|
|
80
|
+
|
|
81
|
+
# View trajectory (all frames)
|
|
82
|
+
aseview trajectory.xyz -i :
|
|
83
|
+
|
|
84
|
+
# View specific frames
|
|
85
|
+
aseview trajectory.xyz -i 0:10 # frames 0-9
|
|
86
|
+
aseview trajectory.xyz -i -1 # last frame
|
|
87
|
+
aseview trajectory.xyz -i ::2 # every 2nd frame
|
|
88
|
+
|
|
89
|
+
# Specify file format
|
|
90
|
+
aseview POSCAR -f vasp
|
|
91
|
+
|
|
92
|
+
# Custom port
|
|
93
|
+
aseview molecule.xyz -p 9000
|
|
94
|
+
|
|
95
|
+
# Overlay multiple structures
|
|
96
|
+
aseview reactant.xyz product.xyz
|
|
97
|
+
|
|
98
|
+
# Overlay with colormap
|
|
99
|
+
aseview trajectory.xyz -v overlay --cmap viridis
|
|
100
|
+
|
|
101
|
+
# Normal mode visualization with ORCA Hessian
|
|
102
|
+
aseview molecule.xyz --hess orca.hess
|
|
103
|
+
|
|
104
|
+
# Save as HTML file
|
|
105
|
+
aseview molecule.xyz -o output.html
|
|
106
|
+
|
|
107
|
+
# Kill existing server on port
|
|
108
|
+
aseview molecule.xyz -k
|
|
109
|
+
|
|
110
|
+
# Help
|
|
111
|
+
aseview -h
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## SSH Port Forwarding
|
|
115
|
+
|
|
116
|
+
When running on a remote server (e.g., HPC cluster, Docker container):
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# 1. On remote server
|
|
120
|
+
aseview molecule.xyz -p 8080
|
|
121
|
+
|
|
122
|
+
# 2. On local machine (separate terminal)
|
|
123
|
+
ssh -L 8080:localhost:8080 user@remote-server
|
|
124
|
+
|
|
125
|
+
# 3. Open in local browser
|
|
126
|
+
# http://localhost:8080
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
For Docker with custom SSH port:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Connect with port forwarding
|
|
133
|
+
ssh user@localhost -p 10011 -L 8080:localhost:8080
|
|
134
|
+
|
|
135
|
+
# Then run aseview inside container
|
|
136
|
+
aseview molecule.xyz -p 8080
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Jupyter Notebook
|
|
140
|
+
|
|
141
|
+
### Quick Start
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from ase.io import read
|
|
145
|
+
from aseview import MolecularViewer
|
|
146
|
+
|
|
147
|
+
atoms = read('molecule.xyz')
|
|
148
|
+
viewer = MolecularViewer(atoms)
|
|
149
|
+
viewer.show()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### With Trajectory
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from ase.io import read
|
|
156
|
+
from aseview import MolecularViewer
|
|
157
|
+
|
|
158
|
+
# Read all frames
|
|
159
|
+
trajectory = read('trajectory.xyz', index=':')
|
|
160
|
+
viewer = MolecularViewer(trajectory)
|
|
161
|
+
viewer.show()
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Overlay Multiple Structures
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
from ase.io import read
|
|
168
|
+
from aseview import OverlayViewer
|
|
169
|
+
|
|
170
|
+
reactant = read('reactant.xyz')
|
|
171
|
+
product = read('product.xyz')
|
|
172
|
+
viewer = OverlayViewer([reactant, product])
|
|
173
|
+
viewer.show()
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Overlay with Colormap
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
from ase.io import read
|
|
180
|
+
from aseview import OverlayViewer
|
|
181
|
+
|
|
182
|
+
trajectory = read('optimization.xyz', index=':')
|
|
183
|
+
viewer = OverlayViewer(
|
|
184
|
+
trajectory,
|
|
185
|
+
colorBy='Colormap',
|
|
186
|
+
colormap='viridis' # viridis, plasma, coolwarm, jet, rainbow, grayscale
|
|
187
|
+
)
|
|
188
|
+
viewer.show()
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Align Molecules (RMSD Minimization)
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
from ase.io import read
|
|
195
|
+
from aseview import OverlayViewer
|
|
196
|
+
|
|
197
|
+
structures = [read(f'conf{i}.xyz') for i in range(5)]
|
|
198
|
+
viewer = OverlayViewer(
|
|
199
|
+
structures,
|
|
200
|
+
alignMolecules=True, # Kabsch rotation + Hungarian reordering
|
|
201
|
+
colorBy='Molecule'
|
|
202
|
+
)
|
|
203
|
+
viewer.show()
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Normal Mode Visualization
|
|
207
|
+
|
|
208
|
+
#### From ASE Vibrations
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
from ase import Atoms
|
|
212
|
+
from ase.calculators.emt import EMT
|
|
213
|
+
from ase.optimize import BFGS
|
|
214
|
+
from ase.vibrations import Vibrations
|
|
215
|
+
from aseview import NormalViewer
|
|
216
|
+
|
|
217
|
+
# Create or load molecule
|
|
218
|
+
atoms = Atoms('H2O', positions=[[0, 0, 0], [0.96, 0, 0], [-0.24, 0.93, 0]])
|
|
219
|
+
atoms.calc = EMT()
|
|
220
|
+
|
|
221
|
+
# Optimize structure
|
|
222
|
+
opt = BFGS(atoms)
|
|
223
|
+
opt.run(fmax=0.01)
|
|
224
|
+
|
|
225
|
+
# Calculate vibrations
|
|
226
|
+
vib = Vibrations(atoms, name='vib')
|
|
227
|
+
vib.run()
|
|
228
|
+
vib.summary()
|
|
229
|
+
|
|
230
|
+
# Visualize normal modes
|
|
231
|
+
viewer = NormalViewer(atoms, vibrations=vib)
|
|
232
|
+
viewer.show()
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### From ORCA Hessian File
|
|
236
|
+
|
|
237
|
+
```python
|
|
238
|
+
from ase.io import read
|
|
239
|
+
from aseview import NormalViewer
|
|
240
|
+
|
|
241
|
+
atoms = read('molecule.xyz')
|
|
242
|
+
viewer = NormalViewer.from_orca(atoms, 'orca.hess')
|
|
243
|
+
viewer.show()
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Features:
|
|
247
|
+
- Mode selector dropdown with frequencies
|
|
248
|
+
- Sinusoidal animation of atomic displacements
|
|
249
|
+
- Amplitude slider to control displacement magnitude
|
|
250
|
+
- Show Vectors toggle to display mode displacement arrows
|
|
251
|
+
- Imaginary frequencies (transition states) shown in red
|
|
252
|
+
|
|
253
|
+
### Using view_molecule Helper
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
from aseview.jupyter import view_molecule
|
|
257
|
+
from ase.io import read
|
|
258
|
+
|
|
259
|
+
atoms = read('molecule.xyz')
|
|
260
|
+
view_molecule(atoms, viewer_type='molecular', height=600)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Custom Settings
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
from aseview import MolecularViewer
|
|
267
|
+
|
|
268
|
+
viewer = MolecularViewer(
|
|
269
|
+
atoms,
|
|
270
|
+
style='neon', # default, cartoon, neon, glossy, metallic, rowan, grey
|
|
271
|
+
bondThreshold=1.2, # bond detection scale factor
|
|
272
|
+
atomSize=0.5,
|
|
273
|
+
showCell=False,
|
|
274
|
+
backgroundColor='#000000'
|
|
275
|
+
)
|
|
276
|
+
viewer.show(width='100%', height=800)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Save to HTML
|
|
280
|
+
|
|
281
|
+
```python
|
|
282
|
+
viewer.save_html('output.html')
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Viewer Types
|
|
286
|
+
|
|
287
|
+
| Viewer | Description |
|
|
288
|
+
|--------|-------------|
|
|
289
|
+
| MolecularViewer | Single structure or trajectory animation |
|
|
290
|
+
| NormalViewer | Normal mode vibration visualization |
|
|
291
|
+
| OverlayViewer | Compare multiple structures overlaid |
|
|
292
|
+
|
|
293
|
+
## JavaScript Module
|
|
294
|
+
|
|
295
|
+
Use aseview in any web page without Python:
|
|
296
|
+
|
|
297
|
+
```html
|
|
298
|
+
<div id="viewer" style="width:100%; height:500px;"></div>
|
|
299
|
+
|
|
300
|
+
<script src="https://raw.githack.com/kangmg/aseview_v2_dev/main/aseview/static/js/aseview.js"></script>
|
|
301
|
+
<script>
|
|
302
|
+
const viewer = new ASEView.MolecularViewer('#viewer');
|
|
303
|
+
viewer.setData({
|
|
304
|
+
symbols: ['O', 'H', 'H'],
|
|
305
|
+
positions: [
|
|
306
|
+
[0.0, 0.0, 0.117],
|
|
307
|
+
[0.0, 0.757, -0.469],
|
|
308
|
+
[0.0, -0.757, -0.469]
|
|
309
|
+
]
|
|
310
|
+
});
|
|
311
|
+
</script>
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
See the [JavaScript Module documentation](https://kangmg.github.io/aseview_v2_dev/js-module/) for full API reference.
|
|
315
|
+
|
|
316
|
+
## Supported Formats
|
|
317
|
+
|
|
318
|
+
All formats supported by ASE: xyz, cif, pdb, POSCAR, extxyz, etc.
|
|
319
|
+
|
|
320
|
+
## License
|
|
321
|
+
|
|
322
|
+
MIT
|