if lookup:
            t1, t2, t3, t4 = types[pid1-1], types[pid2-1], types[pid3-1], types[pid4-1] # get types of particles
            try:
                dihtypeid = dihedraltypes[t1][t2][t3][t4] #dihtypeid is now a tuple
            #if t1 not in dihedraltypes: # interactions in the other way