Twist-field representations of W-algebras, exact conformal blocks and character identities

We study the twist-field representations of W-algebras and generalize construction of the corresponding vertex operators to D- and B-series. It is shown, how the computation of characters of these representations leads to nontrivial identities involving lattice theta-functions. We also propose a way to calculate their exact conformal blocks, expressing them for D-series in terms of geometric data of the corresponding Prym variety for covering curve with involution.

Representation theory of W-algebras [1][2][3] is still a subject with many open questions and even challenges. These questions often arise in the context of two-dimensional conformal field theory (CFT) with extended symmetry, and due to recently found nontrivial correspondence [4][5][6][7] can be also important even for multidimensional supersymmetric gauge theories. 1 The main object of this study is a conformal block. Generally, the space of conformal blocks is the space of all functionals on the product of Verma modules at marked points on the Riemann surface, that solve the Ward identities (see e.g. [11], where the language of coinvariants was used). Such spaces form certain bundles over the moduli space of complex curves with marked points.
However, in order to construct the correlation functions in physical theories one should be able to extract a particular section of this bundle. The corresponding functionals are computed usually on the highest weight vectors in each of the Verma modules. For the Virasoro algebra the conformal blocks are specified by particular intermediate dimensions, or equivalently, by the asymptotic behavior of a conformal block on the boundary of moduli space [12]. It turns out that for generic W-algebra it is not enough to fix quantum numbers in the intermediate channels. Even for sphere with three marked points the vector space of conformal blocks becomes infinite dimensional for W N algebras with N > 2.
However, for certain particular cases this conformal block can be constructed explicitly applying some extra machinery. In what follows we restrict ourselves to the case of integer (and sometimes -half-integer) Virasoro central charges, when representations of W-algebras are more directly related to the representations of the corresponding Kac-Moody (KM) algebras (of level k = 1), and the corresponding quantum field theories can be directly described by (minimal possible amount of) free fields [13].
One of the recent methods [14] reduces the problem here to the Riemann-Hilbert problem, arising in the context of the isomonodromy/CFT correspondence [15][16][17]. The key idea of this approach is to extract the concrete conformal block by implying the condition that it has predictable monodromies after insertion of the simplest degenerate fields, or fermions. Morally it means, that we fix the 3-point blocks as eigenvectors of the Verlinde loop operators and parameterize them by the monodromy data.
Even in such situation, in case of generic monodromies one cannot write explicit formula for the conformal block. Below, following [18], we are going to restrict ourselves to the case of so-called twist fields [19][20][21], corresponding to the quasi-permutation monodromies, when the representations of W-algebras become related to the twisted representations of the corresponding KM algebras 2 [22,23]. 1 In addition to supersymmetric gauge theories there are other important multidimensional applications of W-algebras, including at least the holographic dualities, AdS-type geometries and Chern-Simons gauge theories, see e.g. [8][9][10] and references therein. However, the role of particular twist-field representations of W-algebras, considered below -especially for other Dynkin series, for these applications is much less clear, than their possible role for supersymmetric gauge theories. 2 To prevent terminological confusion we should stress that "twist field representation" is different from "twisted representation": the latter implies that algebra is changed (twisted!) itself, whereas the first only reflects the way -how this representation was constructed.

JHEP08(2018)108
The paper is organized as follows. We start from formulation of the representations of KM and W-algebras in terms of free bosonic and fermionic fields. First the GL(N ) case is revisited, and we extend it to the D-and B-series, using the real fermions. Then we define the twist field representations, corresponding to the elements of Cartan's normalizer g ∈ N G (h) together with some extra data (to be denoted asġ andg, see the details in section 3 below). Bosonization of the twist fields essentially depends on the conjugacy classes in N G (h). We classify therefore these conjugacy classes for G = GL(N ) and G = O(n) (for n = 2N and n = 2N + 1) and define the twist fields Og in terms of the boundary conditions in corresponding free field theory.
Bosonization rules allow to compute straightforwardly the characters χġ(q) of the corresponding representations. For the twist fields of "GL(N ) type" this goes back to the seminal results of Al. Zamolodchikov and V. Knizhnik, and we develop here a similar technique in the case of real fermions and another class of the twist fields, arising only for Dand B-series. The character formulas include summations over the root lattices, reflecting the fact that one deals here with the class of lattice vertex algebras. Dependently on the conjugacy class g ∈ N G (h) of a twist field, the lattice can be reduced to its projection to the Weyl-invariant part: in such cases "smaller" lattice theta functions show up, or we find even a kind of "duality" between the lattice theta functions for D-and B-series.
If two different elements g 1,2 ∈ N G (h) are nevertheless conjugated g 1 ∼ g 2 in G, but not in N G (h), this gives (for appropriate additional data) a nontrivial identity χġ 1 (q) = χġ 2 (q) between two characters, involving lattice theta-functions. Such character identities go back to 70's of the last century (see [24,25]) and even to Gauss, but our derivation gives probably new identities, involving in particular the theta functions for D-and B-root lattices.
Finally, we propose a construction of the exact conformal blocks of the twist fields for W-algebras of D-series, generalizing approach of [18][19][20][21], and obtain explicit formula, expressing the multipoint blocks in terms of algebro-geometric objects on the branched cover of the original curve with extra involution. Some important technical details are collected in appendices.

JHEP08(2018)108
2. Any such expression can be obtained by taking the regular products (constant terms in the OPE, denoted by brackets) of the "elementary elements" : α ∂ k ψ α (z)∂ l ψ * α (z) :, since Therefore one can perform this procedure iteratively and express everything as regular products of bilinears.
3. Any element : can be expressed as a linear combination of ∂ l +1 U k (z) for different l and k with l + k = l + k.
Hence, the generators {U k (z)} are expressible in terms of {W k (z)} (and vice versa) by some non-linear triangular transformations, but we do not need here its explicit form. 4 Formally there is an infinite number of generators in (2.8) and (2.9), but since all of them are expressed in terms of N generators (2.10), they are not independent: one always has for some polynomials {P n }, and this is the origin of non-linearity of W-algebra [28]. The relation between fermions and bosons is given by well-known [13,29] bosonization formulas where α (J 0 ) = α−1 β=1 (−1) J 0,β , and diagonal J αα,n ≡ J α,n form the Heisenberg algebra: One can also express all other generators in terms of (positive and negative parts of) the bosonic fields One can say that these OPE's and commutation relations are defined by metric on ndimensional Euclidean space, or symbolically by ds 2 = n i=1 dΨ 2 i . The KM currents are again expressed by bilinear combinations and satisfy usual commutation relations together with J ji (z). It is also convenient to pass to the complexified fermions (α = 1, . . . , N ) which due to (2.17) have the standard OPE's given by (2.2). Let us point out that B Nseries (i, j = 1, . . . , 2N + 1) differs from D N -series (i, j = 1, . . . , 2N ) by remaining single real fermion Ψ 2N +1 (z) = Ψ(z). Using the complexified fermions the generators (2.19) can be re-written as so that we see explicitly gl(N ) 1 ⊂ so(n) 1 . Note also that elements J αα (z) = J α (z) again form the Heisenberg algebra, and its zero modes J α,0 correspond to the Cartan subalgebra of so(n).

JHEP08(2018)108
As before, we define the W-algebra W (so(n)) as the commutant of so(n) ⊂ so(n) 1 . In contrast to the simply-laced cases, one finds this commutant for B-series being not in the completion of U so(2N + 1) 1 , but rather in the entire fermionic algebra. An inclusion of algebras gl(N ) ⊂ so(2N ) acting on the same space leads to inverse inclusion Similarly to (2.9) one can present the generators of the W (so(n))-algebra explicitly, using the real fermions The last current is bosonic in the D N case, but fermionic for the B N -series. These expressions are obtained analogously to (2.9) with the help of invariant theory, the only important difference is that for SO(n) case there is also completely antisymmetric invariant tensor. We can rewrite these expressions using complex fermions (for the D N case one should just put here Ψ(z) = 0 in the expressions for U -currents and Ψ(z) = 1 in the expressions for the V -current) It is easy to see that odd generators vanish U 2k+1 = 0, while even generators in the D N case coincide with those in W (gl(N )) algebra Hence, finally we have the following sets of independent generators: 3 Twist-field representations from twisted fermions

