{'fraction_non_alphanumeric': 0.04369777158774373, 'fraction_numerical': 0.009749303621169917, 'mean_word_length': 4.485538881309687, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A simple method to construct Flat Band lattices

We develop a simple and general method to construct arbitrary Flat Band lattices. We identify the basic ingredients behind zero-dispersion bands and develop a method to construct extended lattices based on a consecutive repetition of a given mini-array. The number of degenerated localized states is defined by the number of connected mini-arrays times the number of modes preserving the symmetry at a given connector site. In this way, we create one or more (depending on the lattice geometry) complete degenerated Flat Bands for quasi-one and two-dimensional systems. We probe our method by studying several examples, and discuss the effect of additional interactions like anisotropy or nonlinearity. At the end, we test our method by studying numerically a ribbon lattice using a continuous description.


I. INTRODUCTION
Lattices or extended periodical systems constitute a central framework for several areas of research. For example, in solid-state physics periodical lattices are a fundamental starting point [1], where many general predictions have been made without a direct experimental observation. The last decades, photonic lattices have emerged as key experimental setups where to study most of the predicted electronic properties, due to a direct observation of the optical wave-function using a simple CCD camera [2]. In this context, Anderson Localization [3] was directly observed, for the first time, in twodimensional (2D) waveguide arrays [4] and, then, also in one-dimensional (1D) lattices [5]. In this case, the energy is trapped due to consecutive destructive interference from randomly distributed scatters (sites or waveguides). Before this very fundamental observation, localization resulting as a balance between discreteness (diffraction) and nonlinearity (self-focusing) was observed in 1D [6][7][8] and 2D [9,10] lattices. Nonlinear localized modes of this nature are known as Discrete Solitons or Intrinsic Localized Modes [11], and the conditions for existence and stability, in diverse contexts, are nowadays well understood [12]. The nonlinearity and larger intensities create effective defects regions, where the trapping potential changes locally. In this way, waves naturally get trapped at deeper potential wells. In the nonlinear case, this occurs in a perfectly periodic lattice; however, this type of phenomena can also be observed in a linear regime by directly inserting a linear defect into a homogeneous system [13,14]. Exponentially decaying localized modes are obtained in both -linear and nonlinear-cases, depending on the effective strength of the induced defect. Therefore, these modes are not compact and high localization demands a very strong effective disturbance.
Another interesting way to induce localization on a lattice originates from the understanding of the linear properties of a given unconventional array. In standard/conventional systems (e.g., square, hexagonal or honeycomb lattices) the linear spectrum is always disper-sive (excepting some k-space points where the derivative becomes locally zero). As a result, when exciting the lattice, for example using a single-site excitation, a set of linear extended modes will be excited and waves will propagate incoherently across the lattice, depending on their specific velocities. Therefore, stationary localized patterns will be not observed for perfectly periodic linear standard lattices and the energy will diffuse only [2]. However, by carefully selecting the geometry of the lattice, a different kind of linear spectrum can be obtained. A Flat Band (FB) -unconventional-lattice possesses a unique linear spectrum. In these quasi-1D or 2D systems, a complete band (not only a section of it) is completely flat, implying zero dispersion and not diffraction at all for the states belonging to this band. Diamond [15], Stub [16], Sawtooth [17,18], Kagome [19,20] or Lieb [21][22][23] lattices are some examples of recent explored FB systems, in diverse physical contexts. These examples show the diversity of fabrication techniques and impressive possibilities for creating, in principle, any wished lattice. In all these geometries, a FB is composed by a large set of degenerated localized linear modes, all of them propagating coherently along the lattice. Moreover, these states occupy only few lattice sites being exactly compact (zero tail), in a perfectly periodic linear lattice. This implies that the localization is always perfect and it does not depend on any external parameter. The special geometry of FB systems generates consecutive phase cancellations that, effectively, reduces the excited region to a mini-array of a given lattice. The linear combination of these localized states is thought to be important for applications in all-optical imaging transmission [24,25], as a secure and compact mechanism of transporting information at a very low level of power.
There are several attempts to find a simple method to construct FB lattices [26][27][28][29]. However, we have not found a direct, simple and general method to create any wished FB system with given specific features (e.g., having several zero dispersion bands). For example, Ref. [27] starts from a given 2D or 3D lattice, and constructs partial line graphs without much connection with the physics of the sub-lattices, which is of major relevance in our method. In Ref. [30] authors describe a collection of FB lattices to study bosons and fermions dynamics. They briefly mention that an important condition is that the wave-function may be zero at some connecting sites, in order to make impossible the transport across the lattice. It is important to notice that this is an important requirement but it is not complete. It is possible to excite any lattice with a profile having zero amplitudes at some connecting sites; however, the energy could nevertheless diffuse and the FB will be not exclusively excited. To observe localization, as a result of the excitation of any FB, a mandatory condition is to excite the lattice by one of the modes of a given mini-array (or a linear combination of them), that has zero amplitudes at the connecting sites. The additive destructive interference will make possible the cancellation of the amplitude at the connecting sites and the transport will be just forbidden.
In this work, we identify the key ingredients to construct arbitrary lattices possessing one or more flat bands, focusing on the consecutive addition of miniarrays to form an extended lattice. Our method is based on the knowledge of the fundamental linear modes belonging to a given mini-array, in order to assure the cancellation of phases at connector sites. The existence of a linear mode satisfying this condition constitutes a proof to guarantee the existence of a Flat Band, which is composed of compact localized states. Different systems in quasi-one and two dimensions are generated with one or more Flat Bands (it is straightforward to extend our method to 3D as well). Additionally, we also show that it is possible to use our method to construct aperiodical systems having a set of compact modes forming a full FB. Extra considerations as, for example, anisotropy, next-nearest neighbors interactions or local nonlinearity are also discussed. At the end, we study a ribbon lattice using a continuous model where we test our discrete predictions in a more realistic configuration.

II. GENERAL MODEL
Focusing on written and induced waveguide lattices [2], we model the propagation of light in weakly coupled systems using a Discrete Linear Schrödinger (DLS) Equation. In this model, a given waveguide mode weakly interacts with its close neighbors due to an evanescent interaction. The amplitude of the mode at the n-th waveguide position is given by ψ n , and its dynamical evolution is simply modelled as where z is the propagation coordinate (in other contexts, it corresponds to time [2,12]). n corresponds to the propagation constant at the n-th site (if the lattice is homogenous, we simply set n = 0, without loss of generality). V nm describes the coupling interaction between the n-th and m-th sites. When constructing the lattice, these coefficients define all the linear interactions between close sites, according to a given lattice geometry. In fact, as we will discuss below, some FBs also survive when including next nearest-neighbors interactions; of course, taking into account the exponentially decaying tendency of coupling constants with respect to separation distance [31]. For some FB lattices the anisotropy or next-nearest neighbors interactions destroy the flatness of the band. However, we will show that our method allows the construction of more robust systems, what is important to observe the FB phenomenology in real experiments [15, 18, 20-22, 25, 32]. In general, the linear properties of any periodical system are contained in the definition of V nm coefficients. We solve the stationary problem by using a plane wave (Bloch) ansatz ψ n (z) = A n e i k· n e iβz .
By inserting this into model (1), we obtain the following set of coupled stationary equations The number of sites per unitary cell defines the number of different amplitude A n to be considered. For example, in a system with three sites per unit cell (e.g., Stub, Lieb or Kagome lattices), we will require three different amplitudes to characterize the linear properties of the system having three linear bands. By solving the eigenvalue problem (2), we obtain the linear spectrum of a given lattice according to the interactions included in V nm . Along this work, we will consider a constant spatial period of a = 1, in order to simplify the expressions.

III. TWO-SITES CASE
Let us start with the simplest possible mini-array: a dimer [see Fig. 1(a)-left]. This basic system describes two close waveguides interacting via a coupling coefficient V . A dimer possesses two linear stationary modes: A 1 = A 2 and A 1 = −A 2 [symbolic notation {+, +} and {+, −}, respectively], as shown in Fig. 1(a)-right (for simplicity, we do not include any mode normalization along the text). The frequency of these modes is β = V and β = −V , respectively. Now, we increase the system size by adding a "connector" site in between two vertically oriented dimers [see Fig. 1(b)]. We include an additional couplingV (full line), which is determined by the specific geometry (angle and distance [31]). Immediately, we realize that the original dimer solution {+, −}, located in any of the two dimers, also corresponds to a solution (mode) of this new composed system. For this mode, Eqs. (2) read The phase difference between the non-zero amplitude sites allows the cancellation of the amplitude at the added connector site. The frequency of this mode, in the new composed system, remains equal to the one of the original dimer problem (β = −V ). By adding more connector sites and dimers (mini-arrays), we are able to construct a full extended lattice, as the one shown in Fig. 1(c). This lattice is known as Rhombic or Diamond lattice and has been recently studied experimentally in Ref. [15]. As the {+, −} mode is still a mode in the extended system, there will be as many of these modes as the number of miniarrays (dimers) in the lattice, all of them having the same frequency β = −V . Therefore, all these modes will form a completely degenerated Flat Band.
We solve the linear problem (2) for the full Rhombic lattice, considering the unitary cell formed by three sites [enclosed area in Fig. 1(c)], and find the bands We realize that the mini-array mode is also an exact solution of the extended system forming a full Flat Band at β = −V , independent on theV value. Fig. 1(d) shows the linear spectrum for this Diamond lattice.
The discreteness of the system and the symmetry at the connector site equation, when considering a linear mode of the mini-array, are the keys of success to create any lattice possessing, at least, one Flat Band. For the previous example, and assuming a {+, −} mode (or combinations of it) as an initial condition at z = 0, the connector equation becomes because ψ C (z = 0) = 0. Considering this example and extending it to other configurations, we could claim that we can construct any FB lattice by connecting any given mini-array (dimer, trimer, rhombus, etc.) via different connector sites in different directions, assuring that the dynamical equation for this site may be strictly equal to zero. This is achieved by using a specific mini-array mode as an initial condition, what effectively allows the cancellation of phases at the connector site. In this way, we can construct a full lattice with a zero dispersion band, where this particular mini-array mode will be a degenerated solution of the extended system. One way to assure this is, for example, by choosing the connector sites coinciding with a node of a given mode of the mini-array. Therefore, this mode will naturally become a mode of the Flat Band because it will preserve the symmetry at the dynamical connector site equation. Of course, this method is not unique, but when it is successfully applied it assures the existence of a FB. Another interesting example is based on a mini-array consisting of only three sites connected in a row, as sketched in Fig. 2-left. This simple system possesses three linear stationary modes:

IV. THREE-SITES CASE
as shown in Fig. 2-right, with frequencies: β = √ 2, 0, − √ 2, respectively. We will show that we can use two of these modes to construct two different FB lattices.

A. "Cross" lattice
We start our lattice composition by selecting one of the three linear modes of the mini-array. The first mode does not present any phase oscillation. Therefore, it will not induce cancellation of transport on a given connector site, neither it will be associated to any Flat Band (however, this could change by assuming very rear negative coupling constants [33]). The second {+, 0, −} mode is similar to the mode used for the dimer to create the rhombic lattice, but it has an extra zero amplitude site at the center [see Fig. 3(a)]. So, it becomes natural to use this null site to connect two mini-arrays. However, if we connect a second mini-array, for example, to the right, we would end up with a system that will not preserve the symmetry of the mini-array mode, and our method will simply not work (there is a way to do it in a higher dimension, by rotating the mini-arrays in 90 • consecutively, obtaining a 3D FB spine-like ribbon). Therefore, we add an extra connector site in between two mini-arrays as shown in Fig. 3(b), using a horizontal coupling V 2 . As we expect, the trimer {+, 0, −} mode is also a solution of this new system [see Fig. 3(c1)], and it can be located in any of the two mini-arrays, or simultaneously in both. However, we realize that there is no only one FB candidate solution for this new composed system. Interestingly, the inclusion of a connector site and the conservation of the zero amplitude site at the center of the original trimer, allow the generation of new linear localized states. In Fig. 3(c2) we show a different mode, which still has a zero amplitude at the center of the three-sites mini-array. This mode is exactly equal to the Stub FB mode [16], although our composed system has additional sites below the central row. Due to symmetry, this mode can also be located in the lower row as shown in Fig. 3(c3). As a consequence, another FB mode could be the one having equal amplitudes in the top and bottom rows while having a double negative amplitude at the central connector site [see Fig. 3(c4)]. This new mode preserves the zero amplitude at the mini-array center, which indeed would be the connection of the composed system to their surrounding. In this particular case, the inclusion of an out of axis connector site adds more complexity to the original trimer mini-array. Therefore, in order to describe all the possible FB mode candidates, a new mini-array definition is required; i.e., a four sites mini-array as the region enclosed in Fig. 3(d). Additionally to preserving the original trimer mode, now written with four components as {+, 0, −, 0}, an extra mode appears with the same fre-quency β = 0. This mode has a profile {+, 0, 0, −V 1 /V 2 } or {0, 0, +, −V 1 /V 2 }, where always the center site of the original three-sites mini-array remains zero. In fact, this new mode does not change our criterion for constructing FB systems. It tells us that the original three-sites mini-array was not enough to describe the new quasi-1D composed system, so we may consider a larger mini-array structure (although it allowed the generation of a 3D FB spine-like ribbon lattice as commented above). Now, by connecting several three-sites mini-arrays using several connector sites, we are able to construct a full Cross lattice, as shown in Fig. 3(d). We define the unitary cell of this lattice [enclosed area in Fig. 3(d)], and solve the eigenvalue problem (2), finding that We plot these four bands in Fig. 3(e). We find two dispersive and two degenerated Flat (β = 0) bands. These zero dispersion bands are composed of the localized states shown in Fig. 3(c), exactly the same obtained for the mini-array and for the composed small system [ Fig. 3(b)].

B. Sawtooth lattice
We continue using the modes of the trimer mini-array, but this time we focus on the third one: Fig. 4(a)]. We add a connector site and couple a second three-sites mini-array, as shown in Fig. 4(b). As the coupling coefficient depends on the geometry, we allow the new system to have diagonal (V 1 ) and horizontal (V 2 ), in principle different, coupling coefficients. By injecting the {−, √ 2, −} mode in the first mini-array, we realize that an extra condition may be satisfied. If we write the stationary equations (2) for the connector site amplitude, we get Therefore, in order to have a zero amplitude at the connector site, a ratio δ ≡ V 1 /V 2 = √ 2 is required. For this particular condition, the third mode of the three-sites mini-array becomes a mode of the composed system as well. In fact, it can be located in three different positions in this new composed system, because the connector site forms also a similar mini-array with a different inclination.
By continue adding mini-arrays via connector sites, we are able to construct a full Sawtooth lattice as the one sketched in Fig. 4(c), where the unitary cell of four sites is denoted by an enclosed area. However, due to the Sawtooth symmetry the four sites can be reduced to just two sites [18]. We solve the eigenvalue problem (2) with this geometry and find two linear bands: where f (k x , δ) = 1 + 4(δ 2 − 1) cos 2 (k x ) + 4 cos 4 (k x ). If δ = √ 2, the two bands reduce to β(k x ) = −2V 2 , 4V 2 cos 2 (k x ); i.e., a Flat Band emerges for this particular ratio between coupling coefficients. In fact, this is exactly the same condition for the third mode to be a mode of the composed system. Therefore, the {−, √ 2, −} mode is also a mode of a full Sawtooth lattice, when satisfying the condition: δ = √ 2. In Fig. 4(d) we show the linear spectrum for three different values of δ, where we observe that the lower band becomes completely flat at this particular condition.

