File: commands.py

package info (click to toggle)
pymol 2.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,312 kB
  • sloc: cpp: 480,106; python: 79,860; ansic: 28,343; javascript: 6,792; sh: 47; makefile: 30; csh: 8
file content (42 lines) | stat: -rw-r--r-- 1,233 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
# 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)