File: commands.py

package info (click to toggle)
pymol 1.8.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,248 kB
  • ctags: 24,095
  • sloc: cpp: 474,635; python: 75,034; ansic: 22,888; sh: 236; makefile: 78; csh: 21
file content (43 lines) | stat: -rw-r--r-- 1,242 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# commands extensions to PyMOL for batchmin

from pymol import cmd
from chempy.bmin import realtime
import threading

def amin(*arg,**kwarg):
    realtime.assign(arg[0])
    bmin(*arg, **kwarg)

def bmin(object,iter=500,grad=0.1,interval=100,
            solvation=None):
    realtime.setup(object)
    t = threading.Thread(target=realtime.mini,
                                args=(int(iter),float(grad),int(interval),str(object)),
                                kwargs={
        'solvation':solvation, # turn on GB/SA (cdie)
        'rest_flag':2, # atoms with flag 2 set are restrained
        'fix_flag':3, # atoms with flag 3 set are fixed
        }
                                )
    t.setDaemon(1)
    t.start()

def bmin_sync(object,iter=500,grad=0.1,interval=100,
            solvation=None):
    realtime.setup(object)
    realtime.mini(int(iter),float(grad),int(interval),str(object),
                      solvation=solvation,
                      rest_flag=2,
                      fix_flag=3)
    
def pmin():
    cmd.delete('min')
    realtime.assign('lig')
    cmd.create('min','(lig|prot)')
    bmin('min')
    
cmd.extend('bmin',bmin)
cmd.extend('bmin_sync',bmin_sync)
cmd.extend('amin',amin)
cmd.extend('pmin',pmin)