This is a read-only mirror of pymolwiki.org

Main Page

From PyMOL Wiki
Jump to navigation Jump to search
hosted by SBGridlogo2.jpg
Welcome to the PyMOL Wiki!
The community-run support site for the PyMOL molecular viewer.
To request a new account, email SBGrid at: accounts (@) sbgrid dot org
Quick Links
Tutorials Table of Contents Commands
Script Library Plugins FAQ
Gallery | Covers PyMOL Cheat Sheet (PDF) Getting Help
News & Updates
Official Release PyMOL v2.5 has been released on May 10, 2021.
Python 3 New Python 3 compatibility guide for scripts and plugins
POSF New PyMOL fellows announced for 2018-2019
Tutorial Plugins Tutorial updated for PyQt5
New Plugin PICv is a new plugin for clustering protein-protein interactions and visualization with available data from PDBe
Selection keywords New polymer.protein and polymer.nucleic selection keywords. Thanks everyone who participated in the poll!
Plugin Update MOLE 2.5 is an updated version of channel analysis software in PyMOL
New Script dssr_block is a wrapper for DSSR (3dna) and creates block-shaped nucleic acid cartoons
Older News See Older News.
Did you know...

Monitor file continuously

This script can be used to continuously check the modification timestamp on a file (any format, although this example assumes it's a PDB file), and re-loads it whenever the timestamp changes. As written it is intended to be started from the command line, but this is not a requirement.

The Code

<source lang="python"> from pymol import cmd import threading import time import os import sys

class pymol_file_monitor (object) :

 def __init__ (self,
     file_name, 
     time_wait=1) : # time in seconds between mtime check
   self.file_name = file_name
   self.time_wait = time_wait
   self.watch = True # this can be toggled elsewhere to stop updating
   self.mtime = 0
   t = threading.Thread(target=self.check_file)
   t.setDaemon(1)
   t.start()
   print "Watching file %s" % file_name
 def check_file (self) :
   while (self.watch) :
     if (os.path.exists(self.file_name)) :
       print "checking..."
       mtime = os.path.getmtime(self.file_name)
       if (mtime > self.mtime) :
         self.mtime = mtime
       ..→
A Random PyMOL-generated Cover. See Covers.