Twisted representations and twist-fields
For any current algebra, generated by currents {Φ I (z)}, the commutation relations follow from their local OPE's

JHEP08(2018)108
However, to define the commutation relations, in addition to local OPE's one should also know the boundary conditions for the currents: in radial quantization -the analytic behaviour of Φ I (z) around zero. Any vertex operator V g (0), e.g. sitting at the origin, 5 can create a nontrivial monodromy for our currents: or some linear automorphism of the current algebra.
Example. Perhaps the simplest example of such nontrivial monodromy is the diagonal transformation of fermionic fields which comes just from the shifts the mode expansion indices Instead of (2.2) one gets therefore which means that for the shifted fermions (3.4) one should use the different normal ordering: This implies that for the diagonal components of the gl(N ) 1 algebra one has extra shift J α (z) → J α (z) + θα z , while for the non-diagonal currents we obtain so that the commutation relations for this "twisted" Kac-Moody algebra become We see that these commutation relations differ from the conventional ones (2.7) only by extra shift, which can be hidden into the Cartan generators J αα,0 . However, in the twisted case one cannot think about W-algebra as the commutant of certain gl(N ), since there is no such zero mode subalgebra in twisted gl(N ) 1 . Nevertheless we define the currents

JHEP08(2018)108
and one can still use two basic facts: • since U k (e 2πi z) = U k (z), they are expanded in integer powers of z as before; • they satisfy the same algebraic relations for all values of monodromies {θ α }, because the OPE's of ψ α , ψ * α , and thus the OPE's of U k , do not depend on these monodromy parameters.
Consider now more general situation, when i.e. unlike (3.3), the monodromy is no longer diagonal. 6 It is clear that then the action on The most general transformation we consider in the O(n) case mixes ψ and ψ * : where it is convenient to introduce conventions ψ * −α = ψ α , α > 0, and ψ 0 can be absent. Here matrix g should preserve the anticommutation relations.
Consider now a sequence of (super) vertex algebras W-algebra ⊂ Heisenberg algebra h ⊂ KM-algebra ⊂ Fermions.
Taking an element g ∈ G we construct a twisted representation of the fermionic algebra ψ, ψ * . Then, for G = GL(N ) or G = SO(2N ) one gets the KM algebra as the invariant of the group Γ, acting on the fermionic algebra (Γ = U(1) and Γ = Z/2Z in two cases correspondingly). This group acts on the twisted representations of the fermionic algebra, therefore the twisted representations of KM algebra are labeled by pairs (g, Γ isotypic component), in what follows we denote such pair byġ. 7 Denote by Hġ the corresponding representation of the KM algebra for G = GL(N ) or G = SO(2N ). For the G = SO(2N +1) case Hġ is a representation of the fermionic algebra itself. An explicit description of Hġ and calculation of its characters is given in section 4 using bosonization. However, in order to apply bosonization one has to restrict the elements g ∈ N G (h) ⊂ G to the Cartan normalizer, and this will be the key object in our definition of the twist fields. 6 The element g should preserve the structure of the OPEs, so it should preserve symmetric form on fermions, and therefore lies in O(2N ). It automatically implies that all even generators of the W-algebra U 2k (w) are also preserved. To preserve odd generators U 2k+1 (z) one should also have g ∈ Sp(2N ), but O(2N ) ∩ Sp(2N ) = GL(N ), therefore g ∈ GL(N ). 7 Since the action of Γ on the twisted representations of fermionic algebra is not canonical here is no canonical identification of the set Γ isotypic components and the set of representations of Γ. In our case the group Γ is commutative, and the set of Γ isotypic components forms a principal homogeneous space for group Rep Γ, (see also section 3b of [31,32] for generic discussion of non-uniqueness of the action of Γ in orbifold models). However, the definition of the action of Γ in our examples will be always clear below.

JHEP08(2018)108
In particular, bosonization means that one considers the space Hġ as a sum of twisted representations of the Heisenberg algebra h. These representations depend not only on the elements g ∈ N G (h), but also on additional data: eigenvalues of the zero modes of the g-invariant part of h. This extra data, below to be called r-charges following [18], has discrete freedom, since only the exponents of such eigenvalues are specified by g. We also denote below the most refined data asg = (g, r). Finally, we consider the twisted representations of the Heisenberg algebra as (the twistfield) representations of the W-algebra, already untwisted since the W-algebra generators are G-invariant.

Definition 1
We call the vertex operator Vg = Og a twist field when g lies in the normalizer of Cartan h ⊂ g, i.e. g ∈ N G (h) iff Such elements also preserve the Heisenberg subalgebra h = J 1 (z), . . . , J rank g (z) ⊂ g 1 g hg −1 = h (3.14) If different elements g 1 , g 2 ∈ N G (h) are conjugated in G: g 1 = Ωg 2 Ω −1 , then such conjugation identifies g 1 and g 2 twistings of the fermionic algebras. This conjugation also induces one-to-one correspondence between the set ofġ 1 and the set ofġ 2 , and maps the twisted representation Hġ 1 to Hġ 2 . More formally, if we denote corresponding representations by Tġ(ĝ) :ĝ → EndHġ, and the action of Ω by Ω 12 : Hġ 1 → Hġ 2 , then we have Ω 12 Tġ 1 (J(z))Ω −1 12 = Tġ 2 (J(z) Ω ). Note, that twisted representations of KM algebra Hġ 1 , Hġ 2 are not isomorphic due to appearance of conjugation by Ω: the current J(z) can have different monodromies in Hġ 1 and Hġ 2 . But the corresponding representations of W-algebra become equivalent (up to external automorphism in case of SO(2N )), see details in section 4.6. 8 If g 1 = Ωg 2 Ω −1 , with Ω ∈ N G (h), then the conjugation by Ω preserves h. Therefore this conjugation induces the transformation of twisted representations of h in Hġ 1 into twisted representations of h in Hġ 2 , and induces one-to-one correspondence between the sets ofg 1 andg 2 . Hence we have an action of N G (h) on the set ofg.
Below we describe the structure of the Cartan normalizers N GL(N ) (h) and N O(n) (h) and specify notationsġ andg in these cases explicitly. We also describe the representatives of all the orbits in the set ofg under the action of N G (h).

Cartan normalizers
Structure of the Cartan normalizer for gl(N ). Let us choose the Cartan subalgebra in a standard way h ⊃ diag(x 1 , . . . , x N ), so that the conjugation (3.13) can only permute the eigenvalues. Therefore we conclude that or g is just a quasipermutation. 8 One can compare this conjugation and additional data inġ,g with the description of the representations of G-invariant part of vertex algebra in case of the finite group G in [31,32].

JHEP08(2018)108
Now let us find the conjugacy classes in this group. Any element of N GL(N ) (h) has the form g = (c 1 . . . c k , (λ 1 , . . . , λ N )), where c i are the cyclic permutations -their only parameters are lengths l j = l(c j ). It is enough to consider just a single cycle of the length l = l(c) g = (c, (λ 1 , . . . , λ l )) (3.16) since any g can be decomposed into a product of such elements. Conjugation of this element by diagonal matrix is given by Therefore one can always adjust {µ i } to replace all {λ i } by the same number, e.g. to put These "averaged over a cycle" parameters have been called as r-charges in [18]. Hence, all elements of g ∈ N GL(N ) (h) can be conjugated to the products over the cycles Transformation [l, e 2πir ] acts like follows: where ψ α+l = ψ α , and we have included the extra factor e iπ l−1 l into the definition of transformation in order to have simple formula det[l, e 2πir ] = e 2iπrl (3.20) and to simplify the identification between r and U(1) charge in appendix B.3. In this caseġ is just a pair (g, tr log g), the value of tr log g is defined up to 2πiZ, and this freedom corresponds to the representation of Γ = U(1) mentioned above. Elementg contains information about all r-chargesg = (g, r), for given g the r-charge r j is defined by g up to the shift by 1 l j Z. Ifg 1 andg 2 correspond to the sameġ, then the corresponding r-charges differ by the shift in the certain lattice, see the character formula (4.4) in section 4. dψ −α dψ α +dΨ 2 (the last term is present only for the B N -series). In this basis the so(n) algebra (algebra, preserving this form) becomes just the algebra of matrices, which are antisymmetric under the reflection w.r.t. the anti-diagonal. In particular, the Cartan elements are given by

