symsph.py (pymol-v1.8.6.0.tar.bz2) | : | symsph.py (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 14 | skipping to change at line 14 | |||
# | # | |||
# symexp name [,selection [,cutoff ]] | # symexp name [,selection [,cutoff ]] | |||
from pymol import cmd as global_cmd | from pymol import cmd as global_cmd | |||
def symsph(name, selection="sele", cutoff=20.0, self_cmd=global_cmd): | def symsph(name, selection="sele", cutoff=20.0, self_cmd=global_cmd): | |||
cutoff = float(cutoff) | cutoff = float(cutoff) | |||
prefix = selection+"_symarea_" | prefix = selection+"_symarea_" | |||
tmp_obj = selection+"_tmp" | tmp_obj = selection+"_tmp" | |||
if selection not in self_cmd.get_names("selections"): | if selection not in self_cmd.get_names("selections"): | |||
print " error: '"+selection+"' is not defined." | print(" error: '"+selection+"' is not defined.") | |||
return self_cmd.DEFAULT_FAILURE | return self_cmd.DEFAULT_ERROR | |||
if not self_cmd.count_atoms(selection): | if not self_cmd.count_atoms(selection): | |||
print " error: '"+selection+"' contains no atoms." | print(" error: '"+selection+"' contains no atoms.") | |||
return self_cmd.DEFAULT_FAILURE | return self_cmd.DEFAULT_ERROR | |||
obj_list = self_cmd.get_object_list(selection) | obj_list = self_cmd.get_object_list(selection) | |||
if len(obj_list)!=1: | if len(obj_list)!=1: | |||
print script_name+" error: '"+selection+"' must only span one object.'" | print(script_name+" error: '"+selection+"' must only span one object.'") | |||
return self_cmd.DEFAULT_FAILURE | return self_cmd.DEFAULT_ERROR | |||
obj = obj_list[0] | obj = obj_list[0] | |||
cmd.center(selection) | cmd.center(selection) | |||
cmd.pseudoatom(tmp_obj) | cmd.pseudoatom(tmp_obj) | |||
cmd.delete(prefix+"*") | cmd.delete(prefix+"*") | |||
cmd.symexp(prefix,obj,tmp_obj,cutoff,segi=1) | cmd.symexp(prefix,obj,tmp_obj,cutoff,segi=1) | |||
cmd.create(name,"("+obj+" or "+prefix+"*) within %1.9f of %s"%(cutoff,tmp_ob j)) | cmd.create(name,"("+obj+" or "+prefix+"*) within %1.9f of %s"%(cutoff,tmp_ob j)) | |||
cmd.delete(tmp_obj) | cmd.delete(tmp_obj) | |||
cmd.delete(prefix+"*") | cmd.delete(prefix+"*") | |||
#symsph("sele",20) | #symsph("sele",20) | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |