def create_json_file(self): data = {'name': self.name, 'path': self.path} if not os.path.exists(self.path): mkdir(self.path) json_file = os.path.join(self.path, 'data.json') if not os.path.exists(json_file): with open(json_file, 'w') as f: json.dump(data, f, indent=4) return json_file
def copy_inp_file(job): ziel_path = job.path if not os.path.exists(ziel_path): mkdir(ziel_path) inp_path = os.path.dirname(__file__) inp_from = os.path.join(inp_path, 'input.loc') inp_to = os.path.join(ziel_path, 'input.loc') shutil.copy(inp_from, inp_to) print(ziel_path) print('input.loc copied.')
def pipeline(): Ini = IniReader() path = Ini.project_path start = Ini.start end = Ini.end now = datetime.now() now = now.strftime("%b %d %Y %H:%M:%S") rec = 'Project begins.' rec += '\n' + '***' * 25 rename_file(path, 'record') record(path, rec, init=True) print('***' * 25) print(now) print(rec) mkdir(path) try: shutil.copy(Ini.ini_path, path + '/input.ini') except Exception as e: print(e) anchor = start while anchor < end: # print(anchor, end) if anchor == 0: GeoOpt.geo_opt(path) elif anchor == 1: HF1.hf1(path) elif anchor == 2: Loc.localization(path) elif anchor == 3: HF2.hf2(path) elif anchor == 4: LMP2.lmp2(path) elif anchor == 5: RPA.rpa(path) elif anchor == 6: Cluster.cluster(path) elif anchor == 7: Correction.correction(path) elif anchor == 8: Results.results(path) anchor += 1 now = datetime.now() now = now.strftime("%b %d %Y %H:%M:%S") rec = 'Project End.\n' rec += '***' * 25 rename_file(path, 'record') record(path, rec, init=True) print(now) print(rec)
def write_part1(self): mkdir(self.lmp2_path) with open(self.input_path, 'w') as f: f.write('READC14' + '\n') f.write('DUALBAS' + '\n') f.write('KNET' + '\n') f.write('8' + '\n') f.write('MEMORY' + '\n') f.write('40000' + '\n') f.write('NOSYM12' + '\n') f.write('CLUSCOR' + '\n') f.write('LPairlst' + '\n') f.write('100000' + '\n') f.write('MOG_DIST' + '\n') f.write('9 9' + '\n') f.write('NOSING' + '\n') f.write('NFITCEL' + '\n') f.write('-100' + '\n') f.write('STREAMIN' + '\n') f.write('SMAL3IDX' + '\n')
def write_basic_info(self): mkdir(self.dir_path) with open(self.input_path, 'w') as f: f.write(self.name + '\n') f.write(self.slab_or_molecule + '\n') f.write(str(self.layer_group) + '\n')
def copy_molpro_inp(self): mkdir(self.rpa_path) inp_from = self.rpa_path.replace('rpa', 'lmp2') inp_from = os.path.join(inp_from, 'molpro.inp') shutil.copy(inp_from, self.inp_file)