JHEP08(2018)108
for B N -series (and for the D N -series just 0 in the middle should be removed). The action of an element from N O(n) (h) should preserve the chosen quadratic form, and, when acting on the diagonal matrix (3.21), it can either permute some eigenvalues, also doing it simultaneously in the both blocks, or interchange x α with −x α (the same as to change the sign of x α ). It is defined in this way up to a subgroup of diagonal matrices themselves. In other words where the generator of the last factor Z/2Z changes the sign of the extra fermion Ψ. This triple (s, σ, λ) ∈ N O(n) (h), with s ∈ S N , σ α ∈ Z/2Z and λ α ∈ C × , is embedded into O(n) as follows and in these formulas ψ −α = ψ * α and ψ * −α = ψ α is again implied. The structure of the actions in the semidirect product has the obvious form: Notice that the normalizer of Cartan in SO(n) is distinguished by condition that N α=1 σ α = 1, and the Weyl group is given as the factor of this normalizer by the Cartan torus W(so(n)) = N SO(n) (h)/H (3.26) Consider now the conjugacy classes in N O(n) (h). First, conjugating an arbitrary element (s, σ, λ) by permutations, we reduce the problem again to the case when s = c is just a single cycle. Then one can further conjugate this element by (Z/2Z) N : and solving equations for { α }, remove all σ α = −1, except for, maybe, one. Hence: • For σ = (1, . . . , 1) the situation is the same as in gl(N ) case: we can transform λ to (λ, . . . , λ). These conjugacy classes are therefore the same (but denoted by [l, λ] + ):

JHEP08(2018)108
• For, say, σ = (−1, 1, . . . , 1) let us conjugate this element by (1, 1, µ): In contrast to the previous case, here one can put all λ i = 1, since one can put first µ 2 1 = i λ −1 i , and then solve N − 1 equations µ i+1 = λ i µ i not being restricted by any boundary conditions. It means that Therefore we can formulate: Lemma 1 One gets for the conjugacy classes and now we are ready to describe the twist fields in detail. As in the GL(N ) case, to be precise one should add explicit values of the r-charges, i.e. to consider the pairsg = (g, r), where λ j = e 2πir j . Moreover, for even n = 2N it is also useful to introduceġ = (g, r), where r ∈ R K /Q D K are defined up to addition of the vectors from D K root lattice: r ∼ r mod Q D K . 9 For odd n we just haveġ = g.

Twist fields and bosonization for gl(N )
Take an element (3.18), whose action on fermions (in the fundamental and antifundamental representations), say for a single cycle, is while the corresponding (adjoint) action on the Cartan is just Such formulas have a simple geometric interpretation [33,34]: there is the branched cover in the vicinity of the point z = 0 given by ξ l = z, so that all these (fermionic and bosonic) fields are actually defined on different sheets ξ (α) = z 1/l e 2πiα/l of the cover: The vector r is determined by given g up to the lattice Z K , (explicitly up to the shift liri → liri + ni which are due to the logarithms). The lattice QD K ⊂ Z K is defined by ni ∈ 2Z. Therefore, there are two elementsġ, corresponding to given g, since |Z K /QD K | = 2. These two choices of r exactly correspond to two subspaces with given fermion number (−1) F in the fermion representations, the group Γ = Z/2Z acts by this fermion number.

JHEP08(2018)108
Using these formulas one can write down expansions for the fields on the cover, whose OPE's locally are given bỹ Now one writes the following formulas for the mode expansion of fermions, which are already twisted on the covering curve by e 2πiσ : Due to (3.32) one should have ψ * (e 2πil z) = (−1) l−1 e 2πilr ψ * (z) and ψ(e 2πil z) = (−1) l−1 e −2πilr ψ(z), therefore one can take σ = lr, so that: with the commutation relations between their modes being J n/l , J m/l = nδ n+m,0 n, m ∈ Z (3.39) These twisted bosons provide one of the convenient languages for the twist field representations. The other one is provided by bosonization of the constituent fermions with the fixed fractional parts of the power expansions in (3.37) The corresponding bosons (see (B.45) in appendix) always have an integer mode expansion.

Twist fields and bosonization for so(n)
Let us mention first that there is a difference between the groups N O(n) (h) and N SO(n) (h), since the action of the first one can also map V (z) → −V (z), so that one of the generators of the W-algebra V (e 2πi z) = −V (z) becomes a Ramond field, and we allow this extra minus sign below. 10 In addition to the conjugacy classes [l, λ] + , similar to those of gl(N ), we now also have to study [l] − 's. First one has to identify the action of N O(n) (h) on the fermions, where just by definition: This means that the element of our interest is the complete cycle Therefore 2N complex fermions can be realized as a pushforward of a single real fermion η(ξ), living on a 2l-sheeted branched cover Here the branched cover z = ξ 2l can be realized as a sequence of two covers π 2 : ξ → ζ = ξ 2 and π l : ζ → ζ l = z, and it leads to trickier global construction of the exact conformal blocks, see section 6 below.
which generates the global automorphism of the cover of order two, which is continued to the global automorphism of the algebraic curve during the consideration of exact conformal blocks in section 6. It acts locally by ξ → −ξ. Using this element one can write the OPE of η(ξ) in the form: Now the analytic structure of this field can be obtained In order to ensure right monodromies (3.43) for ψ, ψ * one should get powers 1 2l Z in the r.h.s., which means that σ ∼ l − 1 2 ∼ 1 2 , and η(ξ) turns to be a Ramond fermion with the N .

JHEP08(2018)108
extra ramification Let us now construct (a twisted!) boson from this fermion by This boson behaves as follows under the continuation around a twist field: To realize this situation we may take the Ramond boson on the cover in variable ζ: where commutation relations of modes are given by Inverse bosonization formula for this real fermion looks like with the Pauli matrix σ 1 = 0 1 1 0 , and it is discussed in detail in appendix B.1.

Characters for the twisted modules
Now we turn directly to the computation of characters, using bosonization rules. In order to do this one has to apply the following heuristic "master formula" for the trace over the space Hġ, which is the minimal space closed under the action of both W-algebra and twisted Kac-Moody algebra. For simply-laced cases, gl(N ) and so(2N ), Hġ is the module of corresponding Kac-Moody algebra, whereas in the so(2N + 1) case it should be entire fermionic Fock module due to presence of the fermionic W-current. Explicit descriptions of Hġ are the following: for gl(N ) it is the subspace with the fixed total fermionic charge, for so(2N ) it is the subspace with the fixed parity of total fermionic charge, and for so(2N + 1) it is entire space. Notice that this representation depends onġ -not just g, and also it contains all representations of W-algebra with differentg corresponding to the sameġ.

JHEP08(2018)108
Denominator of (4.1) collects the contributions from the Fock descendants of twisted bosons (parameters θ Adj,k (g) are the eigenvalues of adjoint action of g on the Cartan subalgebra), and the numerator -contribution of the zero modes. This formula is heuristic, moreover, in some important cases we also get contribution from the extra fermion, sometimes it is more informative to consider super-characters etc. Below we prove the following Theorem 1 The characters of twisted representations are given by the formulas (4.4), (4.7), (4.10), (4.17), (4.19).

