Officer charged in alleged sex with inmate