  We study the Ramond twisted representations of the affine W-algebra W^k(g,f)
in the case that f admits a good even grading. We establish the vanishing and
the almost irreducibility of the corresponding BRST cohomology. This confirms
some of the recent conjectures of Kac and Wakimoto. In type A, our results give
the characters of all irreducible ordinary Ramond twisted representations of
W^k(sl_n,f) for all nilpotent elements f and all non-critical k, and prove the
existence of modular invariant representations conjectured by Kac and Wakimoto.