gl(N ) twist fields
To be definite, let us fix an element g = for α ∈ Z/l j Z, labeling the fields within [l j ]-cycle. For the conformal dimension one gets therefore (see (B.39), and computation by alternative methods in (5.15), (6.30)) and since we are computing character of the space, obtained by the action of gl(N ) 1 , we have to take into account all vacua arising after the action of the shift operators e Q (i) −Q (j) , i.e. labeled by the A K−1 root lattice. Hence, the character (4.1) for this case is given by In this formula the numerator collects contributions from the highest vectors χ ZM (they differ by the value of zero modes J  Consider now the twist fields (3.31) for g ∈ N O(2N ) (h), and take first K = 0, so our twist has no minus-cycles [l j , e 2πir j ] + (4.5)

JHEP08(2018)108
The only difference from the previous situation with the gl(N ) case is that now one also have extra currents J αβ = ψ * α (z)ψ * β (z) and Jᾱ β = ψ α (z)ψ β (z). It means that due to bosonization (B.45), (4.2) possible charge's shifts now include e ±Q (i) ±Q (j) , so the full lattice of the zero-mode charges (one zero mode for each cycle [l i , e 2πir i ] + ) contains all points with or is just the root lattice Q D K . After corresponding modification of numerator and the same contribution of the twisted Heisenberg algebra to denominator, the formula for the character in this case acquires the form Now we have extra cycles of type [l i ] − , so we have extra η-fermions that have to be bosonized in a different way (B.18): where {γ i , γ j } = 2δ ij are gamma-matrices (or generators of the Clifford algebra Cl K (C)) in the smallest possible representation, which make different fermions anticommuting. Due to presence of K cycles of type [l i ] − , the zero-mode χ ZM (q) generating operators include now γ j e Q (i) , which perform integer shifts of i-th bosonic zero mode together with the inessential action on fermionic vacua. So now we do not have to imply that the number of shifts by e Q (i) should be even. Hence, instead of D K -lattice from (4.7) the numerator includes now summation over the root lattice Q B K , i.e.
where factor 2 [ K +1 2 ]−1 corresponds to the dimension of the spinor representation of so(K ), generated by γ i γ j . Another simple factor q ∆ 0 g contains the minimal conformal dimension JHEP08(2018)108 (without contribution of the "r-charges") which will be computed below in (5.18), (6.30). The numerator of (4.10) contains K contributions from twisted bosons corresponding to plus-cycles, and K contributions from twisted Ramond bosons corresponding to minus-cycles.

so(2N + 1) twist fields
The W-algebra W (so(2N + 1)) contains fermionic operator V (z) = Ψ 1 (z) . . . Ψ 2N +1 (z), which cannot be expressed in terms of generators of so(2N + 1) 1 since the latter are all even in fermions. It means that to construct a module of the W-algebra one should use entire fermionic algebra. Taking into account the fermionic nature of this W-algebra one can consider Z/2Z graded modules and define two different characters where F is the fermionic number: One of the characters vanishes χ − (q) = 0 if at least one fermionic zero mode exists, since each state gets partner with the opposite fermionic parity. Such fermionic zero modes are always present for the Ramond fermions and η-fermions, so the only case with non-trivial χ − (q) corresponds to [l i , e 2πir i ] + (4.14) In this case our computation works as follows: take bosonization for the [l] + -cycles in terms of K twisted bosons (B.45), (4.2), then the fermionic operators produce the zero-mode shifts e ±Q (i) with the fermionic number F = F b + F f = F b = 1, and the Heisenberg generators J (i) n/l i with the fermionic number F = F b = 0. Moreover, we also have an extra "true" fermion Ψ(z) with F = F f = 1. Therefore the total trace can be computed, separating bosons and fermions, as where the traces over bosonic and fermionic spaces are given by

JHEP08(2018)108
Hence, the final answer for this character is given by where D-and D -lattices are defined in (A.1).
Let us now turn to the computation of χ + (q). Choose an element from where a = 0, 1. The bosonized fermions e iϕ (i) (z) contain elements e Q (i) generating the B K root lattice, which together with contribution of the fermionic and Heisenberg modes finally give Here the only new part, comparing to the D N -case, is an extra factor corresponding to (R or N S) fermionic contribution.

Character identities
In section 3 we have classified the twist fields by conjugacy classes in N G (h) (more precisely, by the orbits of N G (h) on the set ofg). However, it is possible that two different elements g 1 , g 2 ∈ N G (h) in the normalizer of Cartan are nevertheless conjugated in G: g 1 = Ωg 2 Ω −1 .
As was explained in section 3.1, conjugation by Ω maps twisted representation Hġ 1 to , grading operator is invariant L Ω 0 = L 0 , and we have This theorem is sometimes an origin of non-trivial identities and product formulas for the lattice theta-functions, and below we examine such examples.

JHEP08(2018)108
gl(N ) case. Here any element is conjugated to a product of cycles of length one (see the exact definition of shifted r-charge in (3.18)): where v (l,r) j = r + 1−l+2j 2l . One gets therefore an identity was known yet to Gauss and has been originally used by Al. Zamolodchikov in the context of twist-field representations of the Virasoro algebra. which leads to very similar identities to the gl(N )-case. For example, one can easily rederive the product formula [24] for the D-lattice theta function

JHEP08(2018)108
can be separated into the parts with fixed monodromies around zero: so that the only non-trivial OPE is between η (a) and η (2l−a) . In particular, η (0) and η (l) are self-conjugated Ramond (R) and Neveu-Schwarz (NS) fermions, which can be combined into the newη fermion, whereas all other components can be considered as charged twisted fermionsψ,ψ * : Therefore one gets equivalence . Moreover, if we take the product of two cycles [1] − , then we can combine a pair of R-fermions and a pair of N S-fermions into two complex fermions with charges 0 and 1 2 , therefore This means literally that a pair of η-fermions is equivalent to two charged bosons: one with charge v = 0 and another one with charge v = 1 2 . Equivalence between these two representations leads to the simple identity (B.24), (B.25): Using this identity we can remove a pair of [1] − cycles from (4.10) shifting K → K − 2, and add two more directions to the lattice of charges B K → B K+2 with corresponding r-charges 0 and 1 2 .
so(2N ) case, K = 0. We have the consequence of identity (A.17) for the case S = 2Z: so(2N ) case, K > 0; so(2N + 1), K > 0. In these cases everything can be expressed in factorized form using (A. 19) and checked explicitly, so these cases are not very interesting.

JHEP08(2018)108
so(2N + 1) case, NS fermion. Here in addition to all identities that we had in the so(2N ) case, one has two more identities appearing due to the fact that we can combine the N S (or R) fermion with a pair of N S, R fermions to get one complex fermion with twist 0 (or twist 1 2 ) and one R-fermion (or NS-fermion). Thus Due to these relations in the cases with K = 0 one can always transform any character with the N S fermion to a character with the R fermion, and vice versa.

Twist field representations and modules of W-algebras
By definition, all our twisted representations of the Kac-Moody algebra are twist-field representations of the W-algebra. As was explained in previous section, if g 1 = Ωg 2 Ω −1 , then conjugation by Ω transforms the g 1 -twisted representation to the g 2 -twisted representation. Moreover, such conjugation transforms the W-algebra generators expressed through the g 1 -twisted fermions to those expressed through the g 2 -twisted fermions with a single exception: if Ω ∈ O(n) \ SO(n), the conjugation by Ω changes the sign of the last generator V (z), see (2.24). For odd n this is equivalent to the action of the operator (−1) F on representations of W-algebra, but for even n this is an external automorphism of the W-algebra (coming from external automorphism of D N ). Therefore, the representations of W-algebra corresponding to conjugated g-twists are isomorphic, except for the case when Ω ∈ O(2N ) \ SO(2N ) -where only external automorphism of W-algebra maps one representation to another. The last detail is not crucial if twist g commutes with a certain element of O(2N ) \ SO(2N ) -in this case any conjugation Ω can be reduced to the conjugation by SO (2N ). This happens when g belongs to the class n j=1 [1, e 2πiv j ] + with some v k = 0 or v k = 1 2 : for example, it can be obtained from a pair of minus-cycles, or from some plus-cycle with the fine-tuned r-charge.
It is enough to consider the case of twisting by g ∈ H, since any element of N G (h) is conjugated to an element from H. In this case subspaces of Hġ with all fixed fermion charges become representations of W-algebra. 12 The r-charges of the corresponding representations are given by shifts of the vector r = log g 2πi by root lattice of g. Explicit formulas are collected below, but let us first discuss the irreducibility of representations. The Verma modules of W-algebras are irreducible if see [36][37][38] (in particular Theorem 6.6.1) or [39] (eq. (4.4)). For generic r this condition is satisfied and all modules, arising in the decomposition (subspaces of Hġ with all fixed fermion charges), are Verma modules due to coincidence of the characters. If g comes from the element of N G (h) with nontrivial cyclic structure, then r is not necessarily generic. For gl(N ) case, as follows (4.22), the r-charges corresponding to a JHEP08(2018)108 single cycle do satisfy (4.35), and for different cycles this condition also holds provided r are generic (no relations between r from different cycles). The same argument works for so(2N ) with "plus-cycles", but if we have at least two "minus-cycles", the corresponding r-charges can violate the condition (4.35), and not only Verma modules arise in the decomposition over irreducible representations.
In any case we have an identity of characters where χ 0 (q) is the character of Verma module, andχġ(q) is the character of the space of highest vectors. Hence, there is a non-trivial statement that all coefficients of the power expansion of the ratios χġ(q)/χ 0 (q) are positive integers, which can be proven using identities, derived in the previous section.
The list of characters of the Verma modules, appeared above, is: • gl(N ), so(2N ) (NS sector). Algebra is generated by N bosonic currents, each of them producing 1 n>0 (1−q n ) , so the character is • so(2N ) (R sector). One of these currents, V (z), becomes Ramond, with half-integer modes: • so(2N + 1) (NS sector). One current, V (z), becomes Neveu-Schwarz fermion, so taking into account its parity we get • so(2N + 1) (R sector). In the case of the Ramond fermion V (z) character χ − 0 (q) vanishes because the fermionic zero mode produces equal numbers of states with the opposite fermionic parities: so(2N ) case, R-sector. Here any element is conjugated to [1] − because contribution from the cycle [1] − to the denominator cancels contribution from the Ramond boson V (z).
so(2N + 1) case, K = 0, NS fermion. Here one has two non-trivial characterŝ Now we reformulate the results of previous sections using the notion of twisted representations of vertex algebras. Recall the corresponding setting (following, for example, [23]). Let V be a vertex algebra (equivalently vacuum representation of the vertex algebra), and σ be an automorphism of V of finite order l.

JHEP08(2018)108
Such correspondence should be σ-equivariant, namely giving the boundary conditions for the currents, and agree with the vacuum vector and relations in V . In particular, it follows from the σ-equivariancy Consider now a Lie group G (either GL(N ) or SO(2N ), N ≥ 2), with g = Lie(G) being the corresponding Lie algebra. Denote by V(g) the irreducible vacuum representation of g of the level one. This space has a structure of the vertex algebra, i.e. for any v ∈ V(g) one can assign the current A v (z). This space of currents is generated by the currents J αβ (z) from section 2.
The vertex algebra V(g) is a lattice vertex algebra. Let Q g denote the root lattice of g, and introduce rank of g bosonic fields with the OPE ϕ i (z)ϕ j (w) = −δ ij log(z − w) + reg, and the stress-energy tensor T (z) = − 1 2 j : ∂ϕ j (z) 2 :, then the currents of V(g) can be presented in the bosonized form where α = (α 1 , . . . , α n ) ∈ Q g and a i,m are arbitrary positive integers, while the stressenergy tensor corresponding to standard conformal vector 1 2 J 2 j,−1 |0 = τ ∈ V(g) (here J j,n are modes of the field i∂ϕ j (z)). The group G acts on V (g), and in order to use lattice algebra description we consider only the subgroup N G (h) ⊂ G which preserves the Cartan subalgebra.
In [23] the representations of the lattice vertex algebra, twisted by automorphisms, arise from isometries of the lattice Q g . Here we restrict ourself to the isometries provided by action of the Weyl group W (this case was actually considered in [40] without language of twisted representations). Let s ∈ W be an element of the Weyl group, by g we denote its lifting to G, in other words g ∈ N G (h) such that adjoint action g on h coincides with s. We consider representation twisted by such g. Setting of [23] and [40] works for special g, for example such g should have finite order, but we will expand this to the generic g ∈ N G (h). Clearly, the conformal vector τ is invariant under the adjoint action of N G (h).
The g-twisted representations of V (g) in [23] are defined as a direct sum of twisted representations of h. By {e 2πiθ Adj,k } we denote eigenvalues of s, or of the adjoint action g adj on h, we set −1 < θ Adj,k ≤ 0, by {J k ∈ h} -the corresponding eigenvectors, and define the currents J k (z) = n∈Z JHEP08(2018)108 generated by creation operators J k,θ Adj,k +n , n ≤ 0. Here µ ∈ h * 0 , where h 0 is g adj -invariant subspace of h.
It has been proven in [23] that twisted representations of V (g) have the structure for certain finite set of µ 0 ∈ h * 0 . Here π s denotes projection from h * to h * 0 , corresponding to the element s ∈ W for the chosen adjoint action g adj . For any root α the corresponding current J α (z) acts from F µ to F µ+πsα and equals to the linear combination of vertex operators. Number d(s) denotes the defect of the element s ∈ W, its square is defined by Here P g denotes the weight lattice of g, h ⊥ 0 denotes the space of linear functions vanishing on h 0 , | · | stands for the number of elements in the group. It can be proven that for any s the number d(s) is integer. In our case (GL(N ) and SO(n) groups) this number always equals to some power of 2.
Formula (5.6) allows to calculate the character of the module M , i.e. the trace of q L 0 . First, notice that the character of the Fock module F µ equals where ∆ µ is an eigenvalue of L 0 on the vector v µ . The value of ∆ µ consists of two contributions. The first comes from the terms with θ Adj = 0, and, as follows from (5.5), is equal to 1 2 (µ, µ). The second contribution comes from the normal ordering. The vectors J k ∈ h, corresponding to θ Adj,k = 0 can always be arranged into orthogonal pairs (J 1 , J 1 ), (J 2 , J 2 ), . . . with complementary eigenvalues θ Adj,k + θ Adj,k = −1. 13 After normal ordering of the corresponding currents one gets where θ = θ Adj,k . The last term in the r.h.s., which appears due to J k,n+θ , J k ,m−θ = (n + θ)δ n+m,0 , also gives a nontrivial contribution to the action of L 0 on highest vector v µ , since Altogether one gets 13 There is also "degenerate" case J k = J k for θ Adj,k = θ Adj,k = − 1 2 .

JHEP08(2018)108
and therefore, finally for the character of (5.6) Recall that the initial weight µ 0 in the setting of [23] should belong to the finite set in h * 0 (or h * 0 /π W Q). But we will generalize such representations and take any µ 0 ∈ h * 0 . This can be viewed as a twisting by more general elements g ∈ N G (h), which can have infinite order. Actually the corresponding elements are representatives of the conjugacy classes of N G (h) used in section 3. while π s Q gl(N ) is generated by the vectors 1 l i f i − 1 l j f j , so one can present any element of π s Q gl(N ) as 1 l j n j f j with n j = 0 and identify with that from Q gl(K) . Let µ 0 = j r j f j . Then the formula (5.12) takes here the form where, since for any length l cycle θ Adj,k = −k/l, This formula coincides with (4.4), and the reason is that the corresponding element from N GL(N ) (h) is exactly (3.18), g = K j=1 [l j , e 2πir j ]. Indeed, let α = e a − e b , where a belongs to the cycle j and b belongs to the cycle j , then the current J α (z) shifts L 0 grading by r j − r j + [rational number with denominator l j l j ].
SO(2N ) case. The root lattice Q so(2N ) = Q D N is generated by the vectors {e i − e j , e i + e j }, where again e 1 , . . . , e N denote the basis in R N . As we already discussed in section 3, there are two types of the Weyl group elements, the first type just permutes e i , while the second type permutes e i together with the sign changes.
The first case almost repeats the previous paragraph, without loss of generality we assume that the Weyl group element acts as (e 1 → e 2 → . . . → e l 1 → e 1 ), (e l 1 +1 → e l 1 +2 → JHEP08(2018)108 . . . → e l 1 +l 2 → e l 1 +1 ), . . ., where l 1 , . . . , l K are again the lengths of the cycles. The sinvariant part of h * 0 is generated by the same "averaged" vectors (5.13), while π s Q D N is generated by the vectors 1 In other words, π s Q D N consist of the vectors n j l j f j , where (n 1 , . . . , n k ) ∈ Q so(2K) . Let µ 0 = j r j f j , then the character formula (5.12) for this case acquires the form and coincides with (4.7). Here ∆ 0 s is defined in (5.15). The corresponding element from N SO(2N ) (h) has the form K j=1 [l j , e 2πir j ] + in the notations of section 3 (see (3.31)). For the second type (the corresponding element from N SO(2N ) (h) has the form K j=1 [l j , e 2πir j ] + · K j =1 [l j ] − ) one can present the Weyl group element as a product of K disjoint cycles of lengths l 1 , . . . , l K which just permute e i , and K cycles of lengths l 1 , . . . , l K which permute e i with signs, see (3.31). Now, without loss of generality, we assume that s acts as (e 1 → e 2 → . . . → e l 1 → e 1 ), (e l 1 +1 → e l 1 +2 → . . . → e l 1 +l 2 → e l 1 +1 ), . . ., (e L+1 → e 2 → . . . → e L+l 1 → −e 1 ), (e L+l 1 +1 → e L+l 1 +2 → . . . → e L+l 1 +l 2 → −e L+l 1 +1 ), . . ., where L = l 1 + . . . + l K . The s-invariant part of h * 0 is generated by the same vectors (5.13), while π s Q D N is generated by the vectors 1 l i f i . One can say that π s Q D N consists of the vectors n j l j f j , where (n 1 , . . . , n k ) ∈ Q so(2K+1) = Q B N , so that for the character formula one gets where, since in addition to [l] + -cycles with θ Adj,k = −k/l one has now [l ] − -cycles with θ Adj,k = −(k − 1 2 )/l , This formula coincides with (4.10). The number 2 K /2−1 equals to d(σ), this is the first case where this number is nontrivial. Note, that we consider here only internal automorphisms, i.e. K is even. Recall also (see section 4.5) that if g, g ∈ N G (h) are conjugate in G , then corresponding characters Tr(q L 0 ) M (s,µ 0 ) and Tr(q L 0 ) M (s ,µ 0 ) are equal.

Characters from principal specialization of the Weyl-Kac formula
Fix an element g ∈ G of finite order l. The g-twisted representations of V (g) are representations of the affine Lie algebra twisted by g. Recall that these twisted affine Lie algebras JHEP08(2018)108 L(g, g) are defined in [22, section 8] as g invariant part of g[t, t −1 ] ⊕ Ck, where g acts as By definition g is an internal automorphism, therefore the algebra L(g, g) is isomorphic to g (see Theorem [22, 8.5]), though natural homogeneous grading on L(g, g) differs from the homogeneous grading on g.
Therefore the g-twisted representations of V (g) as a vector spaces are integrable representations of g. 14 Their characters can be computed using the Weyl-Kac character formula. This formula has simplest form in the principal specialization, i.e. computed on the element q ρ ∨ ∈ G. Here ρ ∨ ∈ h ⊕ Ck is such that α i (ρ ∨ ) = 1 for all affine simple roots α i (including α 0 ). Then the character of integrable highest weight module with the highest weight Λ equals (see [22, eq. (10.9.4)]) , (5.20) where ∆ ∨ + is the set of all positive (affine) coroots. Here h is the Coxeter number. It will be convenient to use q ρ ∨ /h instead of q ρ ∨ . The weight ρ is defined by (ρ, α ∨ i ) = 1 for all simple coroots α i (including affine root α 0 ).
The grading above in this section was the L 0 grading, and it was obtained using the twist by the element g ∈ N G (h). Now we take certain g such that g-twisted L 0 grading coincides with principal grading in (5.20). We take g in the Cartan subgroup H and, as was explained above, choice of g corresponds to the choice of µ 0 in (5.12).
In the principal grading used in (5.20) h for all simple roots E α i (including affine root α 0 ). Therefore µ 0 ∈ P g + 1 h ρ, where P g is the weight lattice for g, ρ is defined by the formula (ρ, α i ) = 1 for all simple roots. 15 Below we write explicit formulas for the characters of twisted representation corresponding to such g (and such µ). In the simply laced case, computing the characters using two formulas (5.12) and (5.20) one gets an identity, which is actually the Macdonald identity [24].
14 Note that we get only level 1 integrable representation of g, since V (g) was defined above as a lattice vertex algebra, i.e. vacuum representation of the level k = 1. 15 Note the difference between ρ and ρ: the first was defined by pairing with simple coroots (including affine one), and the second is defined by scalar products with (non affine) roots. In the simply laced case these conditions in terms of roots and coroots are equivalent and we have ρ = ρ + hΛ0.

JHEP08(2018)108
Simple roots: Simple coroots: Note that the multiplicity of imaginary roots is N instead on N − 1 since we consider G = GL(N ) instead of SL(N ), and the corresponding affine algebra differs by one additional Heisenberg algebra.
The computation of the denominator in (5.20), using (5.21) gives while for the numerator (the same for all level k = 1 weights) one gets so that the character (5.20) in principal specialization One can compare the last expression with the formula (5.12) using the choice of µ 0 , as explained above. We get an identity which is a particular case of formula (4.23) from section 4.5, and again reproduces the product formula for the lattice A N −1 theta function (A. 16).
Recall that the r.h.s. of (5.25) also has an interpretation of a character of the twisted Heisenberg algebra. This twist of the Heisenberg algebra emerges in the representation twisted by g with g Adj acting as the Coxeter element of the Weyl group, hence r.h.s. of (5.25) equals to the r.h.s. of (5.14) for a single cycle K = 1, l = N . This g is conjugate to used above in the computation of l.h.s., therefore the characters of the twisted modules should be the same. The construction of level one representations in terms of principal Heisenberg subalgebra is well-known, see [41,42]. Another interpretation of the l.h.s. in (5.25) is the sum of characters of the W-algebra, namely W-algebra of gl(N ), (see section 4.6). Simple roots: α 0 = δ−e 1 −e 2 , α i = e i −e i+1 , 1 ≤ i < N, α N = e N −1 +e N Simple coroots: Now again we just compute the denominator 5.27) and the numerator (the same for all k = 1 weights) in (5.20), giving for the character As in the previous case, comparing this with the formula (5.6), one gets an identity where the r.h.s. can be interpreted as a character of the representation of Heisenberg algebra twisted by g, such that g Adj is Coxeter element. Again, this is the same as construction of the level k = 1 representation in terms of principal Heisenberg subalgebra from [41,42]. The l.h.s. of the formula (5.30) can also be interpreted as the sum of characters of the W (so(2N ))-algebra, (see section 4.6). By now in this section we have considered only the simply laced case -the only one, when the algebra V (g) is the lattice algebra or, in other words, when the level k = 1 representations can be constructed as a sum of representations of the Heisenberg algebra. However, the formula (5.20) is valid for any affine Kac-Moody algebra. Below we consider the case G = SO (2N + 1), where the level k = 1 representations can be constructed using free fermions.

JHEP08(2018)108
SO(2N + 1), N > 2 case. Root system is B (1) N (affine B N ), the dual root system is B Simple coroots: Imaginary coroots: (2m − 1)K of multiplicity N − 1, m ∈ Z 2mK of multiplicity N , m ∈ Z \ {0}. (5.31) Compute again the denominator and the numerator in the formula (5.20). Now the numerator for Λ = Λ 0 and Λ = Λ 1 is the same (1 + q k ) (5.33) but for Λ = Λ N it is different Here we used the identities (B.12) and ∞ k=1 (1 − q 2k−1 )(1 − q k−1/2 ) −1 = ∞ k=1 (1 + q k−1/2 ). It is convenient to consider the direct sums of two representations L Λ 0 ⊕L Λ 1 and L Λ N ⊕L Λ N since these sums have construction in terms of fermions. Using (5.20) one gets The r.h.s. of these equations suggests the existence of the construction of these representations in terms of N -component twisted (principal) Heisenberg algebra and additional fermion (in NS and R sectors correspondingly), exactly this construction has been considered in section 3.4.

JHEP08(2018)108
On the other hand these characters can be rewritten in terms of the simplest B-lattice theta-functions just using the Jacobi triple product identity Finally, let us point out that for the root system B 2 (affine B 2 ) the dual roots system is C Simple roots: α 0 = δ − 2e 1 , α 1 = e 1 − e 2 , α 2 = 2e 2 .
Simple coroots: (5.38) The computation leads to result, coinciding with formulas (5.32), (5.33), (5.34) for N = 2. Though the root system here has a bit different combinatorial structure, the fermionic construction is the same, using 5 real fermions.

