{'fraction_non_alphanumeric': 0.02756658426232567, 'fraction_numerical': 0.007183170856849667, 'mean_word_length': 4.916114790286976, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Topological and geometric decomposition of nematic textures

Directional media, such as nematic liquid crystals and ferromagnets, are characterized by their topologically stabilized defects in directional order. In nematics, boundary conditions and surface-treated inclusions often create complex structures, which are difficult to classify. Topological charge of point defects in nematics has ambiguously defined sign and its additivity cannot be ensured when defects are observed separately. We demonstrate how the topological charge of complex defect structures can be determined by identifying and counting parts of the texture that satisfy simple geometric rules. We introduce a parameter called the defect rank and show that it corresponds to what is intuitively perceived as a point charge based on the properties of the director field. Finally, we discuss the role of free energy constraints in validity of the classification with the defect rank.


I. INTRODUCTION
Various states of matter we know today are characterized by interactions and symmetry of their microscopic building blocks. Local order is reflected in mesoscopic quantities, such as the phase of electromagnetic waves, crystalline order, nematic director, magnetization, dielectric tensor and others. We call these quantities order parameters. A prominent example of partially ordered matter are liquid crystals, which are characterized by orientational order and liquid-like positional freedom of the molecules. Nematic liquid crystals exhibit topologically prescribed defects, which in combination with surface-treated colloidal particles [1], nanoparticles or general confinement [2,3], enable creation of complex materials with tunable optical response [4].
The nematic order can be represented with an order parameter tensor that contains both the magnitude of the ordering and the directional information [5]. In studies of defect topology, the principal eigenvector of this tensor, the director, is a common choice to represent the average direction of molecular alignment. Vectors with unit size lie on a sphere (S 2 ), which is a topologically nontrivial space. Consequently, boundary conditions can exist that cannot be smoothly interpolated in bulk without introducing defects [6,7]. In contrast to Heisenberg ferromagnets, which have the ground state manifold with exact topology of a sphere, nematic liquid crystals have an additional rule that opposite vectors represent the same state, as the molecules have no back-front distinction [8]. One consequence of this property is that beside the point defects, nematics also allow line defects. Beside that, the sign of the vector field representing the director is ambiguous and therefore the same holds for the invariants of the field which are odd in the director, such as the topological charge of point defects [6].
The growing interest for controlled formation of complex defect structures in constrained nematic liquid crystals [1][2][3] is increasing the demand for visualization and simple classification of complex nematic director fields. This stimulated us to derive a natural expression for the topological charge that does not involve integration and reflects its discrete nature. We accomplish this by decomposing the director field into a hierarchy of geometric primitives, which enables intuitive understanding of the topological charge based on the qualitative features of the director field. We extend the classification from strictly topological to a more general one that has the advantage of differentiating topologically equivalent states with 2 different energies. We introduce a quantity called the defect rank and draw parallels with the topological charge and naming conventions for point defects.

II. PATCHES, BOUNDARIES AND GRAINS
If the vector heads are artificially prescribed, the director field n becomes a proper vector field. Volumes of interest, such as those that include defects, can then be classified using the topological charge, which enumerates the defects with the elements of the second homotopic group [6,8]. As topological properties are invariant to the specific shape of the surface that encloses the test volume, a spherical volume is assumed from here on without the loss of generality. For a sphere, parametrized by the spherical angles θ and φ, the Gauss integral for the topological charge [7,[9][10][11] reduces to the following expression, This expression involves integration over all the details of the director field n, which can be eliminated, if the director n on the enclosing sphere (the surface texture) is decomposed into geometric primitives, over which the integration can be performed in advance. According to the component of n along the surface normal, the sphere can be split into patches of outgoing vector field and patches of ingoing vector field. These patches are separated by a disjoint set of closed loops (boundaries) where the director lies tangentially to the enclosing sphere. On the boundaries, the director still has one degree of freedom -its direction in the tangent plane. With the same approach as for the patches, the boundary can be split into parts with a constant orientation along the normal to the boundary curve. These are separated by points (grains), where n is directed tangentially along the boundary (Fig. 1a).
Degenerate cases, such as textures with touching boundaries or wide areas where director is parallel to the surface, can always be regularized by an infinitesimal perturbation of the director field.
The parametrization of the sphere with the polar angle θ and the azimuth φ generates a local coordinate frame (r,θ,φ), whereθ andφ lie parallel to the surface (Fig. 1a). Within this coordinate frame, we introduce local spherical coordinates with angles α and β to express the director n, n = t(r cos α +θ sin α cos β +φ sin α sin β) where t = ±1 simplifies the calculation for director fields with reversed vectors. Without the loss of generality, each angle can vary in only one of the directions: α = α(θ) and β = β(φ).
To calculate the contributions of patches, boundaries and grains to the topological charge (Eq. 1), a model for α(θ) and β(φ) is needed. On every patch, the director n can be combed perpendicularly to the surface without changing the topology, because the condition for the normal component to have a constant sign locally restricts the ground states to a halfsphere, which is topologically trivial (contractible to a point). This is achieved by setting α = β = 0 so that the director points directly outwards if t = 1 and inwards if t = −1. For a single patch, shaped like a spherical cap bounded by a circle of constant latitude at θ = θ 0 4 ( Fig. 1a), the contribution to the topological charge follows, This contribution is proportional to the fraction of the sphere covered by the patch and its sign depends on whether the director points inwards or outwards from the surface, which is given by the signature t = ±1.
On the boundary, the director makes a smooth turn from outward to inward direction.
A boundary without grains is modeled by setting β = 0 and choosing α to do a half-turn within a narrow transition zone between the boundary and the patch, η is the half-width of the transition zone around the boundary, and the boundary signature s = ±1 selects the in-plane orientation of the director at the boundary, n = stθ (Fig. 1a).
To simplify the calculation, the width η of the transition zone is limited to zero, The result does not depend on s, therefore the orientation of the director on the boundary does not influence the topological charge.
The contribution of a single grain is obtained in a similar fashion. The reverse of the in-plane orientation of the director is smoothly interpolated by β with ξ being the half width of the transition inφ direction (Fig 1a,inset). Parameter w = ±1 governs in which way the director points at the grain, n = (tsw)φ. A limit ξ → 0 yields the contribution of the grain.
Consider a texture, divided by N boundaries into N + 1 patches of arbitrary shapes.
Every boundary can have an even number of grains, since the continuity requires an even number of director flips on a closed circuit. The topological charge q of the entire texture then splits into a sum of elementary contributions (Eqs. (3,5,6)), FIG. 2. Boundaries divide the texture into patches with arbitrary positioning, shape and hierarchical nesting order. If the texture is instead viewed as a superposition of layers, the boundaries can be counted together with patches. In such decomposition, each patch contributes ±1 to the topological charge, depending on whether its direction is oriented inwards or outwards, here represented with alternating colors.
Instead of adding patch contributions q pi , which are proportional to the areas of the patches, multiplied by the signature t (Eq. 3), we start with a uniform background sphere and progressively build the desired configuration. For convenience, we choose the background with the director pointing outwards, t = 1. To recover the desired configuration, N patches must be added. Each patch contribution is counted twice, once to cancel out the background and once to account for its own contribution. This way, all the patches are shaped as spherical caps ( Fig. 2) and their contributions can be grouped with their respective boundaries, The background patch q 0 has the topological charge of a radial hedgehog, where χ is the Euler characteristic of the surface [12,13]. The dependence on the polar angle θ has disappeared, since the shape and position of the boundaries are not topologically relevant. Any number of boundaries can be nested one inside another, which results in 6 patches with alternating t being added to the sphere (Fig. 2).
The grain contribution g = tw/2 can be associated with geometric features of the texture.
The director n rotates around the surface normal as we move along the boundary. There are two possible directions in which we can trace the boundary, but they are invariantly distinguishable, as there are patches of opposite signatures on each side. For a choice of the direction that has the positive signature patch on its left side, the grain contribution is +1/2 if the director rotates anticlockwise and −1/2 otherwise (Fig. 1b).
The charge decomposition in the form applies not only to the nematic director, but to any medium that can be described with a unit vector order parameter. It works for spherical enclosing surfaces, with possible generalization to surfaces of arbitrary genus. We assumed the vector field on the enclosing surface is nonsingular. Singular objects, like boojums and other surface defects, contribute additional terms to the expression [13][14][15].
Patches, boundaries and grains are two-, one-and zero-dimensional geometric features of the surface texture. This decomposition is similar to the notion of domain walls and defect lines in ferromagnetic systems [16,17], except in our case we observe 2D texture on a closed surface instead of bulk 3D field. Our boundaries are similar to cross sections of magnetic Néel walls and the grains correspond to cross sections of Bloch lines. However, in magnetic systems, the domain walls and lines naturally prefer narrow transition zones [16], whereas in nematics narrow transition zones are merely a computational tool.

III. FREE ENERGY CONSTRAINTS
One of the reasons for calculating the topological invariants is to detect similarity between director fields. Take two surfaces that enclose closed volumes in the bulk. If we cut out the only even or odd parity of the topological charge is properly defined and conserved [6,18].
Despite ambiguity, the signs of topological charge are usually assigned by convention. The charge +1 is assigned to all radial hedgehogs and −1 to hyperbolic hedgehogs, regardless the orientation of the arrows on vectors, even though there is a 3D rotation in director space that can transform one into the other [14,19]. In case the hedgehogs interact in the same medium, the continuity of the director field prescribes their relative signs of topological charge that may clash with this convention. The transformation from a hyperbolic to radial hedgehog involves a rotation of the director without simultaneous rotation of the underlying space.
Such transformation does not satisfy our condition to push-forward transformations and the incompatibility of the surface textures means they cannot exist in the same surrounding director field without costly elastic deformations. The transition between the hedgehogs is thus restricted by an energy barrier, except in cases where the experiment is specifically designed to support the transition [19].
We seek a geometric invariant that matches the conventional understanding of the hedgehog charge and preserves even or odd parity, without introducing any inconsistencies not already present in the topological definition. In the following section, we define the defect rank of a point defect, q * , and compare it to the topological charge q.
The definition of the defect rank q * can be made consistent with the conventions if we find a matching integer expression involving the surface texture properties. Earlier (Eq. 4) we introduced the boundary signature s = ±1 that describes how the director behaves on the boundary. The boundary signature s = −1 corresponds to the director stream lines that touch the boundary from the outside of the sphere (Fig. 3a) and s = 1 to the streamlines that s can be assigned to a boundary as a whole only if there are no grains present on the texture, otherwise it is a local property that is only constant between two grains. To find a suitable expression for the defect rank, the classification must be restricted to textures without grains. Two such textures match if their boundaries have the same signature s, otherwise the stitching involves rotation of the director relative to the local coordinate frame (Fig. 3c). The topological charge (Eq. 9) alternates between even and odd with the number of boundaries. This property is replicated by the defect rank, if we define it as If the surface has grains in its texture, the defect rank q * is not defined. The textures with grains can be understood as intermediate states through which the texture must pass in order to change its defect rank. For the defect rank to be a useful parameter, such intermediate states must have a higher energy, although the energy constraints are not absolutely prohibiting, like topological are. If the energy barrier is removed, which can be accomplished by external fields, boundary frustration or heating, the transition occurs and the texture changes [14,19]. The entire texture on the enclosing surface can still be used for more precise comparison and testing for compatibility. The texture decomposition can be seen as a generalization of the traditional topological charge, as the latter is included in the former, as given by (Eq. 9).
The boundary signature s is not a topological invariant, but nevertheless has interesting properties which resemble conservation laws needed for effective classification. Two neighboring boundaries with opposite signatures can annihilate, as they represent a "fold" in the director field (Fig. 4a). The definition of q * matches the convention for the radial hedgehog, which has no boundaries, (q * = 1), and hyperbolic hedgehog that has two boundaries with negative signature (q * = 1 + 2 · (−1), Fig. 4b). The singular case when the boundary is shrunk to a point corresponds to a point defect sitting on the enclosing surface [15]. Pushing additional point defect with rank s inside the enclosing surface adds a boundary of the same signature s to the surface, which suggests that the defect rank is conserved.
Consider the case of two radial hedgehogs arranged into a vector field resembling that of an electric dipole. The hedgehogs must have the opposite orientations of arrows, as one acts as a source and the other as a sink. This structure has q = 0 by strict topological definition (Fig. 4c). However, we observe that the texture on an enclosing sphere has one positivesignature boundary, which translates to q * = 2, the same as we get with naïve counting of hedgehogs (Fig. 4d). Note that the "dipole" in this case is not the structure with one hyperbolic and one radial hedgehog, which is usually denoted by this name in nematics.
The defect rank detects this and differentiates between them, while the topological charge assigns q = 0 to both.
The defect rank q * is sign-invariant and matches the existing conventions [10]  patches with t = −1 and 12 grains with g = + 1 2 . Together, this reproduces q = 4. However, the defect rank cannot be assigned due to the presence of grains. model director fields for point defects with known topological charge [10,20,21]. Visualization of the normal component of the director, n · ν, shows that negative q solutions are realized as |q| + 1 negative-signature patches on the enclosing sphere (Fig. 5a). For these solutions, the defect rank can also be determined and is equal to the topological charge. On the other hand, positive q solutions have q −1 negative-signature patches and each boundary has four g = + 1 2 grains, which gives the correct topological charge (Fig. 5b), but the defect rank cannot be determined due to the presence of grains. In nematics, the entire texture can be arbitrarily multiplied by −1, so the q and −q textures are topologically equal. However, the surface textures and their defect ranks are different, which implies that the two states are not interchangable without deviating from the energy minimum. Textures with high defect rank or topological charge are energetically expensive and as such hard to find in real systems. In an idealized calculation, the only stable point defects are those with q = ±1 and in a cluster of many point defects, they prefer to form pairs with zero total charge [22].
Complex textures are most likely to be found locally as a part of a larger complex of line defects and colloidal inclusions, or in frustrated systems.

V. CONCLUSION
Topological defects in directional media are interesting both from the topological and geometrical point of view. The physical system cannot undergo a transition between states with different topology, which stabilizes the defect states. On the other hand, contributions to the free energy that result from spatial variations of the director depend solely on the geometry of the field. Constraints conditioned by the free energy are physically just as important as topological, which calls for a deeper analysis.
Instead of treating the nematic director field as a separate entity from the coordinate space, we observed it relatively to a chosen surface. Our geometric interpretation of topological charge enables directly relating the geometric appearance of the director field to its topology. With the texture decomposition, the topological charge can be found simply by finding the loops where the director is tangential to the surface and counting them, which is a useful representation also for the educational purposes. This manner of calculating the topological charge works also for chiral nematics and other media with unit vector fields, such as Heisenberg ferromagnets [11] and antiferromagnets [23].
We show that in nematics, conditions that energetically stabilize the structures are closely related to the conservation of surface textures. As the topological charge is ambiguously defined in this case, we exploit the geometric nature of the texture decomposition and introduce the defect rank, which measures the shape and structure of the director field instead of only the topological properties. The defect rank closely matches the intuitive understanding of defects and mathematically quantifies the visual clues that are usually used to identify the defects by eye. The even or odd parity of the defect rank also matches the parity of the topological charge, whenever the defect rank is well-defined. Especially in interpretation of the experimental data and description of nematic textures, the defect rank should be used instead of the topological charge. The latter should not even be assigned a sign when used in a description of a single defect structure, while the defect rank spans an entire integer range without ambiguities. This contrasts with the ferromagnetic case, which is fully described by the topological charge and does not require description with the defect rank.
Furthermore, the description of defects using surface textures can be applied to systems with complex boundary conditions, like nematic colloids [24,25], faceted particles [26], 14 nematic droplets [27] and nematics in porous media [2]. For a nematic in a homeotropic micro-channel network, counting of patches corresponds to the formalism of counting escape directions at channel crossings, devised by Serra et al. [3]. The confinement borders of the nematic can be viewed as an enclosing surface and the decomposition directly related to the boundary conditions enforced by the surface treatment. Colloidal particles with heterogeneous surface anchoring also imply a certain texture on its surface [28]. Knowing the meaning of the texture features can simplify the design of particles with desired topological properties and aid in interpretation of the results.