def _writeCubeFile(self, step, molID, numCube=-1): """ Converts each molecular wavefunction to a cube file to be loaded in vmd """ self.__createCubeFileTxt(step, molID) start_data_write_time = time.time() if all_settings['keep_cube_files']: RDataFName = "%s-%i-%i.cube" % ('Real', step, molID) IDataFName = "%s-%i-%i.cube" % ('Imag', step, molID) else: RDataFName = "tmp%s-%i.cube" % ('Real', molID) IDataFName = "tmp%s-%i.cube" % ('Imag', molID) RDataFPath = self.all_settings['data_fold'] / RDataFName IDataFPath = self.all_settings['data_fold'] / IDataFName if not all_settings['keep_cube_files']: self.all_settings['delete_these'].append(RDataFPath) self.all_settings['delete_these'].append(IDataFPath) if self.writeRealCube: self.data_files_to_visualise.append(RDataFPath) if self.writeImagCube: self.data_files_to_visualise.append(IDataFPath) self.all_settings['tcl']['cube_files'] = \ ' '.join(map(str, self.data_files_to_visualise)) self.tga_folderpath, _, self.tga_filepath = io.file_handler( self.all_settings['img_prefix'], 'tga', self.all_settings) # if all_settings['draw_time']: # replace = str(self.all_settings['Mtime-steps'][self.step]) # tLabelTxt = self.all_settings['time_lab_txt'].replace("*", replace) # self.all_settings['tcl']['time_step'] = '"%s"' % (tLabelTxt) self.all_settings['tcl']['cube_files'] = ' '.join( map(str, self.data_files_to_visualise) ) if self.writeRealCube: io.open_write(RDataFPath, self.RCubeTxt) if self.writeImagCube: io.open_write(IDataFPath, self.ICubeTxt) end_time = time.time() - start_data_write_time self.all_settings['times']['Write Cube File'][step] += end_time
msg = "Trajectory %i/%i %s Timestep %s" % (step + 1, num_steps, timeTaken, timeStep) traj_print = "\n"+txt_lib.align(msg, 69, "l") + "*" if self.all_settings['verbose_output']: print("*"*70) print(traj_print) io.times_print(self.all_settings['times'], step, 70, tmpTime) else: io.print_same_line(traj_print, sys, print) if self.all_settings['verbose_output']: print("*"*70, "\n") self.all_settings['times_taken'].append(time.time() - start_step_time) if __name__ == '__main__': all_settings['img_prefix'] = consts.Orig_img_prefix.replace("$fs_", "") tgaFiles = [io.file_handler(all_settings['img_prefix'], 'tga', all_settings)[2] for step in INIT.all_steps] all_settings['to_stitch'] = '\n'.join(map(str, tgaFiles)) errors = {} step_data = MainLoop(INIT.all_settings, INIT.all_steps, errors)