Operator algebra structure
Now we are going to compute certain conformal blocks. We denote by |g the highest weight vector of the representation of twisted Heisenberg h. We denote corresponding field by Og.
The fields Og are primary fields for the W-algebra, so we compute conformal blocks for this algebra. 16 But our theory has more symmetry, it contains fermions and bosons with nontrivial boundary conditions (3.10) and (3.11). The presence of such operators provides additional restriction of the fusion of two fields First, the monodromy of the fused field should equal to the product of the monodromies h = g 1 g 2 . Second, we have a selection rule in terms of r-charges. Namely, for any zero mode in h, untwisted with respect to both g 1 , g 2 , corresponding r-charge forḧ equals to the sum of r-charges of g 1 , g 2 . In particular, we have equality for total r-chargesḣ =ġ 1ġ2 .
As an opposite example, if g 1 , g 2 are both diagonal (this corresponds to the trivial element of the Weyl group), then all r-charges of h equal to the sum of r-charges for g 1 and g 2 .
In principle, such conformal block for twist fields can be studied for any g ∈ G, see [14] about their relation to the isomonodromic deformations. But here we restrict ourselves to the case g ∈ N G (h). If g corresponds to nontrivial element of the Weyl group, then corresponding fields are special, for example in the case G = GL(2) all fields, corresponding to transposition, have conformal dimension 1 16 . The corresponding conformal blocks were found by Al. Zamolodchikov in [19][20][21]. Here we generalize his construction and give the answer in terms of the geometry of the branched cover.

