meown 1.0.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.
Potentially problematic release.
This version of meown might be problematic. Click here for more details.
- meown-1.0.0/MANIFEST.in +2 -0
- meown-1.0.0/PKG-INFO +347 -0
- meown-1.0.0/README.md +309 -0
- meown-1.0.0/gui/__init__.py +0 -0
- meown-1.0.0/gui/main_window.py +849 -0
- meown-1.0.0/gui/visualizer.py +616 -0
- meown-1.0.0/meown.egg-info/PKG-INFO +347 -0
- meown-1.0.0/meown.egg-info/SOURCES.txt +26 -0
- meown-1.0.0/meown.egg-info/dependency_links.txt +1 -0
- meown-1.0.0/meown.egg-info/entry_points.txt +2 -0
- meown-1.0.0/meown.egg-info/requires.txt +15 -0
- meown-1.0.0/meown.egg-info/top_level.txt +2 -0
- meown-1.0.0/meown_logo.ico +0 -0
- meown-1.0.0/pyproject.toml +59 -0
- meown-1.0.0/setup.cfg +4 -0
- meown-1.0.0/src/__init__.py +0 -0
- meown-1.0.0/src/api.py +303 -0
- meown-1.0.0/src/config.py +289 -0
- meown-1.0.0/src/exporter.py +321 -0
- meown-1.0.0/src/implantation.py +385 -0
- meown-1.0.0/src/loader.py +308 -0
- meown-1.0.0/src/optimization.py +103 -0
- meown-1.0.0/src/physics.py +1199 -0
- meown-1.0.0/src/py.typed +0 -0
- meown-1.0.0/src/qe_potential.py +75 -0
- meown-1.0.0/src/symmetry.py +184 -0
- meown-1.0.0/src/validation.py +362 -0
- meown-1.0.0/src/validator.py +133 -0
meown-1.0.0/MANIFEST.in
ADDED
meown-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: meown
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Muon Site Prediction Engine — P-UEP framework with physics-informed inference
|
|
5
|
+
Author: QM Labs
|
|
6
|
+
Author-email: Sayan Ghosh <sayangeophysics@gmail.com>
|
|
7
|
+
License: Proprietary. All rights reserved.
|
|
8
|
+
Project-URL: Homepage, https://github.com/your-org/meown
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/your-org/meown/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
14
|
+
Classifier: License :: Other/Proprietary License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
21
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
22
|
+
Classifier: Operating System :: MacOS
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: numpy>=1.21
|
|
26
|
+
Requires-Dist: scipy>=1.7
|
|
27
|
+
Requires-Dist: torch>=2.0
|
|
28
|
+
Requires-Dist: pymatgen>=2023.1
|
|
29
|
+
Requires-Dist: spglib>=2.0
|
|
30
|
+
Provides-Extra: gui
|
|
31
|
+
Requires-Dist: PyQt6>=6.4; extra == "gui"
|
|
32
|
+
Requires-Dist: pyqtgraph>=0.13; extra == "gui"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
35
|
+
Requires-Dist: black; extra == "dev"
|
|
36
|
+
Requires-Dist: mypy; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff; extra == "dev"
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<img src="meown_logo.ico" alt="Meown Logo" width="128">
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
# Meown — Muon Site Prediction Engine
|
|
44
|
+
|
|
45
|
+
[](https://www.python.org/)
|
|
46
|
+
[](https://pytorch.org/)
|
|
47
|
+
[]()
|
|
48
|
+
[]()
|
|
49
|
+
|
|
50
|
+
A research-grade **Muon Site Prediction Engine** using a Polarizable Unperturbed Electrostatic Potential (P-UEP) framework with physics-informed inference to identify high-probability muon stopping sites in crystal structures.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- **Physics Inference Engine** — high-speed potential energy surface (PES) exploration using P-UEP
|
|
57
|
+
- **Advanced Potentials** — Hartree, exchange-correlation, polarization, Morse corrections
|
|
58
|
+
- **Ultra-Precision Relaxation** — symmetry-aware optimization with basin-hopping + L-BFGS
|
|
59
|
+
- **Interactive GUI** — PyQt6 workspace with 3D crystal visualization and energy landscapes
|
|
60
|
+
- **Universal Confidence Metric** — physics-grounded scoring integrating energy, geometry, and dynamical stability
|
|
61
|
+
- **Batch Processing** — process multiple CIF files from the API
|
|
62
|
+
- **Export Formats** — CSV, JSON, PDF reports of predicted muon sites
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
### Prerequisites
|
|
69
|
+
|
|
70
|
+
- **Python 3.9–3.12** (Python 3.13+ is not yet supported by PyTorch)
|
|
71
|
+
- **pip** (latest — `python -m pip install --upgrade pip`)
|
|
72
|
+
- **Git** (optional — for cloning the repository)
|
|
73
|
+
- **CUDA-capable GPU** (optional — enables GPU-accelerated inference)
|
|
74
|
+
|
|
75
|
+
> **Windows users**: If you get build errors during installation, install [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and ensure the "Desktop development with C++" workload is selected.
|
|
76
|
+
|
|
77
|
+
### Step 1 — Create a virtual environment (recommended)
|
|
78
|
+
|
|
79
|
+
Isolate dependencies to avoid conflicts:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Windows (Command Prompt)
|
|
83
|
+
python -m venv venv
|
|
84
|
+
venv\Scripts\activate
|
|
85
|
+
|
|
86
|
+
# Windows (PowerShell)
|
|
87
|
+
python -m venv venv
|
|
88
|
+
.\venv\Scripts\Activate.ps1
|
|
89
|
+
|
|
90
|
+
# Linux / macOS
|
|
91
|
+
python3 -m venv venv
|
|
92
|
+
source venv/bin/activate
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Your shell prompt should now show `(venv)`.
|
|
96
|
+
|
|
97
|
+
### Step 2 — Clone the repository
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/your-org/meown.git
|
|
101
|
+
cd meown
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Or download and unzip the source manually, then `cd` into the `meown/` directory.
|
|
105
|
+
|
|
106
|
+
### Step 3 — Install PyTorch (choose your platform)
|
|
107
|
+
|
|
108
|
+
PyTorch is the core deep-learning backend. Install the correct version for your system:
|
|
109
|
+
|
|
110
|
+
**CPU-only (works on any system):**
|
|
111
|
+
```bash
|
|
112
|
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**CUDA 11.8 (NVIDIA GPU):**
|
|
116
|
+
```bash
|
|
117
|
+
pip install torch --index-url https://download.pytorch.org/whl/cu118
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**CUDA 12.1 (NVIDIA GPU, newer):**
|
|
121
|
+
```bash
|
|
122
|
+
pip install torch --index-url https://download.pytorch.org/whl/cu121
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
> If unsure, start with CPU. You can reinstall with CUDA later — no changes to Meown needed.
|
|
126
|
+
|
|
127
|
+
### Step 4 — Install Meown
|
|
128
|
+
|
|
129
|
+
#### Basic install (engine only, no GUI)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pip install -e .
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This installs the core dependencies: NumPy, SciPy, PyTorch, pymatgen, spglib.
|
|
136
|
+
|
|
137
|
+
#### With GUI support (recommended for desktop use)
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install -e ".[gui]"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Adds PyQt6 and pyqtgraph for the interactive 3D workspace.
|
|
144
|
+
|
|
145
|
+
#### With development tools
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pip install -e ".[dev]"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Adds pytest, black, mypy, and ruff for testing and linting.
|
|
152
|
+
|
|
153
|
+
#### Full install (everything)
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
pip install -e ".[gui,dev]"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Step 5 — Verify installation
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
python -c "from src.api import MuonSiteEngine; print('Meown ready')"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Expected output:
|
|
166
|
+
```
|
|
167
|
+
Meown ready
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Step 6 — Run a quick test
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
python -c "
|
|
174
|
+
from src.api import MuonSiteEngine
|
|
175
|
+
e = MuonSiteEngine()
|
|
176
|
+
e.load_structure('data/cifs/SrTiO3.cif')
|
|
177
|
+
sites = e.find_sites(n_sites=2, inference_steps=50)
|
|
178
|
+
for s in sites:
|
|
179
|
+
print(f' Site at {s.frac_coords}, energy={s.total_energy:.3f} eV')
|
|
180
|
+
print('OK')
|
|
181
|
+
"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This loads `SrTiO3.cif`, runs 50 inference steps, and prints the top 2 predicted muon sites.
|
|
185
|
+
|
|
186
|
+
### Troubleshooting
|
|
187
|
+
|
|
188
|
+
| Problem | Solution |
|
|
189
|
+
|---|---|
|
|
190
|
+
| `pip install` fails with MSVC error | Install [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) |
|
|
191
|
+
| `ImportError: No module named torch` | You skipped Step 3 — install PyTorch first, then Meown |
|
|
192
|
+
| `ImportError: No module named PyQt6` | Install the GUI extras: `pip install -e ".[gui]"` |
|
|
193
|
+
| `OSError: [WinError 126]` or DLL errors | Ensure no conflicting torch versions; try `pip install torch --force-reinstall` |
|
|
194
|
+
| Model loss shows `nan` | This is expected with very few steps. Increase `inference_steps` (≥200) for real usage. |
|
|
195
|
+
| GUI fails to open | Run from a desktop environment (not SSH). If it still fails, try `python gui/main_window.py --debug` |
|
|
196
|
+
| GPU not detected | Run `python -c "import torch; print(torch.cuda.is_available())"`. If `False`, reinstall PyTorch with the correct CUDA index URL. |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Quick Start
|
|
201
|
+
|
|
202
|
+
### GUI
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
python gui/main_window.py
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Load a CIF file from `data/cifs/`, run the engine, and explore predicted muon sites in 3D.
|
|
209
|
+
|
|
210
|
+
### Python API
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
from src.api import MuonSiteEngine
|
|
214
|
+
|
|
215
|
+
engine = MuonSiteEngine()
|
|
216
|
+
|
|
217
|
+
# Load a crystal structure
|
|
218
|
+
crystal = engine.load_structure("data/cifs/SrTiO3.cif")
|
|
219
|
+
print(f"Loaded {crystal.formula} ({crystal.space_group})")
|
|
220
|
+
|
|
221
|
+
# Find muon sites
|
|
222
|
+
sites = engine.find_sites(n_sites=5, inference_steps=300)
|
|
223
|
+
|
|
224
|
+
print(f"Found {len(sites)} candidate sites")
|
|
225
|
+
for site in sites:
|
|
226
|
+
print(f" Site at {site.frac_coords}: {site.total_energy:.3f} eV, "
|
|
227
|
+
f"confidence={site.confidence:.1f}")
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Batch processing
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
from src.api import MuonSiteEngine
|
|
234
|
+
from pathlib import Path
|
|
235
|
+
|
|
236
|
+
engine = MuonSiteEngine()
|
|
237
|
+
|
|
238
|
+
cif_dir = Path("data/cifs")
|
|
239
|
+
for cif_file in cif_dir.glob("*.cif"):
|
|
240
|
+
crystal = engine.load_structure(str(cif_file))
|
|
241
|
+
sites = engine.find_sites(n_sites=2, inference_steps=300)
|
|
242
|
+
print(f"{cif_file.name} ({crystal.formula}): {len(sites)} sites")
|
|
243
|
+
for site in sites:
|
|
244
|
+
print(f" {site.frac_coords} {site.total_energy:.3f} eV")
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## GUI
|
|
250
|
+
|
|
251
|
+
Launch the interactive workspace:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
python gui/main_window.py
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Features:
|
|
258
|
+
- **3D Crystal Viewer** — rotate, zoom, inspect atomic positions
|
|
259
|
+
- **Energy Landscape** — 2D slices and 3D surfaces of the P-UEP potential
|
|
260
|
+
- **Site Table** — ranked list of predicted muon sites with scores
|
|
261
|
+
- **Export Panel** — save results to CSV, JSON, or PDF
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Configuration
|
|
266
|
+
|
|
267
|
+
All physics parameters are in [`src/config.py`](src/config.py) as composable dataclasses:
|
|
268
|
+
|
|
269
|
+
```python
|
|
270
|
+
from src.config import MuonSiteConfig, OptimizationConfig
|
|
271
|
+
|
|
272
|
+
config = MuonSiteConfig(
|
|
273
|
+
optimization=OptimizationConfig(
|
|
274
|
+
n_random_starts=100,
|
|
275
|
+
n_basin_hops=50,
|
|
276
|
+
)
|
|
277
|
+
)
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
| Config Class | Purpose |
|
|
281
|
+
|---|---|
|
|
282
|
+
| `MuonSiteConfig` | Master config combining all sub-configs |
|
|
283
|
+
| `CorrelationConfig` | Correlation barrier strength and decay |
|
|
284
|
+
| `ElectrostaticsConfig` | Electrostatic field smoothing and screening |
|
|
285
|
+
| `OptimizationConfig` | Random starts, basin-hopping, L-BFGS tolerance |
|
|
286
|
+
| `ValidationConfig` | Minimum distance, energy thresholds |
|
|
287
|
+
| `QuantumConfig` | Zero-point energy (ZPE) and Hessian settings |
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Project Structure
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
meown/
|
|
295
|
+
├── src/ # Core physics engine
|
|
296
|
+
│ ├── api.py # Public API — MuonSiteEngine
|
|
297
|
+
│ ├── config.py # Physics parameters & configuration
|
|
298
|
+
│ ├── physics.py # P-UEP engine
|
|
299
|
+
│ ├── optimization.py # Symmetry-aware site optimization
|
|
300
|
+
│ ├── implantation.py # Muon implantation physics
|
|
301
|
+
│ ├── symmetry.py # Crystal symmetry utilities
|
|
302
|
+
│ ├── loader.py # CIF file loading
|
|
303
|
+
│ ├── exporter.py # CSV/JSON/PDF export
|
|
304
|
+
│ ├── validation.py # Result validation
|
|
305
|
+
│ ├── validator.py # Site validator
|
|
306
|
+
│ └── qe_potential.py # Quantum Espresso integration
|
|
307
|
+
│
|
|
308
|
+
├── gui/ # Graphical user interface (PyQt6)
|
|
309
|
+
│ ├── main_window.py # Main application window
|
|
310
|
+
│ └── visualizer.py # 3D crystal & energy landscape visualization
|
|
311
|
+
│
|
|
312
|
+
├── meown_logo.ico # Application icon (used by GUI)
|
|
313
|
+
├── data/ # Sample crystal structures (CIF)
|
|
314
|
+
│ └── cifs/ # CIF collection (SrTiO3, MnSi, Cu, etc.)
|
|
315
|
+
│
|
|
316
|
+
├── tests/ # Test suite
|
|
317
|
+
│
|
|
318
|
+
├── pyproject.toml # Modern Python packaging (PEP 621)
|
|
319
|
+
├── requirements.txt # Python dependencies
|
|
320
|
+
├── meown_logo.ico # Application icon
|
|
321
|
+
├── README.md
|
|
322
|
+
└── CONTRIBUTING.md
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Input Data Format
|
|
328
|
+
|
|
329
|
+
Crystal structures should be provided in **CIF** format. Sample CIFs are in `data/cifs/`.
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Output
|
|
334
|
+
|
|
335
|
+
| Format | Description |
|
|
336
|
+
|---|---|
|
|
337
|
+
| CSV | Ranked list of muon sites with coordinates and energies |
|
|
338
|
+
| JSONL | Per-site physics breakdown |
|
|
339
|
+
| PDF | Full report with visualizations (GUI only) |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
## License
|
|
346
|
+
|
|
347
|
+
Proprietary — Copyright (c) 2026 QM Labs. All rights reserved.
|
meown-1.0.0/README.md
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="meown_logo.ico" alt="Meown Logo" width="128">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Meown — Muon Site Prediction Engine
|
|
6
|
+
|
|
7
|
+
[](https://www.python.org/)
|
|
8
|
+
[](https://pytorch.org/)
|
|
9
|
+
[]()
|
|
10
|
+
[]()
|
|
11
|
+
|
|
12
|
+
A research-grade **Muon Site Prediction Engine** using a Polarizable Unperturbed Electrostatic Potential (P-UEP) framework with physics-informed inference to identify high-probability muon stopping sites in crystal structures.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Physics Inference Engine** — high-speed potential energy surface (PES) exploration using P-UEP
|
|
19
|
+
- **Advanced Potentials** — Hartree, exchange-correlation, polarization, Morse corrections
|
|
20
|
+
- **Ultra-Precision Relaxation** — symmetry-aware optimization with basin-hopping + L-BFGS
|
|
21
|
+
- **Interactive GUI** — PyQt6 workspace with 3D crystal visualization and energy landscapes
|
|
22
|
+
- **Universal Confidence Metric** — physics-grounded scoring integrating energy, geometry, and dynamical stability
|
|
23
|
+
- **Batch Processing** — process multiple CIF files from the API
|
|
24
|
+
- **Export Formats** — CSV, JSON, PDF reports of predicted muon sites
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
### Prerequisites
|
|
31
|
+
|
|
32
|
+
- **Python 3.9–3.12** (Python 3.13+ is not yet supported by PyTorch)
|
|
33
|
+
- **pip** (latest — `python -m pip install --upgrade pip`)
|
|
34
|
+
- **Git** (optional — for cloning the repository)
|
|
35
|
+
- **CUDA-capable GPU** (optional — enables GPU-accelerated inference)
|
|
36
|
+
|
|
37
|
+
> **Windows users**: If you get build errors during installation, install [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and ensure the "Desktop development with C++" workload is selected.
|
|
38
|
+
|
|
39
|
+
### Step 1 — Create a virtual environment (recommended)
|
|
40
|
+
|
|
41
|
+
Isolate dependencies to avoid conflicts:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Windows (Command Prompt)
|
|
45
|
+
python -m venv venv
|
|
46
|
+
venv\Scripts\activate
|
|
47
|
+
|
|
48
|
+
# Windows (PowerShell)
|
|
49
|
+
python -m venv venv
|
|
50
|
+
.\venv\Scripts\Activate.ps1
|
|
51
|
+
|
|
52
|
+
# Linux / macOS
|
|
53
|
+
python3 -m venv venv
|
|
54
|
+
source venv/bin/activate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Your shell prompt should now show `(venv)`.
|
|
58
|
+
|
|
59
|
+
### Step 2 — Clone the repository
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/your-org/meown.git
|
|
63
|
+
cd meown
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or download and unzip the source manually, then `cd` into the `meown/` directory.
|
|
67
|
+
|
|
68
|
+
### Step 3 — Install PyTorch (choose your platform)
|
|
69
|
+
|
|
70
|
+
PyTorch is the core deep-learning backend. Install the correct version for your system:
|
|
71
|
+
|
|
72
|
+
**CPU-only (works on any system):**
|
|
73
|
+
```bash
|
|
74
|
+
pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**CUDA 11.8 (NVIDIA GPU):**
|
|
78
|
+
```bash
|
|
79
|
+
pip install torch --index-url https://download.pytorch.org/whl/cu118
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**CUDA 12.1 (NVIDIA GPU, newer):**
|
|
83
|
+
```bash
|
|
84
|
+
pip install torch --index-url https://download.pytorch.org/whl/cu121
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
> If unsure, start with CPU. You can reinstall with CUDA later — no changes to Meown needed.
|
|
88
|
+
|
|
89
|
+
### Step 4 — Install Meown
|
|
90
|
+
|
|
91
|
+
#### Basic install (engine only, no GUI)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install -e .
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This installs the core dependencies: NumPy, SciPy, PyTorch, pymatgen, spglib.
|
|
98
|
+
|
|
99
|
+
#### With GUI support (recommended for desktop use)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install -e ".[gui]"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Adds PyQt6 and pyqtgraph for the interactive 3D workspace.
|
|
106
|
+
|
|
107
|
+
#### With development tools
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pip install -e ".[dev]"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Adds pytest, black, mypy, and ruff for testing and linting.
|
|
114
|
+
|
|
115
|
+
#### Full install (everything)
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pip install -e ".[gui,dev]"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Step 5 — Verify installation
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python -c "from src.api import MuonSiteEngine; print('Meown ready')"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Expected output:
|
|
128
|
+
```
|
|
129
|
+
Meown ready
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Step 6 — Run a quick test
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
python -c "
|
|
136
|
+
from src.api import MuonSiteEngine
|
|
137
|
+
e = MuonSiteEngine()
|
|
138
|
+
e.load_structure('data/cifs/SrTiO3.cif')
|
|
139
|
+
sites = e.find_sites(n_sites=2, inference_steps=50)
|
|
140
|
+
for s in sites:
|
|
141
|
+
print(f' Site at {s.frac_coords}, energy={s.total_energy:.3f} eV')
|
|
142
|
+
print('OK')
|
|
143
|
+
"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
This loads `SrTiO3.cif`, runs 50 inference steps, and prints the top 2 predicted muon sites.
|
|
147
|
+
|
|
148
|
+
### Troubleshooting
|
|
149
|
+
|
|
150
|
+
| Problem | Solution |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `pip install` fails with MSVC error | Install [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) |
|
|
153
|
+
| `ImportError: No module named torch` | You skipped Step 3 — install PyTorch first, then Meown |
|
|
154
|
+
| `ImportError: No module named PyQt6` | Install the GUI extras: `pip install -e ".[gui]"` |
|
|
155
|
+
| `OSError: [WinError 126]` or DLL errors | Ensure no conflicting torch versions; try `pip install torch --force-reinstall` |
|
|
156
|
+
| Model loss shows `nan` | This is expected with very few steps. Increase `inference_steps` (≥200) for real usage. |
|
|
157
|
+
| GUI fails to open | Run from a desktop environment (not SSH). If it still fails, try `python gui/main_window.py --debug` |
|
|
158
|
+
| GPU not detected | Run `python -c "import torch; print(torch.cuda.is_available())"`. If `False`, reinstall PyTorch with the correct CUDA index URL. |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Quick Start
|
|
163
|
+
|
|
164
|
+
### GUI
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
python gui/main_window.py
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Load a CIF file from `data/cifs/`, run the engine, and explore predicted muon sites in 3D.
|
|
171
|
+
|
|
172
|
+
### Python API
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from src.api import MuonSiteEngine
|
|
176
|
+
|
|
177
|
+
engine = MuonSiteEngine()
|
|
178
|
+
|
|
179
|
+
# Load a crystal structure
|
|
180
|
+
crystal = engine.load_structure("data/cifs/SrTiO3.cif")
|
|
181
|
+
print(f"Loaded {crystal.formula} ({crystal.space_group})")
|
|
182
|
+
|
|
183
|
+
# Find muon sites
|
|
184
|
+
sites = engine.find_sites(n_sites=5, inference_steps=300)
|
|
185
|
+
|
|
186
|
+
print(f"Found {len(sites)} candidate sites")
|
|
187
|
+
for site in sites:
|
|
188
|
+
print(f" Site at {site.frac_coords}: {site.total_energy:.3f} eV, "
|
|
189
|
+
f"confidence={site.confidence:.1f}")
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Batch processing
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from src.api import MuonSiteEngine
|
|
196
|
+
from pathlib import Path
|
|
197
|
+
|
|
198
|
+
engine = MuonSiteEngine()
|
|
199
|
+
|
|
200
|
+
cif_dir = Path("data/cifs")
|
|
201
|
+
for cif_file in cif_dir.glob("*.cif"):
|
|
202
|
+
crystal = engine.load_structure(str(cif_file))
|
|
203
|
+
sites = engine.find_sites(n_sites=2, inference_steps=300)
|
|
204
|
+
print(f"{cif_file.name} ({crystal.formula}): {len(sites)} sites")
|
|
205
|
+
for site in sites:
|
|
206
|
+
print(f" {site.frac_coords} {site.total_energy:.3f} eV")
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## GUI
|
|
212
|
+
|
|
213
|
+
Launch the interactive workspace:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
python gui/main_window.py
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Features:
|
|
220
|
+
- **3D Crystal Viewer** — rotate, zoom, inspect atomic positions
|
|
221
|
+
- **Energy Landscape** — 2D slices and 3D surfaces of the P-UEP potential
|
|
222
|
+
- **Site Table** — ranked list of predicted muon sites with scores
|
|
223
|
+
- **Export Panel** — save results to CSV, JSON, or PDF
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Configuration
|
|
228
|
+
|
|
229
|
+
All physics parameters are in [`src/config.py`](src/config.py) as composable dataclasses:
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
from src.config import MuonSiteConfig, OptimizationConfig
|
|
233
|
+
|
|
234
|
+
config = MuonSiteConfig(
|
|
235
|
+
optimization=OptimizationConfig(
|
|
236
|
+
n_random_starts=100,
|
|
237
|
+
n_basin_hops=50,
|
|
238
|
+
)
|
|
239
|
+
)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
| Config Class | Purpose |
|
|
243
|
+
|---|---|
|
|
244
|
+
| `MuonSiteConfig` | Master config combining all sub-configs |
|
|
245
|
+
| `CorrelationConfig` | Correlation barrier strength and decay |
|
|
246
|
+
| `ElectrostaticsConfig` | Electrostatic field smoothing and screening |
|
|
247
|
+
| `OptimizationConfig` | Random starts, basin-hopping, L-BFGS tolerance |
|
|
248
|
+
| `ValidationConfig` | Minimum distance, energy thresholds |
|
|
249
|
+
| `QuantumConfig` | Zero-point energy (ZPE) and Hessian settings |
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Project Structure
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
meown/
|
|
257
|
+
├── src/ # Core physics engine
|
|
258
|
+
│ ├── api.py # Public API — MuonSiteEngine
|
|
259
|
+
│ ├── config.py # Physics parameters & configuration
|
|
260
|
+
│ ├── physics.py # P-UEP engine
|
|
261
|
+
│ ├── optimization.py # Symmetry-aware site optimization
|
|
262
|
+
│ ├── implantation.py # Muon implantation physics
|
|
263
|
+
│ ├── symmetry.py # Crystal symmetry utilities
|
|
264
|
+
│ ├── loader.py # CIF file loading
|
|
265
|
+
│ ├── exporter.py # CSV/JSON/PDF export
|
|
266
|
+
│ ├── validation.py # Result validation
|
|
267
|
+
│ ├── validator.py # Site validator
|
|
268
|
+
│ └── qe_potential.py # Quantum Espresso integration
|
|
269
|
+
│
|
|
270
|
+
├── gui/ # Graphical user interface (PyQt6)
|
|
271
|
+
│ ├── main_window.py # Main application window
|
|
272
|
+
│ └── visualizer.py # 3D crystal & energy landscape visualization
|
|
273
|
+
│
|
|
274
|
+
├── meown_logo.ico # Application icon (used by GUI)
|
|
275
|
+
├── data/ # Sample crystal structures (CIF)
|
|
276
|
+
│ └── cifs/ # CIF collection (SrTiO3, MnSi, Cu, etc.)
|
|
277
|
+
│
|
|
278
|
+
├── tests/ # Test suite
|
|
279
|
+
│
|
|
280
|
+
├── pyproject.toml # Modern Python packaging (PEP 621)
|
|
281
|
+
├── requirements.txt # Python dependencies
|
|
282
|
+
├── meown_logo.ico # Application icon
|
|
283
|
+
├── README.md
|
|
284
|
+
└── CONTRIBUTING.md
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Input Data Format
|
|
290
|
+
|
|
291
|
+
Crystal structures should be provided in **CIF** format. Sample CIFs are in `data/cifs/`.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Output
|
|
296
|
+
|
|
297
|
+
| Format | Description |
|
|
298
|
+
|---|---|
|
|
299
|
+
| CSV | Ranked list of muon sites with coordinates and energies |
|
|
300
|
+
| JSONL | Per-site physics breakdown |
|
|
301
|
+
| PDF | Full report with visualizations (GUI only) |
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
Proprietary — Copyright (c) 2026 QM Labs. All rights reserved.
|
|
File without changes
|