|
30 | 30 | import shutil |
31 | 31 | import numpy as np |
32 | 32 |
|
| 33 | +def read_report(folder): |
| 34 | + """ |
| 35 | + Read the finished calculation report |
| 36 | + """ |
| 37 | + repfile = os.path.join(folder, "report.yaml") |
| 38 | + if not os.path.exists(repfile): |
| 39 | + raise FileNotFoundError(f"file {repfile} not found") |
| 40 | + |
| 41 | + with open(repfile, 'r') as fin: |
| 42 | + data = yaml.safe_load(fin) |
| 43 | + return data |
| 44 | + |
33 | 45 | class InputTemplate: |
34 | 46 | def __init__(self): |
35 | 47 | pass |
@@ -93,7 +105,6 @@ def merge_dicts(self, dicts): |
93 | 105 | merged_dict[key] = val |
94 | 106 | return merged_dict |
95 | 107 |
|
96 | | - |
97 | 108 | class CompositionScaling(InputTemplate): |
98 | 109 | def __init__(self): |
99 | 110 | self._input_chemical_composition = None |
@@ -157,6 +168,7 @@ def __init__(self): |
157 | 168 | self._n_print_steps = 0 |
158 | 169 | self._n_iterations = 1 |
159 | 170 | self._equilibration_control = None |
| 171 | + self._folder_prefix = None |
160 | 172 |
|
161 | 173 | #add second level options; for example spring constants |
162 | 174 | self._spring_constants = None |
@@ -549,6 +561,14 @@ def spring_constants(self, val): |
549 | 561 | val = self.check_and_convert_to_list(val, check_none=True) |
550 | 562 | self._spring_constants = val |
551 | 563 |
|
| 564 | + @property |
| 565 | + def folder_prefix(self): |
| 566 | + return self._folder_prefix |
| 567 | + |
| 568 | + @folder_prefix.setter |
| 569 | + def folder_prefix(self, val): |
| 570 | + self._folder_prefix = val |
| 571 | + |
552 | 572 | def fix_paths(self, potlist): |
553 | 573 | """ |
554 | 574 | Fix paths for potential files to complete ones |
@@ -594,7 +614,11 @@ def create_identifier(self): |
594 | 614 | l = self.lattice |
595 | 615 | l = l.split('/') |
596 | 616 | l = l[-1] |
597 | | - identistring = "-".join([prefix, l, str(ts), str(ps)]) |
| 617 | + |
| 618 | + if self.folder_prefix is None: |
| 619 | + identistring = "-".join([prefix, l, str(ts), str(ps)]) |
| 620 | + else: |
| 621 | + identistring = "-".join([self.folder_prefix, prefix, l, str(ts), str(ps)]) |
598 | 622 | return identistring |
599 | 623 |
|
600 | 624 | def create_folders(self, prefix=None): |
@@ -688,7 +712,8 @@ def read_inputfile(file): |
688 | 712 | if mode == "melting_temperature": |
689 | 713 | calc = Calculation.generate(indata) |
690 | 714 | calc.add_from_dict(ci, keys=["mode", "pair_style", "pair_coeff", "repeat", "n_equilibration_steps", |
691 | | - "n_switching_steps", "n_print_steps", "n_iterations", "spring_constants", "equilibration_control"]) |
| 715 | + "n_switching_steps", "n_print_steps", "n_iterations", "spring_constants", "equilibration_control", |
| 716 | + "folder_prefix"]) |
692 | 717 | calc.pressure = Calculation.convert_to_list(ci["pressure"], check_none=True) if "pressure" in ci.keys() else 0 |
693 | 718 | calc.temperature = Calculation.convert_to_list(ci["temperature"]) if "temperature" in ci.keys() else None |
694 | 719 | calc.lattice = Calculation.convert_to_list(ci["lattice"]) if "lattice" in ci.keys() else None |
@@ -724,7 +749,7 @@ def read_inputfile(file): |
724 | 749 | calc = Calculation.generate(indata) |
725 | 750 | calc.add_from_dict(ci, keys=["mode", "pair_style", "pair_coeff", "repeat", "n_equilibration_steps", |
726 | 751 | "n_switching_steps", "n_print_steps", "n_iterations", "potential_file", "spring_constants", |
727 | | - "melting_cycle", "equilibration_control"]) |
| 752 | + "melting_cycle", "equilibration_control", "folder_prefix"]) |
728 | 753 | calc.lattice = combo[0]["lattice"] |
729 | 754 | calc.lattice_constant = combo[0]["lattice_constant"] |
730 | 755 | calc.reference_phase = combo[0]["reference_phase"] |
|
0 commit comments