1
- from Tkinter import *
2
- import tkSimpleDialog
3
- import tkMessageBox
4
- import tkColorChooser
5
- import tkFileDialog
1
+ from __future__ import print_function
2
+
6
3
import sys
4
+ if sys .version_info [0 ] < 3 :
5
+ from Tkinter import *
6
+ import tkSimpleDialog
7
+ import tkMessageBox
8
+ import tkColorChooser
9
+ else :
10
+ from tkinter import *
11
+ from tkinter import simpledialog as tkSimpleDialog
12
+ import tkinter .messagebox as tkMessageBox
13
+ import tkinter .colorchooser as tkColorChooser
14
+
7
15
import re
8
- from pymol import stored , cmd , selector
16
+ from pymol import stored , cmd
9
17
import math
10
18
from pymol .cgo import *
11
19
from pymol .vfont import plain
12
- try :
13
- from cctbx import sgtbx , uctbx
14
- import numpy as N
15
- from numpy .linalg import *
16
- from cctbx import uctbx , sgtbx
17
- except :
18
- quit ("Oops! SuperSym requires cctbx and numeric python to function. Please install these." )
20
+
21
+ from cctbx import sgtbx , uctbx
22
+ import numpy as N
23
+ from numpy .linalg import *
19
24
20
25
21
26
def __init__ (self ):
@@ -391,7 +396,7 @@ def symset(prefix = "sym", object = -1, x=0,y=0,z=0, opList = []):
391
396
try :
392
397
op = opMatrices [i ]
393
398
except :
394
- print "Bad symmetry partner numbers. Try again."
399
+ print ( "Bad symmetry partner numbers. Try again." )
395
400
quit ()
396
401
copy = "%s%02d_%d_%d_%d" % (prefix , i , x , y , z )
397
402
cmd .copy (copy , object )
@@ -522,8 +527,8 @@ def get_orthogonalization_matrix(object, quiet = 0):
522
527
[0.0 , b * sg , c * (ca - cb * cg ) / sg ],
523
528
[0.0 , 0.0 , c * sb * math .sqrt (1.0 - ((cb * cg - ca ) / (sb * sg ))** 2 )]])
524
529
if not quiet :
525
- print fracToOrt
526
- print inv (fracToOrt )
530
+ print ( fracToOrt )
531
+ print ( inv (fracToOrt ) )
527
532
return fracToOrt
528
533
529
534
# -*- coding: utf-8 -*-
@@ -562,7 +567,7 @@ def findSurfaceResidues(objSel="(all)", cutoff=2.5, selName = 0):
562
567
563
568
stored .tmp_dict = {}
564
569
cmd .iterate (tmpObj , "stored.tmp_dict[(chain,resv)]=1" )
565
- exposed = stored .tmp_dict .keys ()
570
+ exposed = list ( stored .tmp_dict .keys () )
566
571
exposed .sort ()
567
572
568
573
cmd .select (selName , objSel + " in " + tmpObj )
@@ -615,14 +620,14 @@ def draw_cell_param(cell_param_list,radius=1.0,mode=0):
615
620
616
621
U = uctbx .unit_cell ((cell_param_list ))
617
622
618
- vert_000 = map (set_to_zero ,U .orthogonalize ((0. ,0. ,0 )))
619
- vert_100 = map (set_to_zero ,U .orthogonalize ((1. ,0. ,0 )))
620
- vert_010 = map (set_to_zero ,U .orthogonalize ((0. ,1. ,0 )))
621
- vert_001 = map (set_to_zero ,U .orthogonalize ((0. ,0. ,1 )))
622
- vert_110 = map (set_to_zero ,U .orthogonalize ((1. ,1. ,0 )))
623
- vert_011 = map (set_to_zero ,U .orthogonalize ((0. ,1. ,1 )))
624
- vert_101 = map (set_to_zero ,U .orthogonalize ((1. ,0. ,1 )))
625
- vert_111 = map (set_to_zero ,U .orthogonalize ((1. ,1. ,1 )))
623
+ vert_000 = list ( map (set_to_zero ,U .orthogonalize ((0. ,0. ,0 ) )))
624
+ vert_100 = list ( map (set_to_zero ,U .orthogonalize ((1. ,0. ,0 ) )))
625
+ vert_010 = list ( map (set_to_zero ,U .orthogonalize ((0. ,1. ,0 ) )))
626
+ vert_001 = list ( map (set_to_zero ,U .orthogonalize ((0. ,0. ,1 ) )))
627
+ vert_110 = list ( map (set_to_zero ,U .orthogonalize ((1. ,1. ,0 ) )))
628
+ vert_011 = list ( map (set_to_zero ,U .orthogonalize ((0. ,1. ,1 ) )))
629
+ vert_101 = list ( map (set_to_zero ,U .orthogonalize ((1. ,0. ,1 ) )))
630
+ vert_111 = list ( map (set_to_zero ,U .orthogonalize ((1. ,1. ,1 ) )))
626
631
627
632
# vert_000 = map(None,U.orthogonalize((0.,0.,0)))
628
633
# vert_100 = map(None,U.orthogonalize((1.,0.,0)))
@@ -692,9 +697,9 @@ def draw_cell_param(cell_param_list,radius=1.0,mode=0):
692
697
#wire_text(text,plain,map(None,U.orthogonalize((0.0,0.0,1.05))),'C',[[3.0,0.0,0.0],[0.0,3.0,0.0],[0.0,0.0,3.0]])
693
698
694
699
cyl_text (text ,plain ,[- 5. ,- 5. ,- 1 ],'Origin' ,0.20 ,axes = [[3.0 ,0.0 ,0.0 ],[0.0 ,3.0 ,0.0 ],[0.0 ,0.0 ,3.0 ]],color = [1.0 ,0.0 ,1.0 ])
695
- cyl_text (text ,plain ,map ( None , U .orthogonalize ((1.05 ,0.0 ,0.0 ))),'A' ,0.20 ,axes = [[3.0 ,0.0 ,0.0 ],[0.0 ,3.0 ,0.0 ],[0.0 ,0.0 ,3.0 ]],color = [1.0 ,0.0 ,0.0 ])
696
- cyl_text (text ,plain ,map ( None , U .orthogonalize ((0.0 ,1.05 ,0.0 ))),'B' ,0.20 ,axes = [[3.0 ,0.0 ,0.0 ],[0.0 ,3.0 ,0.0 ],[0.0 ,0.0 ,3.0 ]],color = [0.0 ,1.0 ,0.0 ])
697
- cyl_text (text ,plain ,map ( None , U .orthogonalize ((0.0 ,0.0 ,1.05 ))),'C' ,0.20 ,axes = [[3.0 ,0.0 ,0.0 ],[0.0 ,3.0 ,0.0 ],[0.0 ,0.0 ,3.0 ]],color = [0.0 ,0.0 ,1.0 ])
700
+ cyl_text (text ,plain ,list ( U .orthogonalize ((1.05 ,0.0 ,0.0 ))),'A' ,0.20 ,axes = [[3.0 ,0.0 ,0.0 ],[0.0 ,3.0 ,0.0 ],[0.0 ,0.0 ,3.0 ]],color = [1.0 ,0.0 ,0.0 ])
701
+ cyl_text (text ,plain ,list ( U .orthogonalize ((0.0 ,1.05 ,0.0 ))),'B' ,0.20 ,axes = [[3.0 ,0.0 ,0.0 ],[0.0 ,3.0 ,0.0 ],[0.0 ,0.0 ,3.0 ]],color = [0.0 ,1.0 ,0.0 ])
702
+ cyl_text (text ,plain ,list ( U .orthogonalize ((0.0 ,0.0 ,1.05 ))),'C' ,0.20 ,axes = [[3.0 ,0.0 ,0.0 ],[0.0 ,3.0 ,0.0 ],[0.0 ,0.0 ,3.0 ]],color = [0.0 ,0.0 ,1.0 ])
698
703
699
704
cmd .load_cgo (text ,'text' )
700
705
@@ -865,8 +870,8 @@ def draw_symops_param(cell_param_list,sg,radius=0.2,extension=0):
865
870
if symop_axes :
866
871
for ax in symop_axes :
867
872
#print ax
868
- start = map (set_to_zero ,U .orthogonalize (list (ax ['start' ])))
869
- end = map (set_to_zero ,U .orthogonalize (list (ax ['end' ])))
873
+ start = list ( map (set_to_zero ,U .orthogonalize (list (ax ['start' ]) )))
874
+ end = list ( map (set_to_zero ,U .orthogonalize (list (ax ['end' ]) )))
870
875
###############################################################################
871
876
# Tried rounding off start and end values in order to understand why axes go
872
877
# missing in the drawing, but seem to be present in the cgo. Doesn't help!
@@ -910,7 +915,7 @@ def draw_symops_param(cell_param_list,sg,radius=0.2,extension=0):
910
915
# #######################################################################################
911
916
912
917
else :
913
- print "\n No symmetry axes found for this space group: %s\n " % sg
918
+ print ( "\n No symmetry axes found for this space group: %s\n " % sg )
914
919
915
920
for key ,val in ax_obj .items ():
916
921
name = sg + "_" + key
@@ -937,27 +942,6 @@ def draw_symops_param(cell_param_list,sg,radius=0.2,extension=0):
937
942
def list_plus (lhs , rhs ):
938
943
return [l + r for l , r in zip (lhs , rhs )]
939
944
940
- def list_minus (lhs , rhs ):
941
- return [l - r for l , r in zip (lhs , rhs )]
942
-
943
- def list_multiplies (lhs , rhs ):
944
- return [l * r for l , r in zip (lhs , rhs )]
945
-
946
- def list_divides (lhs , rhs ):
947
- return [l / r for l , r in zip (lhs , rhs )]
948
-
949
- def list_modulus (lhs , rhs ):
950
- return [l % r for l , r in zip (lhs , rhs )]
951
-
952
- def list_dot_product (lhs , rhs = 0 ):
953
- if rhs == 0 : rhs = lhs
954
- result = 0
955
- for l , r in zip (lhs , rhs ): result += l * r
956
- return result
957
-
958
- def str_ev (EV ):
959
- return "[%d,%d,%d]" % EV
960
-
961
945
###def fract_2_dec(fraction):
962
946
### list = fraction.split('/')
963
947
### if len(list) == 2 and list[1] != 0:
@@ -1081,7 +1065,7 @@ def get_all_axes(space_group_symbol=None, space_group_info=None, extension=0):
1081
1065
if rtmxanal :
1082
1066
#print rtmxanal
1083
1067
axes_dict [rtmxanal ] = 0
1084
- axes_list = axes_dict .keys ()
1068
+ axes_list = list ( axes_dict .keys () )
1085
1069
axes_list .sort ()
1086
1070
1087
1071
# reject nonenantiomorphic space groups
@@ -1090,14 +1074,14 @@ def get_all_axes(space_group_symbol=None, space_group_info=None, extension=0):
1090
1074
sgtbx .space_group_info (space_group_symbol ).show_summary (),
1091
1075
#print len(axes_list), space_group_symbol
1092
1076
except :
1093
- print space_group , space_group_symbol
1094
- print
1077
+ print ( space_group , space_group_symbol )
1078
+ print ()
1095
1079
sys .exit (1 )
1096
1080
axes = []
1097
1081
for a in axes_list :
1098
1082
if len (a ) == 3 and len (a [1 ]) == 3 and len (a [2 ]) == 3 :
1099
1083
tmp_dict = {}
1100
- print "%4s %7.4f %7.4f %7.4f %7.4f %7.4f %7.4f " % (a [0 ],a [1 ][0 ],a [1 ][1 ],a [1 ][2 ],a [2 ][0 ],a [2 ][1 ],a [2 ][2 ])
1084
+ print ( "%4s %7.4f %7.4f %7.4f %7.4f %7.4f %7.4f " % (a [0 ],a [1 ][0 ],a [1 ][1 ],a [1 ][2 ],a [2 ][0 ],a [2 ][1 ],a [2 ][2 ]) )
1101
1085
tmp_dict ['symb' ] = a [0 ]
1102
1086
start_array = N .asarray (a [1 ])
1103
1087
end_array = N .asarray (a [2 ])
@@ -1109,7 +1093,7 @@ def get_all_axes(space_group_symbol=None, space_group_info=None, extension=0):
1109
1093
#rlc# tmp_dict['end'] = a[2]
1110
1094
axes .append (tmp_dict )
1111
1095
else :
1112
- print a
1096
+ print ( a )
1113
1097
else :
1114
1098
return None
1115
1099
0 commit comments