-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_catalog.sage
60 lines (51 loc) · 2.28 KB
/
generate_catalog.sage
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
# coding: utf-8
## Generates groups catalogs and stores them in `precomputed/` as json files.
## The keys are fingerprints of the groups.
## The values are the names of the groups.
load("main_functions.sage")
def main():
## input
should_generate_tubical = True
tubical_orderbound = 2000
should_generate_toroidal = True
toroidal_orderbound = 130
should_generate_polyhedral_and_axial = True
## output directory
output_dir = "precomputed/"
Path(output_dir).mkdir(parents=True, exist_ok=True)
## tubical
if should_generate_tubical:
catalog = {}
generate_tubical(orderbound=tubical_orderbound, generate_full=False, names_only=True, verbose=False)
assert len(set(flatten(list(catalog.values())))) == len(flatten(list(catalog.values())))
filename = f"tubical_catalog_orderbound_{tubical_orderbound}.json"
with open(output_dir + filename, "w") as f:
json.dump(catalog, f, indent=4)
print()
## toroidal
if should_generate_toroidal:
catalog = {}
generate_chiral_toroidal(orderbound=toroidal_orderbound, generate_full=False, names_only=True, verbose=False)
assert len(set(flatten(list(catalog.values())))) == len(flatten(list(catalog.values())))
filename = f"toroidal_chiral_catalog_orderbound_{toroidal_orderbound}.json"
with open(output_dir + filename, "w") as f:
json.dump(catalog, f, indent=4)
print()
catalog = {}
generate_achiral_toroidal(orderbound=toroidal_orderbound, generate_full=False, names_only=True, verbose=False)
assert len(set(flatten(list(catalog.values())))) == len(flatten(list(catalog.values())))
filename = f"toroidal_achiral_catalog_orderbound_{toroidal_orderbound}.json"
with open(output_dir + filename, "w") as f:
json.dump(catalog, f, indent=4)
print()
## polyhedral and axial
if should_generate_polyhedral_and_axial:
catalog = {}
generate_polyhedral_and_axial(names_only=True, verbose=False)
filename = f"polyhedral_and_axial_catalog.json"
with open(output_dir + filename, "w") as f:
json.dump(catalog, f, indent=4)
print()
if __name__ == "__main__" and "__file__" in globals():
main()