Exemple #1
0
    def _vmd_visualise(self, step):
        """
        Visualises the data. This fills in the variables in the vmd template,
        writes the script and runs it in vmd.
        """
        start_vmd_time = time.time()
        for i in self.all_settings['tcl']['cube_files'].split(' '):

            if not io.path_leads_somewhere(i.strip()):
                msg = "Sorry I couldn't find the following cube file:"
                msg += "\n%s" % i.strip()
                EXC.ERROR(msg)

        self.all_settings['tcl']['pic_filename'][self.PID] = self.tga_filepath
        io.vmd_variable_writer(self.all_settings, self.PID)
        # check if the file exists
        tmp = os.path.isfile(self.all_settings['vmd_script'][self.PID])
        if not tmp:
            msg = "Sorry I can't find the vmd script!"
            msg += "It hasn't been created (or created in the wrong place)."
            EXC.ERROR(msg)

        cond = 'tga' not in self.all_settings['files_to_keep']
        cond *= not all_settings['calibrate']
        if cond:
            self.all_settings['delete_these'].append(self.tga_filepath)

        io.VMD_visualise(self.all_settings, self.PID)

        end_time = time.time() - start_vmd_time
        self.all_settings['times']['VMD Visualisation'][step] += end_time
Exemple #2
0
    def _display_img(self):
        """
        Displays the created image in the default viewer. Only works in linux!
        """
        if self.all_settings['mols_plotted'] > 0:
            if self.all_settings['load_in_vmd']:
                self.all_settings['tcl']['pic_filename'][self.PID] = \
                    self.tga_filepath
                io.vmd_variable_writer(self.all_settings, self.PID)

                vmd_bin = self.all_settings['vmd_exe']
                os.system(f"{vmd_bin} -nt -e {self.all_settings['vmd_script'][self.PID]}")
                io.settings_update(self.all_settings)

            if self.all_settings['show_img_after_vmd']:
                open_pic_cmd = "xdg-open %s" % (self.tga_filepath)
                subprocess.call(open_pic_cmd, shell=True)
        else:
            EXC.WARN("There were no wavefunctions plotted on the molecules!")