We simulated nematic liquid crystal confined under patterned substrates. In one of the simulated surfaces, the easy axis is planar and uniform, while the other one offers a periodic alignment, with well-defined modulation. We use Monte Carlo simulations within a lattice model to determine the molecular organization of the confined sample built to produce periodic deformations. Stable disclination lines emerge on the samples, spaced with the same modulation length of the periodic surface. When a small pretilt is implemented on the surfaces, the periodicity is altered and a configuration where the disclination lines are spaced by two periods emerges. A transition between two periods to one period spaced disclination lines is possible by decreasing the thickness or applying an electric field. The effects of different set of the liquid crystals elastic constants are also analyzed. The applied model seems to be able to reproduce quite well the optical images obtained in recently published experiments.