示例#1
0
 def testIdAtom(self):
     cmd.fragment('gly', 'm1')
     self.assertEqual(cmd.id_atom('ID 3'), 3)
     self.assertEqual(cmd.id_atom('ID 3', 1), ('m1', 3))
     cmd.feedback("disable", "cmd", "errors")
     self.assertRaises(CmdException, cmd.id_atom, 'ID 3+4')
     self.assertRaises(CmdException, cmd.id_atom, 'ID 100')
示例#2
0
 def selectProt(self):
     index_a = cmd.id_atom("pw2")
     index_A = cmd.id_atom("pw3")
     cmd.select(
         "bounded", "(bound_to id {0:d}) and not "
         "(hydrogens or name H* or id {0:d} or id {1:d})".format(
             index_A, index_a))
     atoms = cmd.get_model("bounded")
     cmd.delete("bounded")
     if not atoms.atom:
         cmd.select(
             "bounded", "(id {0:d} around 2.2) and not "
             "(hydrogens or name H* or id {0:d} or id {1:d})".format(
                 index_A, index_a))
         atoms = cmd.get_model("bounded")
         cmd.delete("bounded")
     if not atoms.atom:
         showerror(self.parent, "Error",
                   "Not found atoms bonded or around (b)")
         self.reset()
     at = atoms.atom[0]
     index_B = at.id
     cmd.select("pw4", "id {:d}".format(index_B))
     self.createAtomObj(4)
     cmd.select(
         "bounded", "(bound_to id {0:d}) and not "
         "(hydrogens or name H* or id {0:d} or id {1:d} or id {2:d})".
         format(index_B, index_a, index_A))
     atoms = cmd.get_model("bounded")
     cmd.delete("bounded")
     if not atoms.atom:
         cmd.select(
             "bounded", "(id {0:d} around 2.2) and not "
             "(hydrogens or name H* or id {0:d} or id {1:d} or id {2:d})".
             format(index_B, index_a, index_A))
         atoms = cmd.get_model("bounded")
         cmd.delete("bounded")
     if not atoms.atom:
         showerror(self.parent, "Error",
                   "Not found atoms bonded or around (b)")
         self.reset()
     at = atoms.atom[0]
     index_C = at.id
     cmd.select("pw5", "id {:d}".format(index_C))
     self.createAtomObj(5)
示例#3
0
 def doFinish(self):
     r_aA = cmd.get_distance(atom1="pw2", atom2="pw3", state=0)
     cmd.distance(self.params_str[0], "pw2", "pw3")
     th_a = cmd.get_angle(atom1="pw1", atom2="pw2", atom3="pw3", state=0)
     cmd.angle(self.params_str[1], "pw1", "pw2", "pw3")
     th_A = cmd.get_angle(atom1="pw2", atom2="pw3", atom3="pw4", state=0)
     cmd.angle(self.params_str[2], "pw2", "pw3", "pw4")
     if not (r_aA and th_a and th_A):
         showerror(self.parent, "Error!",
                   "Maybe you made a mistake when choosing atoms!")
         self.reset()
     phi_ba = cmd.get_dihedral(atom1="pw0",
                               atom2="pw1",
                               atom3="pw2",
                               atom4="pw3",
                               state=0)
     cmd.dihedral(self.params_str[3], "pw0", "pw1", "pw2", "pw3")
     phi_aA = cmd.get_dihedral(atom1="pw1",
                               atom2="pw2",
                               atom3="pw3",
                               atom4="pw4",
                               state=0)
     cmd.dihedral(self.params_str[4], "pw1", "pw2", "pw3", "pw4")
     phi_AB = cmd.get_dihedral(atom1="pw2",
                               atom2="pw3",
                               atom3="pw4",
                               atom4="pw5",
                               state=0)
     cmd.dihedral(self.params_str[5], "pw2", "pw3", "pw4", "pw5")
     index_c = cmd.id_atom("pw0")
     index_c_name = getAtomString('pw0')
     index_b = cmd.id_atom("pw1")
     index_b_name = getAtomString('pw1')
     index_a = cmd.id_atom("pw2")
     index_a_name = getAtomString('pw2')
     index_A = cmd.id_atom("pw3")
     index_A_name = getAtomString('pw3')
     index_B = cmd.id_atom("pw4")
     index_B_name = getAtomString('pw4')
     index_C = cmd.id_atom("pw5")
     index_C_name = getAtomString('pw5')
     self.setBondForceParam(r_aA, th_a, th_A, phi_ba, phi_aA, phi_AB,
                            index_c, index_b, index_a, index_A, index_B,
                            index_C)
     self.setAtomsDef(index_c_name, index_b_name, index_a_name,
                      index_A_name, index_B_name, index_C_name)
     top = Toplevel(
         self.parent)  # <- freeze when open gro file in pymol 1.X
     Output(top, self.bondForceParams, self.atoms_def)
     cmd.set_wizard()
示例#4
0
文件: rpc.py 项目: dahuilangda/rdkit
def rpcIdAtom(what='all', mode=0):
    """ returns the results of cmd.id_atom(what) """
    return cmd.id_atom(what, mode=mode)
示例#5
0
文件: rpc.py 项目: jandom/rdkit
def rpcIdAtom(what='all', mode=0):
  """ returns the results of cmd.id_atom(what) """
  return cmd.id_atom(what, mode=mode)
示例#6
0
def get_ID(index, sel):
        
    return int(cmd.id_atom('index ' + str(index) + ' & ' + sel + ' & present'))