예제 #1
0
def check_VMD_TEMP(all_settings):
    ltxt = io.open_read(all_settings['vmd_temp']).strip('\n').split('\n')
    for i, line in enumerate(ltxt):
        if 'render' in line.lower() and 'tachyon' in line.lower():
            break
    ltxt = ltxt[:i + 1]
    ltxt.append(consts.end_of_vmd_file)
    io.open_write(all_settings['vmd_temp'], '\n'.join(ltxt))
예제 #2
0
    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