Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SE(3)-Equivariant Hybrid Graph Autoencoder for Crystal Structures
|
| 2 |
+
|
| 3 |
+
This repository contains an implementation of a Hybrid Graph Autoencoder for Crystal Structures with SE(3)-Equivariance, improved lattice prediction, and enforced translational invariance.
|
| 4 |
+
|
| 5 |
+
## Model Features
|
| 6 |
+
|
| 7 |
+
- SE(3)-equivariant layers in both encoder and decoder (EGNN-style)
|
| 8 |
+
- Translation invariance through center subtraction in encoder
|
| 9 |
+
- Improved lattice prediction without sigmoid activation
|
| 10 |
+
- Supports visualization with t-SNE plots
|
| 11 |
+
- Handles crystal structures with up to 20 sites
|
| 12 |
+
- Supports 56 different chemical species
|
| 13 |
+
|
| 14 |
+
## Installation
|
| 15 |
+
|
| 16 |
+
```bash
|
| 17 |
+
pip install -r requirements.txt
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Usage
|
| 21 |
+
|
| 22 |
+
### Loading the Pre-trained Model
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
import torch
|
| 26 |
+
from h2_e3_n4 import GraphAutoencoderHybridSE3
|
| 27 |
+
|
| 28 |
+
# Initialize the model
|
| 29 |
+
model = GraphAutoencoderHybridSE3(
|
| 30 |
+
max_sites=20,
|
| 31 |
+
num_species=56,
|
| 32 |
+
latent_dim=128,
|
| 33 |
+
node_hidden_dim=128,
|
| 34 |
+
species_embedding_dim=64
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
# Load pre-trained weights
|
| 38 |
+
model.load_state_dict(torch.load('hybrid_graph_autoencoder_se3.pt'))
|
| 39 |
+
model.eval()
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
### Reconstructing Structures
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
from h2_e3_n4 import reconstruct_and_write
|
| 46 |
+
|
| 47 |
+
# Reconstruct a structure from a CIF file
|
| 48 |
+
reconstruct_and_write(model, "input.cif", "reconstructed.cif")
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
### Crystal Interpolation
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from h2_e3_n4 import interpolate_crystals
|
| 55 |
+
|
| 56 |
+
# Interpolate between two crystal structures
|
| 57 |
+
interpolated = interpolate_crystals(model, "crystal1.cif", "crystal2.cif", alpha=0.5)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Model Architecture
|
| 61 |
+
|
| 62 |
+
The model consists of:
|
| 63 |
+
1. An SE(3)-equivariant encoder that processes atomic coordinates and species
|
| 64 |
+
2. A latent space representation
|
| 65 |
+
3. An SE(3)-equivariant decoder that reconstructs the crystal structure
|
| 66 |
+
|
| 67 |
+
## Citation
|
| 68 |
+
|
| 69 |
+
If you use this code in your research, please cite:
|
| 70 |
+
|
| 71 |
+
```bibtex
|
| 72 |
+
@article{your-paper,
|
| 73 |
+
title={SE(3)-Equivariant Hybrid Graph Autoencoder for Crystal Structures},
|
| 74 |
+
author={[Your Name]},
|
| 75 |
+
year={2025}
|
| 76 |
+
}
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## License
|
| 80 |
+
|
| 81 |
+
MIT License
|