A theoretical analysis of the flexibility of polyimides and polyamido-acids