I'm struggling a bit tryng to calculate multiple dihedral through residues just giving the atom name. Basically I'd like to interate the dihaedral calcualtion all around a protein / RNA.
For now I'm arrived here:
def myfunc(model,chain,segi,resn,resi,name):
s1 = "/%s/%s/%s/%s`%s/CB" % (model,chain,segi,resn,resi)
s2 = "/%s/%s/%s/%s`%s/CA" % (model,chain,segi,resn,resi)
s3 = "/%s/%s/%s/%s`%s/N" % (model,chain,segi,resn,resi)
s4 = "/%s/%s/%s/%s`%s/C" % (model,chain,segi,resn,resi)
cmd.get_dihedral(s1,s2,s3,s4,state=0)
print(s1,s2,s3,s4)
myspace = {'myfunc': myfunc}
cmd.iterate('(all)', 'myfunc(model,chain,segi,resn,resi,name)', space=myspace)
The TOP would be a file that look like this:
NAME NAME NAME NAME DIHAEDRAL
NAME NAME NAME NAME DIHAEDRAL
Someone can help? Thanks in advance guys.
If I understood you correctly, this should be close to what you are looking for:
There were several errors in your script:
cmd.iteratecommand loops from atom to atom over a selection. If you manually define the name of the atoms in your function, you only need to loop over the residues. The selection has to be restricted to avoid duplicate dihedrals.nameargument was not used and can be omitted.segiandchainarguments were swapped according to the selection macros