print('Fifth atom: %s' % top.atom(4)) print('All atoms: %s' % [atom for atom in top.atoms])
print('Second residue: %s' % top.residue(1)) print('All residues: %s' % [residue for residue in top.residues])
atom = top.atom(10) print('''Hi! I am the %sth atom, and my name is %s. I am a %s atom with %s bonds. I am part of an %s residue.''' % ( atom.index, atom.name, atom.element.name, atom.n_bonds, atom.residue.name))
res = top.residue(10) atom.is_sidechain res.is_protein 等
print([atom.index for atom in top.atoms if atom.element.symbol is 'C' and atom.is_sidechain]) print([residue for residue in top.chain(0).residues if residue.index % 2 == 0])
top.select
1 2 3 4 5 6 7 8 9 10 11
top.select("water") top.select("resSeq 35") top.select("water and name O") top.select("mass 5.5 to 20") top.select("resname =~ 'C.*'") top.select("protein and (backbone or resname ALA)") top.select('protein and not symbol H') # 重原子