|
9 | 9 | from perplex_utils import run_vertex, run_pssect |
10 | 10 | from perplex_utils import create_perplex_table |
11 | 11 |
|
12 | | -project_name = "iron_olivine_lo_res" |
13 | | -database = databases["stx24"] |
14 | | -composition = burnman.Composition( |
15 | | - {"MgO": 1.8, "FeO": 0.2, "SiO2": 1.0, "Fe": 0.1}, "molar" |
16 | | -) |
17 | | -pressure_range = [1.0e5, 10.0e9] |
18 | | -temperature_range = [200.0, 3000.0] |
19 | | -n_pressures = 11 |
20 | | -n_temperatures = 11 |
21 | | -outfile = "iron_olivine_lo_res_table.dat" |
| 12 | +if __name__ == "__main__": |
| 13 | + project_name = "iron_olivine_lo_res" |
| 14 | + database = databases["stx24"] |
| 15 | + composition = burnman.Composition( |
| 16 | + {"MgO": 1.8, "FeO": 0.2, "SiO2": 1.0, "Fe": 0.1}, "molar" |
| 17 | + ) |
| 18 | + pressure_range = [1.0e5, 10.0e9] |
| 19 | + temperature_range = [200.0, 3000.0] |
| 20 | + n_pressures = 11 |
| 21 | + n_temperatures = 11 |
| 22 | + outfile = "iron_olivine_lo_res_table.dat" |
22 | 23 |
|
23 | | -perplex_dir = os.path.join(os.getcwd(), "perplex-installer/Perple_X") |
24 | | -perplex_bindir = os.path.join(os.getcwd(), "perplex-installer/Perple_X/bin") |
| 24 | + perplex_dir = os.path.join(os.getcwd(), "perplex-installer/Perple_X") |
| 25 | + perplex_bindir = os.path.join(os.getcwd(), "perplex-installer/Perple_X/bin") |
25 | 26 |
|
26 | | -try: |
27 | | - shutil.rmtree(project_name) |
28 | | - print(f"Deleted old project directory ({project_name}).") |
29 | | -except FileNotFoundError: |
30 | | - pass |
| 27 | + try: |
| 28 | + shutil.rmtree(project_name) |
| 29 | + print(f"Deleted old project directory ({project_name}).") |
| 30 | + except FileNotFoundError: |
| 31 | + pass |
31 | 32 |
|
32 | | -os.mkdir(project_name) |
33 | | -os.chdir(project_name) |
34 | | -print(f"Now working in newly created directory ({os.getcwd().split("/")[-1]}).") |
| 33 | + os.mkdir(project_name) |
| 34 | + os.chdir(project_name) |
| 35 | + print(f"Now working in newly created directory ({project_name}).") |
35 | 36 |
|
36 | | -print("Creating local copies of requested thermodynamic data files...") |
37 | | -endmember_file = os.path.join(perplex_dir, "datafiles", database["data_file"]) |
38 | | -solution_file = os.path.join(perplex_dir, "datafiles", database["solution_model_file"]) |
39 | | -shutil.copyfile(endmember_file, os.path.join(os.getcwd(), database["data_file"])) |
40 | | -shutil.copyfile( |
41 | | - solution_file, os.path.join(os.getcwd(), database["solution_model_file"]) |
42 | | -) |
43 | | -perplex_option_file = "burnman_perplex_options.dat" |
| 37 | + print("Creating local copies of requested thermodynamic data files...") |
| 38 | + endmember_file = os.path.join(perplex_dir, "datafiles", database["data_file"]) |
| 39 | + solution_file = os.path.join( |
| 40 | + perplex_dir, "datafiles", database["solution_model_file"] |
| 41 | + ) |
| 42 | + shutil.copyfile(endmember_file, os.path.join(os.getcwd(), database["data_file"])) |
| 43 | + shutil.copyfile( |
| 44 | + solution_file, os.path.join(os.getcwd(), database["solution_model_file"]) |
| 45 | + ) |
| 46 | + perplex_option_file = "burnman_perplex_options.dat" |
44 | 47 |
|
45 | | -with open(perplex_option_file, "w") as f: |
46 | | - f.write("sample_on_grid F") |
| 48 | + with open(perplex_option_file, "w") as f: |
| 49 | + f.write("sample_on_grid F") |
47 | 50 |
|
48 | | -print("Making build file...") |
49 | | -make_build_file( |
50 | | - perplex_bindir, |
51 | | - project_name, |
52 | | - database, |
53 | | - perplex_option_file, |
54 | | - composition, |
55 | | - pressure_range, |
56 | | - temperature_range, |
57 | | - verbose=False, |
58 | | -) |
| 51 | + print("Making build file...") |
| 52 | + make_build_file( |
| 53 | + perplex_bindir, |
| 54 | + project_name, |
| 55 | + database, |
| 56 | + perplex_option_file, |
| 57 | + composition, |
| 58 | + pressure_range, |
| 59 | + temperature_range, |
| 60 | + verbose=False, |
| 61 | + ) |
59 | 62 |
|
60 | | -print("Running vertex...") |
61 | | -run_vertex(perplex_bindir, project_name, verbose=False) |
| 63 | + print("Running vertex...") |
| 64 | + run_vertex(perplex_bindir, project_name, verbose=False) |
62 | 65 |
|
63 | | -print("Running pssect...") |
64 | | -run_pssect(perplex_bindir, project_name, convert_to_pdf=False, verbose=False) |
| 66 | + print("Running pssect...") |
| 67 | + run_pssect(perplex_bindir, project_name, convert_to_pdf=False, verbose=False) |
65 | 68 |
|
66 | | -print("Creating BurnMan-readable table...") |
67 | | -create_perplex_table( |
68 | | - perplex_bindir, |
69 | | - project_name, |
70 | | - outfile, |
71 | | - n_pressures, |
72 | | - n_temperatures, |
73 | | - pressure_range, |
74 | | - temperature_range, |
75 | | -) |
76 | | -print("Processing complete.") |
| 69 | + print("Creating BurnMan-readable table...") |
| 70 | + create_perplex_table( |
| 71 | + perplex_bindir, |
| 72 | + project_name, |
| 73 | + outfile, |
| 74 | + n_pressures, |
| 75 | + n_temperatures, |
| 76 | + pressure_range, |
| 77 | + temperature_range, |
| 78 | + ) |
| 79 | + print("Processing complete.") |
0 commit comments