Global construction
It has been shown in [18] that conformal block of the generic W (gl(N )) twist fields is given by explicit formula, analogous to the famous Zamolodchikov's conformal blocks of the Virasoro twist fields with dimensions ∆ = 1 16 [19][20][21]. To generalize the construction of [18] to all twist fields {Og|g ∈ N G (h)} considered in this paper, one needs to glue local data in the vicinity of all twist field to some global structure. We consider below such construction for G = O(2N ), since it can be entirely performed in terms of twisted bosons.
First, let us remind the local data in the vicinity of Og(0) discussed already in section 3: • 2l-fold cover z = ξ 2l with holomorphic involution σ : ξ → −ξ without stable points except the twist field positions.

JHEP08(2018)108
• Bosonic field J(z) = (η(σ(z))η(z)), which is antisymmetric J(σ(z)) = −J(z) under the action of involution σ, and has first-order poles coming from zero-mode charges in the branch-points corresponding to cycles of type [l, e 2πir ] + . Now we want to compute spherical 2M -point conformal block where we fix intermediate fields Oḧ k such that h k ∈ G are diagonal, g 2k−1 g 2k = h k , the r-charges for h k should be compatible with the fusion Og 2k−1 Og 2k (q 2 ) ∼ Oḧ k , and fusion of all Oḧ k together equals to identity. 17 In the discussion below we forget about fermion and consider only the twisted boson with current J(z). Now let us list the field-theoretic properties which fix this conformal block uniquely.
Let g corresponds to the cycle [l, λ] + , denote by |0 g the highest vector of the module of the twist-field Og. Then we have J k/l>0 |0 g = 0. Therefore the most singular term of the 1-form J(z)dz in the vicinity of the twist field Og is the simple pole where the residue r is the r-charge. Similarly, if g corresponds to the cycle [l] − , then J(z)dz does not have pole in the vicinity of Og.
For two twist fields Og 2k−1 (z),Og 2k (z ) as above (i.e. corresponding to mutually-inverse elements of the corresponding Weyl group) the operator product expansion in the channel corresponding toḧ k has the form where Vḧ k (z ) = Oḧ k (z ) is a field with fixed charges a ∈ h, 18 (we used another letter V in order to stress that this is just exponent of the bosonic field). Hence 1 2πi C j z,z J(ξ)dξOg 2k−1 (z)Og 2k (z ) = a j Og 2k−1 (z)Og 2k (z ) (6.5) where contour C j z,z is the j-th preimage of the contour encircling two points z, z on the base. We identify such contours with the A-cycles on the cover, and corresponding a's with the A-periods of 1-form J(z)dz.
The standard OPE of two currents 17 In principle, we may choose any monodromies, though in this way we will get complicated twisted representations in the intermediate channels, but as in [18] we restrict ourselves to simpler but still quite general case of pairwise inverse (up to diagonal factors hi) monodromies. 18 Here hj = e 2πia j , and since h is diagonal, we may say that there is one to one correspondence between a andḧ: inḧ we just fix the logarithm of h.
• Odd meromorphic differential dS(σ(ξ)) = −dS(ξ) with the poles in preimages of q i and residues given by corresponding r-charges.
Using this data one can write the following formulas for two auxiliary correlators: Their explicit expressions are fixed uniquely by their analytic behaviour. Now let us study in detail the structure of the curve Σ in order to construct all these objects. JHEP08(2018)108

Curve with holomorphic involution
Involution σ defines the two-fold cover π 2 : Σ →Σ with the total number of branch points being 2K = 2 M i=1 K i , or exactly the total number of [l] − cycles in all elements {g k }. Then the Riemann-Hurwitz formula χ(Σ) = 2 · χ(Σ) − #BP gives the genus g(Σ) = 2g(Σ) + K − 1 (6.12) A natural way to specify the A-cycles on Σ is the following [45]: first to take A 1 , . . . , A g , A 1 , . . . , A g on each copy ofΣ, whereg = g(Σ); and second, all other A-cycles that correspond to the branch cuts of the cover, connecting the branch points of π 2 : The action of the involution on these cycles is obviously given by thus we have the decomposition of the real-valued first homology group into the even and odd parts Compute nowg = g(Σ) using the Riemann-Hurwitz formula for the cover of P 1 . Let K = M i=1 K i be the total number of [l, e 2πir ] + -type cycles in all elements {g 2k−1 }, as well as K serves for the type [l ] − . Then χ(Σ) = N · χ(P 1 ) − #BP gives (cf. with the formula (2.17) of [18])g For our purposes the most essential is the odd part H 1 (Σ, R) − of the homology. One can see these g − A-cycles explicitly as follows: two mutually inverse permutations of type [l] + produce l pairs of A-cycles A (1,2) i with constraints i A (1,2) i = 0. These cycles are permuted by σ (6.13), so they actually form l − 1 independent odd combinations, giving contribution to the r.h.s. of (6.16). For two mutually inverse elements of the type [l ] − one gets instead 2l A-cycles with constraint i A i = 0, and with the action of involution σ : A i → A i+l , giving l independent odd combinations {A i − A i+l }, arising in the r.h.s. of (6.16), while the extra term −N corresponds to the charge conservation in the infinity.

Computation of the conformal block
Now we use the technique from [18][19][20][21] to compute the conformal block (6.2). For the vacuum expectation value of the stress-energy tensor (6.7) one gets from (6.11), (6.20) where t z andt z are the regularized parts of the bidifferentials K andK on diagonal in coordinate z:
From the first order poles we obtain This system of equations for conformal block is obviously solved, so that we can formulate: Theorem 3 Conformal blocks (6.2) for generic W (o(2N )) twist fields are given by Rest z (ζ)dζ k = 1, . . . , 2M (6.33) 19 The counting here works as for the [l]+-cycles, and for the [l ]−-cycles.
Equations (6.33) define so-called Bergmann tau-functions [46] for the curves Σ andΣ respectively, while the so-called Seiberg-Witten tau-function (6.34) can be read literally from [18] log τ SW (a, r, q) = 1 4 where T IJ is the g − × g − "odd block" of the period matrix of Σ, or the period matrix of corresponding Prym variety [45], the "odd" vector where q α k are preimages of q k , r α k -corresponding r-charges, and A J (P ) = P dω J is the Abel map to the Jacobian of Σ. The last term in the r.h.s. of (6.35) is given by where θ * is some odd Riemann theta-function for the curve Σ, and Remark. In the general N > 2 case conformal block constructed above is not fixed by conjugacy classes of twists and by charges in the intermediate channels: it depends also on the geometry of the cover. This is a reminiscent of infinite-dimensional space of 3point conformal blocks in the general case, but unlike that case now we deal only with finite-dimensional space, which can be easily studied.