V. 2D LIEB-LIKE EXAMPLES
Now, we review our method for two-dimensional Lieb FB lattices, which have received great attention recently [21,22,25,32,34]. We start by identifying the mini-array necessary to construct a standard Lieb lattice. In Fig. 5(a) we show a mini-array example consisting of eight sites forming a ring, including an anisotropy (V x = V y ) degree of freedom. This system possesses eight linear modes, but we will consider only two for our study: Fig. 5(b1)] and {−, 0, +, 0, 0, +, 0, −} [ Fig. 5(b2)]. These two modes are degenerated with a frequency β = 0, due to a perfect cancellation of phases.

A. Lieb lattice
We will construct a Lieb 2D lattice by using the miniarray and first mode shown in Figs. 5(a) and 5(b1), respectively. In this case, a zero site of the mini-array is used as a connector site (there is no need to add an ex- tra site, although when doing it a different FB lattice could be created as we will show below). Fig. 6(a) shows a composed system formed using the connection of two mini-arrays sharing a same connector site at one corner. As expected, the {0, is also a solution of this composed system in any of the two mini-arrays, due to the perfect phase cancellation at the corner sites. By repeating this procedure in different directions, and using different corner sites, we are able to construct a full 2D Lieb lattice as shown in Fig. 6(b). The original mini-array mode can be located in different mini-arrays of the full lattice, all of them degenerated with β = 0. Solving Eqs. (2) for this lattice geometry, which consider three sites per unit cell [see enclosed region in Fig. 6(b)], we find the corresponding linear spectrum β(k x , k y ) = 0, ±2 V 2 x cos 2 (k x ) + V 2 y cos 2 (k y ) .
As it is expected from our method, the degenerated mini-array modes form a complete zero-dispersion band at β = 0 [see Fig. 6(c)]. Additionally, two dispersive bands are found for this system as well [21,22].

B. Lieb 2 lattice
We construct a "Lieb 2" lattice by using the mini-array and second mode shown in Figs. 5(a) and 5(b2), respectively. For this problem, we have zero amplitude sites at the sides of the mini-array. So, we add a new connector site to connect this mini-array to another one, as shown in the example presented in Fig. 7(a). If we inject the original stationary {−, 0, +, 0, 0, +, 0, −} mode [ Fig. 5(b2)] in one or both mini-arrays, it will also be a solution o the composed system, because the connector site remains zero. Naturally, we can add several connector sites in the four sides of the original mini-array and connect more mini-arrays in different directions. In this way, we are able to compose a full new system that we named "Lieb 2" lattice, with a geometry shown in Fig. 7(b). This composed system possesses ten sites per unit cell [see enclosed region in Fig. 7(b)] and, therefore, a linear spectrum having ten linear bands. The analytical form of these bands is not trivial, so we only present their plot in Fig. 7(c). By inspecting the spectrum, we find two flat bands, both located at β = 0. The first one is composed of {−, 0, +, 0, 0, +, 0, −} mini-array modes, that continue being solutions of the extended system [see shaded area at the left-down corner of Fig. 7(b)]. Additionally, a new localized FB state appears in the region in between four mini-arrays. It has eight sites different to zero in a staggered sign sequence, what is necessary to cancel the transport to the rest of the lattice [see rightdown shaded region in Fig. 7(b)]. For an isotropic configuration (V x = V y ), all amplitudes have equal magnitude. However, for anisotropic lattices (V x = V y ) the relation of amplitudes becomes a bit more complicated. If we define the horizontal connector site amplitude as C, the vertical connector site amplitude as B, and the corner site amplitude as A, then C = −V y A/V x and B = −V x A/V y . Similar to the Cross lattice case (Fig. 3), the appearance of this new localized state does not change our method, it only implies that the initial mini-array was not enough to describe the full new composed system.

VI. MULTIPLE FLAT BANDS
The number of FBs of a given lattice depends on the number of stationary modes that satisfy the symmetry condition at the connector sites of a given mini-array. Therefore, by analizing the specific geometry, we can construct different lattices having more than only one FB. For example, the Cross and the Lieb 2 lattices present two FBs at frequency β = 0. As we discussed before, the modes belonging to these two bands are spatially different, but both preserve the condition of having a zero amplitude at the connector sites, as the original miniarray mode does. Therefore, depending on the geometry and complexity of a given mini-array, it is possible to find additional compact linear modes which are also solutions of the small system, and that preserve the condition of cancelling the transport at the same connector site.  Now, we show explicitly how to construct a system possessing more than one Flat Band. We focus on a simple system, the so-called "B2-ribbon". In Fig. 8(a)left we show a four-sites mini-array, that possesses four linear modes, with three of them being useful for FB lattice composition. If we think on an horizontally oriented ribbon lattice, the two good modes (useful for phase cancellation) are the ones shown in Fig. 8(a)-right. These modes are denoted as {−, +, −, +} and {−, +, +, −}, with frequencies β = (V x − V y ) and β = −(V x + V y ), respectively. We immediately observe that when connecting two mini-arrays via a connector site [as shown in Fig. 8(b)], the dynamical equation for this site will be just zero, when initializing the system with one of these stationary modes (the connector site is symmetrically coupled to the mini-arrays with a coefficient V d ). By increasing the system size with more connectors and more mini-arrays, we are able to construct a full B2-ribbon lattice [see Fig. 8(c)]. We compute the linear spectrum of this extended system, by identifying the unitary cell of this lattice [enclosed region in Fig. 8(c)]. This cell contains five sites, therefore five linear bands are generated as Fig. 8(d) shows. The analytical expressions for the three dispersive bands are not compact and we will not write them explicitly. The two zero dispersion bands are simply located at frequencies β = (V x −V y ) and β = −(V x + V y ), exactly at the same frequencies than the original mini-array modes. Therefore, as expected, these two modes are also localized solutions for the extended system and generate two full Flat Bands.
This example is one of the many possible configurations useful to create lattices presenting more than one FB. Of course, this method could also be extended to full 2D lattices and not only to quasi-1D ribbons. In fact, the lattice Lieb 2 (see Fig. 7) is an example of this. In general, the dimension is not important, the key point is to preserve the discreteness of the system that allows the cancellation of phases for the modes of the mini-array and, therefore, the cancellation of transport across the lattice.

A. Aperiodical composition
It is possible to construct aperiodical lattices by connecting different mini-arrays via connector sites. The particular mode of every mini-array will also be a mode of the full lattice and could form a dense band, of course depending on its particular frequency. This point is very interesting because aperiodical systems will present no dispersive bands at all, but could present full FBs composed of different states. Therefore, the disorder could promote localization in the form of destructive interference of plane waves (Anderson localization [4,5]) or due to a local geometric phase cancellation (FB localization [15,21,22]). As our criterion does not depend on the periodicity, but on the discreteness of the system (miniarray geometry), we can compose an aperiodical system as a sequence of different mini-arrays connected by several connector sites. This system will not be periodic, but still will preserve all the properties of the different coupled mini-arrays. In Fig. 9(a) we show an example of a small composed system, which includes eight different mini-arrays. We obtain its linear spectrum by numerically diagonalizing the corresponding coupling matrix V nm , and plot β versus eigenvalue number in Fig. 9(b). As this system is not periodic, its spectrum does not form a soft curve [35]. Additionally, we realize that all the mini-array modes [fourteen in this case, see boxes in Fig. 9(b)], that satisfy the condition for having a zero amplitude at a given connector site, are also a solution of this extended system. This array is clearly aperiodic, but can be extended to form a periodical lattice by repeating the same pattern several times. By doing this, we would generate a new periodical system, but having a more complex unitary cell [ Fig.9(a)]. Therefore, the original mini-array states will also be a solution of the extended system and will form fourteen different degenerated Flat bands. show the amplitude profile for some localized modes of this system (the color scale increases from red to yellow, with orange being equal to zero).

B. Next-nearest neighbor coupling
Not all the lattices preserve their zero dispersion band when including next-nearest neighbor interactions. For example, a Lieb lattice adds curvature to the original Flat Band when including diagonal coupling [36], and the FB localized modes are simply lost. However, this is not an intrinsic problem of FB systems, the point is that the lattice geometry is just not the right one. In order to construct a lattice with a FB, which is robust against nextnearest neighbor interactions, there is no need to add any new ingredient to our method. We just may chose the right geometrical configuration for connector sites to assure that when considering, for example, a diagonal coupling, the dynamical equation for the connector site continues being zero, when injecting a FB mode as an initial condition. For example, this occurs for the previous Lieb 2 lattice [ Fig. 7(b)]. As we explained before, this lattice possesses two FB at β = 0. When including diagonal coupling coefficients, both FB survives but one of them shifts to a frequency β = −2V d , where V d corresponds to the next-nearest coefficient (we can see that when V d = 0, the band converges to its previous location). Another example is the B2-ribbon lattice (Fig. 8). When including a diagonal interaction between vertices of the mini-array, the {−, +, −, +} and {−, +, +, −} modes shift their fre- respectively. Therefore, the FBs also shift their frequencies to these values and the mode profiles preserves their perfect localization.

C. Anisotropy
In typical photonics setups, the anisotropy of crystals or of the waveguide modes is an important parameter to be taken into account when studying the linear properties of a given lattice. For example, in femtosecond written waveguide arrays [21,34], the coupling interaction strongly depends on the elliptical profile of written waveguides (although the Silica buffer is essentially isotropic). On the other hand, photonic lattices induced in SBN photorefractive crystals [20,25] also presents a strong anisotropy, but caused by the crystal itself (induced waveguides have a symmetrical profile). This consideration effectively implies that, for a fixed distance, the coupling also changes depending on their orientation (V x = V y ) [31]. When computing the linear spectrum of a given lattice, the anisotropy could destroy the flatness of a previous Flat Band. For example, a Kagome lattice has no any FB when horizontal coupling differ from the diagonal one [20]. However, there are several systems where this effect does not affect at all the flatness of the band, for example the Cross or the Lieb lattices.
We already considered the anisotropy in our method from the very beginning, and we were able to construct robust systems presenting FBs. The only necessary condition is to have a balance between the mode amplitudes in terms of the different coupling interactions of the system. This essentially implies that the amplitude of FB modes will not have the same value at different positions. The most important consideration is that the connector dynamical equation must be zero from the beginning, when injecting a given mini-array mode. An interesting example is the Lieb 2 lattice. This system has two FBs at β = 0. The first one is composed of localized modes having only four sites with amplitude different to zero [left-down corner in Fig. 7(c)]. As we can see, the cancellation of phases for this mode is always horizontal or vertical, therefore the anisotropy balance is not required and modes simply have equal amplitudes but different phases. On the other hand, the second flat band is composed of modes which cancel the transport by balancing vertical and horizontal interactions [right-down corner in Fig. 7(c)]. Therefore, a correction of amplitudes is required depending on a given anisotropy V x = V y , as we explicitly described before.
If we consider that different sites of the unitary cell could present different propagation constants (determined by n ), an effective anisotropy is generated in the system. Again, this is not a problem for the generation of FB lattices, however extra conditions for the balance of equations need to be fulfilled. Essentially, by starting from a given mini-array with a defined configuration of n , new modes need to be computed. Then, by inspecting their symmetry one can realize if these modes are good candidates for spatial localization on an extended lattice. If the required balance is not achieved when the propagation constants are different, the coupling anisotropy could help to solve this. However, this overall balance could be too complex to be implemented in real experiments.

D. Nonlinear solutions
One of the most common nonlinear interactions studied in diverse lattice systems corresponds to a cubic nonlinearity [2,12]. In Optics this interaction arises from the Kerr-effect, which is nothing else that an increment of the refractive index due to the intensity of a given beam. In BEC's, this interaction originates from the scattering between particles and in solid-state physics from the interaction, for example, between phonons and electrons on a given lattice. In model (1), this nonlinear effect is written as γ|ψ n | 2 ψ n , where γ corresponds to the strength of the nonlinear response. When looking for real solutions, the stationary problem to solve becomes simply β( k)A n = m = n V n, m A m e i k·( m− n) + γA 2 n A n .
In general, any FB mode possessing a set of N amplitudes (A), but with alternating/staggered sign, has a very simple and compact form [37,38]. As the connector sites amplitudes remain zero, the total power, defined as P = n |A n | 2 , is just given by P = N A 2 . The frequency of the nonlinear solution becomes β = β 0 + γA 2 (where the frequency shift β 0 depends on the specific FB of a given lattice) and, therefore, a very simple and exact relation between the frequency and power arises These nonlinear solutions are perfectly localized in a very compact spatial region. They are analytical compactons solutions [39,40], which conserve their spatial profile in the whole range of parameters. They bifurcate at the FB position (β = β 0 ) for a zero level of power (P = 0). These solutions exist for positive and negative nonlinearity, with the corresponding shift on the sign frequency to assure that P > 0.
When the FB modes possess a more complex spatial profile, including differences in the magnitude of the amplitudes, a more complicated relation is required. For example, in linear Sawtooth lattices the FB exists for a very specific value of coupling coefficients. Additionally, the FB mode has a non symmetric profile of the form {..., 0, −1, √ 2, −1, 0, ...}. Therefore, when increasing the solutions power, the amplitudes will change and the perfect balance will be more tricky. Ref. [41] explores how to preserve this balance in a nonlinear context (cubic and saturable), but allowing the system to also modify the coupling constants.

E. Continuous model
Finally, we study the robustness of our method in a more realistic environment. Although discrete models, based on nearest-neighbor interactions, describe very well the phenomenology observed in direct experiments [2,12], a better prove of the stable propagation of localized FB modes is obtained by numerically solving a paraxial wave equation, Here, ψ = ψ(x, y, z) describes the envelope of the electric field, k 0 = 2π/λ is the wavenumber in free space, λ is the vacuum wavelength, and n 0 is the refractive index of the bulk material. The function ∆n(x, y) defines the refractive index structure, which depends on the specific lattice geometry. ∇ 2 ⊥ = ∂ 2 x + ∂ 2 y corresponds to the transverse Laplacian operator.
As an interesting example, we study a system possessing three FBs, as shown in Fig. 10. A six-sites miniarray [ Fig. 10(a)] has three FB modes [ Fig. 10(b)] that cancel the amplitude at the connector site [ Fig. 10(c)]. The frequencies of these modes are −V y + √ 2V x , −V y , and −V y − √ 2V x , respectively. When computing the linear spectrum [considering the unitary cell shown in Fig. 10(d)], we find seven linear bands [see Fig. 10(e)]. Four of them are dispersive and three are completely Flat. The frequencies of the zero dispersion bands are exactly the same than the ones of the mini-array modes shown in Fig. 10(b), as expected from our method.
To study this lattice in a more realistic configuration, we insert the lattice geometry in model (3) by defining the function ∆n(x, y) [21]. We assume elliptical waveguides [8], what induces a strong effective anisotropy: V y = V x . This does not affect the flatness of the three degenerated bands, it only implies a different balance between the FB modes amplitudes. Considering standard parameters used in Ref. [21] (n 0 = 1.40, lattice period of d = 20 µm, propagation distance of L = 10 cm, λ = 532 nm, and maximum index contrast of 0.67 × 10 −3 ), we implement a Beam Propagation Method to solve Eq.(3) numerically. In Fig. 11 we show our results for three different input conditions. We observe that the three input profiles, corresponding to the three FB modes of a B3-ribbon lattice [see Fig. 10(b)], propagate a long distance without suffering noticeable distortion. In fact, Fig. 11(a) shows the excitation of some outsider lobes, which are very weak in comparison to the central highly excited sites. In Fig. 11(b) and (c) only the mode profiles are observable, with essentially a zero background. This result is certainly very interesting because we are using discrete solutions as input conditions of a continuous model. It is well known that a discrete (tight-binding) model describes only the lower part of the spectrum of an, in principle, infinite band-gap system [1]. When thinking on corrections to the nearest-neighbors model (1), the first consideration to have in mind are diagonal or nextnearest neighbor interactions. The B3-ribbon lattice example is robust against to anisotropy and, also, to second order linear interactions. This is a good indication that the discrete predictions will be observable for long distances in a continuous (realistic) medium. However, as this is an approximation of a more complex system, which includes an infinite set of linear bands, after even longer distances the FB states may start to experience diffraction across the lattice.

VIII. CONCLUSIONS
In this work, we developed a simple method to construct different FB lattices. By inspecting the mini-array mode profiles, we identify the good candidate modes for cancelling the transport across a full lattice, as a con- sequence of a local geometric phase cancellation at the connector sites. Our method is based on the discrete properties of a given lattice and the right identification of the corresponding mini-array. In this way, our method is able to explain all the already known FB lattice systems, but also give a simple receipt for inventing new ones. As our technique is based on the modes of a given mini-array, the lattice composition method will always give a complete FB, composed of spatially localized linear modes. By allowing the system to have extra interactions, we can also find robust lattices which preserve the localization of FB modes when including, for example, next nearest-neighbor interactions. This becomes very important when studying the lattice phenomenology experimentally, as we showed by numerically solving a continuous model. Finally, we showed that some nonlinear FB lattices possess simple analytical compact solutions, which could be relevant when thinking on the mobility of strongly localized wave-packets [37].