“cmd.set_dihedral” changes the dihedral angle formed between the four bonded atoms provided. The atoms must be acyclic.
cmd.set_dihedral(string atom1, string atom2, string atom3, string atom4, float angle, int state, int quiet)
def set_dihedral(atom1, atom2, atom3, atom4, angle, state=1, quiet=1):