Relation between W (so(2N )) and W (gl(N )) blocks
It is interesting to compare the formulas from previous section with the formulas from [18] for the exact W (gl(N )) conformal blocks. Since, as we already discussed W (so(2N )) ⊂ W (gl(N )), any vertex operator of the W (gl(N )) algebra is a vertex operator of its subalgebra W (so(2N )), and it is clear from our construction that twist fields Oġ for the elements g ∼ [l, e 2πir ] + , are also the twist fields for W (gl(N )). Moreover, the corresponding Verma modules, generated by W (so(2N )) and by W (gl(N )), actually coincide, 20 and it means that corresponding conformal blocks of such fields in these two theories should coincide as well. 20 These two modules coincide due to dimensional argument: they are both irreducible and have the same characters. Irreducibility follows from the fact that the null-vector condition can be written as α, log g 2πi ∈ Z for a simple root α, and for generic r's it is violated, see also comments in section 4.6.

JHEP08(2018)108
Indeed, in such a case Σ =Σ Σ , and therefore K(ξ, ξ ) = 0 if ξ , ξ are on the different components, and K(ξ, ξ ) =K(ξ, ξ ) if they are on the same component, hence t z (z) = 2t z (z) (6.39) For holomorphic and meromorphic differentials, one has in this case in the natural basis for the preimages {q α k } onΣ, and the period matrix of Σ consists of two nonzerog×g blocks: Under such conditions formula (6.32) turns into with corresponding obvious modifications of the formulas (6.36) and (6.37), which gives exactly the W (gl(N )) conformal block in terms of the data on smaller curveΣ.

Conclusion
In this paper we have considered the twist fields for W-algebras with integer Virasoro central charges, which are labeled by the conjugacy classes in the Cartan normalizers N G (h) of corresponding Lie groups and some extra discrete data. In addition to the most common W N -algebras, corresponding to A-series (or W (gl(N )) = W N ⊕ H, coming from G = GL(N )), we have extended this construction for the G = O(n) case, which includes in addition to D-series the non simply-laced B-case with the half-integer Virasoro central charge.
In terms of two-dimensional conformal field theory our construction is based on the freefield representation, where generalization to the D-series and B-series exploits the theory of real fermions, which in the odd B-case cannot be fully bosonized, so that in addition to the modules of twisted Heisenberg algebra one has to take into account those of the infinitedimensional Clifford algebra. This construction produces representations of the W-algebras (that are at the same time the twisted representations of corresponding KM algebras), which can be decomposed further into the Verma modules. To find this decomposition we have computed the characters of twisted representations, using two alternative methods.
The first one comes from bosonization of the W-algebra or the corresponding KM algebra at level one. Dependently on particular element from N G (h) it identifies the representation space with a collection of the Fock modules for untwisted or twisted bosons.

JHEP08(2018)108
The essential new phenomenon, which appears in the case of orthogonal groups, is presence of different [l] − cycles in g ∈ N G (h) and necessity to use in such cases the "exotic" bosonization for the Ramond-type fermions with non-local OPE on the cover. Alternative method for computation of the characters uses pure algebraic construction of the twisted Kac-Moody algebras and the Weyl-Kac formula in principal specialization.
Since there are the elements g 1 , g 2 not conjugated in N G (h), but conjugated in G, two different constructions with g 1 and g 2 give formally different formulations of the same representation. The computation of corresponding characters χġ 1 (q) and χġ 2 (q) leads therefore to quite simple but nontrivial identities for the corresponding lattice theta-functions, χġ 1 (q) = χġ 2 (q), which have been also proven by direct methods.
We have also derived an exact formula for generic conformal block of the twist fields in D-case, which directly generalizes the corresponding construction for common W Nalgebra. The result, as is usual for Zamolodchikov's exact conformal block, is expressed in terms of geometry of the covering curve (here with extra involution), and can be factorized into the classical "Seiberg-Witten" part, totally determined by the period matrix of the corresponding Prym variety, and the quasiclassical correction, expressed now in terms of two different canonical bi-differentials. In order to expand this method for the B-case one has to learn more about the theory of "exotic fermions" on Riemann surfaces, probably along the lines of [47,48], and we postpone this for a separate publication.
Another set of open problems is obviously related with generalization to other series and twisted fields related with external automorphisms. Here only the E-cases seem to be straightforward, since standard bosonization can be immediately applied in the simplylaced case, and there should not be many problems with the fermionic construction. However, it is not easy to predict what happens in the situation when Kac-Moody algebras at level k = 1 have fractional central charges, and the direct application of the methods developed in this paper is probably impossible. It is still not very clear, what is the role of these exact conformal blocks in the context of multi-dimensional supersymmetric gauge theories (not even thinking about other possible multidimensional applications of the W-algebras!), since generally there is no Nekrasov combinatorial representation in most of the cases.
Finally, there is an interesting question of possible generalization of our approach to the twisted representations with k = 1, which has been already considered in [51]. Some overlap of our formulas with section 8 of this paper suggests that such generalization could exist. We hope to return to all these issues in the future. JHEP08(2018)108 section 6 have been obtained using support of Russian Science Foundation, the work of AM has been also partially supported by RFBR grant 17-01-00585 and the RFBR/JSPS joint project 17-51-50051. This work has been also funded by the Russian Academic Excellence Project '5-100'.
PG and AM also like to thank the KdV Institute of the University of Amsterdam, where essential part of this work has been done, and especially G. Helminck, for the warm hospitality. MB and PG are Young Russian Mathematics award winners and would like to thank its sponsors and jury.

A Identities for lattice Θ-functions
Here we present few rigorously proved identities, used to verify representation-theoretic considerations at the level of computations of the characters.

A.1 First identity for A N −1 and D N Θ-functions
One can describe the lattices A N −1 , D N and D N in a similar way: The last lattice is actually just D N lattice, but shifted by the vector (1, 0, . . . , 0). So all these definitions can be rewritten as where S ⊆ Z: in our cases it should be chosen to be {0}, 2Z, and 2Z + 1, respectively. Notice also that for S = Z we get the simplest B N lattice. By definition Θ L S ( v; q) = For our purposes we need this function computed for the vector v = r 1 + l 1 − 1 2l 1 , r 1 + l 1 − 3 2l 1 , . . . , r 1 + 1 − l 1 2l 1 ⊕ ⊕ r 2 + l 2 − 1 2l 2 , r 2 + l 2 − 3 2l 2 , . . . , r 2 + 1 − l 2 2l 2 ⊕ . . . ⊕ ⊕ r K + l K − 1 2l K , r K + l K − 3 2l K , . . . , r K + 1 − l K 2l K which follows from the fact that Θ( v; q) = Θ(σ( v); q), where σ is a permutation. For example, take σ a to be a-th power of the cyclic permutation, then: One can identify the last factor in the r.h.s. with the contribution of zero modes, related to the r-charges [18]. JHEP08(2018)108

B Exotic bosonizations
Here we present some details of the bosonization procedures used in the main text.

B.1 N S × R
Consider first construction [49,50]  one gets unusual sign factor. 21 It is more convenient to use in this section coordinate ξ = √ t, so analytic continuation in t around 0 maps ξ to −ξ.

JHEP08(2018)108
The character of such module is given by where in the l.h.s. we have two Ramond fermions with two vacuum states, whereas the r.h.s. corresponds to the sum over bosonic modules with half-integer vacuum J 0 charges. This formula is a simple consequence of the Jacobi triple product identity. Analogously we have similar formula for the bosonization of N S × N S fermions