Bandgap calculations for conjugated polymers