-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.py
34 lines (27 loc) · 976 Bytes
/
generator.py
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
"""
Generate test_generator.json for tests generation
Date: 2015/08/24
Author: Junhao Li <streaver91@gmail.com>
"""
import json
from ase.data import chemical_symbols
from random import randint
lattices = ['fcc', 'bcc', 'sc', 'diamond', 'hcp']
# Parameters for Debugging
lattices = ['fcc']
# chemical_symbols = ['Al']
with open('test_generator.json', 'w') as f:
for pk, elem in enumerate(chemical_symbols):
for lattice in lattices:
kimnum = '{:012d}'.format(randint(0, 10**12 - 1))
# hcp lattice will use a different lattice constant driver
if lattice == 'hcp':
latticeProperty = 'structure-hexagonal-crystal-npt'
else:
latticeProperty = 'structure-cubic-crystal-npt'
f.write(json.dumps({
'symbol': elem,
'lattice': lattice,
'kimnum': kimnum,
'latticeProperty': latticeProperty,
}) + '\n')