├── FeatureExtraction ├── README.md ├── alignn │ ├── __init__.py │ ├── __init__.pyc │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── config.cpython-38.pyc │ │ ├── data.cpython-38.pyc │ │ ├── train.cpython-38.pyc │ │ └── utils.cpython-38.pyc │ ├── cli.py │ ├── config.py │ ├── data.py │ ├── models │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-38.pyc │ │ │ ├── alignn.cpython-38.pyc │ │ │ ├── alignn_cgcnn.cpython-38.pyc │ │ │ ├── alignn_layernorm.cpython-38.pyc │ │ │ ├── dense_alignn.cpython-38.pyc │ │ │ ├── densegcn.cpython-38.pyc │ │ │ ├── gcn.cpython-38.pyc │ │ │ ├── icgcnn.cpython-38.pyc │ │ │ ├── modified_cgcnn.cpython-38.pyc │ │ │ └── utils.cpython-38.pyc │ │ ├── alignn.py │ │ ├── alignn_cgcnn.py │ │ ├── alignn_layernorm.py │ │ ├── dense_alignn.py │ │ ├── densegcn.py │ │ ├── gcn.py │ │ ├── icgcnn.py │ │ ├── modified_cgcnn.py │ │ └── utils.py │ ├── pretrained.py │ ├── pretrained_activation.py │ ├── profile.py │ ├── train.py │ ├── train_folder.py │ ├── train_props.py │ └── utils.py ├── create_features.sh └── pre-processing.ipynb ├── FineTuning ├── README.md ├── alignn │ ├── __init__.py │ ├── __init__.pyc │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── config.cpython-38.pyc │ │ ├── data.cpython-38.pyc │ │ ├── train.cpython-38.pyc │ │ └── utils.cpython-38.pyc │ ├── cli.py │ ├── config.py │ ├── data.py │ ├── models │ │ ├── __init__.py │ │ ├── __init__.pyc │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-38.pyc │ │ │ ├── alignn.cpython-38.pyc │ │ │ ├── alignn_cgcnn.cpython-38.pyc │ │ │ ├── alignn_layernorm.cpython-38.pyc │ │ │ ├── dense_alignn.cpython-38.pyc │ │ │ ├── densegcn.cpython-38.pyc │ │ │ ├── gcn.cpython-38.pyc │ │ │ ├── icgcnn.cpython-38.pyc │ │ │ ├── modified_cgcnn.cpython-38.pyc │ │ │ └── utils.cpython-38.pyc │ │ ├── alignn.py │ │ ├── alignn_cgcnn.py │ │ ├── alignn_layernorm.py │ │ ├── dense_alignn.py │ │ ├── densegcn.py │ │ ├── gcn.py │ │ ├── icgcnn.py │ │ ├── modified_cgcnn.py │ │ └── utils.py │ ├── pretrained.py │ ├── profile.py │ ├── train.py │ ├── train_folder.py │ ├── train_props.py │ └── utils.py └── run │ ├── config_sc.json │ └── config_tl_mp_eform.json ├── LICENSE ├── README.md ├── examples ├── POSCAR-JVASP-10.vasp ├── POSCAR-JVASP-107772.vasp ├── POSCAR-JVASP-13526.vasp ├── POSCAR-JVASP-1372.vasp ├── POSCAR-JVASP-14014.vasp ├── POSCAR-JVASP-14441.vasp ├── POSCAR-JVASP-14873.vasp ├── POSCAR-JVASP-15345.vasp ├── POSCAR-JVASP-1996.vasp ├── POSCAR-JVASP-21210.vasp ├── POSCAR-JVASP-22556.vasp ├── POSCAR-JVASP-27901.vasp ├── POSCAR-JVASP-28397.vasp ├── POSCAR-JVASP-28565.vasp ├── POSCAR-JVASP-28634.vasp ├── POSCAR-JVASP-28704.vasp ├── POSCAR-JVASP-42300.vasp ├── POSCAR-JVASP-48166.vasp ├── POSCAR-JVASP-50332.vasp ├── POSCAR-JVASP-60596.vasp ├── POSCAR-JVASP-60702.vasp ├── POSCAR-JVASP-63912.vasp ├── POSCAR-JVASP-64003.vasp ├── POSCAR-JVASP-64045.vasp ├── POSCAR-JVASP-64240.vasp ├── POSCAR-JVASP-64377.vasp ├── POSCAR-JVASP-64584.vasp ├── POSCAR-JVASP-64664.vasp ├── POSCAR-JVASP-64719.vasp ├── POSCAR-JVASP-64906.vasp ├── POSCAR-JVASP-65062.vasp ├── POSCAR-JVASP-65101.vasp ├── POSCAR-JVASP-655.vasp ├── POSCAR-JVASP-676.vasp ├── POSCAR-JVASP-76308.vasp ├── POSCAR-JVASP-76309.vasp ├── POSCAR-JVASP-76312.vasp ├── POSCAR-JVASP-76313.vasp ├── POSCAR-JVASP-76318.vasp ├── POSCAR-JVASP-76515.vasp ├── POSCAR-JVASP-76516.vasp ├── POSCAR-JVASP-76525.vasp ├── POSCAR-JVASP-76528.vasp ├── POSCAR-JVASP-76536.vasp ├── POSCAR-JVASP-76548.vasp ├── POSCAR-JVASP-76549.vasp ├── POSCAR-JVASP-76562.vasp ├── POSCAR-JVASP-76567.vasp ├── POSCAR-JVASP-86097.vasp ├── POSCAR-JVASP-86205.vasp ├── POSCAR-JVASP-86436.vasp ├── POSCAR-JVASP-86726.vasp ├── POSCAR-JVASP-86968.vasp ├── POSCAR-JVASP-89025.vasp ├── POSCAR-JVASP-89265.vasp ├── POSCAR-JVASP-90228.vasp ├── POSCAR-JVASP-90532.vasp ├── POSCAR-JVASP-90856.vasp ├── POSCAR-JVASP-97378.vasp ├── POSCAR-JVASP-97499.vasp ├── POSCAR-JVASP-97570.vasp ├── POSCAR-JVASP-97677.vasp ├── POSCAR-JVASP-97799.vasp ├── POSCAR-JVASP-97915.vasp ├── POSCAR-JVASP-97984.vasp ├── POSCAR-JVASP-98167.vasp ├── POSCAR-JVASP-98224.vasp ├── POSCAR-JVASP-98225.vasp ├── POSCAR-JVASP-98284.vasp ├── POSCAR-JVASP-98550.vasp ├── config_example.json └── id_prop.csv └── setup.py /FeatureExtraction/README.md: -------------------------------------------------------------------------------- 1 | # ALIGNNTL: Feature Extraction 2 | 3 | This directory contains information on how to perform feature extraction using ALIGNN. 4 | 5 | ### Instructions 6 | 7 | The user requires following files in order to perform feature extraction 8 | * Sturcture files - contains structure information for a given material (format: `POSCAR`, `.cif`, `.xyz` or `.pdb`) 9 | * Input-Property file - contains name of the structure file and its corresponding property value (format: `.csv`) 10 | * Pre-trained model - model trained using ALIGNN using any specific materials property (format: `.zip`) 11 | 12 | We have provided the an example of Sturcture files (`POSCAR` files) and Input-Property file (`id_prop.csv`) in [`examples`](../examples). Download the pre-trained model trained on large datasets from here. 13 | 14 | Now, in order to perform feature extraction, add the details regarding the model in the `all_models` dictionary inside the `train.py` file as described below: 15 | ``` 16 | all_models = { 17 | name of the file: [link to the pre-trained model (optional), number of outputs], 18 | name of the file 2: [link to the pre-trained model 2 (optional), number of outputs], 19 | ... 20 | } 21 | ``` 22 | If the link to the pre-trained model is not provided inside the `all_models` dictionary, place the zip file of the pre-trained model inside the [`alignn`](./alignn) folder. Once the setup for the pre-trained model is done, the feature extraction can be performed by running the `create_features.sh` script file which contains the following code: 23 | ``` 24 | for filename in ../examples/*.vasp; do 25 | python alignn/pretrained_activation.py --model_name mp_e_form_alignnn --file_format poscar --file_path "$filename" --output_path "../examples/data" 26 | done 27 | ``` 28 | The script will convert the structure files into atom (x), bond (y) and angle (z) based features one-by-one (batch-wise conversion has not been implemented yet). Example: `abc.vasp` will produce `abc_x.csv` (9 atom-based features), `abc_y.csv` (9 bond-based features) and `abc_z.csv` (5 angle-based features). 29 | 30 | Once you have converted all the structure files in the Input-Property file `id_prop.csv` using the script file, run the jupyter notebooks `pre-processing.ipynb` to convert the structure-wise features into a dataset. Pre-processing steps contained within the `pre-processing.ipynb` file is as follows: 31 | * Attach the appropriate property value and identifier (jid) to each of the extracted features file based on id_prop.csv 32 | * Create a seperate file for each of the features (atom, bond, angle) based on the extracted checkpoints 33 | * Create combined features (in the order of atom, bond and angle) from same (3-1) or different (3-2) checkpoints. Use first 512 features for atom+bond and all features for atom+bon+angle as input for model training. 34 | * (Optional) Divide each of the files into train, validation and test files based on the json file `ids_train_val_test.json` available in the output directory of the ALIGNN model 35 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/__init__.py: -------------------------------------------------------------------------------- 1 | """Version number.""" 2 | __version__ = "2021.11.16" 3 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/__init__.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/__pycache__/config.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/__pycache__/config.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/__pycache__/data.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/__pycache__/data.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/__pycache__/train.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/__pycache__/train.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/__pycache__/utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/__pycache__/utils.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/cli.py: -------------------------------------------------------------------------------- 1 | """Ignite training cli.""" 2 | 3 | import json 4 | import os 5 | import shutil 6 | from pathlib import Path 7 | 8 | # from typing import Any, Dict, Optional, Union 9 | from typing import Optional 10 | 11 | import torch 12 | import typer 13 | 14 | from alignn.config import TrainingConfig 15 | from alignn.profile import profile_dgl 16 | from alignn.train import train_dgl 17 | 18 | 19 | def cli( 20 | config: Optional[Path] = typer.Argument(None), 21 | progress: bool = False, 22 | checkpoint_dir: Path = Path("/tmp/models"), 23 | store_outputs: bool = False, 24 | tensorboard: bool = False, 25 | profile: bool = False, 26 | ): 27 | """ALIGNN training cli. 28 | 29 | config: path to json config file (conform to TrainingConfig) 30 | progress: enable tqdm console logging 31 | tensorboard: enable tensorboard logging 32 | profile: run profiling script for one epoch instead of training 33 | """ 34 | model_dir = config.parent 35 | 36 | if config is None: 37 | model_dir = os.getcwd() 38 | config = TrainingConfig(epochs=10, n_train=32, n_val=32, batch_size=16) 39 | 40 | elif config.is_file(): 41 | model_dir = config.parent 42 | with open(config, "r") as f: 43 | config = json.load(f) 44 | config = TrainingConfig(**config) 45 | 46 | if profile: 47 | profile_dgl(config) 48 | return 49 | 50 | hist = train_dgl( 51 | config, 52 | progress=progress, 53 | checkpoint_dir=checkpoint_dir, 54 | store_outputs=store_outputs, 55 | log_tensorboard=tensorboard, 56 | ) 57 | 58 | # print(model_dir) 59 | # with open(model_dir / "metrics.json", "w") as f: 60 | # json.dump(hist, f) 61 | 62 | torch.save(hist, model_dir / "metrics.pt") 63 | 64 | with open(model_dir / "fullconfig.json", "w") as f: 65 | json.dump(json.loads(config.json()), f, indent=2) 66 | 67 | # move temporary checkpoint data into model_dir 68 | for checkpoint in checkpoint_dir.glob("*.pt"): 69 | shutil.copy(checkpoint, model_dir / checkpoint.name) 70 | 71 | 72 | if __name__ == "__main__": 73 | typer.run(cli) 74 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/config.py: -------------------------------------------------------------------------------- 1 | """Pydantic model for default configuration and validation.""" 2 | 3 | import subprocess 4 | from typing import Optional, Union 5 | import os 6 | from pydantic import root_validator 7 | 8 | # vfrom pydantic import Field, root_validator, validator 9 | from pydantic.typing import Literal 10 | from alignn.utils import BaseSettings 11 | from alignn.models.modified_cgcnn import CGCNNConfig 12 | from alignn.models.icgcnn import ICGCNNConfig 13 | from alignn.models.gcn import SimpleGCNConfig 14 | from alignn.models.densegcn import DenseGCNConfig 15 | from alignn.models.alignn import ALIGNNConfig 16 | from alignn.models.dense_alignn import DenseALIGNNConfig 17 | from alignn.models.alignn_cgcnn import ACGCNNConfig 18 | from alignn.models.alignn_layernorm import ALIGNNConfig as ALIGNN_LN_Config 19 | 20 | # from typing import List 21 | 22 | try: 23 | VERSION = ( 24 | subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip() 25 | ) 26 | except Exception as exp: 27 | VERSION = "NA" 28 | pass 29 | 30 | 31 | FEATURESET_SIZE = {"basic": 11, "atomic_number": 1, "cfid": 438, "cgcnn": 92} 32 | 33 | 34 | TARGET_ENUM = Literal[ 35 | "formation_energy_peratom", 36 | "optb88vdw_bandgap", 37 | "bulk_modulus_kv", 38 | "shear_modulus_gv", 39 | "mbj_bandgap", 40 | "slme", 41 | "magmom_oszicar", 42 | "spillage", 43 | "kpoint_length_unit", 44 | "encut", 45 | "optb88vdw_total_energy", 46 | "epsx", 47 | "epsy", 48 | "epsz", 49 | "mepsx", 50 | "mepsy", 51 | "mepsz", 52 | "max_ir_mode", 53 | "min_ir_mode", 54 | "n-Seebeck", 55 | "p-Seebeck", 56 | "n-powerfact", 57 | "p-powerfact", 58 | "ncond", 59 | "pcond", 60 | "nkappa", 61 | "pkappa", 62 | "ehull", 63 | "exfoliation_energy", 64 | "dfpt_piezo_max_dielectric", 65 | "dfpt_piezo_max_eij", 66 | "dfpt_piezo_max_dij", 67 | "gap pbe", 68 | "e_form", 69 | "e_hull", 70 | "energy_per_atom", 71 | "formation_energy_per_atom", 72 | "band_gap", 73 | "e_above_hull", 74 | "mu_b", 75 | "bulk modulus", 76 | "shear modulus", 77 | "elastic anisotropy", 78 | "U0", 79 | "HOMO", 80 | "LUMO", 81 | "R2", 82 | "ZPVE", 83 | "omega1", 84 | "mu", 85 | "alpha", 86 | "homo", 87 | "lumo", 88 | "gap", 89 | "r2", 90 | "zpve", 91 | "U", 92 | "H", 93 | "G", 94 | "Cv", 95 | "A", 96 | "B", 97 | "C", 98 | "all", 99 | "target", 100 | "max_efg", 101 | "avg_elec_mass", 102 | "avg_hole_mass", 103 | "_oqmd_band_gap", 104 | "_oqmd_delta_e", 105 | "_oqmd_stability", 106 | "edos_up", 107 | "pdos_elast", 108 | "bandgap", 109 | "energy_total", 110 | "net_magmom", 111 | "b3lyp_homo", 112 | "b3lyp_lumo", 113 | "b3lyp_gap", 114 | "b3lyp_scharber_pce", 115 | "b3lyp_scharber_voc", 116 | "b3lyp_scharber_jsc", 117 | "log_kd_ki", 118 | "max_co2_adsp", 119 | "min_co2_adsp", 120 | "lcd", 121 | "pld", 122 | "void_fraction", 123 | "surface_area_m2g", 124 | "surface_area_m2cm3", 125 | "co2_absp", 126 | ] 127 | 128 | 129 | class TrainingConfig(BaseSettings): 130 | """Training config defaults and validation.""" 131 | 132 | version: str = VERSION 133 | 134 | # dataset configuration 135 | dataset: Literal[ 136 | "dft_3d", 137 | "jdft_3d-8-18-2021", 138 | "dft_2d", 139 | "megnet", 140 | "megnet2", 141 | "mp_3d_2020", 142 | "qm9", 143 | "qm9_dgl", 144 | "qm9_std_jctc", 145 | "user_data", 146 | "oqmd_3d_no_cfid", 147 | "edos_up", 148 | "edos_pdos", 149 | "qmof", 150 | "hmof", 151 | "hpov", 152 | "pdbbind", 153 | "pdbbind_core", 154 | ] = "dft_3d" 155 | target: TARGET_ENUM = "formation_energy_peratom" 156 | atom_features: Literal["basic", "atomic_number", "cfid", "cgcnn"] = "cgcnn" 157 | neighbor_strategy: Literal["k-nearest", "voronoi"] = "k-nearest" 158 | id_tag: Literal["jid", "id", "_oqmd_entry_id"] = "jid" 159 | 160 | # logging configuration 161 | 162 | # training configuration 163 | random_seed: Optional[int] = 123 164 | classification_threshold: Optional[float] = None 165 | # target_range: Optional[List] = None 166 | n_val: Optional[int] = None 167 | n_test: Optional[int] = None 168 | n_train: Optional[int] = None 169 | train_ratio: Optional[float] = 0.8 170 | val_ratio: Optional[float] = 0.1 171 | test_ratio: Optional[float] = 0.1 172 | source_model: Optional[str] = None 173 | target_multiplication_factor: Optional[float] = None 174 | epochs: int = 300 175 | batch_size: int = 64 176 | weight_decay: float = 0 177 | learning_rate: float = 1e-2 178 | filename: str = "sample" 179 | warmup_steps: int = 2000 180 | criterion: Literal["mse", "l1", "poisson", "zig"] = "mse" 181 | optimizer: Literal["adamw", "sgd"] = "adamw" 182 | scheduler: Literal["onecycle", "none"] = "onecycle" 183 | pin_memory: bool = False 184 | save_dataloader: bool = False 185 | write_checkpoint: bool = True 186 | write_predictions: bool = True 187 | store_outputs: bool = True 188 | progress: bool = True 189 | log_tensorboard: bool = False 190 | standard_scalar_and_pca: bool = False 191 | use_canonize: bool = True 192 | num_workers: int = 4 193 | cutoff: float = 8.0 194 | max_neighbors: int = 12 195 | keep_data_order: bool = False 196 | distributed: bool = False 197 | n_early_stopping: Optional[int] = None # typically 50 198 | output_dir: str = os.path.abspath(".") # typically 50 199 | # alignn_layers: int = 4 200 | # gcn_layers: int =4 201 | # edge_input_features: int= 80 202 | # hidden_features: int= 256 203 | # triplet_input_features: int=40 204 | # embedding_features: int=64 205 | 206 | # model configuration 207 | model: Union[ 208 | CGCNNConfig, 209 | ICGCNNConfig, 210 | SimpleGCNConfig, 211 | DenseGCNConfig, 212 | ALIGNNConfig, 213 | ALIGNN_LN_Config, 214 | DenseALIGNNConfig, 215 | ACGCNNConfig, 216 | ] = ALIGNNConfig(name="alignn") 217 | # ] = CGCNNConfig(name="cgcnn") 218 | 219 | @root_validator() 220 | def set_input_size(cls, values): 221 | """Automatically configure node feature dimensionality.""" 222 | values["model"].atom_input_features = FEATURESET_SIZE[ 223 | values["atom_features"] 224 | ] 225 | 226 | return values 227 | 228 | # @property 229 | # def atom_input_features(self): 230 | # """Automatically configure node feature dimensionality.""" 231 | # return FEATURESET_SIZE[self.atom_features] 232 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__init__.py: -------------------------------------------------------------------------------- 1 | """Graph neural network implementations.""" 2 | # from alignn.models.alignn import ALIGNN, ALIGNNConfig 3 | # from alignn.models.cgcnn import CGCNN, CGCNNConfig 4 | # from alignn.models.dense_alignn import DenseALIGNN, DenseALIGNNConfig 5 | # from alignn.models.densegcn import DenseGCN, DenseGCNConfig 6 | # from alignn.models.gcn import SimpleGCN, SimpleGCNConfig 7 | # from alignn.models.icgcnn import ICGCNNConfig, iCGCNN 8 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__init__.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/alignn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/alignn.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/alignn_cgcnn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/alignn_cgcnn.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/alignn_layernorm.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/alignn_layernorm.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/dense_alignn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/dense_alignn.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/densegcn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/densegcn.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/gcn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/gcn.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/icgcnn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/icgcnn.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/modified_cgcnn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/modified_cgcnn.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/__pycache__/utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FeatureExtraction/alignn/models/__pycache__/utils.cpython-38.pyc -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/densegcn.py: -------------------------------------------------------------------------------- 1 | """A baseline graph convolution network dgl implementation.""" 2 | from typing import List, Optional 3 | 4 | import dgl 5 | import torch 6 | from dgl.nn import AvgPooling, GraphConv 7 | from pydantic.typing import Literal 8 | from torch import nn 9 | from torch.nn import functional as F 10 | 11 | from alignn.utils import BaseSettings 12 | 13 | 14 | class DenseGCNConfig(BaseSettings): 15 | """Hyperparameter schema for jarvisdgl.models.densegcn.""" 16 | 17 | name: Literal["densegcn"] 18 | atom_input_features: int = 1 19 | edge_lengthscale: float = 4.0 20 | weight_edges: bool = True 21 | conv_layers: int = 4 22 | node_features: int = 32 23 | growth_rate: int = 32 24 | output_features: int = 1 25 | classification: bool = False 26 | 27 | class Config: 28 | """Configure model settings behavior.""" 29 | 30 | env_prefix = "jv_model" 31 | 32 | 33 | class _DenseLayer(nn.Module): 34 | """BatchNorm-ReLU-GraphConv Dense layer.""" 35 | 36 | def __init__(self, in_features: int, growth_rate: int): 37 | super().__init__() 38 | self.bn = nn.BatchNorm1d(in_features) 39 | self.conv = GraphConv(in_features, growth_rate) 40 | 41 | def forward( 42 | self, 43 | g: dgl.DGLGraph, 44 | input: List[torch.Tensor], 45 | edge_weight: Optional[torch.Tensor], 46 | ): 47 | 48 | prev_features = F.relu(self.bn(torch.cat(input, 1))) 49 | new_features = self.conv(g, prev_features, edge_weight=edge_weight) 50 | 51 | return new_features 52 | 53 | 54 | class _DenseBlock(nn.ModuleDict): 55 | """Block of densely-connected bn-ReLU-conv layers.""" 56 | 57 | def __init__(self, n_layers: int, in_features: int, growth_rate: int): 58 | super().__init__() 59 | for id_layer in range(n_layers): 60 | layer = _DenseLayer( 61 | in_features + id_layer * growth_rate, growth_rate 62 | ) 63 | self.add_module(f"denselayer{1+id_layer}", layer) 64 | 65 | def forward( 66 | self, 67 | g: dgl.DGLGraph, 68 | node_features: torch.Tensor, 69 | edge_weight: Optional[torch.Tensor] = None, 70 | ): 71 | features = [node_features] 72 | for name, layer in self.items(): 73 | new_features = layer(g, features, edge_weight=edge_weight) 74 | features.append(new_features) 75 | return torch.cat(features, 1) 76 | 77 | 78 | class DenseGCN(nn.Module): 79 | """GraphConv GCN with DenseNet-style connections.""" 80 | 81 | def __init__( 82 | self, config: DenseGCNConfig = DenseGCNConfig(name="densegcn") 83 | ): 84 | """Initialize class with number of input features, conv layers.""" 85 | super().__init__() 86 | print(config) 87 | self.edge_lengthscale = config.edge_lengthscale 88 | self.weight_edges = config.weight_edges 89 | 90 | self.atom_embedding = nn.Linear( 91 | config.atom_input_features, config.node_features 92 | ) 93 | 94 | self.bn = nn.BatchNorm1d(config.node_features) 95 | 96 | # bn-relu-conv 97 | self.dense_layers = _DenseBlock( 98 | config.conv_layers, config.node_features, config.growth_rate 99 | ) 100 | 101 | final_size = ( 102 | config.node_features + config.conv_layers * config.growth_rate 103 | ) 104 | 105 | self.bn_final = nn.BatchNorm1d(final_size) 106 | 107 | self.readout = AvgPooling() 108 | 109 | self.fc = nn.Linear(final_size, config.output_features) 110 | 111 | def forward(self, g): 112 | """Baseline SimpleGCN : start with `atom_features`.""" 113 | g = g.local_var() 114 | 115 | if self.weight_edges: 116 | r = torch.norm(g.edata["r"], dim=1) 117 | edge_weights = torch.exp(-(r ** 2) / self.edge_lengthscale ** 2) 118 | else: 119 | edge_weights = None 120 | 121 | # initial node features: atom feature network... 122 | # conv-bn-relu 123 | v = g.ndata.pop("atom_features") 124 | node_features = self.atom_embedding(v) 125 | node_features = F.relu(self.bn(node_features)) 126 | 127 | # bn-relu-conv 128 | h = self.dense_layers(g, node_features, edge_weight=edge_weights) 129 | 130 | # norm-relu-pool-classify 131 | h = F.relu(self.bn_final(h)) 132 | 133 | h = self.readout(g, h) 134 | 135 | out = self.fc(h) 136 | 137 | return torch.squeeze(out) 138 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/gcn.py: -------------------------------------------------------------------------------- 1 | """A baseline graph convolution network dgl implementation.""" 2 | # import dgl 3 | import torch 4 | from dgl.nn import AvgPooling, GraphConv 5 | from pydantic.typing import Literal 6 | from torch import nn 7 | from torch.nn import functional as F 8 | 9 | from alignn.utils import BaseSettings 10 | 11 | 12 | class SimpleGCNConfig(BaseSettings): 13 | """Hyperparameter schema for jarvisdgl.models.gcn.""" 14 | 15 | name: Literal["simplegcn"] 16 | atom_input_features: int = 1 17 | weight_edges: bool = True 18 | width: int = 64 19 | output_features: int = 1 20 | 21 | class Config: 22 | """Configure model settings behavior.""" 23 | 24 | env_prefix = "jv_model" 25 | 26 | 27 | class SimpleGCN(nn.Module): 28 | """GraphConv GCN with DenseNet-style connections.""" 29 | 30 | def __init__( 31 | self, config: SimpleGCNConfig = SimpleGCNConfig(name="simplegcn") 32 | ): 33 | """Initialize class with number of input features, conv layers.""" 34 | super().__init__() 35 | self.edge_lengthscale = config.edge_lengthscale 36 | self.weight_edges = config.weight_edges 37 | 38 | self.atom_embedding = nn.Linear( 39 | config.atom_input_features, config.width 40 | ) 41 | 42 | self.layer1 = GraphConv(config.width, config.width) 43 | self.layer2 = GraphConv(config.width, config.output_features) 44 | self.readout = AvgPooling() 45 | 46 | def forward(self, g): 47 | """Baseline SimpleGCN : start with `atom_features`.""" 48 | g = g.local_var() 49 | 50 | if self.weight_edges: 51 | r = torch.norm(g.edata["bondlength"], dim=1) 52 | edge_weights = torch.exp(-(r ** 2) / self.edge_lengthscale ** 2) 53 | else: 54 | edge_weights = None 55 | 56 | # initial node features: atom feature network... 57 | v = g.ndata.pop("atom_features") 58 | node_features = self.atom_embedding(v) 59 | 60 | x = F.relu(self.layer1(g, node_features, edge_weight=edge_weights)) 61 | x = self.layer2(g, x, edge_weight=edge_weights) 62 | x = self.readout(g, x) 63 | 64 | return torch.squeeze(x) 65 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/icgcnn.py: -------------------------------------------------------------------------------- 1 | """CGCNN: dgl implementation.""" 2 | 3 | from typing import Tuple 4 | import dgl 5 | import dgl.function as fn 6 | 7 | # import numpy as np 8 | import torch 9 | import torch.nn.functional as F 10 | from dgl.nn import AvgPooling 11 | from pydantic.typing import Literal 12 | from torch import nn 13 | 14 | from alignn.models.utils import RBFExpansion 15 | from alignn.utils import BaseSettings 16 | 17 | 18 | class ICGCNNConfig(BaseSettings): 19 | """Hyperparameter schema for jarvisdgl.models.icgcnn.""" 20 | 21 | name: Literal["icgcnn"] 22 | conv_layers: int = 3 23 | atom_input_features: int = 1 24 | edge_features: int = 16 25 | node_features: int = 64 26 | fc_layers: int = 1 27 | fc_features: int = 64 28 | output_features: int = 1 29 | 30 | # if logscale is set, apply `exp` to final outputs 31 | # to constrain predictions to be positive 32 | logscale: bool = False 33 | hurdle: bool = False 34 | classification: bool = False 35 | 36 | class Config: 37 | """Configure model settings behavior.""" 38 | 39 | env_prefix = "jv_model" 40 | 41 | 42 | class CGCNNUpdate(nn.Module): 43 | """Helper nn.Module for CGCNN-style updates.""" 44 | 45 | def __init__(self, in_features: int, out_features: int): 46 | """Set up CGCNN internal parameters.""" 47 | super().__init__() 48 | 49 | # edge interaction model (W_f / W_1) 50 | self.conv = nn.Sequential( 51 | nn.Linear(in_features, out_features), 52 | nn.BatchNorm1d(out_features), 53 | nn.Sigmoid(), 54 | ) 55 | 56 | # edge attention model (W_s / W_2) 57 | self.screen = nn.Sequential( 58 | nn.Linear(in_features, out_features), 59 | nn.BatchNorm1d(out_features), 60 | nn.Softplus(), 61 | ) 62 | 63 | def forward(self, x: torch.Tensor): 64 | """Apply CGCNNConv-style update.""" 65 | return self.conv(x) * self.screen(x) 66 | 67 | 68 | class iCGCNNConv(nn.Module): 69 | """Park and Wolverton iCGCNN convolution. 70 | 71 | 10.1103/PhysRevMaterials.4.063801 72 | 73 | In the papers, nodes are v_i, v_j, edges are u_ij 74 | In DGL, nodes are u (src) and v (dst), edges are e 75 | """ 76 | 77 | def __init__(self, node_features: int = 64, edge_features: int = 32): 78 | """Initialize torch modules for iCGCNNConv layer.""" 79 | super().__init__() 80 | self.node_features = node_features 81 | self.edge_features = edge_features 82 | 83 | # iCGCNNConv has a node update and an edge update 84 | # each update has a pairwise and triplet interaction term 85 | 86 | # pairwise features: 87 | # z_ij = cat(v_i, v_j, u_ij) 88 | pair_sz = 2 * self.node_features + self.edge_features 89 | 90 | # triplet features: 91 | # z_ijl = cat(v_i, v_j, v_l, u_ij, u_il) 92 | triple_sz = 3 * self.node_features + 2 * self.edge_features 93 | 94 | # node update functions 95 | self.node_pair_update = CGCNNUpdate(pair_sz, self.node_features) 96 | self.node_triple_update = CGCNNUpdate(triple_sz, self.node_features) 97 | 98 | # edge update functions 99 | self.edge_pair_update = CGCNNUpdate(pair_sz, self.edge_features) 100 | self.edge_triple_update = CGCNNUpdate(triple_sz, self.edge_features) 101 | 102 | # final batchnorm 103 | self.node_bn = nn.BatchNorm1d(self.node_features) 104 | self.edge_bn = nn.BatchNorm1d(self.edge_features) 105 | 106 | def combine_edge_features(self, edges): 107 | """Edge update for iCGCNNConv. 108 | 109 | concatenate source and destination node features with edge features 110 | then apply the edge update modulated by the edge interaction model 111 | """ 112 | # form augmented edge features z_ij = [v_i, v_j, u_ij] 113 | z = torch.cat((edges.src["h"], edges.dst["h"], edges.data["h"]), dim=1) 114 | 115 | return {"z_pair": z} 116 | 117 | def combine_triplet_features(self, edges): 118 | """Line graph edge update for iCGCNNConv.""" 119 | z_ijl = torch.cat( 120 | ( 121 | edges.src["src_h"], 122 | edges.src["dst_h"], 123 | edges.dst["dst_h"], 124 | edges.src["h"], 125 | edges.dst["h"], 126 | ), 127 | dim=1, 128 | ) 129 | return {"z_triple": z_ijl} 130 | 131 | def forward( 132 | self, 133 | g: dgl.DGLGraph, 134 | node_feats: torch.Tensor, 135 | edge_feats: torch.Tensor, 136 | ) -> Tuple[torch.Tensor, torch.Tensor]: 137 | """CGCNN convolution defined in Eq 1, 2, and 3. 138 | 139 | 10.1103/PhysRevMaterials.4.063801 140 | 141 | This convolution function forms z_ij and z_ijl tensors 142 | and performs two aggregrations each: 143 | one to update node features and one to update edge features 144 | """ 145 | g = g.local_var() 146 | 147 | g.ndata["h"] = node_feats 148 | g.edata["h"] = edge_feats 149 | 150 | # propagate node features to line graph nodes 151 | g.apply_edges( 152 | func=lambda edges: { 153 | "src_h": edges.src["h"], 154 | "dst_h": edges.dst["h"], 155 | } 156 | ) 157 | 158 | # line graph edge == pairs of bonds (u,v), (v,w) 159 | # z_ijl = cat(src[src], src[dst], dst[dst]) 160 | lg = dgl.line_graph(g, shared=True) 161 | 162 | # both node and edge updates need both z_ij and z_ijl 163 | # compute these separately with apply_edges 164 | # apply multiple linear maps within that message function 165 | # then propagate them with separate update_all call each 166 | 167 | # compute z_ij (n_pairs, pair_sz) 168 | g.apply_edges(self.combine_edge_features) 169 | z_pair = g.edata.pop("z_pair") 170 | 171 | # compute z_ijl_kk' (n_triples, triple_sz) 172 | lg.apply_edges(self.combine_triplet_features) 173 | z_triple = lg.edata.pop("z_triple") 174 | 175 | # node update: eqs 1 and 2 176 | # eq 1 (pre-reduction) (n_edges, node_sz) 177 | # reduces to (n_nodes, node_sz) 178 | h_node_pair = self.node_pair_update(z_pair) 179 | 180 | # eq 2 (pre-reduction) (n_triples, node_sz) 181 | # reduces to (n_nodes, node_sz) 182 | h_node_triple = self.node_triple_update(z_triple) 183 | 184 | # edge update: eq 3 185 | # eq 3 term 1 (n_edges, edge_sz) 186 | # no reduction needed 187 | h_edge_pair = self.edge_pair_update(z_pair) 188 | 189 | # eq 3 term 2 (pre-reduction) (n_triples, edge_sz) 190 | # reduces to (n_edges, edge_sz) 191 | h_edge_triple = self.edge_triple_update(z_triple) 192 | 193 | # aggregate triple features to edges, then edges to nodes 194 | lg.edata["h_node_triple"] = h_node_triple 195 | lg.edata["h_edge_triple"] = h_edge_triple 196 | 197 | # triple -> edge aggregation (i.e. LG edges to LG nodes) 198 | # partial summation in Eq 2 (sum over l, k') 199 | lg.update_all( 200 | fn.copy_e("h_node_triple", "h_node_triple"), 201 | fn.sum("h_node_triple", "h_node_triple"), 202 | ) 203 | # sum over l, k' in Eq 3 204 | lg.update_all( 205 | fn.copy_e("h_edge_triple", "h_edge_triple"), 206 | fn.sum("h_edge_triple", "h_edge_triple"), 207 | ) 208 | 209 | # further aggregate triplet features to nodes 210 | # complete summation in eq 2 (sum over j, k) 211 | g.edata["h_node_triple"] = lg.ndata.pop("h_node_triple") 212 | g.update_all( 213 | fn.copy_e("h_node_triple", "h_node_triple"), 214 | fn.sum("h_node_triple", "h_node_triple"), 215 | ) 216 | 217 | # edge-wise reduction in eq 1 (sum over j,k) 218 | g.edata["h_node_pair"] = h_node_pair 219 | g.update_all( 220 | message_func=fn.copy_e("h_node_pair", "h_node_pair"), 221 | reduce_func=fn.sum("h_node_pair", "h_node_pair"), 222 | ) 223 | 224 | # final batchnorm 225 | h_node = g.ndata.pop("h_node_pair") + g.ndata.pop("h_node_triple") 226 | h_node = self.node_bn(h_node) 227 | 228 | h_edge = h_edge_pair + lg.ndata.pop("h_edge_triple") 229 | h_edge = self.edge_bn(h_edge) 230 | 231 | # residual connection plus nonlinearity 232 | return F.softplus(node_feats + h_node), F.softplus(edge_feats + h_edge) 233 | 234 | 235 | class iCGCNN(nn.Module): 236 | """iCGCNN dgl implementation.""" 237 | 238 | def __init__(self, config: ICGCNNConfig = ICGCNNConfig(name="icgcnn")): 239 | """Set up CGCNN modules.""" 240 | super().__init__() 241 | 242 | self.rbf = RBFExpansion(vmin=0, vmax=8.0, bins=config.edge_features) 243 | self.atom_embedding = nn.Linear( 244 | config.atom_input_features, config.node_features 245 | ) 246 | self.classification = config.classification 247 | self.conv_layers = nn.ModuleList( 248 | [ 249 | iCGCNNConv(config.node_features, config.edge_features) 250 | for _ in range(config.conv_layers) 251 | ] 252 | ) 253 | 254 | self.readout = AvgPooling() 255 | 256 | self.fc = nn.Sequential( 257 | nn.Linear(config.node_features, config.fc_features), nn.Softplus() 258 | ) 259 | 260 | if self.classification: 261 | self.fc_out = nn.Linear(config.fc_features, 2) 262 | self.softmax = nn.LogSoftmax(dim=1) 263 | else: 264 | self.fc_out = nn.Linear(config.fc_features, config.output_features) 265 | 266 | self.logscale = config.logscale 267 | 268 | def forward(self, g) -> torch.Tensor: 269 | """CGCNN function mapping graph to outputs.""" 270 | g, lg = g 271 | g = g.local_var() 272 | 273 | # fixed edge features: RBF-expanded bondlengths 274 | bondlength = torch.norm(g.edata.pop("r"), dim=1) 275 | h_edge = self.rbf(bondlength) 276 | 277 | # initial node features: atom feature network... 278 | v = g.ndata.pop("atom_features") 279 | h_node = self.atom_embedding(v) 280 | 281 | # CGCNN-Conv block: update node features 282 | for conv_layer in self.conv_layers: 283 | h_node, h_edge = conv_layer(g, h_node, h_edge) 284 | 285 | # crystal-level readout 286 | features = self.readout(g, h_node) 287 | features = F.softplus(features) 288 | features = self.fc(features) 289 | features = F.softplus(features) 290 | 291 | out = self.fc_out(features) 292 | 293 | if self.logscale: 294 | out = torch.exp(out) 295 | if self.classification: 296 | # out = torch.round(torch.sigmoid(out)) 297 | out = self.softmax(out) 298 | 299 | return torch.squeeze(out) 300 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/models/utils.py: -------------------------------------------------------------------------------- 1 | """Shared model-building components.""" 2 | from typing import Optional 3 | 4 | import numpy as np 5 | import torch 6 | from torch import nn 7 | 8 | 9 | class RBFExpansion(nn.Module): 10 | """Expand interatomic distances with radial basis functions.""" 11 | 12 | def __init__( 13 | self, 14 | vmin: float = 0, 15 | vmax: float = 8, 16 | bins: int = 40, 17 | lengthscale: Optional[float] = None, 18 | ): 19 | """Register torch parameters for RBF expansion.""" 20 | super().__init__() 21 | self.vmin = vmin 22 | self.vmax = vmax 23 | self.bins = bins 24 | self.register_buffer( 25 | "centers", torch.linspace(self.vmin, self.vmax, self.bins) 26 | ) 27 | 28 | if lengthscale is None: 29 | # SchNet-style 30 | # set lengthscales relative to granularity of RBF expansion 31 | self.lengthscale = np.diff(self.centers).mean() 32 | self.gamma = 1 / self.lengthscale 33 | 34 | else: 35 | self.lengthscale = lengthscale 36 | self.gamma = 1 / (lengthscale ** 2) 37 | 38 | def forward(self, distance: torch.Tensor) -> torch.Tensor: 39 | """Apply RBF expansion to interatomic distance tensor.""" 40 | #print(torch.exp(-self.gamma * (distance.unsqueeze(1) - self.centers) ** 2).shape) 41 | return torch.exp( 42 | -self.gamma * (distance.unsqueeze(1) - self.centers) ** 2 43 | ) 44 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/pretrained.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Module to download and load pre-trained ALIGNN models.""" 4 | import requests 5 | import os 6 | import zipfile 7 | from tqdm import tqdm 8 | from alignn.models.alignn import ALIGNN, ALIGNNConfig 9 | import tempfile 10 | import torch 11 | import sys 12 | from jarvis.db.jsonutils import loadjson 13 | import argparse 14 | from jarvis.core.atoms import Atoms 15 | from jarvis.core.graphs import Graph 16 | 17 | # Name of the model, figshare link, number of outputs 18 | all_models = { 19 | "jv_formation_energy_peratom_alignn": [ 20 | "https://figshare.com/ndownloader/files/31458679", 21 | 1, 22 | ], 23 | "jv_optb88vdw_total_energy_alignn": [ 24 | "https://figshare.com/ndownloader/files/31459642", 25 | 1, 26 | ], 27 | "jv_optb88vdw_bandgap_alignn": [ 28 | "https://figshare.com/ndownloader/files/31459636", 29 | 1, 30 | ], 31 | "jv_mbj_bandgap_alignn": [ 32 | "https://figshare.com/ndownloader/files/31458694", 33 | 1, 34 | ], 35 | "jv_spillage_alignn": [ 36 | "https://figshare.com/ndownloader/files/31458736", 37 | 1, 38 | ], 39 | "jv_slme_alignn": ["https://figshare.com/ndownloader/files/31458727", 1], 40 | "jv_bulk_modulus_kv_alignn": [ 41 | "https://figshare.com/ndownloader/files/31458649", 42 | 1, 43 | ], 44 | "jv_shear_modulus_gv_alignn": [ 45 | "https://figshare.com/ndownloader/files/31458724", 46 | 1, 47 | ], 48 | "jv_n-Seebeck_alignn": [ 49 | "https://figshare.com/ndownloader/files/31458718", 50 | 1, 51 | ], 52 | "jv_n-powerfact_alignn": [ 53 | "https://figshare.com/ndownloader/files/31458712", 54 | 1, 55 | ], 56 | "jv_magmom_oszicar_alignn": [ 57 | "https://figshare.com/ndownloader/files/31458685", 58 | 1, 59 | ], 60 | "jv_kpoint_length_unit_alignn": [ 61 | "https://figshare.com/ndownloader/files/31458682", 62 | 1, 63 | ], 64 | "jv_avg_elec_mass_alignn": [ 65 | "https://figshare.com/ndownloader/files/31458643", 66 | 1, 67 | ], 68 | "jv_avg_hole_mass_alignn": [ 69 | "https://figshare.com/ndownloader/files/31458646", 70 | 1, 71 | ], 72 | "jv_epsx_alignn": ["https://figshare.com/ndownloader/files/31458667", 1], 73 | "jv_mepsx_alignn": ["https://figshare.com/ndownloader/files/31458703", 1], 74 | "jv_max_efg_alignn": [ 75 | "https://figshare.com/ndownloader/files/31458691", 76 | 1, 77 | ], 78 | "jv_ehull_alignn": ["https://figshare.com/ndownloader/files/31458658", 1], 79 | "jv_dfpt_piezo_max_dielectric_alignn": [ 80 | "https://figshare.com/ndownloader/files/31458652", 81 | 1, 82 | ], 83 | "jv_dfpt_piezo_max_dij_alignn": [ 84 | "https://figshare.com/ndownloader/files/31458655", 85 | 1, 86 | ], 87 | "jv_exfoliation_energy_alignn": [ 88 | "https://figshare.com/ndownloader/files/31458676", 89 | 1, 90 | ], 91 | "mp_e_form_alignn": [ 92 | "https://figshare.com/ndownloader/files/31458811", 93 | 1, 94 | ], 95 | "mp_gappbe_alignn": [ 96 | "https://figshare.com/ndownloader/files/31458814", 97 | 1, 98 | ], 99 | "qm9_U0_alignn": ["https://figshare.com/ndownloader/files/31459054", 1], 100 | "qm9_U_alignn": ["https://figshare.com/ndownloader/files/31459051", 1], 101 | "qm9_alpha_alignn": ["https://figshare.com/ndownloader/files/31459027", 1], 102 | "qm9_gap_alignn": ["https://figshare.com/ndownloader/files/31459036", 1], 103 | "qm9_G_alignn": ["https://figshare.com/ndownloader/files/31459033", 1], 104 | "qm9_HOMO_alignn": ["https://figshare.com/ndownloader/files/31459042", 1], 105 | "qm9_LUMO_alignn": ["https://figshare.com/ndownloader/files/31459045", 1], 106 | "qm9_ZPVE_alignn": ["https://figshare.com/ndownloader/files/31459057", 1], 107 | "hmof_co2_absp_alignnn": [ 108 | "https://figshare.com/ndownloader/files/31459198", 109 | 5, 110 | ], 111 | "hmof_max_co2_adsp_alignnn": [ 112 | "https://figshare.com/ndownloader/files/31459207", 113 | 1, 114 | ], 115 | "hmof_surface_area_m2g_alignnn": [ 116 | "https://figshare.com/ndownloader/files/31459222", 117 | 1, 118 | ], 119 | "hmof_surface_area_m2cm3_alignnn": [ 120 | "https://figshare.com/ndownloader/files/31459219", 121 | 1, 122 | ], 123 | "hmof_pld_alignnn": ["https://figshare.com/ndownloader/files/31459216", 1], 124 | "hmof_lcd_alignnn": ["https://figshare.com/ndownloader/files/31459201", 1], 125 | "hmof_void_fraction_alignnn": [ 126 | "https://figshare.com/ndownloader/files/31459228", 127 | 1, 128 | ], 129 | } 130 | parser = argparse.ArgumentParser( 131 | description="Atomistic Line Graph Neural Network Pretrained Models" 132 | ) 133 | parser.add_argument( 134 | "--model_name", 135 | default="jv_formation_energy_peratom_alignn", 136 | help="Choose a model from these " 137 | + str(len(list(all_models.keys()))) 138 | + " models:" 139 | + ", ".join(list(all_models.keys())), 140 | ) 141 | 142 | parser.add_argument( 143 | "--file_format", default="poscar", help="poscar/cif/xyz/pdb file format." 144 | ) 145 | 146 | parser.add_argument( 147 | "--file_path", 148 | default="alignn/examples/sample_data/POSCAR-JVASP-10.vasp", 149 | help="Path to file.", 150 | ) 151 | 152 | parser.add_argument( 153 | "--cutoff", 154 | default=8, 155 | help="Distance cut-off for graph constuction" 156 | + ", usually 8 for solids and 5 for molecules.", 157 | ) 158 | 159 | 160 | device = "cpu" 161 | if torch.cuda.is_available(): 162 | device = torch.device("cuda") 163 | 164 | 165 | def get_prediction( 166 | model_name="jv_formation_energy_peratom_alignn", 167 | atoms=None, 168 | cutoff=8, 169 | ): 170 | """Get model with progress bar.""" 171 | tmp = all_models[model_name] 172 | url = tmp[0] 173 | output_features = tmp[1] 174 | zfile = model_name + ".zip" 175 | path = str(os.path.join(os.path.dirname(__file__), zfile)) 176 | if not os.path.isfile(path): 177 | response = requests.get(url, stream=True) 178 | total_size_in_bytes = int(response.headers.get("content-length", 0)) 179 | block_size = 1024 # 1 Kibibyte 180 | progress_bar = tqdm( 181 | total=total_size_in_bytes, unit="iB", unit_scale=True 182 | ) 183 | with open(path, "wb") as file: 184 | for data in response.iter_content(block_size): 185 | progress_bar.update(len(data)) 186 | file.write(data) 187 | progress_bar.close() 188 | zp = zipfile.ZipFile(path) 189 | names = zp.namelist() 190 | for i in names: 191 | if "checkpoint_" in i and "pt" in i: 192 | tmp = i 193 | # print("chk", i) 194 | # print("Loading the zipfile...", zipfile.ZipFile(path).namelist()) 195 | data = zipfile.ZipFile(path).read(tmp) 196 | model = ALIGNN( 197 | ALIGNNConfig(name="alignn", output_features=output_features) 198 | ) 199 | new_file, filename = tempfile.mkstemp() 200 | with open(filename, "wb") as f: 201 | f.write(data) 202 | model.load_state_dict(torch.load(filename, map_location=device)["model"]) 203 | model.to(device) 204 | model.eval() 205 | if os.path.exists(filename): 206 | os.remove(filename) 207 | 208 | 209 | # print("Loading completed.") 210 | g, lg = Graph.atom_dgl_multigraph(atoms, cutoff=float(cutoff)) 211 | #print(lg.edata) 212 | #print(lg) 213 | out_data = ( 214 | model([g.to(device), lg.to(device)]) 215 | .detach() 216 | .cpu() 217 | .numpy() 218 | .flatten() 219 | .tolist() 220 | ) 221 | 222 | return out_data 223 | 224 | 225 | if __name__ == "__main__": 226 | args = parser.parse_args(sys.argv[1:]) 227 | model_name = args.model_name 228 | file_path = args.file_path 229 | file_format = args.file_format 230 | cutoff = args.cutoff 231 | if file_format == "poscar": 232 | atoms = Atoms.from_poscar(file_path) 233 | elif file_format == "cif": 234 | atoms = Atoms.from_cif(file_path) 235 | elif file_format == "xyz": 236 | atoms = Atoms.from_xyz(file_path, box_size=500) 237 | elif file_format == "pdb": 238 | atoms = Atoms.from_pdb(file_path, max_lat=500) 239 | else: 240 | raise NotImplementedError("File format not implemented", file_format) 241 | 242 | out_data = get_prediction( 243 | model_name=model_name, cutoff=float(cutoff), atoms=atoms 244 | ) 245 | 246 | print("Predicted value:", model_name, file_path, out_data) 247 | 248 | 249 | # x = get_model() 250 | # print(x) 251 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/profile.py: -------------------------------------------------------------------------------- 1 | """pytorch profiling script. 2 | 3 | from the repository root, run 4 | `PYTHONPATH=$PYTHONPATH:. python jarvisdgl/profile.py` 5 | """ 6 | 7 | from functools import partial 8 | 9 | # from pathlib import Path 10 | from typing import Any, Dict, Union 11 | 12 | # import numpy as np 13 | import torch 14 | import torch.profiler 15 | from torch import nn 16 | from tqdm import tqdm 17 | 18 | from alignn import data, models 19 | from alignn.config import TrainingConfig 20 | from alignn.train import group_decay, setup_optimizer 21 | 22 | device = "cpu" 23 | if torch.cuda.is_available(): 24 | device = torch.device("cuda") 25 | 26 | 27 | def profile_dgl(config: Union[TrainingConfig, Dict[str, Any]]): 28 | """Training entry point for DGL networks. 29 | 30 | `config` should conform to alignn.conf.TrainingConfig, and 31 | if passed as a dict with matching keys, pydantic validation is used 32 | """ 33 | if type(config) is dict: 34 | config = TrainingConfig(**config) 35 | 36 | lg_models = {"clgn", "alignn"} 37 | 38 | # use input standardization for all real-valued feature sets 39 | 40 | train_loader, val_loader, prepare_batch = data.get_train_val_loaders( 41 | target=config.target, 42 | n_train=config.n_train, 43 | n_val=config.n_val, 44 | batch_size=config.batch_size, 45 | atom_features=config.atom_features, 46 | neighbor_strategy=config.neighbor_strategy, 47 | standardize=config.atom_features != "cgcnn", 48 | line_graph=config.model.name in lg_models, 49 | ) 50 | prepare_batch = partial(prepare_batch, device=device) 51 | 52 | # define network, optimizer, scheduler 53 | _model = { 54 | "cgcnn": models.CGCNN, 55 | "icgcnn": models.iCGCNN, 56 | "densegcn": models.DenseGCN, 57 | "clgn": models.CLGN, 58 | "alignn": models.ALIGNN, 59 | } 60 | model = _model.get(config.model.name)(config.model) 61 | model.to(device) 62 | 63 | # group parameters to skip weight decay for bias and batchnorm 64 | params = group_decay(model) 65 | optimizer = setup_optimizer(params, config) 66 | 67 | criterion = nn.MSELoss() 68 | 69 | with torch.profiler.profile( 70 | schedule=torch.profiler.schedule(wait=2, warmup=2, active=6, repeat=1), 71 | on_trace_ready=torch.profiler.tensorboard_trace_handler("."), 72 | with_stack=True, 73 | profile_memory=True, 74 | ) as profiler: 75 | # train for one epoch 76 | for batch in tqdm(train_loader): 77 | g, y = prepare_batch(batch) 78 | pred = model(g) 79 | loss = criterion(pred, y) 80 | optimizer.zero_grad() 81 | loss.backward() 82 | optimizer.step() 83 | profiler.step() 84 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/train_folder.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Module to train for a folder with formatted dataset.""" 4 | import csv 5 | import os 6 | import sys 7 | from jarvis.core.atoms import Atoms 8 | from alignn.data import get_train_val_loaders 9 | from alignn.train import train_dgl 10 | from alignn.config import TrainingConfig 11 | from jarvis.db.jsonutils import loadjson 12 | import argparse 13 | 14 | parser = argparse.ArgumentParser( 15 | description="Atomistic Line Graph Neural Network" 16 | ) 17 | parser.add_argument( 18 | "--root_dir", 19 | default="./", 20 | help="Folder with id_props.csv, structure files", 21 | ) 22 | parser.add_argument( 23 | "--config_name", 24 | default="alignn/examples/sample_data/config_example.json", 25 | help="Name of the config file", 26 | ) 27 | 28 | parser.add_argument( 29 | "--file_format", default="poscar", help="poscar/cif/xyz/pdb file format." 30 | ) 31 | 32 | parser.add_argument( 33 | "--keep_data_order", 34 | default=False, 35 | help="Whether to randomly shuffle samples, True/False", 36 | ) 37 | 38 | parser.add_argument( 39 | "--classification_threshold", 40 | default=None, 41 | help="Floating point threshold for converting into 0/1 class" 42 | + ", use only for classification tasks", 43 | ) 44 | 45 | parser.add_argument( 46 | "--batch_size", default=None, help="Batch size, generally 64" 47 | ) 48 | 49 | parser.add_argument( 50 | "--epochs", default=None, help="Number of epochs, generally 300" 51 | ) 52 | 53 | parser.add_argument( 54 | "--output_dir", 55 | default="./", 56 | help="Folder to save outputs", 57 | ) 58 | 59 | parser.add_argument( 60 | "--id_prop_file", 61 | default="id_prop.csv", 62 | help="Name of the id_prop file", 63 | ) 64 | 65 | 66 | def train_for_folder( 67 | root_dir="examples/sample_data", 68 | config_name="config.json", 69 | id_prop_file="id_prop.csv", 70 | keep_data_order=False, 71 | classification_threshold=None, 72 | batch_size=None, 73 | epochs=None, 74 | file_format="poscar", 75 | output_dir=None, 76 | ): 77 | """Train for a folder.""" 78 | # config_dat=os.path.join(root_dir,config_name) 79 | id_prop_dat = os.path.join(root_dir, id_prop_file) 80 | config = loadjson(config_name) 81 | if type(config) is dict: 82 | try: 83 | config = TrainingConfig(**config) 84 | except Exception as exp: 85 | print("Check", exp) 86 | 87 | config.keep_data_order = keep_data_order 88 | if classification_threshold is not None: 89 | config.classification_threshold = float(classification_threshold) 90 | if output_dir is not None: 91 | config.output_dir = output_dir 92 | if batch_size is not None: 93 | config.batch_size = int(batch_size) 94 | if epochs is not None: 95 | config.epochs = int(epochs) 96 | with open(id_prop_dat, "r") as f: 97 | reader = csv.reader(f) 98 | data = [row for row in reader] 99 | 100 | dataset = [] 101 | n_outputs = [] 102 | multioutput = False 103 | lists_length_equal = True 104 | for i in data: 105 | info = {} 106 | file_name = i[0] 107 | file_path = os.path.join(root_dir, file_name) 108 | if file_format == "poscar": 109 | atoms = Atoms.from_poscar(file_path) 110 | elif file_format == "cif": 111 | atoms = Atoms.from_cif(file_path) 112 | elif file_format == "xyz": 113 | # Note using 500 angstrom as box size 114 | atoms = Atoms.from_xyz(file_path, box_size=500) 115 | elif file_format == "pdb": 116 | # Note using 500 angstrom as box size 117 | # Recommended install pytraj 118 | # conda install -c ambermd pytraj 119 | atoms = Atoms.from_pdb(file_path, max_lat=500) 120 | else: 121 | raise NotImplementedError( 122 | "File format not implemented", file_format 123 | ) 124 | 125 | info["atoms"] = atoms.to_dict() 126 | info["jid"] = file_name 127 | 128 | tmp = [float(j) for j in i[1:]] # float(i[1]) 129 | if len(tmp) == 1: 130 | tmp = tmp[0] 131 | else: 132 | multioutput = True 133 | info["target"] = tmp # float(i[1]) 134 | n_outputs.append(info["target"]) 135 | dataset.append(info) 136 | if multioutput: 137 | lists_length_equal = False not in [ 138 | len(i) == len(n_outputs[0]) for i in n_outputs 139 | ] 140 | 141 | # print ('n_outputs',n_outputs[0]) 142 | if multioutput and classification_threshold is not None: 143 | raise ValueError("Classification for multi-output not implemented.") 144 | if multioutput and lists_length_equal: 145 | config.model.output_features = len(n_outputs[0]) 146 | else: 147 | # TODO: Pad with NaN 148 | if not lists_length_equal: 149 | raise ValueError("Make sure the outputs are of same size.") 150 | else: 151 | config.model.output_features = 1 152 | ( 153 | train_loader, 154 | val_loader, 155 | test_loader, 156 | prepare_batch, 157 | ) = get_train_val_loaders( 158 | dataset_array=dataset, 159 | target=config.target, 160 | n_train=config.n_train, 161 | n_val=config.n_val, 162 | n_test=config.n_test, 163 | train_ratio=config.train_ratio, 164 | val_ratio=config.val_ratio, 165 | test_ratio=config.test_ratio, 166 | batch_size=config.batch_size, 167 | atom_features=config.atom_features, 168 | neighbor_strategy=config.neighbor_strategy, 169 | standardize=config.atom_features != "cgcnn", 170 | id_tag=config.id_tag, 171 | pin_memory=config.pin_memory, 172 | workers=config.num_workers, 173 | save_dataloader=config.save_dataloader, 174 | use_canonize=config.use_canonize, 175 | filename=config.filename, 176 | cutoff=config.cutoff, 177 | max_neighbors=config.max_neighbors, 178 | output_features=config.model.output_features, 179 | classification_threshold=config.classification_threshold, 180 | target_multiplication_factor=config.target_multiplication_factor, 181 | standard_scalar_and_pca=config.standard_scalar_and_pca, 182 | keep_data_order=config.keep_data_order, 183 | output_dir=config.output_dir, 184 | ) 185 | 186 | train_dgl( 187 | config, 188 | train_val_test_loaders=[ 189 | train_loader, 190 | val_loader, 191 | test_loader, 192 | prepare_batch, 193 | ], 194 | ) 195 | 196 | # train_data = get_torch_dataset( 197 | 198 | 199 | if __name__ == "__main__": 200 | args = parser.parse_args(sys.argv[1:]) 201 | train_for_folder( 202 | root_dir=args.root_dir, 203 | config_name=args.config_name, 204 | id_prop_file=args.id_prop_file, 205 | keep_data_order=args.keep_data_order, 206 | classification_threshold=args.classification_threshold, 207 | output_dir=args.output_dir, 208 | batch_size=(args.batch_size), 209 | epochs=(args.epochs), 210 | file_format=(args.file_format), 211 | ) 212 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/train_props.py: -------------------------------------------------------------------------------- 1 | """Helper function for high-throughput GNN trainings.""" 2 | import matplotlib.pyplot as plt 3 | 4 | # import numpy as np 5 | import time 6 | from alignn.train import train_dgl 7 | 8 | # from sklearn.metrics import mean_absolute_error 9 | plt.switch_backend("agg") 10 | 11 | 12 | def train_prop_model( 13 | prop="", 14 | dataset="dft_3d", 15 | write_predictions=True, 16 | name="alignn", 17 | save_dataloader=False, 18 | train_ratio=None, 19 | classification_threshold=None, 20 | val_ratio=None, 21 | test_ratio=None, 22 | learning_rate=0.001, 23 | batch_size=None, 24 | scheduler=None, 25 | n_epochs=None, 26 | id_tag=None, 27 | num_workers=None, 28 | weight_decay=None, 29 | alignn_layers=None, 30 | gcn_layers=None, 31 | edge_input_features=None, 32 | triplet_input_features=None, 33 | embedding_features=None, 34 | hidden_features=None, 35 | output_features=None, 36 | random_seed=None, 37 | n_early_stopping=None, 38 | cutoff=None, 39 | max_neighbors=None, 40 | ): 41 | """Train models for a dataset and a property.""" 42 | if scheduler is None: 43 | scheduler = "onecycle" 44 | if batch_size is None: 45 | batch_size = 64 46 | if n_epochs is None: 47 | n_epochs = 300 48 | if num_workers is None: 49 | num_workers = 0 50 | config = { 51 | "dataset": dataset, 52 | "target": prop, 53 | "epochs": n_epochs, # 00,#00, 54 | "batch_size": batch_size, # 0, 55 | "weight_decay": 1e-05, 56 | "learning_rate": learning_rate, 57 | "criterion": "mse", 58 | "optimizer": "adamw", 59 | "scheduler": scheduler, 60 | "save_dataloader": save_dataloader, 61 | "pin_memory": False, 62 | "write_predictions": write_predictions, 63 | "num_workers": num_workers, 64 | "classification_threshold": classification_threshold, 65 | "model": { 66 | "name": name, 67 | }, 68 | } 69 | if n_early_stopping is not None: 70 | config["n_early_stopping"] = n_early_stopping 71 | if cutoff is not None: 72 | config["cutoff"] = cutoff 73 | if max_neighbors is not None: 74 | config["max_neighbors"] = max_neighbors 75 | if weight_decay is not None: 76 | config["weight_decay"] = weight_decay 77 | if alignn_layers is not None: 78 | config["model"]["alignn_layers"] = alignn_layers 79 | if gcn_layers is not None: 80 | config["model"]["gcn_layers"] = gcn_layers 81 | if edge_input_features is not None: 82 | config["model"]["edge_input_features"] = edge_input_features 83 | if hidden_features is not None: 84 | config["model"]["hidden_features"] = hidden_features 85 | if embedding_features is not None: 86 | config["model"]["embedding_features"] = embedding_features 87 | if output_features is not None: 88 | config["model"]["output_features"] = output_features 89 | if random_seed is not None: 90 | config["random_seed"] = random_seed 91 | # if model_name is not None: 92 | # config['model']['name']=model_name 93 | 94 | if id_tag is not None: 95 | config["id_tag"] = id_tag 96 | if train_ratio is not None: 97 | config["train_ratio"] = train_ratio 98 | if val_ratio is None: 99 | raise ValueError("Enter val_ratio.") 100 | 101 | if test_ratio is None: 102 | raise ValueError("Enter test_ratio.") 103 | config["val_ratio"] = val_ratio 104 | config["test_ratio"] = test_ratio 105 | if dataset == "jv_3d": 106 | # config["save_dataloader"]=True 107 | config["num_workers"] = 4 108 | config["pin_memory"] = False 109 | # config["learning_rate"] = 0.001 110 | # config["epochs"] = 300 111 | 112 | if dataset == "mp_3d_2020": 113 | config["id_tag"] = "id" 114 | config["num_workers"] = 0 115 | if dataset == "megnet2": 116 | config["id_tag"] = "id" 117 | config["num_workers"] = 0 118 | if dataset == "megnet": 119 | config["id_tag"] = "id" 120 | if prop == "e_form" or prop == "gap pbe": 121 | config["n_train"] = 60000 122 | config["n_val"] = 5000 123 | config["n_test"] = 4239 124 | # config["learning_rate"] = 0.01 125 | # config["epochs"] = 300 126 | config["num_workers"] = 4 127 | if dataset == "oqmd_3d_no_cfid": 128 | config["id_tag"] = "_oqmd_entry_id" 129 | config["num_workers"] = 0 130 | if dataset == "hmof" and prop == "co2_absp": 131 | config["model"]["output_features"] = 5 132 | if dataset == "edos_pdos": 133 | if prop == "edos_up": 134 | config["model"]["output_features"] = 300 135 | elif prop == "pdos_elast": 136 | config["model"]["output_features"] = 200 137 | else: 138 | raise ValueError("Target not available.") 139 | if dataset == "qm9_std_jctc": 140 | config["id_tag"] = "id" 141 | config["n_train"] = 110000 142 | config["n_val"] = 10000 143 | config["n_test"] = 10829 144 | 145 | # config["batch_size"] = 64 146 | config["cutoff"] = 5.0 147 | config["standard_scalar_and_pca"] = False 148 | 149 | if dataset == "qm9_dgl": 150 | config["id_tag"] = "id" 151 | config["n_train"] = 110000 152 | config["n_val"] = 10000 153 | config["n_test"] = 10831 154 | config["standard_scalar_and_pca"] = False 155 | config["batch_size"] = 64 156 | config["cutoff"] = 5.0 157 | if config["target"] == "all": 158 | config["model"]["output_features"] = 12 159 | 160 | # config["max_neighbors"] = 9 161 | 162 | if dataset == "hpov": 163 | config["id_tag"] = "id" 164 | if dataset == "qm9": 165 | config["id_tag"] = "id" 166 | config["n_train"] = 110000 167 | config["n_val"] = 10000 168 | config["n_test"] = 13885 169 | config["batch_size"] = batch_size 170 | config["cutoff"] = 5.0 171 | config["max_neighbors"] = 9 172 | # config['atom_features']='atomic_number' 173 | if prop in ["homo", "lumo", "gap", "zpve", "U0", "U", "H", "G"]: 174 | config["target_multiplication_factor"] = 27.211386024367243 175 | t1 = time.time() 176 | result = train_dgl(config) 177 | t2 = time.time() 178 | print("train=", result["train"]) 179 | print("validation=", result["validation"]) 180 | print("Toal time:", t2 - t1) 181 | print() 182 | print() 183 | print() 184 | -------------------------------------------------------------------------------- /FeatureExtraction/alignn/utils.py: -------------------------------------------------------------------------------- 1 | """Shared pydantic settings configuration.""" 2 | import json 3 | from pathlib import Path 4 | from typing import Union 5 | import matplotlib.pyplot as plt 6 | 7 | from pydantic import BaseSettings as PydanticBaseSettings 8 | 9 | 10 | class BaseSettings(PydanticBaseSettings): 11 | """Add configuration to default Pydantic BaseSettings.""" 12 | 13 | class Config: 14 | """Configure BaseSettings behavior.""" 15 | 16 | extra = "forbid" 17 | use_enum_values = True 18 | env_prefix = "jv_" 19 | 20 | 21 | def plot_learning_curve( 22 | results_dir: Union[str, Path], key: str = "mae", plot_train: bool = False 23 | ): 24 | """Plot learning curves based on json history files.""" 25 | if isinstance(results_dir, str): 26 | results_dir = Path(results_dir) 27 | 28 | with open(results_dir / "history_val.json", "r") as f: 29 | val = json.load(f) 30 | 31 | p = plt.plot(val[key], label=results_dir.name) 32 | 33 | if plot_train: 34 | # plot the training trace in the same color, lower opacity 35 | with open(results_dir / "history_train.json", "r") as f: 36 | train = json.load(f) 37 | 38 | c = p[0].get_color() 39 | plt.plot(train[key], alpha=0.5, c=c) 40 | 41 | plt.xlabel("epochs") 42 | plt.ylabel(key) 43 | 44 | return train, val 45 | -------------------------------------------------------------------------------- /FeatureExtraction/create_features.sh: -------------------------------------------------------------------------------- 1 | for filename in ../examples/*.vasp; do 2 | python alignn/pretrained_activation.py --model_name mp_e_form_alignnn --file_format poscar --file_path "$filename" --output_path "../examples/data" 3 | done 4 | -------------------------------------------------------------------------------- /FineTuning/README.md: -------------------------------------------------------------------------------- 1 | # ALIGNNTL: Fine-Tuning 2 | 3 | This directory contains information on how to perform fine-tuning using ALIGNN. 4 | 5 | ### Instructions 6 | 7 | The user requires following files in order to start training a model using fine-tuning method 8 | * Sturcture files - contains structure information for a given material (format: `POSCAR`, `.cif`, `.xyz` or `.pdb`) 9 | * Input-Property file - contains name of the structure file and its corresponding property value (format: `.csv`) 10 | * Configuration file - configuration file with hyperparamters associated with training the model (format: `.json`) 11 | * Pre-trained model - model trained using ALIGNN using any specific materials property (format: `.zip`) 12 | 13 | We have provided the an example of Sturcture files (`POSCAR` files), Input-Property file (`id_prop.csv`) and Configuration file (`config_example.json`) in [`examples`](../examples). Download the pre-trained model trained on large datasets from here. 14 | 15 | Now, in order to perform fine-tuning based transfer learning, add the details regarding the model in the `all_models` dictionary inside the `train.py` file as described below: 16 | ``` 17 | all_models = { 18 | name of the file: [link to the pre-trained model (optional), number of outputs], 19 | name of the file 2: [link to the pre-trained model 2 (optional), number of outputs], 20 | ... 21 | } 22 | ``` 23 | If the link to the pre-trained model is not provided inside the `all_models` dictionary, place the zip file of the pre-trained model inside the [`alignn`](./alignn) folder. Once the setup for the pre-trained model is done, the fine-tuning based model training can be performed as follows: 24 | ``` 25 | python alignn/train_folder.py --root_dir "../examples" --config "../examples/config_example.json" --id_prop_file "id_prop.csv" --output_dir=model 26 | ``` 27 | Make sure that the Input-Property file `--id_prop_file` is placed inside the root directory `--root_dir` where Sturcture files are present. 28 | -------------------------------------------------------------------------------- /FineTuning/alignn/__init__.py: -------------------------------------------------------------------------------- 1 | """Version number.""" 2 | __version__ = "2021.11.16" 3 | -------------------------------------------------------------------------------- /FineTuning/alignn/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/__init__.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/__pycache__/config.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/__pycache__/config.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/__pycache__/data.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/__pycache__/data.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/__pycache__/train.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/__pycache__/train.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/__pycache__/utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/__pycache__/utils.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/cli.py: -------------------------------------------------------------------------------- 1 | """Ignite training cli.""" 2 | 3 | import json 4 | import os 5 | import shutil 6 | from pathlib import Path 7 | 8 | # from typing import Any, Dict, Optional, Union 9 | from typing import Optional 10 | 11 | import torch 12 | import typer 13 | 14 | from alignn.config import TrainingConfig 15 | from alignn.profile import profile_dgl 16 | from alignn.train import train_dgl 17 | 18 | 19 | def cli( 20 | config: Optional[Path] = typer.Argument(None), 21 | progress: bool = False, 22 | checkpoint_dir: Path = Path("/tmp/models"), 23 | store_outputs: bool = False, 24 | tensorboard: bool = False, 25 | profile: bool = False, 26 | ): 27 | """ALIGNN training cli. 28 | 29 | config: path to json config file (conform to TrainingConfig) 30 | progress: enable tqdm console logging 31 | tensorboard: enable tensorboard logging 32 | profile: run profiling script for one epoch instead of training 33 | """ 34 | model_dir = config.parent 35 | 36 | if config is None: 37 | model_dir = os.getcwd() 38 | config = TrainingConfig(epochs=10, n_train=32, n_val=32, batch_size=16) 39 | 40 | elif config.is_file(): 41 | model_dir = config.parent 42 | with open(config, "r") as f: 43 | config = json.load(f) 44 | config = TrainingConfig(**config) 45 | 46 | if profile: 47 | profile_dgl(config) 48 | return 49 | 50 | hist = train_dgl( 51 | config, 52 | progress=progress, 53 | checkpoint_dir=checkpoint_dir, 54 | store_outputs=store_outputs, 55 | log_tensorboard=tensorboard, 56 | ) 57 | 58 | # print(model_dir) 59 | # with open(model_dir / "metrics.json", "w") as f: 60 | # json.dump(hist, f) 61 | 62 | torch.save(hist, model_dir / "metrics.pt") 63 | 64 | with open(model_dir / "fullconfig.json", "w") as f: 65 | json.dump(json.loads(config.json()), f, indent=2) 66 | 67 | # move temporary checkpoint data into model_dir 68 | for checkpoint in checkpoint_dir.glob("*.pt"): 69 | shutil.copy(checkpoint, model_dir / checkpoint.name) 70 | 71 | 72 | if __name__ == "__main__": 73 | typer.run(cli) 74 | -------------------------------------------------------------------------------- /FineTuning/alignn/config.py: -------------------------------------------------------------------------------- 1 | """Pydantic model for default configuration and validation.""" 2 | 3 | import subprocess 4 | from typing import Optional, Union 5 | import os 6 | from pydantic import root_validator 7 | 8 | # vfrom pydantic import Field, root_validator, validator 9 | from pydantic.typing import Literal 10 | from alignn.utils import BaseSettings 11 | from alignn.models.modified_cgcnn import CGCNNConfig 12 | from alignn.models.icgcnn import ICGCNNConfig 13 | from alignn.models.gcn import SimpleGCNConfig 14 | from alignn.models.densegcn import DenseGCNConfig 15 | from alignn.models.alignn import ALIGNNConfig 16 | from alignn.models.dense_alignn import DenseALIGNNConfig 17 | from alignn.models.alignn_cgcnn import ACGCNNConfig 18 | from alignn.models.alignn_layernorm import ALIGNNConfig as ALIGNN_LN_Config 19 | 20 | # from typing import List 21 | 22 | try: 23 | VERSION = ( 24 | subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip() 25 | ) 26 | except Exception as exp: 27 | VERSION = "NA" 28 | pass 29 | 30 | 31 | FEATURESET_SIZE = {"basic": 11, "atomic_number": 1, "cfid": 438, "cgcnn": 92} 32 | 33 | 34 | TARGET_ENUM = Literal[ 35 | "formation_energy_peratom", 36 | "optb88vdw_bandgap", 37 | "bulk_modulus_kv", 38 | "shear_modulus_gv", 39 | "mbj_bandgap", 40 | "slme", 41 | "magmom_oszicar", 42 | "spillage", 43 | "kpoint_length_unit", 44 | "encut", 45 | "optb88vdw_total_energy", 46 | "epsx", 47 | "epsy", 48 | "epsz", 49 | "mepsx", 50 | "mepsy", 51 | "mepsz", 52 | "max_ir_mode", 53 | "min_ir_mode", 54 | "n-Seebeck", 55 | "p-Seebeck", 56 | "n-powerfact", 57 | "p-powerfact", 58 | "ncond", 59 | "pcond", 60 | "nkappa", 61 | "pkappa", 62 | "ehull", 63 | "exfoliation_energy", 64 | "dfpt_piezo_max_dielectric", 65 | "dfpt_piezo_max_eij", 66 | "dfpt_piezo_max_dij", 67 | "gap pbe", 68 | "e_form", 69 | "e_hull", 70 | "energy_per_atom", 71 | "formation_energy_per_atom", 72 | "band_gap", 73 | "e_above_hull", 74 | "mu_b", 75 | "bulk modulus", 76 | "shear modulus", 77 | "elastic anisotropy", 78 | "U0", 79 | "HOMO", 80 | "LUMO", 81 | "R2", 82 | "ZPVE", 83 | "omega1", 84 | "mu", 85 | "alpha", 86 | "homo", 87 | "lumo", 88 | "gap", 89 | "r2", 90 | "zpve", 91 | "U", 92 | "H", 93 | "G", 94 | "Cv", 95 | "A", 96 | "B", 97 | "C", 98 | "all", 99 | "target", 100 | "max_efg", 101 | "avg_elec_mass", 102 | "avg_hole_mass", 103 | "_oqmd_band_gap", 104 | "_oqmd_delta_e", 105 | "_oqmd_stability", 106 | "edos_up", 107 | "pdos_elast", 108 | "bandgap", 109 | "energy_total", 110 | "net_magmom", 111 | "b3lyp_homo", 112 | "b3lyp_lumo", 113 | "b3lyp_gap", 114 | "b3lyp_scharber_pce", 115 | "b3lyp_scharber_voc", 116 | "b3lyp_scharber_jsc", 117 | "log_kd_ki", 118 | "max_co2_adsp", 119 | "min_co2_adsp", 120 | "lcd", 121 | "pld", 122 | "void_fraction", 123 | "surface_area_m2g", 124 | "surface_area_m2cm3", 125 | "co2_absp", 126 | ] 127 | 128 | 129 | class TrainingConfig(BaseSettings): 130 | """Training config defaults and validation.""" 131 | 132 | version: str = VERSION 133 | 134 | # dataset configuration 135 | dataset: Literal[ 136 | "dft_3d", 137 | "jdft_3d-8-18-2021", 138 | "dft_2d", 139 | "megnet", 140 | "megnet2", 141 | "mp_3d_2020", 142 | "qm9", 143 | "qm9_dgl", 144 | "qm9_std_jctc", 145 | "user_data", 146 | "oqmd_3d_no_cfid", 147 | "edos_up", 148 | "edos_pdos", 149 | "qmof", 150 | "hmof", 151 | "hpov", 152 | "pdbbind", 153 | "pdbbind_core", 154 | ] = "dft_3d" 155 | target: TARGET_ENUM = "formation_energy_peratom" 156 | atom_features: Literal["basic", "atomic_number", "cfid", "cgcnn"] = "cgcnn" 157 | neighbor_strategy: Literal["k-nearest", "voronoi"] = "k-nearest" 158 | id_tag: Literal["jid", "id", "_oqmd_entry_id"] = "jid" 159 | 160 | # logging configuration 161 | 162 | # training configuration 163 | random_seed: Optional[int] = 123 164 | classification_threshold: Optional[float] = None 165 | # target_range: Optional[List] = None 166 | n_val: Optional[int] = None 167 | n_test: Optional[int] = None 168 | n_train: Optional[int] = None 169 | train_ratio: Optional[float] = 0.8 170 | val_ratio: Optional[float] = 0.1 171 | test_ratio: Optional[float] = 0.1 172 | source_model: Optional[str] = None 173 | target_multiplication_factor: Optional[float] = None 174 | epochs: int = 300 175 | batch_size: int = 64 176 | weight_decay: float = 0 177 | learning_rate: float = 1e-2 178 | filename: str = "sample" 179 | warmup_steps: int = 2000 180 | criterion: Literal["mse", "l1", "poisson", "zig"] = "mse" 181 | optimizer: Literal["adamw", "sgd"] = "adamw" 182 | scheduler: Literal["onecycle", "none"] = "onecycle" 183 | pin_memory: bool = False 184 | save_dataloader: bool = False 185 | write_checkpoint: bool = True 186 | write_predictions: bool = True 187 | store_outputs: bool = True 188 | progress: bool = True 189 | log_tensorboard: bool = False 190 | standard_scalar_and_pca: bool = False 191 | use_canonize: bool = True 192 | num_workers: int = 4 193 | cutoff: float = 8.0 194 | max_neighbors: int = 12 195 | keep_data_order: bool = False 196 | distributed: bool = False 197 | n_early_stopping: Optional[int] = None # typically 50 198 | output_dir: str = os.path.abspath(".") # typically 50 199 | # alignn_layers: int = 4 200 | # gcn_layers: int =4 201 | # edge_input_features: int= 80 202 | # hidden_features: int= 256 203 | # triplet_input_features: int=40 204 | # embedding_features: int=64 205 | 206 | # model configuration 207 | model: Union[ 208 | CGCNNConfig, 209 | ICGCNNConfig, 210 | SimpleGCNConfig, 211 | DenseGCNConfig, 212 | ALIGNNConfig, 213 | ALIGNN_LN_Config, 214 | DenseALIGNNConfig, 215 | ACGCNNConfig, 216 | ] = ALIGNNConfig(name="alignn") 217 | # ] = CGCNNConfig(name="cgcnn") 218 | 219 | @root_validator() 220 | def set_input_size(cls, values): 221 | """Automatically configure node feature dimensionality.""" 222 | values["model"].atom_input_features = FEATURESET_SIZE[ 223 | values["atom_features"] 224 | ] 225 | 226 | return values 227 | 228 | # @property 229 | # def atom_input_features(self): 230 | # """Automatically configure node feature dimensionality.""" 231 | # return FEATURESET_SIZE[self.atom_features] 232 | -------------------------------------------------------------------------------- /FineTuning/alignn/models/__init__.py: -------------------------------------------------------------------------------- 1 | """Graph neural network implementations.""" 2 | # from alignn.models.alignn import ALIGNN, ALIGNNConfig 3 | # from alignn.models.cgcnn import CGCNN, CGCNNConfig 4 | # from alignn.models.dense_alignn import DenseALIGNN, DenseALIGNNConfig 5 | # from alignn.models.densegcn import DenseGCN, DenseGCNConfig 6 | # from alignn.models.gcn import SimpleGCN, SimpleGCNConfig 7 | # from alignn.models.icgcnn import ICGCNNConfig, iCGCNN 8 | -------------------------------------------------------------------------------- /FineTuning/alignn/models/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__init__.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/alignn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/alignn.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/alignn_cgcnn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/alignn_cgcnn.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/alignn_layernorm.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/alignn_layernorm.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/dense_alignn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/dense_alignn.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/densegcn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/densegcn.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/gcn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/gcn.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/icgcnn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/icgcnn.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/modified_cgcnn.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/modified_cgcnn.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/__pycache__/utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NU-CUCIS/ALIGNNTL/99129068aec7251fb67b6219d7ec9c8aa749fefd/FineTuning/alignn/models/__pycache__/utils.cpython-38.pyc -------------------------------------------------------------------------------- /FineTuning/alignn/models/densegcn.py: -------------------------------------------------------------------------------- 1 | """A baseline graph convolution network dgl implementation.""" 2 | from typing import List, Optional 3 | 4 | import dgl 5 | import torch 6 | from dgl.nn import AvgPooling, GraphConv 7 | from pydantic.typing import Literal 8 | from torch import nn 9 | from torch.nn import functional as F 10 | 11 | from alignn.utils import BaseSettings 12 | 13 | 14 | class DenseGCNConfig(BaseSettings): 15 | """Hyperparameter schema for jarvisdgl.models.densegcn.""" 16 | 17 | name: Literal["densegcn"] 18 | atom_input_features: int = 1 19 | edge_lengthscale: float = 4.0 20 | weight_edges: bool = True 21 | conv_layers: int = 4 22 | node_features: int = 32 23 | growth_rate: int = 32 24 | output_features: int = 1 25 | classification: bool = False 26 | 27 | class Config: 28 | """Configure model settings behavior.""" 29 | 30 | env_prefix = "jv_model" 31 | 32 | 33 | class _DenseLayer(nn.Module): 34 | """BatchNorm-ReLU-GraphConv Dense layer.""" 35 | 36 | def __init__(self, in_features: int, growth_rate: int): 37 | super().__init__() 38 | self.bn = nn.BatchNorm1d(in_features) 39 | self.conv = GraphConv(in_features, growth_rate) 40 | 41 | def forward( 42 | self, 43 | g: dgl.DGLGraph, 44 | input: List[torch.Tensor], 45 | edge_weight: Optional[torch.Tensor], 46 | ): 47 | 48 | prev_features = F.relu(self.bn(torch.cat(input, 1))) 49 | new_features = self.conv(g, prev_features, edge_weight=edge_weight) 50 | 51 | return new_features 52 | 53 | 54 | class _DenseBlock(nn.ModuleDict): 55 | """Block of densely-connected bn-ReLU-conv layers.""" 56 | 57 | def __init__(self, n_layers: int, in_features: int, growth_rate: int): 58 | super().__init__() 59 | for id_layer in range(n_layers): 60 | layer = _DenseLayer( 61 | in_features + id_layer * growth_rate, growth_rate 62 | ) 63 | self.add_module(f"denselayer{1+id_layer}", layer) 64 | 65 | def forward( 66 | self, 67 | g: dgl.DGLGraph, 68 | node_features: torch.Tensor, 69 | edge_weight: Optional[torch.Tensor] = None, 70 | ): 71 | features = [node_features] 72 | for name, layer in self.items(): 73 | new_features = layer(g, features, edge_weight=edge_weight) 74 | features.append(new_features) 75 | return torch.cat(features, 1) 76 | 77 | 78 | class DenseGCN(nn.Module): 79 | """GraphConv GCN with DenseNet-style connections.""" 80 | 81 | def __init__( 82 | self, config: DenseGCNConfig = DenseGCNConfig(name="densegcn") 83 | ): 84 | """Initialize class with number of input features, conv layers.""" 85 | super().__init__() 86 | print(config) 87 | self.edge_lengthscale = config.edge_lengthscale 88 | self.weight_edges = config.weight_edges 89 | 90 | self.atom_embedding = nn.Linear( 91 | config.atom_input_features, config.node_features 92 | ) 93 | 94 | self.bn = nn.BatchNorm1d(config.node_features) 95 | 96 | # bn-relu-conv 97 | self.dense_layers = _DenseBlock( 98 | config.conv_layers, config.node_features, config.growth_rate 99 | ) 100 | 101 | final_size = ( 102 | config.node_features + config.conv_layers * config.growth_rate 103 | ) 104 | 105 | self.bn_final = nn.BatchNorm1d(final_size) 106 | 107 | self.readout = AvgPooling() 108 | 109 | self.fc = nn.Linear(final_size, config.output_features) 110 | 111 | def forward(self, g): 112 | """Baseline SimpleGCN : start with `atom_features`.""" 113 | g = g.local_var() 114 | 115 | if self.weight_edges: 116 | r = torch.norm(g.edata["r"], dim=1) 117 | edge_weights = torch.exp(-(r ** 2) / self.edge_lengthscale ** 2) 118 | else: 119 | edge_weights = None 120 | 121 | # initial node features: atom feature network... 122 | # conv-bn-relu 123 | v = g.ndata.pop("atom_features") 124 | node_features = self.atom_embedding(v) 125 | node_features = F.relu(self.bn(node_features)) 126 | 127 | # bn-relu-conv 128 | h = self.dense_layers(g, node_features, edge_weight=edge_weights) 129 | 130 | # norm-relu-pool-classify 131 | h = F.relu(self.bn_final(h)) 132 | 133 | h = self.readout(g, h) 134 | 135 | out = self.fc(h) 136 | 137 | return torch.squeeze(out) 138 | -------------------------------------------------------------------------------- /FineTuning/alignn/models/gcn.py: -------------------------------------------------------------------------------- 1 | """A baseline graph convolution network dgl implementation.""" 2 | # import dgl 3 | import torch 4 | from dgl.nn import AvgPooling, GraphConv 5 | from pydantic.typing import Literal 6 | from torch import nn 7 | from torch.nn import functional as F 8 | 9 | from alignn.utils import BaseSettings 10 | 11 | 12 | class SimpleGCNConfig(BaseSettings): 13 | """Hyperparameter schema for jarvisdgl.models.gcn.""" 14 | 15 | name: Literal["simplegcn"] 16 | atom_input_features: int = 1 17 | weight_edges: bool = True 18 | width: int = 64 19 | output_features: int = 1 20 | 21 | class Config: 22 | """Configure model settings behavior.""" 23 | 24 | env_prefix = "jv_model" 25 | 26 | 27 | class SimpleGCN(nn.Module): 28 | """GraphConv GCN with DenseNet-style connections.""" 29 | 30 | def __init__( 31 | self, config: SimpleGCNConfig = SimpleGCNConfig(name="simplegcn") 32 | ): 33 | """Initialize class with number of input features, conv layers.""" 34 | super().__init__() 35 | self.edge_lengthscale = config.edge_lengthscale 36 | self.weight_edges = config.weight_edges 37 | 38 | self.atom_embedding = nn.Linear( 39 | config.atom_input_features, config.width 40 | ) 41 | 42 | self.layer1 = GraphConv(config.width, config.width) 43 | self.layer2 = GraphConv(config.width, config.output_features) 44 | self.readout = AvgPooling() 45 | 46 | def forward(self, g): 47 | """Baseline SimpleGCN : start with `atom_features`.""" 48 | g = g.local_var() 49 | 50 | if self.weight_edges: 51 | r = torch.norm(g.edata["bondlength"], dim=1) 52 | edge_weights = torch.exp(-(r ** 2) / self.edge_lengthscale ** 2) 53 | else: 54 | edge_weights = None 55 | 56 | # initial node features: atom feature network... 57 | v = g.ndata.pop("atom_features") 58 | node_features = self.atom_embedding(v) 59 | 60 | x = F.relu(self.layer1(g, node_features, edge_weight=edge_weights)) 61 | x = self.layer2(g, x, edge_weight=edge_weights) 62 | x = self.readout(g, x) 63 | 64 | return torch.squeeze(x) 65 | -------------------------------------------------------------------------------- /FineTuning/alignn/models/icgcnn.py: -------------------------------------------------------------------------------- 1 | """CGCNN: dgl implementation.""" 2 | 3 | from typing import Tuple 4 | import dgl 5 | import dgl.function as fn 6 | 7 | # import numpy as np 8 | import torch 9 | import torch.nn.functional as F 10 | from dgl.nn import AvgPooling 11 | from pydantic.typing import Literal 12 | from torch import nn 13 | 14 | from alignn.models.utils import RBFExpansion 15 | from alignn.utils import BaseSettings 16 | 17 | 18 | class ICGCNNConfig(BaseSettings): 19 | """Hyperparameter schema for jarvisdgl.models.icgcnn.""" 20 | 21 | name: Literal["icgcnn"] 22 | conv_layers: int = 3 23 | atom_input_features: int = 1 24 | edge_features: int = 16 25 | node_features: int = 64 26 | fc_layers: int = 1 27 | fc_features: int = 64 28 | output_features: int = 1 29 | 30 | # if logscale is set, apply `exp` to final outputs 31 | # to constrain predictions to be positive 32 | logscale: bool = False 33 | hurdle: bool = False 34 | classification: bool = False 35 | 36 | class Config: 37 | """Configure model settings behavior.""" 38 | 39 | env_prefix = "jv_model" 40 | 41 | 42 | class CGCNNUpdate(nn.Module): 43 | """Helper nn.Module for CGCNN-style updates.""" 44 | 45 | def __init__(self, in_features: int, out_features: int): 46 | """Set up CGCNN internal parameters.""" 47 | super().__init__() 48 | 49 | # edge interaction model (W_f / W_1) 50 | self.conv = nn.Sequential( 51 | nn.Linear(in_features, out_features), 52 | nn.BatchNorm1d(out_features), 53 | nn.Sigmoid(), 54 | ) 55 | 56 | # edge attention model (W_s / W_2) 57 | self.screen = nn.Sequential( 58 | nn.Linear(in_features, out_features), 59 | nn.BatchNorm1d(out_features), 60 | nn.Softplus(), 61 | ) 62 | 63 | def forward(self, x: torch.Tensor): 64 | """Apply CGCNNConv-style update.""" 65 | return self.conv(x) * self.screen(x) 66 | 67 | 68 | class iCGCNNConv(nn.Module): 69 | """Park and Wolverton iCGCNN convolution. 70 | 71 | 10.1103/PhysRevMaterials.4.063801 72 | 73 | In the papers, nodes are v_i, v_j, edges are u_ij 74 | In DGL, nodes are u (src) and v (dst), edges are e 75 | """ 76 | 77 | def __init__(self, node_features: int = 64, edge_features: int = 32): 78 | """Initialize torch modules for iCGCNNConv layer.""" 79 | super().__init__() 80 | self.node_features = node_features 81 | self.edge_features = edge_features 82 | 83 | # iCGCNNConv has a node update and an edge update 84 | # each update has a pairwise and triplet interaction term 85 | 86 | # pairwise features: 87 | # z_ij = cat(v_i, v_j, u_ij) 88 | pair_sz = 2 * self.node_features + self.edge_features 89 | 90 | # triplet features: 91 | # z_ijl = cat(v_i, v_j, v_l, u_ij, u_il) 92 | triple_sz = 3 * self.node_features + 2 * self.edge_features 93 | 94 | # node update functions 95 | self.node_pair_update = CGCNNUpdate(pair_sz, self.node_features) 96 | self.node_triple_update = CGCNNUpdate(triple_sz, self.node_features) 97 | 98 | # edge update functions 99 | self.edge_pair_update = CGCNNUpdate(pair_sz, self.edge_features) 100 | self.edge_triple_update = CGCNNUpdate(triple_sz, self.edge_features) 101 | 102 | # final batchnorm 103 | self.node_bn = nn.BatchNorm1d(self.node_features) 104 | self.edge_bn = nn.BatchNorm1d(self.edge_features) 105 | 106 | def combine_edge_features(self, edges): 107 | """Edge update for iCGCNNConv. 108 | 109 | concatenate source and destination node features with edge features 110 | then apply the edge update modulated by the edge interaction model 111 | """ 112 | # form augmented edge features z_ij = [v_i, v_j, u_ij] 113 | z = torch.cat((edges.src["h"], edges.dst["h"], edges.data["h"]), dim=1) 114 | 115 | return {"z_pair": z} 116 | 117 | def combine_triplet_features(self, edges): 118 | """Line graph edge update for iCGCNNConv.""" 119 | z_ijl = torch.cat( 120 | ( 121 | edges.src["src_h"], 122 | edges.src["dst_h"], 123 | edges.dst["dst_h"], 124 | edges.src["h"], 125 | edges.dst["h"], 126 | ), 127 | dim=1, 128 | ) 129 | return {"z_triple": z_ijl} 130 | 131 | def forward( 132 | self, 133 | g: dgl.DGLGraph, 134 | node_feats: torch.Tensor, 135 | edge_feats: torch.Tensor, 136 | ) -> Tuple[torch.Tensor, torch.Tensor]: 137 | """CGCNN convolution defined in Eq 1, 2, and 3. 138 | 139 | 10.1103/PhysRevMaterials.4.063801 140 | 141 | This convolution function forms z_ij and z_ijl tensors 142 | and performs two aggregrations each: 143 | one to update node features and one to update edge features 144 | """ 145 | g = g.local_var() 146 | 147 | g.ndata["h"] = node_feats 148 | g.edata["h"] = edge_feats 149 | 150 | # propagate node features to line graph nodes 151 | g.apply_edges( 152 | func=lambda edges: { 153 | "src_h": edges.src["h"], 154 | "dst_h": edges.dst["h"], 155 | } 156 | ) 157 | 158 | # line graph edge == pairs of bonds (u,v), (v,w) 159 | # z_ijl = cat(src[src], src[dst], dst[dst]) 160 | lg = dgl.line_graph(g, shared=True) 161 | 162 | # both node and edge updates need both z_ij and z_ijl 163 | # compute these separately with apply_edges 164 | # apply multiple linear maps within that message function 165 | # then propagate them with separate update_all call each 166 | 167 | # compute z_ij (n_pairs, pair_sz) 168 | g.apply_edges(self.combine_edge_features) 169 | z_pair = g.edata.pop("z_pair") 170 | 171 | # compute z_ijl_kk' (n_triples, triple_sz) 172 | lg.apply_edges(self.combine_triplet_features) 173 | z_triple = lg.edata.pop("z_triple") 174 | 175 | # node update: eqs 1 and 2 176 | # eq 1 (pre-reduction) (n_edges, node_sz) 177 | # reduces to (n_nodes, node_sz) 178 | h_node_pair = self.node_pair_update(z_pair) 179 | 180 | # eq 2 (pre-reduction) (n_triples, node_sz) 181 | # reduces to (n_nodes, node_sz) 182 | h_node_triple = self.node_triple_update(z_triple) 183 | 184 | # edge update: eq 3 185 | # eq 3 term 1 (n_edges, edge_sz) 186 | # no reduction needed 187 | h_edge_pair = self.edge_pair_update(z_pair) 188 | 189 | # eq 3 term 2 (pre-reduction) (n_triples, edge_sz) 190 | # reduces to (n_edges, edge_sz) 191 | h_edge_triple = self.edge_triple_update(z_triple) 192 | 193 | # aggregate triple features to edges, then edges to nodes 194 | lg.edata["h_node_triple"] = h_node_triple 195 | lg.edata["h_edge_triple"] = h_edge_triple 196 | 197 | # triple -> edge aggregation (i.e. LG edges to LG nodes) 198 | # partial summation in Eq 2 (sum over l, k') 199 | lg.update_all( 200 | fn.copy_e("h_node_triple", "h_node_triple"), 201 | fn.sum("h_node_triple", "h_node_triple"), 202 | ) 203 | # sum over l, k' in Eq 3 204 | lg.update_all( 205 | fn.copy_e("h_edge_triple", "h_edge_triple"), 206 | fn.sum("h_edge_triple", "h_edge_triple"), 207 | ) 208 | 209 | # further aggregate triplet features to nodes 210 | # complete summation in eq 2 (sum over j, k) 211 | g.edata["h_node_triple"] = lg.ndata.pop("h_node_triple") 212 | g.update_all( 213 | fn.copy_e("h_node_triple", "h_node_triple"), 214 | fn.sum("h_node_triple", "h_node_triple"), 215 | ) 216 | 217 | # edge-wise reduction in eq 1 (sum over j,k) 218 | g.edata["h_node_pair"] = h_node_pair 219 | g.update_all( 220 | message_func=fn.copy_e("h_node_pair", "h_node_pair"), 221 | reduce_func=fn.sum("h_node_pair", "h_node_pair"), 222 | ) 223 | 224 | # final batchnorm 225 | h_node = g.ndata.pop("h_node_pair") + g.ndata.pop("h_node_triple") 226 | h_node = self.node_bn(h_node) 227 | 228 | h_edge = h_edge_pair + lg.ndata.pop("h_edge_triple") 229 | h_edge = self.edge_bn(h_edge) 230 | 231 | # residual connection plus nonlinearity 232 | return F.softplus(node_feats + h_node), F.softplus(edge_feats + h_edge) 233 | 234 | 235 | class iCGCNN(nn.Module): 236 | """iCGCNN dgl implementation.""" 237 | 238 | def __init__(self, config: ICGCNNConfig = ICGCNNConfig(name="icgcnn")): 239 | """Set up CGCNN modules.""" 240 | super().__init__() 241 | 242 | self.rbf = RBFExpansion(vmin=0, vmax=8.0, bins=config.edge_features) 243 | self.atom_embedding = nn.Linear( 244 | config.atom_input_features, config.node_features 245 | ) 246 | self.classification = config.classification 247 | self.conv_layers = nn.ModuleList( 248 | [ 249 | iCGCNNConv(config.node_features, config.edge_features) 250 | for _ in range(config.conv_layers) 251 | ] 252 | ) 253 | 254 | self.readout = AvgPooling() 255 | 256 | self.fc = nn.Sequential( 257 | nn.Linear(config.node_features, config.fc_features), nn.Softplus() 258 | ) 259 | 260 | if self.classification: 261 | self.fc_out = nn.Linear(config.fc_features, 2) 262 | self.softmax = nn.LogSoftmax(dim=1) 263 | else: 264 | self.fc_out = nn.Linear(config.fc_features, config.output_features) 265 | 266 | self.logscale = config.logscale 267 | 268 | def forward(self, g) -> torch.Tensor: 269 | """CGCNN function mapping graph to outputs.""" 270 | g, lg = g 271 | g = g.local_var() 272 | 273 | # fixed edge features: RBF-expanded bondlengths 274 | bondlength = torch.norm(g.edata.pop("r"), dim=1) 275 | h_edge = self.rbf(bondlength) 276 | 277 | # initial node features: atom feature network... 278 | v = g.ndata.pop("atom_features") 279 | h_node = self.atom_embedding(v) 280 | 281 | # CGCNN-Conv block: update node features 282 | for conv_layer in self.conv_layers: 283 | h_node, h_edge = conv_layer(g, h_node, h_edge) 284 | 285 | # crystal-level readout 286 | features = self.readout(g, h_node) 287 | features = F.softplus(features) 288 | features = self.fc(features) 289 | features = F.softplus(features) 290 | 291 | out = self.fc_out(features) 292 | 293 | if self.logscale: 294 | out = torch.exp(out) 295 | if self.classification: 296 | # out = torch.round(torch.sigmoid(out)) 297 | out = self.softmax(out) 298 | 299 | return torch.squeeze(out) 300 | -------------------------------------------------------------------------------- /FineTuning/alignn/models/utils.py: -------------------------------------------------------------------------------- 1 | """Shared model-building components.""" 2 | from typing import Optional 3 | 4 | import numpy as np 5 | import torch 6 | from torch import nn 7 | 8 | 9 | class RBFExpansion(nn.Module): 10 | """Expand interatomic distances with radial basis functions.""" 11 | 12 | def __init__( 13 | self, 14 | vmin: float = 0, 15 | vmax: float = 8, 16 | bins: int = 40, 17 | lengthscale: Optional[float] = None, 18 | ): 19 | """Register torch parameters for RBF expansion.""" 20 | super().__init__() 21 | self.vmin = vmin 22 | self.vmax = vmax 23 | self.bins = bins 24 | self.register_buffer( 25 | "centers", torch.linspace(self.vmin, self.vmax, self.bins) 26 | ) 27 | 28 | if lengthscale is None: 29 | # SchNet-style 30 | # set lengthscales relative to granularity of RBF expansion 31 | self.lengthscale = np.diff(self.centers).mean() 32 | self.gamma = 1 / self.lengthscale 33 | 34 | else: 35 | self.lengthscale = lengthscale 36 | self.gamma = 1 / (lengthscale ** 2) 37 | 38 | def forward(self, distance: torch.Tensor) -> torch.Tensor: 39 | """Apply RBF expansion to interatomic distance tensor.""" 40 | #print(torch.exp(-self.gamma * (distance.unsqueeze(1) - self.centers) ** 2).shape) 41 | return torch.exp( 42 | -self.gamma * (distance.unsqueeze(1) - self.centers) ** 2 43 | ) 44 | -------------------------------------------------------------------------------- /FineTuning/alignn/pretrained.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Module to download and load pre-trained ALIGNN models.""" 4 | import requests 5 | import os 6 | import zipfile 7 | from tqdm import tqdm 8 | from alignn.models.alignn import ALIGNN, ALIGNNConfig 9 | import tempfile 10 | import torch 11 | import sys 12 | from jarvis.db.jsonutils import loadjson 13 | import argparse 14 | from jarvis.core.atoms import Atoms 15 | from jarvis.core.graphs import Graph 16 | 17 | # Name of the model, figshare link, number of outputs 18 | all_models = { 19 | "jv_formation_energy_peratom_alignn": [ 20 | "https://figshare.com/ndownloader/files/31458679", 21 | 1, 22 | ], 23 | "jv_optb88vdw_total_energy_alignn": [ 24 | "https://figshare.com/ndownloader/files/31459642", 25 | 1, 26 | ], 27 | "jv_optb88vdw_bandgap_alignn": [ 28 | "https://figshare.com/ndownloader/files/31459636", 29 | 1, 30 | ], 31 | "jv_mbj_bandgap_alignn": [ 32 | "https://figshare.com/ndownloader/files/31458694", 33 | 1, 34 | ], 35 | "jv_spillage_alignn": [ 36 | "https://figshare.com/ndownloader/files/31458736", 37 | 1, 38 | ], 39 | "jv_slme_alignn": ["https://figshare.com/ndownloader/files/31458727", 1], 40 | "jv_bulk_modulus_kv_alignn": [ 41 | "https://figshare.com/ndownloader/files/31458649", 42 | 1, 43 | ], 44 | "jv_shear_modulus_gv_alignn": [ 45 | "https://figshare.com/ndownloader/files/31458724", 46 | 1, 47 | ], 48 | "jv_n-Seebeck_alignn": [ 49 | "https://figshare.com/ndownloader/files/31458718", 50 | 1, 51 | ], 52 | "jv_n-powerfact_alignn": [ 53 | "https://figshare.com/ndownloader/files/31458712", 54 | 1, 55 | ], 56 | "jv_magmom_oszicar_alignn": [ 57 | "https://figshare.com/ndownloader/files/31458685", 58 | 1, 59 | ], 60 | "jv_kpoint_length_unit_alignn": [ 61 | "https://figshare.com/ndownloader/files/31458682", 62 | 1, 63 | ], 64 | "jv_avg_elec_mass_alignn": [ 65 | "https://figshare.com/ndownloader/files/31458643", 66 | 1, 67 | ], 68 | "jv_avg_hole_mass_alignn": [ 69 | "https://figshare.com/ndownloader/files/31458646", 70 | 1, 71 | ], 72 | "jv_epsx_alignn": ["https://figshare.com/ndownloader/files/31458667", 1], 73 | "jv_mepsx_alignn": ["https://figshare.com/ndownloader/files/31458703", 1], 74 | "jv_max_efg_alignn": [ 75 | "https://figshare.com/ndownloader/files/31458691", 76 | 1, 77 | ], 78 | "jv_ehull_alignn": ["https://figshare.com/ndownloader/files/31458658", 1], 79 | "jv_dfpt_piezo_max_dielectric_alignn": [ 80 | "https://figshare.com/ndownloader/files/31458652", 81 | 1, 82 | ], 83 | "jv_dfpt_piezo_max_dij_alignn": [ 84 | "https://figshare.com/ndownloader/files/31458655", 85 | 1, 86 | ], 87 | "jv_exfoliation_energy_alignn": [ 88 | "https://figshare.com/ndownloader/files/31458676", 89 | 1, 90 | ], 91 | "mp_e_form_alignn": [ 92 | "https://figshare.com/ndownloader/files/31458811", 93 | 1, 94 | ], 95 | "mp_gappbe_alignn": [ 96 | "https://figshare.com/ndownloader/files/31458814", 97 | 1, 98 | ], 99 | "qm9_U0_alignn": ["https://figshare.com/ndownloader/files/31459054", 1], 100 | "qm9_U_alignn": ["https://figshare.com/ndownloader/files/31459051", 1], 101 | "qm9_alpha_alignn": ["https://figshare.com/ndownloader/files/31459027", 1], 102 | "qm9_gap_alignn": ["https://figshare.com/ndownloader/files/31459036", 1], 103 | "qm9_G_alignn": ["https://figshare.com/ndownloader/files/31459033", 1], 104 | "qm9_HOMO_alignn": ["https://figshare.com/ndownloader/files/31459042", 1], 105 | "qm9_LUMO_alignn": ["https://figshare.com/ndownloader/files/31459045", 1], 106 | "qm9_ZPVE_alignn": ["https://figshare.com/ndownloader/files/31459057", 1], 107 | "hmof_co2_absp_alignnn": [ 108 | "https://figshare.com/ndownloader/files/31459198", 109 | 5, 110 | ], 111 | "hmof_max_co2_adsp_alignnn": [ 112 | "https://figshare.com/ndownloader/files/31459207", 113 | 1, 114 | ], 115 | "hmof_surface_area_m2g_alignnn": [ 116 | "https://figshare.com/ndownloader/files/31459222", 117 | 1, 118 | ], 119 | "hmof_surface_area_m2cm3_alignnn": [ 120 | "https://figshare.com/ndownloader/files/31459219", 121 | 1, 122 | ], 123 | "hmof_pld_alignnn": ["https://figshare.com/ndownloader/files/31459216", 1], 124 | "hmof_lcd_alignnn": ["https://figshare.com/ndownloader/files/31459201", 1], 125 | "hmof_void_fraction_alignnn": [ 126 | "https://figshare.com/ndownloader/files/31459228", 127 | 1, 128 | ], 129 | "extra_sc": [ 130 | None, 131 | 1, 132 | ], 133 | "extra_tl": [ 134 | None, 135 | 1, 136 | ], 137 | } 138 | parser = argparse.ArgumentParser( 139 | description="Atomistic Line Graph Neural Network Pretrained Models" 140 | ) 141 | parser.add_argument( 142 | "--model_name", 143 | default="jv_formation_energy_peratom_alignn", 144 | help="Choose a model from these " 145 | + str(len(list(all_models.keys()))) 146 | + " models:" 147 | + ", ".join(list(all_models.keys())), 148 | ) 149 | 150 | parser.add_argument( 151 | "--file_format", default="poscar", help="poscar/cif/xyz/pdb file format." 152 | ) 153 | 154 | parser.add_argument( 155 | "--file_path", 156 | default="alignn/examples/sample_data/POSCAR-JVASP-10.vasp", 157 | help="Path to file.", 158 | ) 159 | 160 | parser.add_argument( 161 | "--cutoff", 162 | default=8, 163 | help="Distance cut-off for graph constuction" 164 | + ", usually 8 for solids and 5 for molecules.", 165 | ) 166 | 167 | 168 | device = "cpu" 169 | if torch.cuda.is_available(): 170 | device = torch.device("cuda") 171 | 172 | 173 | def get_prediction( 174 | model_name="jv_formation_energy_peratom_alignn", 175 | atoms=None, 176 | cutoff=8, 177 | ): 178 | """Get model with progress bar.""" 179 | tmp = all_models[model_name] 180 | url = tmp[0] 181 | output_features = tmp[1] 182 | zfile = model_name + ".zip" 183 | path = str(os.path.join(os.path.dirname(__file__), zfile)) 184 | if not os.path.isfile(path): 185 | response = requests.get(url, stream=True) 186 | total_size_in_bytes = int(response.headers.get("content-length", 0)) 187 | block_size = 1024 # 1 Kibibyte 188 | progress_bar = tqdm( 189 | total=total_size_in_bytes, unit="iB", unit_scale=True 190 | ) 191 | with open(path, "wb") as file: 192 | for data in response.iter_content(block_size): 193 | progress_bar.update(len(data)) 194 | file.write(data) 195 | progress_bar.close() 196 | zp = zipfile.ZipFile(path) 197 | names = zp.namelist() 198 | for i in names: 199 | if "checkpoint_" in i and "pt" in i: 200 | tmp = i 201 | # print("chk", i) 202 | # print("Loading the zipfile...", zipfile.ZipFile(path).namelist()) 203 | data = zipfile.ZipFile(path).read(tmp) 204 | model = ALIGNN( 205 | ALIGNNConfig(name="alignn", output_features=output_features) 206 | ) 207 | new_file, filename = tempfile.mkstemp() 208 | with open(filename, "wb") as f: 209 | f.write(data) 210 | model.load_state_dict(torch.load(filename, map_location=device)["model"]) 211 | model.to(device) 212 | model.eval() 213 | if os.path.exists(filename): 214 | os.remove(filename) 215 | 216 | 217 | # print("Loading completed.") 218 | g, lg = Graph.atom_dgl_multigraph(atoms, cutoff=float(cutoff)) 219 | #print(lg.edata) 220 | #print(lg) 221 | out_data = ( 222 | model([g.to(device), lg.to(device)]) 223 | .detach() 224 | .cpu() 225 | .numpy() 226 | .flatten() 227 | .tolist() 228 | ) 229 | 230 | return out_data 231 | 232 | 233 | if __name__ == "__main__": 234 | args = parser.parse_args(sys.argv[1:]) 235 | model_name = args.model_name 236 | file_path = args.file_path 237 | file_format = args.file_format 238 | cutoff = args.cutoff 239 | if file_format == "poscar": 240 | atoms = Atoms.from_poscar(file_path) 241 | elif file_format == "cif": 242 | atoms = Atoms.from_cif(file_path) 243 | elif file_format == "xyz": 244 | atoms = Atoms.from_xyz(file_path, box_size=500) 245 | elif file_format == "pdb": 246 | atoms = Atoms.from_pdb(file_path, max_lat=500) 247 | else: 248 | raise NotImplementedError("File format not implemented", file_format) 249 | 250 | out_data = get_prediction( 251 | model_name=model_name, cutoff=float(cutoff), atoms=atoms 252 | ) 253 | 254 | print("Predicted value:", model_name, file_path, out_data) 255 | 256 | # x = get_model() 257 | # print(x) 258 | -------------------------------------------------------------------------------- /FineTuning/alignn/profile.py: -------------------------------------------------------------------------------- 1 | """pytorch profiling script. 2 | 3 | from the repository root, run 4 | `PYTHONPATH=$PYTHONPATH:. python jarvisdgl/profile.py` 5 | """ 6 | 7 | from functools import partial 8 | 9 | # from pathlib import Path 10 | from typing import Any, Dict, Union 11 | 12 | # import numpy as np 13 | import torch 14 | import torch.profiler 15 | from torch import nn 16 | from tqdm import tqdm 17 | 18 | from alignn import data, models 19 | from alignn.config import TrainingConfig 20 | from alignn.train import group_decay, setup_optimizer 21 | 22 | device = "cpu" 23 | if torch.cuda.is_available(): 24 | device = torch.device("cuda") 25 | 26 | 27 | def profile_dgl(config: Union[TrainingConfig, Dict[str, Any]]): 28 | """Training entry point for DGL networks. 29 | 30 | `config` should conform to alignn.conf.TrainingConfig, and 31 | if passed as a dict with matching keys, pydantic validation is used 32 | """ 33 | if type(config) is dict: 34 | config = TrainingConfig(**config) 35 | 36 | lg_models = {"clgn", "alignn"} 37 | 38 | # use input standardization for all real-valued feature sets 39 | 40 | train_loader, val_loader, prepare_batch = data.get_train_val_loaders( 41 | target=config.target, 42 | n_train=config.n_train, 43 | n_val=config.n_val, 44 | batch_size=config.batch_size, 45 | atom_features=config.atom_features, 46 | neighbor_strategy=config.neighbor_strategy, 47 | standardize=config.atom_features != "cgcnn", 48 | line_graph=config.model.name in lg_models, 49 | ) 50 | prepare_batch = partial(prepare_batch, device=device) 51 | 52 | # define network, optimizer, scheduler 53 | _model = { 54 | "cgcnn": models.CGCNN, 55 | "icgcnn": models.iCGCNN, 56 | "densegcn": models.DenseGCN, 57 | "clgn": models.CLGN, 58 | "alignn": models.ALIGNN, 59 | } 60 | model = _model.get(config.model.name)(config.model) 61 | model.to(device) 62 | 63 | # group parameters to skip weight decay for bias and batchnorm 64 | params = group_decay(model) 65 | optimizer = setup_optimizer(params, config) 66 | 67 | criterion = nn.MSELoss() 68 | 69 | with torch.profiler.profile( 70 | schedule=torch.profiler.schedule(wait=2, warmup=2, active=6, repeat=1), 71 | on_trace_ready=torch.profiler.tensorboard_trace_handler("."), 72 | with_stack=True, 73 | profile_memory=True, 74 | ) as profiler: 75 | # train for one epoch 76 | for batch in tqdm(train_loader): 77 | g, y = prepare_batch(batch) 78 | pred = model(g) 79 | loss = criterion(pred, y) 80 | optimizer.zero_grad() 81 | loss.backward() 82 | optimizer.step() 83 | profiler.step() 84 | -------------------------------------------------------------------------------- /FineTuning/alignn/train_folder.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """Module to train for a folder with formatted dataset.""" 4 | import csv 5 | import os 6 | import sys 7 | from jarvis.core.atoms import Atoms 8 | from alignn.data import get_train_val_loaders 9 | from alignn.train import train_dgl 10 | from alignn.config import TrainingConfig 11 | from jarvis.db.jsonutils import loadjson 12 | import argparse 13 | 14 | parser = argparse.ArgumentParser( 15 | description="Atomistic Line Graph Neural Network" 16 | ) 17 | parser.add_argument( 18 | "--root_dir", 19 | default="./", 20 | help="Folder with id_props.csv, structure files", 21 | ) 22 | parser.add_argument( 23 | "--config_name", 24 | default="alignn/examples/sample_data/config_example.json", 25 | help="Name of the config file", 26 | ) 27 | 28 | parser.add_argument( 29 | "--file_format", default="poscar", help="poscar/cif/xyz/pdb file format." 30 | ) 31 | 32 | parser.add_argument( 33 | "--keep_data_order", 34 | default=False, 35 | help="Whether to randomly shuffle samples, True/False", 36 | ) 37 | 38 | parser.add_argument( 39 | "--classification_threshold", 40 | default=None, 41 | help="Floating point threshold for converting into 0/1 class" 42 | + ", use only for classification tasks", 43 | ) 44 | 45 | parser.add_argument( 46 | "--batch_size", default=None, help="Batch size, generally 64" 47 | ) 48 | 49 | parser.add_argument( 50 | "--epochs", default=None, help="Number of epochs, generally 300" 51 | ) 52 | 53 | parser.add_argument( 54 | "--output_dir", 55 | default="./", 56 | help="Folder to save outputs", 57 | ) 58 | 59 | parser.add_argument( 60 | "--id_prop_file", 61 | default="id_prop.csv", 62 | help="Name of the id_prop file", 63 | ) 64 | 65 | 66 | def train_for_folder( 67 | root_dir="examples/sample_data", 68 | config_name="config.json", 69 | id_prop_file="id_prop.csv", 70 | keep_data_order=False, 71 | classification_threshold=None, 72 | batch_size=None, 73 | epochs=None, 74 | file_format="poscar", 75 | output_dir=None, 76 | ): 77 | """Train for a folder.""" 78 | # config_dat=os.path.join(root_dir,config_name) 79 | id_prop_dat = os.path.join(root_dir, id_prop_file) 80 | config = loadjson(config_name) 81 | if type(config) is dict: 82 | try: 83 | config = TrainingConfig(**config) 84 | except Exception as exp: 85 | print("Check", exp) 86 | 87 | config.keep_data_order = keep_data_order 88 | if classification_threshold is not None: 89 | config.classification_threshold = float(classification_threshold) 90 | if output_dir is not None: 91 | config.output_dir = output_dir 92 | if batch_size is not None: 93 | config.batch_size = int(batch_size) 94 | if epochs is not None: 95 | config.epochs = int(epochs) 96 | with open(id_prop_dat, "r") as f: 97 | reader = csv.reader(f) 98 | data = [row for row in reader] 99 | 100 | dataset = [] 101 | n_outputs = [] 102 | multioutput = False 103 | lists_length_equal = True 104 | for i in data: 105 | info = {} 106 | file_name = i[0] 107 | file_path = os.path.join(root_dir, file_name) 108 | if file_format == "poscar": 109 | atoms = Atoms.from_poscar(file_path) 110 | elif file_format == "cif": 111 | atoms = Atoms.from_cif(file_path) 112 | elif file_format == "xyz": 113 | # Note using 500 angstrom as box size 114 | atoms = Atoms.from_xyz(file_path, box_size=500) 115 | elif file_format == "pdb": 116 | # Note using 500 angstrom as box size 117 | # Recommended install pytraj 118 | # conda install -c ambermd pytraj 119 | atoms = Atoms.from_pdb(file_path, max_lat=500) 120 | else: 121 | raise NotImplementedError( 122 | "File format not implemented", file_format 123 | ) 124 | 125 | info["atoms"] = atoms.to_dict() 126 | info["jid"] = file_name 127 | 128 | tmp = [float(j) for j in i[1:]] # float(i[1]) 129 | if len(tmp) == 1: 130 | tmp = tmp[0] 131 | else: 132 | multioutput = True 133 | info["target"] = tmp # float(i[1]) 134 | n_outputs.append(info["target"]) 135 | dataset.append(info) 136 | if multioutput: 137 | lists_length_equal = False not in [ 138 | len(i) == len(n_outputs[0]) for i in n_outputs 139 | ] 140 | 141 | # print ('n_outputs',n_outputs[0]) 142 | if multioutput and classification_threshold is not None: 143 | raise ValueError("Classification for multi-output not implemented.") 144 | if multioutput and lists_length_equal: 145 | config.model.output_features = len(n_outputs[0]) 146 | else: 147 | # TODO: Pad with NaN 148 | if not lists_length_equal: 149 | raise ValueError("Make sure the outputs are of same size.") 150 | else: 151 | config.model.output_features = 1 152 | ( 153 | train_loader, 154 | val_loader, 155 | test_loader, 156 | prepare_batch, 157 | ) = get_train_val_loaders( 158 | dataset_array=dataset, 159 | target=config.target, 160 | n_train=config.n_train, 161 | n_val=config.n_val, 162 | n_test=config.n_test, 163 | train_ratio=config.train_ratio, 164 | val_ratio=config.val_ratio, 165 | test_ratio=config.test_ratio, 166 | batch_size=config.batch_size, 167 | atom_features=config.atom_features, 168 | neighbor_strategy=config.neighbor_strategy, 169 | standardize=config.atom_features != "cgcnn", 170 | id_tag=config.id_tag, 171 | pin_memory=config.pin_memory, 172 | workers=config.num_workers, 173 | save_dataloader=config.save_dataloader, 174 | use_canonize=config.use_canonize, 175 | filename=config.filename, 176 | cutoff=config.cutoff, 177 | max_neighbors=config.max_neighbors, 178 | output_features=config.model.output_features, 179 | classification_threshold=config.classification_threshold, 180 | target_multiplication_factor=config.target_multiplication_factor, 181 | standard_scalar_and_pca=config.standard_scalar_and_pca, 182 | keep_data_order=config.keep_data_order, 183 | output_dir=config.output_dir, 184 | ) 185 | 186 | train_dgl( 187 | config, 188 | train_val_test_loaders=[ 189 | train_loader, 190 | val_loader, 191 | test_loader, 192 | prepare_batch, 193 | ], 194 | ) 195 | 196 | # train_data = get_torch_dataset( 197 | 198 | 199 | if __name__ == "__main__": 200 | args = parser.parse_args(sys.argv[1:]) 201 | train_for_folder( 202 | root_dir=args.root_dir, 203 | config_name=args.config_name, 204 | id_prop_file=args.id_prop_file, 205 | keep_data_order=args.keep_data_order, 206 | classification_threshold=args.classification_threshold, 207 | output_dir=args.output_dir, 208 | batch_size=(args.batch_size), 209 | epochs=(args.epochs), 210 | file_format=(args.file_format), 211 | ) 212 | -------------------------------------------------------------------------------- /FineTuning/alignn/train_props.py: -------------------------------------------------------------------------------- 1 | """Helper function for high-throughput GNN trainings.""" 2 | import matplotlib.pyplot as plt 3 | 4 | # import numpy as np 5 | import time 6 | from alignn.train import train_dgl 7 | 8 | # from sklearn.metrics import mean_absolute_error 9 | plt.switch_backend("agg") 10 | 11 | 12 | def train_prop_model( 13 | prop="", 14 | dataset="dft_3d", 15 | write_predictions=True, 16 | name="alignn", 17 | save_dataloader=False, 18 | train_ratio=None, 19 | classification_threshold=None, 20 | val_ratio=None, 21 | test_ratio=None, 22 | learning_rate=0.001, 23 | batch_size=None, 24 | scheduler=None, 25 | n_epochs=None, 26 | id_tag=None, 27 | num_workers=None, 28 | weight_decay=None, 29 | alignn_layers=None, 30 | gcn_layers=None, 31 | edge_input_features=None, 32 | triplet_input_features=None, 33 | embedding_features=None, 34 | hidden_features=None, 35 | output_features=None, 36 | random_seed=None, 37 | n_early_stopping=None, 38 | cutoff=None, 39 | max_neighbors=None, 40 | ): 41 | """Train models for a dataset and a property.""" 42 | if scheduler is None: 43 | scheduler = "onecycle" 44 | if batch_size is None: 45 | batch_size = 64 46 | if n_epochs is None: 47 | n_epochs = 300 48 | if num_workers is None: 49 | num_workers = 0 50 | config = { 51 | "dataset": dataset, 52 | "target": prop, 53 | "epochs": n_epochs, # 00,#00, 54 | "batch_size": batch_size, # 0, 55 | "weight_decay": 1e-05, 56 | "learning_rate": learning_rate, 57 | "criterion": "mse", 58 | "optimizer": "adamw", 59 | "scheduler": scheduler, 60 | "save_dataloader": save_dataloader, 61 | "pin_memory": False, 62 | "write_predictions": write_predictions, 63 | "num_workers": num_workers, 64 | "classification_threshold": classification_threshold, 65 | "model": { 66 | "name": name, 67 | }, 68 | } 69 | if n_early_stopping is not None: 70 | config["n_early_stopping"] = n_early_stopping 71 | if cutoff is not None: 72 | config["cutoff"] = cutoff 73 | if max_neighbors is not None: 74 | config["max_neighbors"] = max_neighbors 75 | if weight_decay is not None: 76 | config["weight_decay"] = weight_decay 77 | if alignn_layers is not None: 78 | config["model"]["alignn_layers"] = alignn_layers 79 | if gcn_layers is not None: 80 | config["model"]["gcn_layers"] = gcn_layers 81 | if edge_input_features is not None: 82 | config["model"]["edge_input_features"] = edge_input_features 83 | if hidden_features is not None: 84 | config["model"]["hidden_features"] = hidden_features 85 | if embedding_features is not None: 86 | config["model"]["embedding_features"] = embedding_features 87 | if output_features is not None: 88 | config["model"]["output_features"] = output_features 89 | if random_seed is not None: 90 | config["random_seed"] = random_seed 91 | # if model_name is not None: 92 | # config['model']['name']=model_name 93 | 94 | if id_tag is not None: 95 | config["id_tag"] = id_tag 96 | if train_ratio is not None: 97 | config["train_ratio"] = train_ratio 98 | if val_ratio is None: 99 | raise ValueError("Enter val_ratio.") 100 | 101 | if test_ratio is None: 102 | raise ValueError("Enter test_ratio.") 103 | config["val_ratio"] = val_ratio 104 | config["test_ratio"] = test_ratio 105 | if dataset == "jv_3d": 106 | # config["save_dataloader"]=True 107 | config["num_workers"] = 4 108 | config["pin_memory"] = False 109 | # config["learning_rate"] = 0.001 110 | # config["epochs"] = 300 111 | 112 | if dataset == "mp_3d_2020": 113 | config["id_tag"] = "id" 114 | config["num_workers"] = 0 115 | if dataset == "megnet2": 116 | config["id_tag"] = "id" 117 | config["num_workers"] = 0 118 | if dataset == "megnet": 119 | config["id_tag"] = "id" 120 | if prop == "e_form" or prop == "gap pbe": 121 | config["n_train"] = 60000 122 | config["n_val"] = 5000 123 | config["n_test"] = 4239 124 | # config["learning_rate"] = 0.01 125 | # config["epochs"] = 300 126 | config["num_workers"] = 4 127 | if dataset == "oqmd_3d_no_cfid": 128 | config["id_tag"] = "_oqmd_entry_id" 129 | config["num_workers"] = 0 130 | if dataset == "hmof" and prop == "co2_absp": 131 | config["model"]["output_features"] = 5 132 | if dataset == "edos_pdos": 133 | if prop == "edos_up": 134 | config["model"]["output_features"] = 300 135 | elif prop == "pdos_elast": 136 | config["model"]["output_features"] = 200 137 | else: 138 | raise ValueError("Target not available.") 139 | if dataset == "qm9_std_jctc": 140 | config["id_tag"] = "id" 141 | config["n_train"] = 110000 142 | config["n_val"] = 10000 143 | config["n_test"] = 10829 144 | 145 | # config["batch_size"] = 64 146 | config["cutoff"] = 5.0 147 | config["standard_scalar_and_pca"] = False 148 | 149 | if dataset == "qm9_dgl": 150 | config["id_tag"] = "id" 151 | config["n_train"] = 110000 152 | config["n_val"] = 10000 153 | config["n_test"] = 10831 154 | config["standard_scalar_and_pca"] = False 155 | config["batch_size"] = 64 156 | config["cutoff"] = 5.0 157 | if config["target"] == "all": 158 | config["model"]["output_features"] = 12 159 | 160 | # config["max_neighbors"] = 9 161 | 162 | if dataset == "hpov": 163 | config["id_tag"] = "id" 164 | if dataset == "qm9": 165 | config["id_tag"] = "id" 166 | config["n_train"] = 110000 167 | config["n_val"] = 10000 168 | config["n_test"] = 13885 169 | config["batch_size"] = batch_size 170 | config["cutoff"] = 5.0 171 | config["max_neighbors"] = 9 172 | # config['atom_features']='atomic_number' 173 | if prop in ["homo", "lumo", "gap", "zpve", "U0", "U", "H", "G"]: 174 | config["target_multiplication_factor"] = 27.211386024367243 175 | t1 = time.time() 176 | result = train_dgl(config) 177 | t2 = time.time() 178 | print("train=", result["train"]) 179 | print("validation=", result["validation"]) 180 | print("Toal time:", t2 - t1) 181 | print() 182 | print() 183 | print() 184 | -------------------------------------------------------------------------------- /FineTuning/alignn/utils.py: -------------------------------------------------------------------------------- 1 | """Shared pydantic settings configuration.""" 2 | import json 3 | from pathlib import Path 4 | from typing import Union 5 | import matplotlib.pyplot as plt 6 | 7 | from pydantic import BaseSettings as PydanticBaseSettings 8 | 9 | 10 | class BaseSettings(PydanticBaseSettings): 11 | """Add configuration to default Pydantic BaseSettings.""" 12 | 13 | class Config: 14 | """Configure BaseSettings behavior.""" 15 | 16 | extra = "forbid" 17 | use_enum_values = True 18 | env_prefix = "jv_" 19 | 20 | 21 | def plot_learning_curve( 22 | results_dir: Union[str, Path], key: str = "mae", plot_train: bool = False 23 | ): 24 | """Plot learning curves based on json history files.""" 25 | if isinstance(results_dir, str): 26 | results_dir = Path(results_dir) 27 | 28 | with open(results_dir / "history_val.json", "r") as f: 29 | val = json.load(f) 30 | 31 | p = plt.plot(val[key], label=results_dir.name) 32 | 33 | if plot_train: 34 | # plot the training trace in the same color, lower opacity 35 | with open(results_dir / "history_train.json", "r") as f: 36 | train = json.load(f) 37 | 38 | c = p[0].get_color() 39 | plt.plot(train[key], alpha=0.5, c=c) 40 | 41 | plt.xlabel("epochs") 42 | plt.ylabel(key) 43 | 44 | return train, val 45 | -------------------------------------------------------------------------------- /FineTuning/run/config_sc.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "112bbedebdaecf59fb18e11c929080fb2f358246", 3 | "dataset": "user_data", 4 | "source_model": null, 5 | "target": "target", 6 | "atom_features": "cgcnn", 7 | "neighbor_strategy": "k-nearest", 8 | "id_tag": "jid", 9 | "random_seed": 123, 10 | "classification_threshold": null, 11 | "n_val": null, 12 | "n_test": null, 13 | "n_train": null, 14 | "train_ratio": 0.80, 15 | "val_ratio": 0.10, 16 | "test_ratio": 0.10, 17 | "target_multiplication_factor": null, 18 | "epochs": 300, 19 | "batch_size": 64, 20 | "weight_decay": 1e-05, 21 | "learning_rate": 0.001, 22 | "filename": "sample", 23 | "warmup_steps": 2000, 24 | "criterion": "mse", 25 | "optimizer": "adamw", 26 | "scheduler": "onecycle", 27 | "pin_memory": false, 28 | "save_dataloader": false, 29 | "write_checkpoint": true, 30 | "write_predictions": true, 31 | "store_outputs": true, 32 | "progress": true, 33 | "log_tensorboard": false, 34 | "standard_scalar_and_pca": false, 35 | "use_canonize": true, 36 | "num_workers": 0, 37 | "cutoff": 8.0, 38 | "max_neighbors": 12, 39 | "keep_data_order": false, 40 | "model": { 41 | "name": "alignn", 42 | "alignn_layers": 4, 43 | "gcn_layers": 4, 44 | "atom_input_features": 92, 45 | "edge_input_features": 80, 46 | "triplet_input_features": 40, 47 | "embedding_features": 64, 48 | "hidden_features": 256, 49 | "output_features": 1, 50 | "link": "identity", 51 | "zero_inflated": false, 52 | "classification": false 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /FineTuning/run/config_tl_mp_eform.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "112bbedebdaecf59fb18e11c929080fb2f358246", 3 | "dataset": "user_data", 4 | "source_model": "mp_e_form_alignnn", 5 | "target": "target", 6 | "atom_features": "cgcnn", 7 | "neighbor_strategy": "k-nearest", 8 | "id_tag": "jid", 9 | "random_seed": 123, 10 | "classification_threshold": null, 11 | "n_val": null, 12 | "n_test": null, 13 | "n_train": null, 14 | "train_ratio": 0.80, 15 | "val_ratio": 0.10, 16 | "test_ratio": 0.10, 17 | "target_multiplication_factor": null, 18 | "epochs": 300, 19 | "batch_size": 64, 20 | "weight_decay": 1e-05, 21 | "learning_rate": 0.001, 22 | "filename": "sample", 23 | "warmup_steps": 2000, 24 | "criterion": "mse", 25 | "optimizer": "adamw", 26 | "scheduler": "onecycle", 27 | "pin_memory": false, 28 | "save_dataloader": false, 29 | "write_checkpoint": true, 30 | "write_predictions": true, 31 | "store_outputs": true, 32 | "progress": true, 33 | "log_tensorboard": false, 34 | "standard_scalar_and_pca": false, 35 | "use_canonize": true, 36 | "num_workers": 0, 37 | "cutoff": 8.0, 38 | "max_neighbors": 12, 39 | "keep_data_order": false, 40 | "model": { 41 | "name": "alignn", 42 | "alignn_layers": 4, 43 | "gcn_layers": 4, 44 | "atom_input_features": 92, 45 | "edge_input_features": 80, 46 | "triplet_input_features": 40, 47 | "embedding_features": 64, 48 | "hidden_features": 256, 49 | "output_features": 1, 50 | "link": "identity", 51 | "zero_inflated": false, 52 | "classification": false 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Northwestern University 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ALIGNNTL 2 | 3 | This repository contains the code for ALIGNN-based transfer learning framework to predict materials properties using structure-based inputs. The code provides the following functions: 4 | 5 | * Train a ALIGNN model on a given dataset. 6 | * Use a pre-trained ALIGNN model to perform fine-tuning based transfer learning on a given target dataset. 7 | * Use a pre-trained ALIGNN model to perform feature extraction on a given target dataset. 8 | * Predict material properties of new compounds with a pre-trained ALIGNN model. 9 | 10 | ## Installation Requirements 11 | 12 | The basic requirement for using the files are a Python 3.8 with the packages listed in `setup.py`. It is advisable to create an virtual environment with the correct dependencies. Please refer to the guidelines here for installation details. 13 | 14 | The work related experiments was performed on Linux Fedora 7.9 Maipo. The code should be able to work on other Operating Systems as well but it has not been tested elsewhere. 15 | 16 | ## Source Files 17 | 18 | Here is a brief description about the folder content: 19 | 20 | * [`FineTuning`](./FineTuning): code to perform fine-tuning based transfer learning. 21 | 22 | * [`FeatureExtraction`](./FeatureExtraction): code to perform feature extraction. 23 | 24 | * [`example`](./example): example dataset to perform fine-tuning or feature extraction. 25 | 26 | ## ALIGNNTL: Fine-Tuning 27 | 28 | The user requires following files in order to start training a model using fine-tuning method 29 | * Sturcture files - contains structure information for a given material (format: `POSCAR`, `.cif`, `.xyz` or `.pdb`) 30 | * Input-Property file - contains name of the structure file and its corresponding property value (format: `.csv`) 31 | * Configuration file - configuration file with hyperparamters associated with training the model (format: `.json`) 32 | * Pre-trained model - model trained using ALIGNN using any specific materials property (format: `.zip`) 33 | 34 | We have provided the an example of Sturcture files (`POSCAR` files), Input-Property file (`id_prop.csv`) and Configuration file (`config_example.json`) in [`examples`](../examples). Download the pre-trained model trained on large datasets from here. 35 | 36 | Now, in order to perform fine-tuning based transfer learning, add the details regarding the model in the `all_models` dictionary inside the `train.py` file as described below: 37 | ``` 38 | all_models = { 39 | name of the file: [link to the pre-trained model (optional), number of outputs], 40 | name of the file 2: [link to the pre-trained model 2 (optional), number of outputs], 41 | ... 42 | } 43 | ``` 44 | If the link to the pre-trained model is not provided inside the `all_models` dictionary, place the zip file of the pre-trained model inside the [`alignn`](./alignn) folder. Once the setup for the pre-trained model is done, the fine-tuning based model training can be performed as follows: 45 | ``` 46 | python alignn/train_folder.py --root_dir "../examples" --config "../examples/config_example.json" --id_prop_file "id_prop.csv" --output_dir=model 47 | ``` 48 | Make sure that the Input-Property file `--id_prop_file` is placed inside the root directory `--root_dir` where Sturcture files are present. 49 | 50 | ## ALIGNNTL: Feature Extraction 51 | 52 | The user requires following files in order to perform feature extraction 53 | * Sturcture files - contains structure information for a given material (format: `POSCAR`, `.cif`, `.xyz` or `.pdb`) 54 | * Input-Property file - contains name of the structure file and its corresponding property value (format: `.csv`) 55 | * Pre-trained model - model trained using ALIGNN using any specific materials property (format: `.zip`) 56 | 57 | We have provided the an example of Sturcture files (`POSCAR` files) and Input-Property file (`id_prop.csv`) in [`examples`](../examples). Download the pre-trained model trained on large datasets from here. 58 | 59 | Now, in order to perform feature extraction, add the details regarding the model in the `all_models` dictionary inside the `train.py` file as described below: 60 | ``` 61 | all_models = { 62 | name of the file: [link to the pre-trained model (optional), number of outputs], 63 | name of the file 2: [link to the pre-trained model 2 (optional), number of outputs], 64 | ... 65 | } 66 | ``` 67 | If the link to the pre-trained model is not provided inside the `all_models` dictionary, place the zip file of the pre-trained model inside the [`alignn`](./alignn) folder. Once the setup for the pre-trained model is done, the feature extraction can be performed by running the `create_features.sh` script file which contains the following code: 68 | ``` 69 | for filename in ../examples/*.vasp; do 70 | python alignn/pretrained_activation.py --model_name mp_e_form_alignnn --file_format poscar --file_path "$filename" --output_path "../examples/data" 71 | done 72 | ``` 73 | The script will convert the structure files into atom (x), bond (y) and angle (z) based features one-by-one (batch-wise conversion has not been implemented yet). Example: `abc.vasp` will produce `abc_x.csv` (9 atom-based features), `abc_y.csv` (9 bond-based features) and `abc_z.csv` (5 angle-based features). 74 | 75 | Once you have converted all the structure files in the Input-Property file `id_prop.csv` using the script file, run the jupyter notebooks `pre-processing.ipynb` to convert the structure-wise features into a dataset. Pre-processing steps contained within the `pre-processing.ipynb` file is as follows: 76 | * Attach the appropriate property value and identifier (jid) to each of the extracted features file based on id_prop.csv 77 | * Create a seperate file for each of the features (atom, bond, angle) based on the extracted checkpoints 78 | * Create combined features (in the order of atom, bond and angle) from same (3-1) or different (3-2) checkpoints. Use first 512 features for atom+bond and all features for atom+bon+angle as input for model training. 79 | * (Optional) Divide each of the files into train, validation and test files based on the json file `ids_train_val_test.json` available in the output directory of the ALIGNN model 80 | 81 | ## Using Pre-Trained Model 82 | All the trained models are available at [Zenodo](https://doi.org/10.5072/zenodo.1222572), and these models can be used to make predictions directly. 83 | 84 | To perform prediction using the ALIGNN model, please refer to https://github.com/usnistgov/alignn 85 | 86 | To perform prediction using the ElemNet model, please refer to https://github.com/NU-CUCIS/CrossPropertyTL 87 | 88 | ## Developer Team 89 | 90 | The code was developed by Vishu Gupta from the CUCIS group at the Electrical and Computer Engineering Department at Northwestern University. 91 | 92 | ## Publication 93 | 94 | 1. Vishu Gupta, Kamal Choudhary, Brian DeCost, Francesca Tavazza, Carelyn Campbell, Wei-keng Liao, Alok Choudhary, and Ankit Agrawal, “Structure-aware graph neural network based deep transfer learning framework for enhanced predictive analytics on diverse materials datasets,” npj Computational Materials 10.1 (2024): 1. [DOI] [PDF] 95 | 96 | ```tex 97 | @article{gupta2024structure, 98 | title={Structure-aware graph neural network based deep transfer learning framework for enhanced predictive analytics on diverse materials datasets}, 99 | author={Gupta, Vishu and Choudhary, Kamal and DeCost, Brian and Tavazza, Francesca and Campbell, Carelyn and Liao, Wei-keng and Choudhary, Alok and Agrawal, Ankit}, 100 | journal={npj Computational Materials}, 101 | volume={10}, 102 | number={1}, 103 | pages={1}, 104 | year={2024}, 105 | publisher={Nature Publishing Group UK London} 106 | } 107 | ``` 108 | 109 | ## Acknowledgements 110 | 111 | The open-source implementation of ALIGNN here provided significant initial inspiration for the structure of this code base. 112 | 113 | ## Disclaimer 114 | 115 | The research code shared in this repository is shared without any support or guarantee of its quality. However, please do raise an issue if you find anything wrong, and I will try my best to address it. 116 | 117 | email: vishugupta2020@u.northwestern.edu 118 | 119 | Copyright (C) 2023, Northwestern University. 120 | 121 | See COPYRIGHT notice in top-level directory. 122 | 123 | ## Funding Support 124 | 125 | This work was performed under the following financial assistance award 70NANB19H005 from U.S. Department of Commerce, National Institute of Standards and Technology as part of the Center for Hierarchical Materials Design (CHiMaD). Partial support is also acknowledged from NSF award CMMI-2053929, and DOE awards DE-SC0019358, DE-SC0021399, and Northwestern Center for Nanocombinatorics. 126 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-10.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 1.6777483798834445 -2.9059452409270157 -1.1e-15 4 | 1.6777483798834438 2.9059452409270126 -7e-16 5 | -6.5e-15 -8e-16 6.220805465667012 6 | V Se 7 | 1 2 8 | direct 9 | 0.0 0.0 0.0 10 | 0.6666669999999968 0.3333330000000032 0.7479606991085345 11 | 0.3333330000000032 0.6666669999999968 0.252039300891465 12 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-107772.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.376835486482439 0.0086562096165887 7.148251977291244 4 | 2.0211490103296166 3.8822313794698684 7.148251977291244 5 | 0.0142338540946976 0.008656214510917 8.38176620441039 6 | Bi Sb 7 | 3 1 8 | direct 9 | 0.11687114695010013 0.11687114695010009 0.11687114695134818 10 | 0.885057350916569 0.8850573509165686 0.8850573509144881 11 | 0.3806761740317465 0.3806761740317465 0.3806761740305207 12 | 0.6173953281015849 0.6173953281015848 0.6173953281036431 13 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-13526.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 7.091458561131444 0.0 0.0 4 | 0.0 12.284128695721973 0.0 5 | -8.862874621478095 0.0 25.0 6 | Y Br 7 | 4 12 8 | direct 9 | 0.033346999999999086 0.6240773822144681 0.1871170000000006 10 | 0.033346999999999086 0.9574286177855293 0.1871170000000006 11 | 0.5333479999999966 0.12407738221446811 0.1871170000000006 12 | 0.5333479999999966 0.4574286177855292 0.1871170000000006 13 | 0.2891270840017781 0.46667191911829303 0.2510176333839372 14 | 0.2891270840017781 0.11483508088170911 0.2510176333839372 15 | 0.2613405348547832 0.7907530000000023 0.2510114569972214 16 | 0.7891270840017786 0.9666709191182953 0.2510176333839372 17 | 0.7891270840017786 0.6148350808817092 0.2510176333839372 18 | 0.7613405348547837 0.2907530000000023 0.2510114569972214 19 | 0.30535446514521963 0.2907530000000023 0.1232235430027774 20 | 0.2775679159982247 0.9666709191182953 0.123216366616057 21 | 0.2775679159982247 0.6148350808817092 0.123216366616057 22 | 0.8053554651452168 0.7907530000000023 0.1232235430027774 23 | 0.7775679159982244 0.46667191911829303 0.123216366616057 24 | 0.7775679159982244 0.11483508088170911 0.123216366616057 25 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-1372.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.5058938597621094 -3.081249e-10 2.0241289627124215 4 | 1.1686312862968669 3.3053879820023613 2.0241289627124215 5 | -8.715088e-10 -6.162497e-10 4.048256928443838 6 | Al As 7 | 1 1 8 | direct 9 | 0.0 0.0 0.0 10 | 0.24999999999999997 0.25 0.24999999999999997 11 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-14014.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.157436115454804 -0.0 0.0 4 | -0.0 7.038494037846648 0.0 5 | 0.0 0.0 7.411178065479046 6 | Tb Mn Si 7 | 4 4 4 8 | direct 9 | 0.25 0.5014870121743014 0.1863876024079978 10 | 0.75 0.49851298782569875 0.8136123975920022 11 | 0.25 0.0014870121743013 0.3136123975920026 12 | 0.75 0.9985129878256985 0.6863876024079979 13 | 0.75 0.8608859093979077 0.06027225572734521 14 | 0.25 0.1391140906020922 0.939727744272655 15 | 0.75 0.3608859093979077 0.43972774427265476 16 | 0.25 0.6391140906020923 0.5602722557273451 17 | 0.25 0.792634730215007 0.8919146343653592 18 | 0.75 0.207365269784993 0.10808536563464112 19 | 0.25 0.2926347302150071 0.6080853656346409 20 | 0.75 0.707365269784993 0.3919146343653588 21 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-14441.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 2.8173501021142346 -0.0 0.0 4 | -1.4086750510571173 2.439896157530945 0.0 5 | 0.0 0.0 24.551775 6 | Co O 7 | 1 2 8 | direct 9 | 0.2690539999999971 0.9290120000000003 0.0926970000000011 10 | 0.6023870000000002 0.595678999999997 0.1307621356947131 11 | 0.9357210000000009 0.26234500000000344 0.0546328643052866 12 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-14873.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.191262576674699 0.0 -0.0 4 | -0.0 4.191262576674699 0.0 5 | -0.0 0.0 4.191262576674699 6 | Sr B 7 | 1 6 8 | direct 9 | 0.0 0.0 0.0 10 | 0.2028453684309125 0.5 0.5 11 | 0.5 0.5 0.7971546315690875 12 | 0.5 0.5 0.2028453684309125 13 | 0.5 0.2028453684309125 0.5 14 | 0.5 0.7971546315690875 0.5 15 | 0.7971546315690875 0.5 0.5 16 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-15345.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.5666343258756448 0.0 0.0 4 | 0.0 3.60492483256326 -1.0516480500920402 5 | 0.0 0.0043800721536433 3.7551864245512623 6 | Y Co C 7 | 1 1 2 8 | direct 9 | 0.0 0.9970518040927455 0.00294819590736377 10 | 0.5 0.6150401254054609 0.3849598745944179 11 | 0.5 0.15192770422861318 0.5440196337270639 12 | 0.5 0.4559803662731792 0.8480722957711558 13 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-1996.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.93712543178282 0.0 2.273100275741533 4 | 1.3123751439276066 3.7119571065192623 2.273100275741533 5 | 0.0 0.0 4.546200551483066 6 | Na I 7 | 1 1 8 | direct 9 | 0.0 0.0 0.0 10 | 0.5 0.5 0.5 11 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-21210.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 1.6712283e-08 -2.508029669761222 3.5458136263853106 4 | -2.172017276374766 1.254014874098203 3.545813646368687 5 | -2.17201803290572 -1.254014795663004 -3.5458136064019246 6 | Xe 7 | 1 8 | direct 9 | 0.0 0.0 0.0 10 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-22556.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.790914410660539 -0.0 0.0 4 | 0.0 3.790914410660539 0.0 5 | -0.0 -0.0 3.790914410660539 6 | Sr Fe O 7 | 1 1 3 8 | direct 9 | 0.4999990000000025 0.4999990000000025 0.4999990000000025 10 | 0.0 0.0 0.0 11 | 0.4999990000000025 0.0 0.0 12 | 0.0 0.4999990000000025 0.0 13 | 0.0 0.0 0.4999990000000025 14 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-27901.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.4878362323679837 3.6597344e-09 0.0 4 | -1.7439186098402102 3.020554822453009 0.0 5 | 0.0 0.0 25.743165 6 | Sc H Cl 7 | 2 2 2 8 | direct 9 | 0.6666669999999968 0.3333330000000032 0.45082619084199527 10 | 0.33333300000000327 0.6666669999999969 0.5491738091580051 11 | 0.6666669999999968 0.3333330000000032 0.5287351839124973 12 | 0.33333300000000327 0.6666669999999969 0.47126481608750276 13 | 0.0 0.0 0.3881804432720387 14 | 0.0 0.0 0.6118195567279613 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-28397.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.0 -3.9587610833154616 0.0 4 | -6.655928089533787 0.0 0.0 5 | 0.0 0.0 -23.94045079597872 6 | Si S 7 | 4 4 8 | direct 9 | 0.0 0.0 0.5217263648738928 10 | 0.0 0.5 0.5217263648738928 11 | 0.5 0.0 0.4661843287970869 12 | 0.5 0.5 0.4661843287970869 13 | 0.0524900550457348 0.7500000000000001 0.5792751627500841 14 | 0.9475099449542649 0.25 0.5792751627500841 15 | 0.4474867899417421 0.7500000000000001 0.40863414357892813 16 | 0.5525132100582582 0.25 0.40863414357892813 17 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-28565.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.3542337275744103 0.0 0.0 4 | -1.6771168637872051 2.904850045503021 0.0002624763854255 5 | 0.0 0.0027191662067697 29.227006366170723 6 | Te Mo W Se S 7 | 2 2 1 2 2 8 | direct 9 | 0.3332869375319439 0.6665748750638851 0.40880470960271253 10 | 0.3334050587801155 0.6668121175602401 0.2788667649202174 11 | 0.3335186248083656 0.6670362496167267 0.11458088390572692 12 | 0.6666801663591748 0.33335933271835083 0.3438741864905265 13 | 0.3331138284834239 0.6662286569668452 0.5825261819744669 14 | 0.6664959135073409 0.3329918270146898 0.5252624785410095 15 | 0.6664002633646019 0.3327995267292049 0.639695963563112 16 | 0.6669034856871763 0.33380597137434753 0.06276093238425431 17 | 0.6667957214778616 0.3335914429557147 0.1664678986179713 18 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-28634.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.2250494729190726 2.216578e-10 2.163e-13 4 | -1.6125242360333125 2.7929740932668943 -8.4754501616e-06 5 | 6.6135e-12 -9.7386036979e-05 34.14068378844537 6 | Mo W Se S 7 | 1 3 2 6 8 | direct 9 | 0.33331504683701274 0.6666300936741254 0.0934536896030271 10 | 0.33331656497272827 0.6666341299456554 0.47208556491119213 11 | 0.6666698924990063 0.33333978499784117 0.28247993950367123 12 | 0.6666991220003533 0.3333972440007849 0.6548932577640771 13 | 0.33334341592455036 0.6666888318491291 0.3328984548376194 14 | 0.33332779768550075 0.6666565953711356 0.2320623862553914 15 | 0.33337390316228616 0.6667488063245635 0.7006769649140224 16 | 0.6666482437297062 0.33329648745935525 0.0479187308537724 17 | 0.6666490346540366 0.33329706930798436 0.4262562969343839 18 | 0.6666480620607286 0.33329512412140816 0.1390473399063092 19 | 0.6666512247313715 0.33330144946262313 0.5179005541158488 20 | 0.33335669174272836 0.6667143834853922 0.6090748204006833 21 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-28704.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.292134155794691 0.0 0.0 4 | -1.6460670778973454 2.8510786681143565 -3.615752048e-06 5 | 0.0 -0.0001768206441563 34.978246270650075 6 | Mo W Se S 7 | 3 1 6 2 8 | direct 9 | 0.3333192249247229 0.6666384498494459 0.0966675137812058 10 | 0.6666558392026922 0.3333126784053811 0.2791091321598709 11 | 0.6666926464398288 0.3333852928796507 0.6584266681105794 12 | 0.3333321581155246 0.666664316231042 0.468712621722382 13 | 0.3333230348691514 0.6666470697383001 0.3273013286877133 14 | 0.3333590853838843 0.6667201707677635 0.7065686651425439 15 | 0.6666558450522622 0.3333116901045159 0.4202334807678751 16 | 0.6666765519168195 0.3333521038336415 0.5171906710959798 17 | 0.3333210915930135 0.6666421831860199 0.23092332016136433 18 | 0.3333560781404684 0.6667131562809414 0.6102231914914819 19 | 0.6666426939013361 0.33328538780266426 0.0528105185440566 20 | 0.6666647504603075 0.33332850092061717 0.1405808883349591 21 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-42300.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 5.194393535053021 0.034577392554407 -4.9523273114e-06 4 | 2.153028708704779 4.72735668147013 -3.73465553323e-05 5 | 1.5206886157882826 -2.3464718870801353 8.330436594087969 6 | Li Mn Cr O 7 | 4 3 3 12 8 | direct 9 | 0.16966447553882844 0.8301970334723747 0.6605569345508427 10 | 0.8302011715915265 0.16966706473586296 0.33944417799875215 11 | 0.5800947610406406 0.9199998612743996 0.8398874954366794 12 | 0.9199980273839649 0.5800947192447456 0.16011167167032708 13 | -1.954489619e-07 9.006772771999999e-07 -2.539188635e-07 14 | 0.3360465085243891 0.6639729239785194 0.3279302946298646 15 | 0.6639713575254087 0.3360472020186965 0.6720678224275533 16 | 0.08467498734116796 0.41531644060120726 0.8306539868780489 17 | 0.41531790100415245 0.08467328244008408 0.16934804712464238 18 | 0.7499993429865515 0.7499982052607397 0.500001183815335 19 | 0.8727721384770729 0.17597816052634066 0.8319022139728783 20 | 0.7816430635042374 0.7816431915534273 -1.1742013580000081e-07 21 | 0.5667201478544727 0.8743706849948725 0.3262118623990145 22 | 0.525579094104101 0.5255825355739964 0.4999985262026153 23 | 0.6559148822098795 0.29532040758430306 0.16808994773452818 24 | 0.21835655843364699 0.21835464991437428 4.655567088999997e-07 25 | 0.4518573962235184 0.10709729221187209 0.6737836680639248 26 | 0.1759777530687026 0.8727719310531143 0.16809706498534088 27 | 0.10709734988088745 0.4518582962888623 0.32621662001735124 28 | 0.8743719436348032 0.5667185654600829 0.6737898415006399 29 | 0.2953212852995689 0.6559151411942167 0.8319099625384035 30 | 0.9744210498214575 0.9744205099406256 0.49999958383554444 31 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-48166.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -0.0127275386492899 4.475342287282874 4.475342287282874 4 | 4.456801075726424 0.0348234079782807 4.42655690239239 5 | 4.456801075726424 4.42655690239239 0.0348234079782807 6 | Li Mn O F 7 | 1 5 3 5 8 | direct 9 | 0.6472714630906105 0.6084130139340697 0.6084130139340695 10 | 0.9928445264949293 0.9685868196393626 0.9685868196393621 11 | 0.21927918901090712 0.28879130724660956 0.28879130724660956 12 | 0.6389053819101155 0.13349037804761768 0.6135321079330768 13 | 0.6389053819101154 0.6135321079330768 0.13349037804761774 14 | 0.12943749906585614 0.6254210515401791 0.6254210515401791 15 | 0.3837867856040669 0.3998132270233503 0.39981322702335026 16 | 0.8470868829476453 0.3876891490297202 0.3876891490297203 17 | 0.8609676061508488 0.8489324903657344 0.8489324903657341 18 | 0.3870289574388718 0.8716741936695006 0.3921690449931621 19 | 0.38702895743887183 0.3921690449931622 0.8716741936695005 20 | 0.8656843622803222 0.3783813995417081 0.8639037647508528 21 | 0.8656843622803223 0.8639037647508527 0.3783813995417078 22 | 0.3860896443765031 0.8692030522850454 0.8692030522850452 23 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-50332.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -2.2512310528422197 1.4964955426496451 4.920792210337369 4 | 2.2512310528422197 -1.4964955426496451 4.920792210337369 5 | 2.2512310528422197 1.4964955426496451 -4.920792210337369 6 | Na Cu O 7 | 2 1 2 8 | direct 9 | 0.6858955420425209 0.18589554204252068 0.5 10 | 0.31410445795747916 0.814104457957479 0.5 11 | 0.0 0.5 0.5 12 | 0.3670049776681319 0.3670049776681319 8.398296503492967e-18 13 | 0.6329950223318683 0.6329950223318683 -2.0407051056528864e-17 14 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-60596.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -3.2849719315437826 -6.289361e-10 0.0 4 | 1.6424864631140141 -9.068899402058411 -1.254343 5 | 0.0 0.0 23.688514 6 | Ta Pd S 7 | 2 1 6 8 | direct 9 | 0.1470268916499685 0.2940537832999092 0.058460920784649 10 | 0.8529731083500315 0.7059462167000907 0.0972480792153527 11 | 0.5 0.0 0.0778540000000021 12 | 0.7327377347077687 0.46547546941556817 0.0226833907048882 13 | 0.617981269132093 0.23596253826411556 0.1319858311303713 14 | 0.5669134577143131 0.1338269154285202 -0.00027846686807290024 15 | 0.267262265292231 0.5345245305844317 0.1330246092951089 16 | 0.38201873086790694 0.7640374617358845 0.023723168869630402 17 | 0.43308654228568677 0.8661730845714798 0.1559874668680745 18 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-60702.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 9.067075684180468 -0.0 0.0 4 | -0.0 9.601395097069043 0.0 5 | 0.0 0.0 13.805400088543228 6 | Pd Se Cl 7 | 4 32 8 8 | direct 9 | 0.49999999999999994 0.0 0.0 10 | 0.49999999999999994 0.5 0.5 11 | 0.0 0.5 0.0 12 | 0.0 0.0 0.5 13 | 0.0890296642614067 0.3835712458566864 0.3735345418025448 14 | 0.41097033573859354 0.8835712458566864 0.6264654581974549 15 | 0.5890296642614069 0.6164287541433134 0.1264654581974553 16 | 0.7039670606211823 0.4830887496383727 0.3833625591369578 17 | 0.5880171858828603 0.3116584573099965 0.2715868211667293 18 | 0.41097033573859354 0.3835712458566864 0.8735345418025451 19 | 0.0890296642614067 0.8835712458566864 0.1264654581974553 20 | 0.9119828141171397 0.3116584573099965 0.7715868211667294 21 | 0.3770896109922794 0.1563811136145417 0.4724705583331981 22 | 0.1229103890077205 0.6563811136145415 0.5275294416668015 23 | 0.7960329393788177 0.4830887496383727 0.8833625591369582 24 | 0.6229103890077202 0.8436188863854585 0.5275294416668015 25 | 0.5880171858828603 0.8116584573099959 0.2284131788332707 26 | 0.08801718588286078 0.6883415426900041 0.2284131788332707 27 | 0.7960329393788177 0.983088749638372 0.6166374408630418 28 | 0.4119828141171393 0.6883415426900041 0.7284131788332705 29 | 0.4119828141171393 0.1883415426900036 0.7715868211667294 30 | 0.2960329393788176 0.0169112503616275 0.8833625591369582 31 | 0.1229103890077205 0.1563811136145417 0.9724705583331985 32 | 0.9109703357385931 0.6164287541433134 0.6264654581974549 33 | 0.20396706062118217 0.5169112503616279 0.116637440863042 34 | 0.8770896109922798 0.3436188863854581 0.4724705583331981 35 | 0.8770896109922798 0.8436188863854585 0.0275294416668019 36 | 0.3770896109922794 0.6563811136145415 0.0275294416668019 37 | 0.5890296642614069 0.116428754143314 0.3735345418025448 38 | 0.08801718588286078 0.1883415426900036 0.2715868211667293 39 | 0.20396706062118217 0.0169112503616275 0.3833625591369578 40 | 0.9109703357385931 0.116428754143314 0.8735345418025451 41 | 0.2960329393788176 0.5169112503616279 0.6166374408630418 42 | 0.9119828141171397 0.8116584573099959 0.7284131788332705 43 | 0.6229103890077202 0.3436188863854581 0.9724705583331985 44 | 0.7039670606211823 0.983088749638372 0.116637440863042 45 | 0.39703356529970957 0.6589107687488639 0.3911200742214518 46 | 0.8970335652997097 0.3410892312511363 0.1088799257785481 47 | 0.8970335652997097 0.8410892312511361 0.3911200742214518 48 | 0.10296643470029009 0.1589107687488638 0.6088799257785472 49 | 0.39703356529970957 0.1589107687488638 0.1088799257785481 50 | 0.6029664347002902 0.3410892312511363 0.6088799257785472 51 | 0.10296643470029009 0.6589107687488639 0.8911200742214528 52 | 0.6029664347002902 0.8410892312511361 0.8911200742214528 53 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-63912.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.0 4.893247728183244 4.893247728183244 4 | 4.893247728183244 0.0 4.893247728183244 5 | 4.893247728183244 4.893247728183244 0.0 6 | Ba Ca Re 7 | 4 1 1 8 | direct 9 | 0.11911220585518423 0.6269622647149372 0.6269622647149372 10 | 0.6269622647149372 0.6269622647149372 0.6269622647149372 11 | 0.6269622647149372 0.11911220585518423 0.6269622647149372 12 | 0.6269622647149372 0.6269622647149372 0.11911220585518421 13 | 0.25 0.25 0.25 14 | 0.0 0.0 0.0 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64003.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.0 4.901572410735 4.901572410735 4 | 4.901572410735 0.0 4.901572410735 5 | 4.901572410735 4.901572410735 0.0 6 | Ba Te Se 7 | 4 1 1 8 | direct 9 | 0.12515186443486964 0.6249493785217126 0.6249493785217126 10 | 0.6249493785217126 0.6249493785217126 0.6249493785217126 11 | 0.6249493785217125 0.12515186443486964 0.6249493785217127 12 | 0.6249493785217126 0.6249493785217126 0.12515186443486961 13 | 0.0 0.0 0.0 14 | 0.25 0.25 0.25 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64045.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.0 4.936437902689708 4.936437902689708 4 | 4.936437902689708 0.0 4.936437902689708 5 | 4.936437902689708 4.936437902689708 0.0 6 | Ba Ta Zn 7 | 4 1 1 8 | direct 9 | 0.12583664735322053 0.624721450882259 0.6247214508822589 10 | 0.624721450882259 0.624721450882259 0.624721450882259 11 | 0.624721450882259 0.12583664735322053 0.6247214508822589 12 | 0.624721450882259 0.624721450882259 0.12583664735322053 13 | 0.25000000000000006 0.25 0.24999999999999997 14 | 0.0 0.0 0.0 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64240.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -0.0 5.040771484524319 5.040771484524319 4 | 5.040771484524319 0.0 5.040771484524319 5 | 5.040771484524319 5.040771484524319 0.0 6 | Ba Hg Pb 7 | 4 1 1 8 | direct 9 | 0.1225216175990277 0.6258264608003209 0.6258264608003209 10 | 0.6258264608003209 0.6258264608003209 0.6258264608003209 11 | 0.6258264608003209 0.1225216175990277 0.6258264608003209 12 | 0.6258264608003209 0.6258264608003209 0.12252161759902766 13 | 0.25 0.25 0.25 14 | 0.0 0.0 0.0 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64377.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.0 5.129874508851702 5.129874508851702 4 | 5.129874508851702 -0.0 5.129874508851702 5 | 5.129874508851702 5.129874508851702 0.0 6 | Ba Li Hf 7 | 4 1 1 8 | direct 9 | 0.12806946960819965 0.623976510130601 0.623976510130601 10 | 0.623976510130601 0.623976510130601 0.623976510130601 11 | 0.6239765101306008 0.12806946960819962 0.623976510130601 12 | 0.623976510130601 0.623976510130601 0.12806946960819957 13 | 0.0 0.0 0.0 14 | 0.25 0.25 0.25 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64584.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.0 5.104615296684174 5.104615296684174 4 | 5.104615296684174 -0.0 5.104615296684174 5 | 5.104615296684174 5.104615296684174 0.0 6 | Ba Na Ge 7 | 4 1 1 8 | direct 9 | 0.13101840776817025 0.6229941974106115 0.6229941974106115 10 | 0.6229941974106114 0.6229941974106115 0.6229941974106115 11 | 0.6229941974106114 0.13101840776817034 0.6229941974106115 12 | 0.6229941974106114 0.6229941974106115 0.13101840776817036 13 | 0.0 0.0 0.0 14 | 0.24999999999999997 0.25 0.25 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64664.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.0 5.1858714074842 5.1858714074842 4 | 5.1858714074842 0.0 5.1858714074842 5 | 5.1858714074842 5.1858714074842 -0.0 6 | Ba Na Bi 7 | 4 1 1 8 | direct 9 | 0.13109962866281805 0.6229667904457299 0.6229667904457298 10 | 0.6229667904457298 0.6229667904457299 0.6229667904457299 11 | 0.6229667904457299 0.13109962866281807 0.6229667904457298 12 | 0.6229667904457299 0.6229667904457298 0.13109962866281805 13 | 0.0 0.0 0.0 14 | 0.25 0.25 0.25 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64719.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -0.0 5.037541505850243 5.037541505850243 4 | 5.037541505850243 -0.0 5.037541505850243 5 | 5.037541505850243 5.037541505850243 -0.0 6 | Ba Y Nb 7 | 4 1 1 8 | direct 9 | 0.12648425569773464 0.6245049147674203 0.6245049147674203 10 | 0.6245049147674203 0.6245049147674203 0.6245049147674203 11 | 0.6245049147674202 0.12648425569773467 0.6245049147674204 12 | 0.6245049147674203 0.6245049147674203 0.1264842556977346 13 | 0.0 0.0 0.0 14 | 0.25 0.25 0.25 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-64906.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -1.833590720595598 1.833590720595598 3.4849681632445244 4 | 1.833590720595598 -1.833590720595598 3.4849681632445244 5 | 1.833590720595598 1.833590720595598 -3.4849681632445244 6 | Be Os Ru 7 | 2 1 1 8 | direct 9 | 0.0 0.0 0.0 10 | 0.2500000000000001 0.7500000000000001 0.49999999999999994 11 | 0.5000000000000001 0.5000000000000001 3.027457132251912e-17 12 | 0.75 0.25000000000000006 0.49999999999999994 13 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-65062.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -0.0 4.326757913323647 4.326757913323647 4 | 4.326757913323647 -0.0 4.326757913323647 5 | 4.326757913323647 4.326757913323647 0.0 6 | Ca Be W 7 | 4 1 1 8 | direct 9 | 0.12651687616680074 0.6244947079443989 0.624494707944399 10 | 0.6244947079443989 0.6244947079443989 0.6244947079443989 11 | 0.6244947079443989 0.12651687616680074 0.624494707944399 12 | 0.6244947079443989 0.6244947079443989 0.12651687616680074 13 | 0.0 0.0 0.0 14 | 0.25 0.25 0.25 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-65101.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -0.0 4.517300851474054 4.517300851474054 4 | 4.517300851474054 -0.0 4.517300851474054 5 | 4.517300851474054 4.517300851474054 0.0 6 | Be Re Bi 7 | 1 1 4 8 | direct 9 | 0.0 0.0 0.0 10 | 0.25 0.25 0.25 11 | 0.12379293854128284 0.6254026871529048 0.6254026871529049 12 | 0.6254026871529048 0.6254026871529048 0.6254026871529048 13 | 0.6254026871529048 0.12379293854128279 0.6254026871529049 14 | 0.6254026871529048 0.6254026871529048 0.12379293854128282 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-655.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 1.7433449914666201 -3.0195615934611317 0.0 4 | 1.74334499146662 3.0195615934611317 0.0 5 | 0.0 0.0 33.756999 6 | Nb Se 7 | 1 2 8 | direct 9 | 0.0 0.0 0.3056479999999979 10 | 0.3333330000000032 0.6666669999999968 0.3555394988382513 11 | 0.3333330000000032 0.6666669999999968 0.2557565011617516 12 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-676.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.4778329262343175 0.0 0.0 4 | 0.0 6.358483588462181 0.0 5 | 0.0 0.0 33.313518 6 | Te Mo 7 | 4 2 8 | direct 9 | 0.0 0.8619395170563143 0.265114140987848 10 | 0.5 0.3542564560720641 0.2477025193288425 11 | 0.5 0.7037042860282603 0.1405475827636373 12 | 0.0 0.21138102417993898 0.1579592289166588 13 | 0.0 0.6021177544583993 0.1999411686092298 14 | 0.5 0.9635209622050152 0.2057283593937858 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76308.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.476735664683434 -0.0001409835261675 0.0 4 | -0.0001411270922827 4.363491673024054 0.0 5 | 0.0 0.0 28.821097 6 | U Te 7 | 2 6 8 | direct 9 | -8.490441687499999e-06 -0.0009363847078898001 0.2254087426055869 10 | 0.5000074106852598 0.4990730075759134 0.0806549103409565 11 | 0.499990412286296 0.49961414324817294 0.1929569725884193 12 | 2.14222720849e-05 0.5002503174953495 0.30659146281609173 13 | 0.5000147012260457 0.001106231102728 0.3059728397408687 14 | 8.399574981199999e-06 -0.0003516838567084 0.1131090550058446 15 | 0.4999796136703707 0.0002064119548261 0.9994725628394472 16 | -1.3469273351599998e-05 0.5010379571876086 8.74540627872e-05 17 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76309.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -6.427139410165216 -0.0 0.0 4 | 3.213569705082608 5.5660662314110665 0.0 5 | 0.0 0.0 -23.432263 6 | In Cu P Se 7 | 1 1 2 6 8 | direct 9 | 0.0 0.0 0.8507519999999998 10 | 0.33333400000000074 0.6666680000000015 0.8507519999999998 11 | 0.6666659999999994 0.3333319999999986 0.8021627995650195 12 | 0.6666659999999994 0.3333319999999986 0.8993412004349804 13 | 0.34103292942720453 0.3485144915427442 0.777138656542191 14 | 0.0074815621257882155 0.6589670706000875 0.777138656542191 15 | 0.007481562115539614 0.3485144915427442 0.9243653434578087 16 | 0.6514855084742998 0.6589670706000875 0.9243653434578087 17 | 0.3410329294101608 0.9925184378571682 0.9243653434578087 18 | 0.6514855084470076 0.9925184378571682 0.777138656542191 19 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76312.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.8505111896006228 0.0 0.0 4 | 0.0 3.8505111896006228 0.0 5 | 0.0 0.0 23.172608 6 | Cu Br 7 | 2 2 8 | direct 9 | 0.49999999999999994 0.49999999999999994 0.0684559999999976 10 | 0.0 0.0 0.0684559999999976 11 | 0.0 0.49999999999999994 0.1396106273078921 12 | 0.49999999999999994 0.0 0.9973013726921103 13 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76313.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -3.8981219900182933 -3.7237505e-09 0.0 4 | 1.9490614894678115 -3.6334581954451775 -0.225356 5 | 0.0 0.0 26.995257 6 | Y C I 7 | 2 2 2 8 | direct 9 | 0.1450516824699669 0.2901033649402804 0.1809884416655423 10 | 0.8549483175300333 0.7098966350597203 0.07814155833445671 11 | 0.5762279408645535 0.1524558817340315 0.11747981722984471 12 | 0.4237720591354465 0.8475441182659686 0.1416501827701543 13 | 0.8256981468688573 0.6513962937376792 0.2586930813508133 14 | 0.1743018531311427 0.3486037062623211 0.0004359186491882004 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76318.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.003988857196698 -5.203063523044459 0.0 4 | 3.0039905153232285 5.203062565724714 0.0 5 | 0.0 0.0 22.812795 6 | Ti Cl 7 | 2 6 8 | direct 9 | 0.6666659999999993 0.3333340000000007 0.0616454009828724 10 | 0.3333340000000007 0.6666659999999993 0.061653599017123396 11 | 0.6566816018896336 0.6566776541080906 7.12284632005e-05 12 | -1.9477806330790326e-06 0.3433183981095912 7.12284632005e-05 13 | 0.6566776541089986 -1.9477823157804703e-06 0.12322777153680238 14 | 1.9477806332245863e-06 0.6566816018904088 0.12322777153680238 15 | 0.3433183981103662 0.3433223458919091 0.12322777153680238 16 | 0.3433223458910015 1.947782315791579e-06 7.12284632005e-05 17 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76515.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.7944202607364415 -6.572128368551494 0.0 4 | 3.7944202607364415 6.572128368551494 0.0 5 | 0.0 0.0 23.649804 6 | Bi I 7 | 2 6 8 | direct 9 | 0.6666659999999994 0.33333400000000063 0.0771640000000033 10 | 0.3333340000000008 0.6666659999999993 0.0771640000000033 11 | -6.175343572506532e-12 0.3363338805287944 -0.00010390327247650002 12 | 0.6636661194773811 0.663666119477381 -0.00010390327247650002 13 | 0.33633388052261914 0.33633388052261903 0.1544309032724786 14 | 0.33633388052879437 -6.1753959737459415e-12 -0.00010390327247650002 15 | 6.175488092234314e-12 0.6636661194712056 0.1544309032724786 16 | 0.6636661194712057 6.17530447875554e-12 0.1544309032724786 17 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76516.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.631374852245063 -2.0965748614627038 0.0 4 | -0.0 4.1931497229254076 0.0 5 | 0.0 0.0 22.860029 6 | Bi Pt 7 | 2 1 8 | direct 9 | 0.33333300000000315 0.6666669999999968 0.122798185664739 10 | 0.6666669999999968 0.3333330000000032 0.0023118143352603 11 | 0.0 0.0 0.0625550000000032 12 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76525.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.7629580231134514 0.0 0.0 4 | 0.0 6.87602212656798 0.0 5 | 0.0 0.0 24.412573 6 | Zr I 7 | 2 4 8 | direct 9 | 0.5 0.1154353493985894 0.08829698245065609 10 | 0.0 0.4917047269327905 0.0924475019194387 11 | 0.0 0.8823569929696923 0.1578891995509505 12 | 0.0 0.2222252677985402 -4.63096505806e-05 13 | 0.5 0.7247855293792334 0.0228593595093789 14 | 0.5 0.3849141335211457 0.1807922662201586 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76528.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -4.345198747538248 0.0 0.0 4 | 0.0 -9.206474735930364 -0.507555 5 | 0.0 0.0 29.727439 6 | Pr Os I 7 | 6 2 6 8 | direct 9 | 0.75 0.8835221481146582 0.0226636919869307 10 | 0.25 0.0991024187842433 0.1152975677647124 11 | 0.25 0.686837970931804 0.1135020861188097 12 | 0.75 0.9008975812157567 0.211923432235282 13 | 0.75 0.3131620290681963 0.21371891388119194 14 | 0.25 0.1164778518853415 0.3045573080130709 15 | 0.75 0.8892655940756343 0.11272187412771931 16 | 0.25 0.11073440592436569 0.2144981258722847 17 | 0.75 0.395062443108361 0.1056146053917653 18 | 0.25 0.6049375568916393 0.22160639460823622 19 | 0.25 0.6274904954043626 0.002605934508165201 20 | 0.25 0.1307048335698528 0.0005133972796294 21 | 0.75 0.8692951664301471 0.326707602720365 22 | 0.75 0.3725095045956378 0.3246150654918362 23 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76536.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 5.183435298063158 3.0116827303256017 0.011331 4 | -5.183412084311694 3.0116428521929017 0.011331 5 | 0.0 0.0 22.905941 6 | Ti Cl 7 | 2 6 8 | direct 9 | 0.6565535353295157 0.9783571312184274 0.0634808301357011 10 | 0.9783674933176241 0.6565631235078366 0.0634831367626685 11 | 0.659784417051706 0.6597737521709389 0.1269342975545255 12 | 0.9723918625419157 0.31548948541668914 0.1238843970297998 13 | 0.9753000543823279 0.9753099074428345 8.657192479909998e-05 14 | 0.662480315472372 0.31945017649172164 0.0031021171907289 15 | 0.3154981906320898 0.9723956747468283 0.12388414233810559 16 | 0.31944213127245397 0.6624757490047218 0.0031025070636665998 17 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76548.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -4.567116040288575 -3.63932726054e-05 0.0 4 | 2.283589523737267 3.9552212995531733 0.0 5 | 0.0 0.0 -23.735167 6 | Pb I 7 | 1 2 8 | direct 9 | -1.5562735766000001e-06 1.5876587073999998e-06 0.9213333281208262 10 | 0.33333085954651603 0.666668947434045 0.8409323949747657 11 | 0.6666706967270606 0.3333294649072476 0.0016692769044118 12 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76549.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -6.6591637921937705 0.0100752489179631 -0.257279 4 | -0.4341199797548945 -6.64254326449972 -0.733767 5 | 0.0 0.0 28.222509 6 | Re Se Cl 7 | 6 8 2 8 | direct 9 | 0.8214011546275277 0.3485379943559211 0.20722131174132488 10 | 0.6785998763673665 0.1514624599817266 0.0795446954659623 11 | 0.005110512151838501 0.2968904207273367 0.1233252273438536 12 | 0.494889588971529 0.20311018554737248 0.1634406903149157 13 | 0.8417003942624253 0.9897626174607747 0.1541790580316208 14 | 0.6583002224058779 0.5102391249017227 0.1325873809074926 15 | 0.0168554893185377 0.953790295718295 0.0747708038962929 16 | 0.15045104887411803 0.1259715522359494 0.1999536948082405 17 | 0.9944990810969989 0.633838656793489 0.1748111030993721 18 | 0.5055010331629538 0.8661626686077363 0.111956086977682 19 | 0.6648136165927439 0.0449235591235229 0.2336589444470166 20 | 0.4831454841660173 0.5462082346630606 0.211995846671689 21 | 0.3495501136178529 0.37402787197959453 0.086812699630186 22 | 0.8351852925844945 0.455077871679643 0.0531073144393407 23 | 0.9122816597154116 0.4730211248227029 0.2858021883493805 24 | 0.5877154320843069 0.0269753614011534 0.0009649538756343002 25 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76562.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | -4.906075104996936 0.0 0.0 4 | 0.0 -5.25317830268697 -0.352987 5 | 0.0 0.0 24.194826 6 | Te H O 7 | 2 4 8 8 | direct 9 | 0.25016923915028133 0.47261445386098927 0.0866694170284717 10 | 0.7498307608497186 0.9726144538609889 0.0866694170284717 11 | 0.0349694928293361 0.6752920397539183 0.1711811682448166 12 | 0.47652232057300686 0.5717220283098532 0.0006120110609495006 13 | 0.5234776794269934 0.0717220283098534 0.0006120110609495 14 | 0.965030507170664 0.17529203975391797 0.1711811682448166 15 | 0.1048260298649813 0.4999823094672256 0.1618368249953722 16 | 0.3952845530999643 0.41003464001501133 0.0119569451327799 17 | 0.9370805581888688 0.2671801551409292 0.06072350665179771 18 | 0.4329195768541214 0.17495237345207526 0.1120201268858096 19 | 0.5670804231458787 0.6749523734520748 0.11202012688580962 20 | 0.062919441811131 0.767180155140929 0.0607235066517977 21 | 0.6047154469000361 0.9100346400150114 0.0119569451327799 22 | 0.8951739701350182 -1.7690532774699996e-05 0.1618368249953722 23 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-76567.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 0.1504078623986346 4.324687731778055 -0.235726 4 | -11.58684155408895 -0.3964239769459937 0.0 5 | 0.0 0.0 20.475774 6 | As S 7 | 4 6 8 | direct 9 | 0.7073612090451519 0.011064363036011299 0.5179434803176434 10 | 0.6403584180128499 0.732532502449397 0.5261630419995037 11 | 0.48082519162319964 0.26230116319162283 0.4772610449978645 12 | 0.08585953914491938 0.5067222825058614 0.47410367760605254 13 | 0.3548691198812162 0.8687025198172563 0.4721054474236864 14 | 0.3862906859232488 0.14159430420905436 0.5627109665612393 15 | 0.7589048801759599 0.12427317647741881 0.42712649495397975 16 | 0.736874063484342 0.6366352315892173 0.4331044974247696 17 | 0.2716819919695596 0.601808177032909 0.5668475831412677 18 | 0.8449709007395564 0.37348127969125305 0.5426317655739914 19 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-86097.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.089078911208881 0.0 0.0 4 | -0.0 4.089078911208881 -0.0 5 | 0.0 -0.0 4.089078911208881 6 | Dy B 7 | 1 6 8 | direct 9 | 0.0 0.0 0.0 10 | 0.19861408290185742 0.5 0.5 11 | 0.5 0.8013859170981429 0.5 12 | 0.5 0.19861408290185742 0.5 13 | 0.8013859170981429 0.5 0.5 14 | 0.5 0.5 0.19861408290185742 15 | 0.5 0.5 0.8013859170981429 16 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-86205.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 7.709535704177289 2.46207e-11 -2.7257318539859394 4 | -3.8547673520343277 6.676653550671134 -2.7257318539859394 5 | 2.33229e-11 4.03965e-11 8.177196562089774 6 | Sm Sb Os 7 | 1 12 4 8 | direct 9 | 0.0 0.0 0.0 10 | 0.8440272777954052 0.1820018570408906 0.33797357924548915 11 | 0.155972722204595 0.8179981429591096 0.662026420754511 12 | 0.8440272777954048 0.506053698549916 0.6620264207545123 13 | 0.6620264207545109 0.155972722204595 0.8179981429591094 14 | 0.3379735792454887 0.15597272220459563 0.49394630145008395 15 | 0.15597272220459527 0.4939463014500838 0.3379735792454878 16 | 0.5060536985499166 0.662026420754512 0.8440272777954045 17 | 0.49394630145008334 0.33797357924548804 0.15597272220459568 18 | 0.1820018570408914 0.3379735792454889 0.8440272777954052 19 | 0.6620264207545112 0.8440272777954044 0.506053698549916 20 | 0.33797357924548904 0.8440272777954052 0.18200185704089067 21 | 0.8179981429591086 0.662026420754511 0.1559727222045947 22 | -5.915835833105713e-19 0.5 1.1836638972071158e-17 23 | 0.49999999999999994 0.5 0.5 24 | 0.0 0.0 0.5 25 | 0.49999999999999994 0.0 -1.5918936643557756e-17 26 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-86436.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.509029640475962 0.0564034813585673 3.028820493652016 4 | 1.643488701783796 4.1992227516668 3.0288204823793996 5 | 0.0815446486036011 0.0564034838441564 5.431247419233112 6 | Li Sb F 7 | 1 1 6 8 | direct 9 | 0.5 0.5 0.5000000000000001 10 | 0.0 0.0 0.0 11 | 0.6232581762753454 0.8912834450053471 0.24301028493269985 12 | 0.8912834450184702 0.2430102849208133 0.6232581762479585 13 | 0.7569897150816867 0.3767418237226293 0.10871655498407223 14 | 0.2430102849183137 0.6232581762773706 0.8912834450159282 15 | 0.10871655498153017 0.7569897150791868 0.37674182375204146 16 | 0.37674182372465476 0.10871655499465277 0.7569897150673 17 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-86726.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.284492173131309 1.636192e-10 2.4736525652019936 4 | 1.428164057864698 4.039456881219389 2.4736525652019936 5 | 4.62785e-10 3.272383e-10 4.947304128800708 6 | Lu Ni Sn 7 | 1 4 1 8 | direct 9 | 0.0 0.0 0.0 10 | 0.6248769596428021 0.6248769596427668 0.12536912107166331 11 | 0.6248769596427768 0.1253691210716623 0.6248769596427667 12 | 0.12536912107159173 0.6248769596427769 0.6248769596428019 13 | 0.6248769596428222 0.6248769596427868 0.6248769596427602 14 | 0.25 0.25 0.25 15 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-86968.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.927229198330356 -0.0 -0.0 4 | -2.463614599165178 4.267105721364658 -0.0 5 | -0.0 0.0 4.907865140811081 6 | Cd As O 7 | 1 2 6 8 | direct 9 | 0.0 0.0 0.0 10 | 0.6666669999999968 0.3333330000000032 0.5 11 | 0.33333300000000315 0.6666669999999968 0.5 12 | 0.6241909675563854 0.6241909675563982 0.7119171876346506 13 | 0.37580903244362784 0.0 0.7119171876346506 14 | -1.298016336016139e-14 0.3758090324436018 0.7119171876346506 15 | 0.6241909675563723 0.0 0.2880828123653496 16 | 1.3023651329547014e-14 0.6241909675563982 0.2880828123653496 17 | 0.3758090324436148 0.3758090324436018 0.2880828123653496 18 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-89025.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 9.407270982425844 0.0171637632074009 -0.0 4 | -0.1420147938114395 9.406214283443367 -0.0 5 | -0.0 -0.0 10.910854580737215 6 | Na Si Se 7 | 8 8 20 8 | direct 9 | 0.0733132290323325 0.4176318340168439 0.7500000000000001 10 | 0.9266867709676674 0.5823681659831563 0.25 11 | 0.4176318340172705 0.073313229031779 0.7500000000000001 12 | 0.5823681659827293 0.9266867709682209 0.25 13 | 0.1490150541430486 0.8509849458571039 0.5 14 | 0.8509849458569516 0.1490150541428961 0.0 15 | 0.8509849458569516 0.1490150541428961 0.5 16 | 0.1490150541430486 0.8509849458571039 0.0 17 | 0.2542939381419508 0.254293938142708 0.0806181566406065 18 | 0.7457060618580491 0.7457060618572918 0.5806181566406066 19 | 0.2542939381419508 0.254293938142708 0.41938184335939327 20 | 0.7457060618580491 0.7457060618572918 0.9193818433593933 21 | 0.41036583124836795 0.6826777559805023 0.7500000000000001 22 | 0.3173222440192824 0.5896341687508452 0.25 23 | 0.6826777559807173 0.4103658312491549 0.7500000000000001 24 | 0.5896341687516325 0.3173222440194977 0.25 25 | 0.20859396551442239 0.4966279839346694 0.0753541618279579 26 | 0.4966279839356388 0.20859396551589807 0.0753541618279579 27 | 0.5033720160643609 0.7914060344840947 0.5753541618279583 28 | 0.20859396551442239 0.4966279839346694 0.42464583817204204 29 | 0.7914060344855705 0.503372016065331 0.9246458381720417 30 | 0.5033720160643609 0.7914060344840947 0.9246458381720417 31 | 0.4966279839356388 0.20859396551589807 0.42464583817204204 32 | 0.7914060344855705 0.503372016065331 0.5753541618279583 33 | 0.1502544060806899 0.15025440608186216 0.25 34 | 0.17853865301258198 0.725607332055336 0.7500000000000001 35 | 0.15566541081662147 0.1556654108171064 0.9147195295504303 36 | 0.8443345891833786 0.8443345891828942 0.4147195295504303 37 | 0.15566541081662147 0.1556654108171064 0.5852804704495695 38 | 0.8443345891833786 0.8443345891828942 0.0852804704495769 39 | 0.7256073320559903 0.17853865301374758 0.7500000000000001 40 | 0.2743926679440097 0.8214613469862517 0.25 41 | 0.44096017868318516 0.4409601786840314 0.7500000000000001 42 | 0.8214613469874184 0.2743926679446638 0.25 43 | 0.8497455939193103 0.8497455939181378 0.7500000000000001 44 | 0.5590398213168145 0.5590398213159686 0.25 45 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-89265.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.927781968323723 -0.0 0.0 4 | -0.0 6.00787069204336 0.0 5 | 0.0 0.0 10.300965906181538 6 | Fe Si O 7 | 8 4 16 8 | direct 9 | 0.0 0.0 0.0 10 | 0.0 0.5 0.0 11 | 0.5 0.5 0.5 12 | 0.0157990037127402 0.75 0.7259960538387886 13 | 0.5157990037127403 0.25 0.7740039461612113 14 | 0.9842009962872597 0.25 0.2740039461612108 15 | 0.48420099628726 0.75 0.22599605383878907 16 | 0.5 0.0 0.5 17 | 0.5695513893477254 0.75 0.9044038449299105 18 | 0.0695513893477256 0.25 0.5955961550700895 19 | 0.4304486106522744 0.25 0.0955961550700895 20 | 0.9304486106522746 0.75 0.4044038449299106 21 | 0.2621186447345032 0.75 0.4059472083502738 22 | 0.7621186447345026 0.25 0.0940527916497264 23 | 0.21569792728757584 0.46690097029695377 0.66620470723624 24 | 0.7031799812254462 0.75 0.0530850908584951 25 | 0.20317998122544634 0.25 0.4469149091415048 26 | 0.2968200187745536 0.25 0.9469149091415048 27 | 0.7968200187745538 0.75 0.5530850908584951 28 | 0.7156979272875755 0.9669009702969541 0.8337952927637599 29 | 0.21569792728757584 0.0330990297030461 0.66620470723624 30 | 0.2843020727124245 0.46690097029695377 0.1662047072362398 31 | 0.7843020727124245 0.5330990297030459 0.3337952927637606 32 | 0.2843020727124245 0.0330990297030461 0.1662047072362398 33 | 0.7843020727124245 0.9669009702969541 0.3337952927637606 34 | 0.7156979272875755 0.5330990297030459 0.8337952927637599 35 | 0.237881355265497 0.75 0.9059472083502733 36 | 0.7378813552654974 0.25 0.5940527916497265 37 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-90228.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 5.140164879556414 0.3718366767311976 2.6490934348058945 4 | 1.7744180851376485 4.838490976920333 2.6490933997374855 5 | 0.4934612210752001 0.3718367213762913 5.761552875939102 6 | Ag I O 7 | 2 1 6 8 | direct 9 | 0.7883772698439487 0.788377269837433 0.7883772698565537 10 | 0.21162273015605146 0.21162273016256714 0.21162273014344626 11 | 0.0 0.0 0.0 12 | 0.9094705607569298 0.1957406684587681 0.651908172993707 13 | 0.6519081730319839 0.9094705607564962 0.19574066846158192 14 | 0.19574066844088386 0.6519081730235854 0.9094705607570219 15 | 0.09052943924307054 0.8042593315412317 0.3480918270062929 16 | 0.3480918269680161 0.0905294392435039 0.8042593315384179 17 | 0.8042593315591162 0.3480918269764146 0.09052943924297818 18 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-90532.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.839493559425439 9.711650542e-07 -8.2659482e-09 4 | -2.4197477394300204 1.3970411289521494 4.689348110583432 5 | 2.419747734687513 -4.1911243580215105 -4.1329757e-09 6 | Fe O F 7 | 3 3 3 8 | direct 9 | 0.1432268964242956 0.4296806893998879 0.143226896466627 10 | 0.3470255163443093 0.041075548887188895 0.3470255162957263 11 | 0.6739576866664513 0.0218710599842613 0.6739576866614234 12 | 0.06985702181908923 0.2234090456504851 0.4226003260415003 13 | 0.42260032609601567 0.22340904573043846 0.7309516977419275 14 | 0.7309516978403365 0.2234090457085869 0.069857021913083 15 | 0.2720172600485725 0.7611818548508624 0.9322304762730241 16 | 0.5569341185262024 0.7611818549153203 0.2720172600461496 17 | 0.9322304762347267 0.7611818548729726 0.5569341185605378 18 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-90856.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.566933224304235 0.0 -0.0 4 | 0.0 3.566933224304235 -0.0 5 | -0.0 -0.0 9.397075454186664 6 | Ti Cu Si As 7 | 2 2 2 2 8 | direct 9 | 0.7500000000000001 0.7500000000000001 0.784935507022239 10 | 0.25 0.25 0.2150644929777609 11 | 0.25 0.7500000000000001 0.5 12 | 0.7500000000000001 0.25 0.5 13 | 0.25 0.7500000000000001 0.0 14 | 0.7500000000000001 0.25 0.0 15 | 0.7500000000000001 0.7500000000000001 0.3074869598412097 16 | 0.25 0.25 0.6925130401587904 17 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-97378.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 7.843871888963013 0.0 0.0 4 | 0.0 12.306037353082845 0.0 5 | 0.0 0.0 14.515625711752502 6 | Rb Pd I 7 | 8 4 24 8 | direct 9 | 0.2876517311753254 0.0070566724919719 0.8604605548901916 10 | 0.7876517311753253 0.49294332750802805 0.6395394451098084 11 | 0.7123482688246747 0.5070566724919717 0.1395394451098083 12 | 0.2123482688246746 0.9929433275080283 0.3604605548901917 13 | 0.7123482688246747 0.9929433275080283 0.1395394451098083 14 | 0.2123482688246746 0.5070566724919717 0.3604605548901917 15 | 0.2876517311753254 0.49294332750802805 0.8604605548901916 16 | 0.7876517311753253 0.0070566724919719 0.6395394451098084 17 | 0.7327242496991095 0.7500000000000001 0.3987015581802947 18 | 0.23272424969910951 0.7500000000000001 0.10129844181970521 19 | 0.2672757503008906 0.25 0.6012984418197055 20 | 0.7672757503008905 0.25 0.8987015581802946 21 | 0.0406164338186982 0.25 0.7895681899883269 22 | 0.2279403266327665 0.5312610072006797 0.1062612079229422 23 | 0.7279403266327666 0.9687389927993204 0.3937387920770576 24 | 0.2279403266327665 0.9687389927993204 0.1062612079229422 25 | 0.7279403266327666 0.5312610072006797 0.3937387920770576 26 | 0.7720596733672334 0.4687389927993204 0.8937387920770576 27 | 0.2720596733672337 0.0312610072006797 0.6062612079229424 28 | 0.4593835661813019 0.7500000000000001 0.2895681899883268 29 | 0.9593835661813017 0.7500000000000001 0.2104318100116731 30 | 0.5406164338186983 0.25 0.7104318100116731 31 | 0.0348150660866638 0.7500000000000001 0.4916181073867261 32 | 0.9854366817349451 0.25 0.2827376533290857 33 | 0.965184933913336 0.25 0.5083818926132739 34 | 0.4651849339133364 0.25 0.9916181073867261 35 | 0.0145633182650555 0.7500000000000001 0.7172623466709144 36 | 0.514563318265055 0.7500000000000001 0.7827376533290856 37 | 0.2720596733672337 0.4687389927993204 0.6062612079229424 38 | 0.4854366817349447 0.25 0.2172623466709143 39 | 0.0446995254154863 0.7500000000000001 0.9192848799281873 40 | 0.5446995254154867 0.7500000000000001 0.5807151200718127 41 | 0.9553004745845133 0.25 0.0807151200718119 42 | 0.4553004745845136 0.25 0.4192848799281881 43 | 0.534815066086664 0.7500000000000001 0.008381892613274 44 | 0.7720596733672334 0.0312610072006797 0.8937387920770576 45 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-97499.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 10.37325585559557 -2.271858823e-07 -0.0 4 | -5.186627729353156 8.98350272256319 -0.0 5 | -0.0 -0.0 8.066689507668043 6 | K Mn Mo O 7 | 8 2 8 30 8 | direct 9 | 0.9123842307283675 0.6114985518225908 0.1339521687423395 10 | 0.3885014481774494 0.3008856689058713 0.1339521687423395 11 | 0.087615769271632 0.3885014481774088 0.8660478312576608 12 | 0.6114985518225496 0.6991143310941279 0.8660478312576608 13 | 0.0 0.0 0.0 14 | 0.3008856689058241 0.9123842307284561 0.8660478312576608 15 | 0.6991143310941766 0.08761576927154349 0.1339521687423395 16 | 0.0 0.0 0.5 17 | 0.6666669999999968 0.3333330000000032 0.458004875613409 18 | 0.3333330000000032 0.6666669999999967 0.5419951243865911 19 | 0.9839765026346371 0.6598605056239827 0.6389064633788313 20 | 0.32411599701177846 0.9839765026335844 0.3610935366211687 21 | 0.6666669999999968 0.3333330000000032 0.856789420271389 22 | 0.3401394943771411 0.3241159970096013 0.6389064633788313 23 | 0.3333330000000032 0.6666669999999967 0.143210579728611 24 | 0.6758840029882213 0.0160234973664156 0.6389064633788313 25 | 0.016023497365362398 0.3401394943760165 0.3610935366211687 26 | 0.6598605056228588 0.6758840029903989 0.3610935366211687 27 | 0.3640873690748322 0.507511602768055 0.6650579195639872 28 | 0.6359126309251679 0.4924883972319457 0.3349420804360131 29 | 0.007904313538716009 0.2693499819917769 0.5595926856327027 30 | 0.20894259794521883 0.9912184382594202 0.2044301125771209 31 | 0.14342423369595786 0.6359126309239356 0.6650579195639872 32 | 0.2614456784517248 0.992095686462963 0.5595926856327027 33 | 0.7910574020547811 0.008781561740579499 0.7955698874228793 34 | 0.8255024848523503 0.3463696232922944 0.9500441555374498 35 | 0.5195005376208852 0.33180695359634343 0.6554769713587292 36 | 0.7385543215482749 0.007904313537036299 0.4404073143672971 37 | 0.73065001800956 0.7385543215452576 0.5595926856327027 38 | 0.1744975151476574 0.6536303767077055 0.0499558444625507 39 | 0.008781561742734994 0.21772415969064757 0.2044301125771209 40 | 0.3463696232960066 0.5208671284469394 0.0499558444625507 41 | 0.2693499819904395 0.2614456784547415 0.4404073143672971 42 | 0.8565757663040421 0.3640873690760644 0.3349420804360131 43 | 0.4804994623791147 0.6681930464036567 0.3445230286412709 44 | 0.9920956864612848 0.7306500180082224 0.4404073143672971 45 | 0.8123064159775117 0.4804994623825481 0.6554769713587292 46 | 0.5075116027707894 0.1434242336919898 0.3349420804360131 47 | 0.7822758403120454 0.7910574020499315 0.2044301125771209 48 | 0.4924883972292096 0.8565757663080095 0.6650579195639872 49 | 0.3318069535983971 0.8123064159788912 0.3445230286412709 50 | 0.1876935840224884 0.5195005376174519 0.3445230286412709 51 | 0.6681930464016037 0.1876935840211082 0.6554769713587292 52 | 0.5208671284436628 0.1744975151546455 0.9500441555374498 53 | 0.217724159687954 0.2089425979500682 0.7955698874228793 54 | 0.47913287155633694 0.8255024848453619 0.0499558444625507 55 | 0.6536303767039934 0.4791328715530608 0.9500441555374498 56 | 0.9912184382572647 0.782275840309352 0.7955698874228793 57 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-97570.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 6.9098665629767275 0.1286262909266546 -2.570460645968909 4 | -1.9404094646912355 4.803607055787978 4.676294800029834 5 | 2.00291479304321 -4.798810132987134 4.609377888841407 6 | Na Cr O 7 | 4 4 14 8 | direct 9 | 0.6769749789249806 0.9400489797042266 0.6229314608811622 10 | 0.3230250210750203 0.059951020295773115 0.3770685391188375 11 | 0.2506181370395198 0.3650750334341273 0.841270548538591 12 | 0.7493818629604807 0.6349249665658725 0.158729451461409 13 | 0.19996593494388792 0.8251875542329714 0.8696094722663035 14 | 0.8000340650561117 0.17481244576702934 0.1303905277336964 15 | 0.7608546300002266 0.50774736339615 0.6561347699973915 16 | 0.239145369999773 0.49225263660385066 0.3438652300026082 17 | 0.20889858089823077 0.32380581267264685 0.503013237548403 18 | 0.7911014191017697 0.6761941873273539 0.49698676245159656 19 | 0.3749083370005915 0.4562402211841992 0.1690572424042489 20 | 0.6250916629994067 0.5437597788158011 0.8309427575957513 21 | 0.353422139161524 0.7466774346567879 0.4419054676388132 22 | 0.6465778608384745 0.2533225653432131 0.5580945323611879 23 | 0.23679784005454194 0.02147215909092527 0.7412115023147688 24 | 0.12282604988784103 0.8655716269615095 0.08634011080516024 25 | 0.7632021599454576 0.9785278409090822 0.25878849768523005 26 | 0.0035919418281296833 0.5686991194852841 0.7538434681119827 27 | 0.5968865687275696 0.20822884116853055 0.12275067404711983 28 | 0.4031134312724304 0.7917711588314686 0.8772493259528806 29 | 0.8771739501121584 0.13442837303849053 0.9136598891948384 30 | -0.0035919418281300038 0.4313008805147168 0.24615653188801642 31 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-97677.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 6.603532697435508 0.0 -0.0415750874858069 4 | 0.0 9.955902882403395 0.0 5 | 0.0044710816739729 0.0 13.206224023104014 6 | Rb Ge B O 7 | 8 4 16 36 8 | direct 9 | 0.7777858233809999 0.376117903491008 0.1187057083032542 10 | 0.2222141766190003 0.8761179034910089 0.8812942916967458 11 | 0.2531982907498552 0.6550670834605686 0.1169029045348798 12 | 0.7468017092501446 0.1550670834605693 0.8830970954651206 13 | 0.7711562998796898 0.15472315617414478 0.36609706525383695 14 | 0.2288437001203109 0.6547231561741447 0.6339029347461628 15 | 0.7068165937997987 0.4308668586656295 0.6263491331759197 16 | 0.2931834062002018 0.9308668586656295 0.3736508668240807 17 | 0.24391577344557389 0.1583872623427114 0.6160546380402592 18 | 0.7560842265544262 0.6583872623427119 0.3839453619597407 19 | 0.741412766158242 0.6475038251270655 0.870574655232724 20 | 0.2585872338417572 0.1475038251270648 0.1294253447672757 21 | 0.1301228262731217 0.3498137861389932 0.7546603337871364 22 | 0.8698771737268781 0.8498137861389933 0.2453396662128629 23 | 0.0463396601938425 0.46248898842371355 0.4261788893820547 24 | 0.9536603398061577 0.9624889884237132 0.5738211106179447 25 | 0.3402904966206497 0.3423283867821033 0.983410486093169 26 | 0.5038803858272851 0.9605298606713598 0.6780782486335202 27 | 0.4961196141727146 0.46052986067135904 0.3219217513664799 28 | 0.65970950337935 0.8423283867821028 0.0165895139068308 29 | 0.19248218168073467 0.3224320210847631 0.2917473044156946 30 | 0.0681522535759205 0.48120799095904404 0.9087155710362855 31 | 0.9318477464240794 0.981207990959045 0.0912844289637152 32 | 0.6529080294686342 0.821527812304966 0.5446524567337122 33 | 0.3470919705313651 0.32152781230496635 0.4553475432662878 34 | 0.39997476218587386 0.48545813102493984 0.8367513044250913 35 | 0.6000252378141266 0.9854581310249392 0.1632486955749095 36 | 0.8075178183192654 0.8224320210847624 0.7082526955843063 37 | 0.7320224119189448 0.7402924571206045 0.6258091367528279 38 | 0.5211478103325705 0.4073436971292412 0.417449501699008 39 | 0.47885218966743 0.9073436971292403 0.5825504983009914 40 | 0.024769273527418693 0.414196987711834 0.32962313653430303 41 | 0.9752307264725887 0.9141969877118337 0.6703768634656968 42 | 0.18922455157303333 0.41777969259329945 0.4939317059619678 43 | 0.8107754484269675 0.917779692593299 0.506068294038032 44 | 0.9886884672631393 0.395218396215941 0.8218819117083555 45 | 0.3254584502102499 0.3946964162656124 0.7508020765031197 46 | 0.011311532736860398 0.8952183962159401 0.1781180882916446 47 | 0.3580342924098509 0.41463430133948126 0.2525759442185763 48 | 0.6419657075901491 0.9146343013394812 0.7474240557814238 49 | 0.5201152497151943 0.8948114217175218 0.082042724260049 50 | 0.4798847502848048 0.3948114217175225 0.9179572757399508 51 | 0.2679775880810553 0.24029245712060518 0.3741908632471727 52 | 0.6745415497897506 0.8946964162656124 0.2491979234968806 53 | 0.23249893467592206 0.565602177869238 0.8741276137934073 54 | 0.5843732140553032 0.7417439240377616 0.9546154584904284 55 | 0.5621941634833837 0.5650987387754844 0.7934764195298604 56 | 0.9380911716252942 0.7528958479694668 0.3142738412192894 57 | 0.0619088283747054 0.2528958479694669 0.6857261587807105 58 | 0.4156267859446964 0.241743924037761 0.0453845415095712 59 | 0.8568548116821844 0.8851139886251781 0.0105546749767847 60 | 0.5752704176207215 0.7400474129222799 0.4594226248182075 61 | 0.4247295823792789 0.2400474129222805 0.5405773751817923 62 | 0.9183470438347942 0.5620093935474862 0.46395858026733455 63 | 0.0816529561652054 0.0620093935474864 0.5360414197326654 64 | 0.09893061297711832 0.056361660273584094 0.046375230400882 65 | 0.9010693870228813 0.5563616602735842 0.9536247695991181 66 | 0.6186506589394938 0.56682727447181 0.2896187281392504 67 | 0.3813493410605066 0.0668272744718108 0.7103812718607492 68 | 0.10427782149274062 0.2439331247631687 0.210066262299143 69 | 0.8957221785072587 0.7439331247631692 0.7899337377008565 70 | 0.4378058365166174 0.065098738775485 0.2065235804701399 71 | 0.7675010653240785 0.0656021778692386 0.1258723862065925 72 | 0.1431451883178161 0.3851139886251782 0.989445325023215 73 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-97799.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 6.850665464204784 -0.0 0.0 4 | 0.0 9.151330054099736 0.0 5 | 0.0 0.0 11.686961966899378 6 | Ba Ge 7 | 8 16 8 | direct 9 | 0.7499999999999999 0.9851651816728333 0.3084537577307548 10 | 0.7499999999999999 0.4851651816728332 0.1915462422692452 11 | 0.25 0.5148348183271669 0.8084537577307543 12 | 0.7499999999999999 0.1558692741654669 0.9069863755111541 13 | 0.25 0.8441307258345327 0.093013624488846 14 | 0.7499999999999999 0.6558692741654674 0.5930136244888458 15 | 0.25 0.344130725834533 0.4069863755111539 16 | 0.25 0.0148348183271669 0.6915462422692455 17 | 0.25 0.694612273611149 0.5413297451577691 18 | 0.7499999999999999 0.305387726388851 0.45867025484223106 19 | 0.25 0.1946122736111491 0.9586702548422308 20 | 0.7499999999999999 0.805387726388851 0.041329745157768896 21 | 0.9380394582083632 0.3078244843922284 0.6495109575677563 22 | 0.25 0.4263194289212542 0.09264185587542718 23 | 0.7499999999999999 0.5736805710787457 0.9073581441245727 24 | 0.9380394582083632 0.8078244843922286 0.8504890424322437 25 | 0.4380394582083632 0.1921755156077715 0.1495109575677566 26 | 0.5619605417916368 0.3078244843922284 0.6495109575677563 27 | 0.0619605417916369 0.6921755156077715 0.3504890424322434 28 | 0.0619605417916369 0.1921755156077715 0.1495109575677566 29 | 0.5619605417916368 0.8078244843922286 0.8504890424322437 30 | 0.4380394582083632 0.6921755156077715 0.3504890424322434 31 | 0.7499999999999999 0.0736805710787458 0.5926418558754273 32 | 0.25 0.9263194289212543 0.40735814412457266 33 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-97915.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 10.725911963093319 1.15996857e-08 6.192607624601491 4 | 3.5753036689213147 10.112486758693379 6.19260762460149 5 | 1.20088783e-08 8.4915595e-09 12.385216217541235 6 | Ba Na Li N 7 | 14 14 1 6 8 | direct 9 | 0.31544648484414156 0.8948511717178177 0.8948511717180776 10 | 0.10514882828218239 0.6845535151567129 0.10514882828149484 11 | 0.10514882828192229 0.10514882828149491 0.6845535151554368 12 | 0.6845535151558584 0.10514882828218239 0.10514882828192225 13 | 0.1051488282800441 0.1051488282796167 0.10514882828115299 14 | 0.7068764599165493 0.2931235400809447 0.2931235400823319 15 | 0.8948511717180776 0.894851171718505 0.3154464848445629 16 | 0.706876459918591 0.2931235400829862 0.7068764599181327 17 | 0.8948511717178177 0.3154464848432867 0.8948511717185048 18 | 0.2931235400811265 0.2931235400801972 0.706876459917297 19 | 0.29312354008140906 0.7068764599170138 0.2931235400818674 20 | 0.2931235400834508 0.7068764599190556 0.7068764599176682 21 | 0.8948511717199564 0.8948511717203832 0.8948511717188466 22 | 0.7068764599188737 0.7068764599198026 0.29312354008270336 23 | 1.3204328855422072e-19 0.5 0.4999999999999999 24 | 0.0 0.0 0.5 25 | 0.5 0.0 -5.195197373883974e-18 26 | 1.3204328855422072e-19 0.5 -5.195197373883974e-18 27 | 0.5000000000000001 0.5 -1.0390394747767948e-17 28 | 0.32895067449333054 0.3289506744933275 0.3289506744933379 29 | 0.0131479665199807 0.3289506744933448 0.3289506744933433 30 | 0.32895067449334486 0.0131479665199864 0.3289506744933404 31 | 0.986852033480019 0.6710493255066551 0.6710493255066572 32 | 0.6710493255066697 0.6710493255066723 0.6710493255066621 33 | 0.5 0.0 0.4999999999999999 34 | 0.32895067449334336 0.3289506744933404 0.013147966519977797 35 | 0.6710493255066551 0.986852033480013 0.6710493255066595 36 | 0.6710493255066573 0.6710493255066597 0.9868520334800219 37 | 0.0 0.0 0.0 38 | 0.14974544913562332 0.1497454491355799 0.850254550864303 39 | 0.8502545508642679 0.1497454491356148 0.14974544913567964 40 | 0.8502545508643767 0.8502545508644198 0.14974544913569704 41 | 0.8502545508643635 0.1497454491357102 0.850254550864342 42 | 0.14974544913573173 0.8502545508643851 0.8502545508643204 43 | 0.14974544913563653 0.8502545508642896 0.14974544913565793 44 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-97984.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 5.157077730332642 0.0020004753718976 0.0 4 | -0.6195717699670901 5.315460223594058 0.0 5 | 0.0 0.0 5.483903388538411 6 | Tb Ta O 7 | 2 2 8 8 | direct 9 | 4.81509550042249e-19 0.75 0.7648789999795589 10 | -9.95979133970455e-19 0.24999999999999997 0.2351210000204415 11 | 0.5 0.24999999999999997 0.6945799355493159 12 | 0.5 0.7499999999999999 0.305420064450684 13 | 0.7322478341383682 0.0087980658316295 0.5618411666177799 14 | 0.26775216586163164 0.49120193416837066 0.5618411666177799 15 | 0.2677521658616316 0.9912019341683703 0.43815883338222034 16 | 0.7322478341383681 0.5087980658316296 0.43815883338222034 17 | 0.2512380081779776 0.6003034639861332 0.0820277804943317 18 | 0.7487619918220227 0.8996965360138666 0.0820277804943317 19 | 0.7487619918220229 0.39969653601386673 0.9179722195056683 20 | 0.2512380081779776 0.10030346398613328 0.9179722195056683 21 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-98167.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 5.464512229851642 0.0 -2.0923452919299104 4 | 0.0 6.906605401032501 0.0 5 | -0.0012121447362589 0.0 8.409227503444455 6 | Fe H Cl O 7 | 2 16 4 8 8 | direct 9 | -6.947425086243453e-21 0.5 0.5 10 | 0.0 0.0 0.0 11 | 0.3704220527933794 0.7709015610772086 -0.0010484401540996923 12 | 0.6295779472066204 0.2709015610772079 0.5010484401540996 13 | 0.6295779472066204 0.2290984389227916 0.0010484401540997218 14 | 0.37213781468933793 0.7745701414722783 0.1852646344624757 15 | 0.6278621853106623 0.2745701414722781 0.3147353655375242 16 | 0.6278621853106623 0.2254298585277219 0.8147353655375242 17 | 0.37213781468933793 0.7254298585277219 0.6852646344624759 18 | 0.37042205279337936 0.7290984389227916 0.4989515598459002 19 | 0.10949047482625232 0.4266152153389027 0.2065998395395252 20 | 0.10949047482625232 0.07338478466109781 0.7065998395395254 21 | 0.8905095251737484 0.5733847846610982 0.7934001604604746 22 | 0.11267596631551893 0.0730870948361732 0.3480346354865247 23 | 0.887324033684481 0.5730870948361723 0.15196536451347561 24 | 0.887324033684481 0.9269129051638278 0.6519653645134749 25 | 0.11267596631551893 0.42691290516382663 0.8480346354865251 26 | 0.8905095251737484 0.9266152153389019 0.29340016046047496 27 | 0.3231362840580268 0.2626170350373292 0.08026835330900871 28 | 0.6768637159419743 0.7626170350373289 0.4197316466909916 29 | 0.6768637159419741 0.7373829649626711 0.9197316466909912 30 | 0.32313628405802675 0.23738296496267114 0.5802683533090088 31 | 0.7395144265326714 0.2806030933720178 0.43514676387097423 32 | 0.0013585342591274003 0.5004593291738682 0.7502058507751245 33 | 0.9986414657408726 0.0004593291738687 0.7497941492248755 34 | 0.9986414657408726 0.4995406708261317 0.24979414922487453 35 | 0.0013585342591274003 0.9995406708261318 0.2502058507751251 36 | 0.26048557346732837 0.7193969066279823 0.5648532361290265 37 | 0.7395144265326714 0.21939690662798203 0.9351467638709735 38 | 0.26048557346732837 0.7806030933720179 0.0648532361290261 39 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-98224.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 3.8114364321417686 0.0 0.0 4 | 0.0 6.105937959877644 -0.1432562071003751 5 | 0.0 -0.0244931125279313 7.551084446229577 6 | Ni Te 7 | 6 4 8 | direct 9 | 0.24999999999999997 0.2885213091631489 0.6354309692664298 10 | 0.7499999999999999 0.7114786908368511 0.36456903073357033 11 | 0.24999999999999997 0.0080805790835277 0.37071230508688213 12 | 0.7499999999999999 0.9919194209164722 0.629287694913118 13 | 0.24999999999999997 0.9941329696331463 0.8774102833701926 14 | 0.7499999999999999 0.005867030366853399 0.12258971662980699 15 | 0.24999999999999997 0.7175196996728425 0.11835822745805179 16 | 0.7499999999999999 0.2824803003271577 0.8816417725419476 17 | 0.24999999999999997 0.7125856788066884 0.6192643282192467 18 | 0.7499999999999999 0.2874143211933116 0.38073567178075285 19 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-98225.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 7.2963518353359165 0.0 0.0 4 | 0.0 12.357041682775112 -5.2845586858227165 5 | 0.0 -0.0387593429993432 14.224638121809875 6 | K Bi 7 | 16 16 8 | direct 9 | 0.125438452101316 0.5574636895311021 0.8449171159307716 10 | 0.6338684537730342 0.3596782253356972 0.8853339190028652 11 | 0.8661315462269656 0.8596782253356972 0.8853339190028652 12 | 0.36613154622696553 0.6403217746643027 0.11466608099713507 13 | 0.2960662902109483 0.039071020530381695 0.39736051033689396 14 | 0.796066290210948 0.46092897946961814 0.6026394896631061 15 | 0.7039337097890519 0.9609289794696184 0.602639489663106 16 | 0.20393370978905156 0.5390710205303814 0.39736051033689396 17 | 0.1338684537730343 0.14032177466430276 0.11466608099713509 18 | 0.5686664058386977 0.307266972413607 0.3454207502513825 19 | 0.9313335941613022 0.8072669724136069 0.34542075025138247 20 | 0.43133359416130196 0.6927330275863925 0.6545792497486168 21 | 0.37456154789868407 0.05746368953110199 0.8449171159307716 22 | 0.8745615478986836 0.442536310468898 0.15508288406922857 23 | 0.6254384521013163 0.9425363104688976 0.1550828840692286 24 | 0.0686664058386979 0.1927330275863934 0.6545792497486168 25 | 0.35357049258840095 0.8226316517953188 0.9259824830970296 26 | 0.8535704925884013 0.6773683482046808 0.07401751690297029 27 | 0.386376800673597 0.37165922956753966 0.11659856845111777 28 | 0.8863768006735974 0.1283407704324603 0.8834014315488823 29 | 0.6136231993264025 0.6283407704324603 0.8834014315488823 30 | 0.11362319932640279 0.8716592295675396 0.1165985684511178 31 | 0.06089675710707319 0.27184897169410394 0.38698771652261116 32 | 0.43910324289292674 0.7718489716941044 0.3869877165226111 33 | 0.939103242892927 0.7281510283058954 0.6130122834773885 34 | 0.2913096920645714 0.39144847966356333 0.5800172016622356 35 | 0.7913096920645717 0.10855152033643678 0.41998279833776453 36 | 0.7086903079354282 0.6085515203364366 0.41998279833776453 37 | 0.20869030793542848 0.8914484796635632 0.5800172016622356 38 | 0.1464295074115987 0.32263165179531905 0.9259824830970295 39 | 0.5608967571070729 0.22815102830589604 0.6130122834773886 40 | 0.6464295074115985 0.1773683482046809 0.0740175169029703 41 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-98284.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 4.084155317570781 -1.0668253e-09 0.7814969701143276 4 | 1.220610491725006 10.078960482406687 4.68379165911536 5 | -0.0225986115420174 -0.0217823440827324 11.18088794197207 6 | Ce Al Pt 7 | 2 16 9 8 | direct 9 | 0.7729758866231833 0.2270241133767581 0.22702411337675668 10 | 0.2270241133768166 0.7729758866232419 0.7729758866232433 11 | 0.41302533231747257 0.08697466768262302 0.0869746676826307 12 | 0.6092469568259418 0.5088488541309232 0.2726572222159233 13 | 0.07868697617549565 0.7500223900184196 0.09260365762985412 14 | 0.9213130238236903 0.9073963423701478 0.24997760998156796 15 | 0.3907530431740579 0.4911511458690767 0.727342777784077 16 | 3.908351300980554e-13 0.6114325604750731 0.3885674395249293 17 | -3.9092675417696086e-13 0.3885674395249265 0.6114325604750706 18 | 0.2038696013497933 0.1043155936215737 0.48794521367760824 19 | 0.7961303986502066 0.8956844063784264 0.5120547863223917 20 | 0.39075304317336657 0.7273427777840595 0.4911511458690852 21 | 0.5869746676825269 0.9130253323173767 0.9130253323173695 22 | 0.9213130238245042 0.24997760998158017 0.907396342370146 23 | 0.7961303986497686 0.5120547863223823 0.8956844063784296 24 | 0.07868697617630949 0.0926036576298526 0.7500223900184319 25 | 0.6092469568266334 0.2726572222159407 0.5088488541309149 26 | 0.20386960135023124 0.4879452136776175 0.10431559362157082 27 | 0.6603198615884197 0.654873343416703 0.024486933406104826 28 | 0.0 0.0 0.0 29 | 0.12663226539630895 0.3733677346041817 0.37336773460418043 30 | 0.5000000000022752 0.7420940413472576 0.2579059586527599 31 | 0.8733677346036909 0.6266322653958185 0.6266322653958197 32 | 0.6603198615880616 0.0244869334061086 0.6548733434166955 33 | 0.3396801384115801 0.3451266565832974 0.9755130665938954 34 | 0.4999999999977247 0.257905958652742 0.7420940413472402 35 | 0.33968013841193834 0.9755130665938914 0.3451266565833046 36 | -------------------------------------------------------------------------------- /examples/POSCAR-JVASP-98550.vasp: -------------------------------------------------------------------------------- 1 | System 2 | 1.0 3 | 5.587070827330502 -0.006443663978878 8.473581541003853 4 | 2.5373192932596913 4.977690990539769 8.473581542763228 5 | -0.0105307188315544 -0.0064436553469877 10.149720526368277 6 | Ba Ce Mn O 7 | 4 1 3 12 8 | direct 9 | 0.28264367693988574 0.28264367693994413 0.2826436769399879 10 | 0.1310808696891535 0.1310808696891073 0.1310808696890726 11 | 0.7173563230601145 0.7173563230600561 0.7173563230600122 12 | 0.8689191303108464 0.8689191303108927 0.8689191303109276 13 | 0.0 0.0 0.0 14 | 0.4140467937920819 0.4140467937934521 0.4140467937944797 15 | 0.5859532062079178 0.5859532062065482 0.5859532062055202 16 | 0.5000000000000001 0.5000000000000001 0.49999999999999983 17 | 0.7768348018841693 0.3112300725269809 0.7768348018805026 18 | 0.6058084472441644 0.6058084472425342 0.16339896390998823 19 | 0.163398963908445 0.6058084472430464 0.6058084472438565 20 | 0.3941915527558357 0.3941915527574657 0.8366010360900124 21 | 0.8366010360915549 0.39419155275695367 0.39419155275614365 22 | 0.22316519811385446 0.223165198118644 0.6887699274751438 23 | 0.39419155275677753 0.8366010360895119 0.39419155275759765 24 | 0.3112300725235278 0.7768348018830311 0.7768348018841541 25 | 0.6058084472432221 0.16339896391048817 0.6058084472424022 26 | 0.7768348018861453 0.7768348018813561 0.3112300725248564 27 | 0.6887699274764723 0.2231651981169689 0.22316519811584606 28 | 0.2231651981158307 0.6887699274730187 0.22316519811949784 29 | -------------------------------------------------------------------------------- /examples/config_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "112bbedebdaecf59fb18e11c929080fb2f358246", 3 | "dataset": "user_data", 4 | "source_model": null, 5 | "target": "target", 6 | "atom_features": "cgcnn", 7 | "neighbor_strategy": "k-nearest", 8 | "id_tag": "jid", 9 | "random_seed": 123, 10 | "classification_threshold": null, 11 | "n_val": null, 12 | "n_test": null, 13 | "n_train": null, 14 | "train_ratio": 0.80, 15 | "val_ratio": 0.10, 16 | "test_ratio": 0.10, 17 | "target_multiplication_factor": null, 18 | "epochs": 300, 19 | "batch_size": 64, 20 | "weight_decay": 1e-05, 21 | "learning_rate": 0.001, 22 | "filename": "sample", 23 | "warmup_steps": 2000, 24 | "criterion": "mse", 25 | "optimizer": "adamw", 26 | "scheduler": "onecycle", 27 | "pin_memory": false, 28 | "save_dataloader": false, 29 | "write_checkpoint": true, 30 | "write_predictions": true, 31 | "store_outputs": true, 32 | "progress": true, 33 | "log_tensorboard": false, 34 | "standard_scalar_and_pca": false, 35 | "use_canonize": true, 36 | "num_workers": 0, 37 | "cutoff": 8.0, 38 | "max_neighbors": 12, 39 | "keep_data_order": false, 40 | "model": { 41 | "name": "alignn", 42 | "alignn_layers": 4, 43 | "gcn_layers": 4, 44 | "atom_input_features": 92, 45 | "edge_input_features": 80, 46 | "triplet_input_features": 40, 47 | "embedding_features": 64, 48 | "hidden_features": 256, 49 | "output_features": 1, 50 | "link": "identity", 51 | "zero_inflated": false, 52 | "classification": false 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /examples/id_prop.csv: -------------------------------------------------------------------------------- 1 | POSCAR-JVASP-90856.vasp,0.000000 2 | POSCAR-JVASP-86097.vasp,0.000000 3 | POSCAR-JVASP-64906.vasp,0.000000 4 | POSCAR-JVASP-98225.vasp,0.472000 5 | POSCAR-JVASP-10.vasp,0.000000 6 | POSCAR-JVASP-14014.vasp,0.000000 7 | POSCAR-JVASP-64664.vasp,0.000000 8 | POSCAR-JVASP-22556.vasp,0.000000 9 | POSCAR-JVASP-86726.vasp,0.000000 10 | POSCAR-JVASP-28634.vasp,0.689000 11 | POSCAR-JVASP-98550.vasp,1.517000 12 | POSCAR-JVASP-89265.vasp,0.000000 13 | POSCAR-JVASP-97915.vasp,0.000000 14 | POSCAR-JVASP-90228.vasp,0.000000 15 | POSCAR-JVASP-42300.vasp,0.000000 16 | POSCAR-JVASP-86968.vasp,2.122000 17 | POSCAR-JVASP-90532.vasp,0.000000 18 | POSCAR-JVASP-50332.vasp,0.000000 19 | POSCAR-JVASP-86205.vasp,0.000000 20 | POSCAR-JVASP-28704.vasp,0.502000 21 | POSCAR-JVASP-60702.vasp,1.197000 22 | POSCAR-JVASP-97799.vasp,0.560000 23 | POSCAR-JVASP-28565.vasp,0.051000 24 | POSCAR-JVASP-86436.vasp,4.907000 25 | POSCAR-JVASP-1372.vasp,1.681000 26 | POSCAR-JVASP-14873.vasp,0.016000 27 | POSCAR-JVASP-28397.vasp,0.658000 28 | POSCAR-JVASP-98284.vasp,0.000000 29 | POSCAR-JVASP-89025.vasp,2.472000 30 | POSCAR-JVASP-1996.vasp,3.851000 31 | POSCAR-JVASP-48166.vasp,0.482000 32 | POSCAR-JVASP-15345.vasp,0.000000 33 | POSCAR-JVASP-97378.vasp,0.924000 34 | POSCAR-JVASP-97984.vasp,4.030000 35 | POSCAR-JVASP-98224.vasp,0.000000 36 | POSCAR-JVASP-98167.vasp,0.239000 37 | POSCAR-JVASP-64045.vasp,0.000000 38 | POSCAR-JVASP-63912.vasp,0.000000 39 | POSCAR-JVASP-64003.vasp,0.000000 40 | POSCAR-JVASP-64584.vasp,0.000000 41 | POSCAR-JVASP-64240.vasp,0.000000 42 | POSCAR-JVASP-107772.vasp,0.000000 43 | POSCAR-JVASP-64719.vasp,0.000000 44 | POSCAR-JVASP-97499.vasp,1.569000 45 | POSCAR-JVASP-64377.vasp,0.000000 46 | POSCAR-JVASP-21210.vasp,6.149000 47 | POSCAR-JVASP-97677.vasp,4.072000 48 | POSCAR-JVASP-65101.vasp,0.000000 49 | POSCAR-JVASP-65062.vasp,0.000000 50 | POSCAR-JVASP-97570.vasp,2.341000 51 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """ALIGNN: Atomistic LIne Graph Neural Network. 2 | 3 | https://jarvis.nist.gov. 4 | """ 5 | 6 | import setuptools 7 | 8 | with open("README.md", "r", encoding="utf-8") as fh: 9 | long_description = fh.read() 10 | 11 | setuptools.setup( 12 | name="alignn", 13 | version="2021.11.16", 14 | author="Kamal Choudhary, Brian DeCost", 15 | author_email="kamal.choudhary@nist.gov", 16 | description="alignn", 17 | install_requires=[ 18 | "numpy>=1.19.5", 19 | "scipy>=1.6.1", 20 | "jarvis-tools>=2021.07.19", 21 | "torch>=1.7.1", 22 | "dgl-cu101>=0.6.0", 23 | "dgl>=0.6.0", 24 | "scikit-learn>=0.22.2", 25 | "matplotlib>=3.4.1", 26 | "tqdm>=4.60.0", 27 | "pandas>=1.2.3", 28 | "pytorch-ignite>=0.4.7", 29 | "pydantic>=1.8.1", 30 | "flake8>=3.9.1", 31 | "pycodestyle>=2.7.0", 32 | "pydocstyle>=6.0.0", 33 | "pyparsing>=2.2.1,<3", 34 | ], 35 | # scripts=["alignn/alignn_train_folder.py"], 36 | scripts=['alignn/pretrained.py','alignn/train_folder.py'], 37 | long_description=long_description, 38 | long_description_content_type="text/markdown", 39 | url="https://github.com/usnistgov/alignn", 40 | packages=setuptools.find_packages(), 41 | classifiers=[ 42 | "Programming Language :: Python :: 3", 43 | "License :: OSI Approved :: MIT License", 44 | "Operating System :: OS Independent", 45 | ], 46 | python_requires=">=3.7", 47 | ) 48 | --------------------------------------------------------------------------------