Relation between the optical model and the valence model of E1 neutron capture at and between resonances