-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_starting_structures.py
More file actions
38 lines (26 loc) · 1.25 KB
/
create_starting_structures.py
File metadata and controls
38 lines (26 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import argparse
import json
from UnitCell_Environment.unitcell_environment.env.utils import load_compositions, random_airss_structure
if __name__ == "__main__":
cell_fixed = False
parser = argparse.ArgumentParser(description='Optional app description')
parser.add_argument('--output_dir', type=str, default="new_starting_structures",
help='The directory to save the structures')
parser.add_argument("--n", type=int, default="10",
help="The number of structures to generate")
parser.add_argument("--comp_config", type=str, default="comp_config.json",
help="the config file with compositions and structure sizes supported")
parser.add_argument("--comp", type=str, default="SrTiO3x8",
help="the composition/structure size name")
args = parser.parse_args()
directory = args.output_dir
if not os.path.exists(directory):
os.makedirs(directory)
with open(args.comp_config, 'r') as f:
comp_config = json.load(f)
load_compositions(comp_config)
for i in range(args.n):
atoms = random_airss_structure(args.comp, cell_fixed=cell_fixed)
atoms.write(f"{directory}/{args.comp}_{i}.cif")
quit()