File: keyword.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 (59 lines) | stat: -rw-r--r-- 1,938 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#A* -------------------------------------------------------------------
#B* This file contains source code for the PyMOL computer program
#C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific. 
#D* -------------------------------------------------------------------
#E* It is unlawful to modify or remove this copyright notice.
#F* -------------------------------------------------------------------
#G* Please see the accompanying LICENSE file for further information. 
#H* -------------------------------------------------------------------
#I* Additional authors of this source file include:
#-* Scott Dixon, Metaphorics, LLC
#-* 
#-*
#Z* -------------------------------------------------------------------

from __future__ import print_function

import chempy

def get_partial_charge(model):
    if chempy.feedback['verbose']:
        print(' '+str(__name__)+': generating partial charge keywords...')
    list = []
    c = -1
    for a in model.atom:
        list.append("CHARGE %d %6.4f\n" %(c,a.partial_charge))
        c = c - 1
    return list


def get_restrain_positions(model,flag,w_width,f_cnst):
    list = []
    n = 0
    c = 1
    mask = 1<<flag
    for a in model.atom:
        if (a.flags&mask):
            list.append("RESTRAIN-POSITION %5d %12.6f %12.6f %12.6f %6.3f %6.1f\n" %
                            (c,a.coord[0],a.coord[1],a.coord[2],w_width,f_cnst))
            n = n + 1
        c = c + 1
    if chempy.feedback['actions']:
        print(' '+str(__name__)+': %d atoms restrained using flag %d ...' % (n,flag))
        
    return list

def get_inactive(model,flag):
    list = []
    n = 0
    c = 1
    mask = 1<<flag
    for a in model.atom:
        if (a.flags&mask):
            list.append("INACTIVE %d\n" % (c))
            n = n + 1
        c = c + 1
    if chempy.feedback['actions']:
        print(' '+str(__name__)+': %d atoms fixed using flag %d ...' % (n,flag))
    return list