Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Implementation of 2D crystal former #7

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
job*
*.out
__pycache__/
./mp_20/*.csv
375 changes: 375 additions & 0 deletions .ipynb_checkpoints/try-checkpoint.ipynb

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove.

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
default: test

.PHONY: test test-% train sample

TESTS = $(shell find ./tests -name "test_*.py")

test-%:
python ./tests/test_$*.py

test:
@for TEST in $(TESTS); do \
echo "run $$TEST"; \
python $$TEST; \
done

train:
python ./main.py --folder ./data/ --train_path ./mp_20/train_layer_test.csv --valid_path ./mp_20/val_layer_test.csv --epochs 200

sample:
python ./main.py --optimizer none --test_path ./mp_20/test_layer_test.csv --restore_path ./data/adam_bs_100_lr_0.0001_decay_0_clip_1_A_119_W_28_N_21_a_1_w_1_l_1_Nf_5_Kx_16_Kl_4_h0_256_l_16_H_16_k_64_m_64_e_32_drop_0.5/epoch_000100.pkl --spacegroup 65 --num_samples 10 --batchsize 200 --temperature 1.0 --elements C
Binary file added c2db/.DS_Store

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove.

Binary file not shown.
Binary file added c2db/A/.DS_Store
Binary file not shown.
Binary file added c2db/A/2C/.DS_Store
Binary file not shown.
44 changes: 44 additions & 0 deletions c2db/A/2C/1/data.json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this dataset is for testing, maybe move it to the test folder?

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"folder": "/home/niflheim2/cmr/C2DB-ASR/tree/A/C/C2-a6735a4a3797",
"uid": "2C-1",
"olduid": "C2-a6735a4a3797",
"international": "P6/mmm",
"number": 191,
"pointgroup": "6/mmm",
"has_inversion_symmetry": true,
"lgnum": 80,
"layergroup": "p6/mmm",
"bravais_type": "Hexagonal (hp)",
"thickness": 3.224913225352566e-08,
"label": "original03-18",
"gap": 0.0003000685114302737,
"gap_dir": 0.0003000685114309398,
"gap_dir_nosoc": 0.000308946496943463,
"evac": 2.3363375983102452,
"efermi": -4.248481577688634,
"vbm": -4.248631611944349,
"cbm": -4.2483315434329185,
"minhessianeig": -7.00605419619458e-12,
"dyn_stab": "Yes",
"gap_hse": 0.0002564957267392476,
"gap_dir_hse": 0.0002564957267392476,
"efermi_hse": -4.213085568171573,
"vbm_hse": -4.213213816034942,
"cbm_hse": -4.212957320308203,
"alphax_el": 6.574592003348396,
"alphay_el": 6.574592003348392,
"alphaz_el": 0.1533681498711251,
"plasmafrequency_x": 0.0,
"plasmafrequency_y": 0.0,
"energy": -18.453766945888727,
"icsd_id": 96620,
"cod_id": 9012705,
"doi": "10.1126/science.1102896",
"is_magnetic": false,
"spin_axis": "z",
"dE_zx": 0.0,
"dE_zy": 0.0,
"topology": "Z2=1,C_M=1",
"ehull": 0.0,
"hform": -0.007391614814171277
}
4 changes: 4 additions & 0 deletions c2db/A/2C/1/magmoms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"folder": "/home/niflheim2/cmr/C2DB-ASR/tree/A/C/C2-a6735a4a3797",
"uid": "2C-1"
}
7 changes: 7 additions & 0 deletions c2db/A/2C/1/read.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import re

def lattice_from_file(file_path):
f = open(file_path, "r")
lines = f.readlines()
lattice_str = re.search(r'Lattice="([^"]+)"', lines[1]).group(1)
lattice_list = [eval(v) for v in lattice_str]
108 changes: 108 additions & 0 deletions c2db/A/2C/1/results-asr.stiffness.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"object_id": "asr.stiffness::Result",
"constructor": "asr.stiffness::Result",
"args": [],
"kwargs": {
"data": {
"speed_of_sound_x": 21373.063352135574,
"speed_of_sound_y": 21370.856641622737,
"c_11": 345.6538905582198,
"c_12": 70.60779871921024,
"c_13": 0.0005778599312093563,
"c_14": null,
"c_15": null,
"c_16": null,
"c_21": 70.56537570227611,
"c_22": 345.58251859948973,
"c_23": 5.3339141915441094e-05,
"c_24": null,
"c_25": null,
"c_26": null,
"c_31": -1.48020629620793e-13,
"c_32": -3.171870634731279e-14,
"c_33": 275.09324474892543,
"c_34": null,
"c_35": null,
"c_36": null,
"c_41": null,
"c_42": null,
"c_43": null,
"c_44": null,
"c_45": null,
"c_46": null,
"c_51": null,
"c_52": null,
"c_53": null,
"c_54": null,
"c_55": null,
"c_56": null,
"c_61": null,
"c_62": null,
"c_63": null,
"c_64": null,
"c_65": null,
"c_66": null,
"__links__": {
"strains--1.0%-xx": "C2-b088c34acc1b",
"strains-+1.0%-xx": "C2-df0c254be7f9",
"strains--1.0%-yy": "C2-65c455263aaa",
"strains-+1.0%-yy": "C2-2fc059f556fa",
"strains--1.0%-xy": "C2-9ec52112fdfe",
"strains-+1.0%-xy": "C2-92a5b8f033fd"
},
"stiffness_tensor": {
"__ndarray__": [
[
3,
3
],
"float64",
[
345.6538905582198,
70.60779871921024,
0.0005778599312093563,
70.56537570227611,
345.58251859948973,
5.3339141915441094e-05,
-1.48020629620793e-13,
-3.171870634731279e-14,
275.09324474892543
]
]
},
"eigenvalues": {
"__ndarray__": [
[
3
],
"float64",
[
416.20479762329126,
275.03161153441835,
275.09324474892543
]
]
},
"dynamic_stability_stiffness": "high"
},
"metadata": {
"asr_name": "asr.stiffness",
"resources": {
"time": 0.05871438980102539,
"ncores": 1,
"tstart": 1605182101.3158286,
"tend": 1605182101.374543
},
"params": {
"strain_percent": 1.0
},
"code_versions": {
"asr": "0.4.1-fef8a0ce2ab711c3284f5dbfd158907b17f534e9",
"ase": "3.21.0b1-8a83b7f6a6fd68b95b9f542d7c054fa7204d764a",
"gpaw": "20.10.1b1-7ff8d570c9d25f2af1c40c00271000e3ab505f1c"
},
"creates": {}
},
"strict": true
}
}
4 changes: 4 additions & 0 deletions c2db/A/2C/1/structure.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
2
Lattice="2.4672312604313453 -1.7550685731635223e-20 0.0 -1.233615630215672 2.1366849485446453 0.0 1.118374734265682e-17 0.0 15.0" Properties=species:S:1:pos:R:3 energy=-18.453766945888727 dipole="0.8699688255098961 -0.5022767355947244 3.473501422988429e-08" free_energy=-18.45387516640614 pbc="T T F"
C 0.00000000 0.00000000 7.49999997
C 1.23361563 0.71222832 7.50000001
7 changes: 7 additions & 0 deletions c2db_try.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import matplotlib.pyplot as plt
from ase.db import connect

db = connect('c2db.db')
rows = db.select('layergroup')

rows.layergroup
11 changes: 11 additions & 0 deletions crystalformer.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Metadata-Version: 2.1
Name: crystalformer
Version: 0.3
Summary: CrystalFormer is a transformer-based autoregressive model specifically designed for space group-controlled generation of crystalline materials.
Home-page: https://github.com/deepmodeling/CrystalFormer
Author: iopcompphys
Author-email: [email protected], [email protected]
License: Apache License
Keywords: Crystal Generation
Platform: any
License-File: LICENSE
38 changes: 38 additions & 0 deletions crystalformer.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
LICENSE
README.md
setup.py
crystalformer/__init__.py
crystalformer.egg-info/PKG-INFO
crystalformer.egg-info/SOURCES.txt
crystalformer.egg-info/dependency_links.txt
crystalformer.egg-info/top_level.txt
crystalformer/data/layer.csv
crystalformer/data/wyckoff_list.csv
crystalformer/data/wyckoff_symbols.csv
crystalformer/extension/__init__.py
crystalformer/extension/experimental.py
crystalformer/extension/loss.py
crystalformer/extension/mcmc.py
crystalformer/extension/model.py
crystalformer/extension/train.py
crystalformer/extension/transformer.py
crystalformer/src/__init__.py
crystalformer/src/attention.py
crystalformer/src/checkpoint.py
crystalformer/src/elements.py
crystalformer/src/lattice.py
crystalformer/src/loss.py
crystalformer/src/mcmc.py
crystalformer/src/sample.py
crystalformer/src/sym_group.py
crystalformer/src/train.py
crystalformer/src/transformer.py
crystalformer/src/utils.py
crystalformer/src/von_mises.py
crystalformer/src/wyckoff.py
tests/test_fc_mask.py
tests/test_lattice.py
tests/test_sampling.py
tests/test_transformer.py
tests/test_utils.py
tests/test_wyckoff.py
1 change: 1 addition & 0 deletions crystalformer.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions crystalformer.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
crystalformer
Binary file added crystalformer/.DS_Store
Binary file not shown.
Loading