A non-transitory computer-readable storage medium including at least one computer program stored thereon, which, when executed by a processor associated with the non-transitory computer-readable storage medium, causes said processor to execute a method for preparing a pattern for printing on a plate or mask by electron beam lithography, comprising:
- modelling of the pattern by breaking down the pattern into a set of elementary geometric shapes for individual printing to reproduce said pattern, and recording the modelled pattern as a model in a memory;
- and
- determining, for each elementary geometric shape of the set in the model, by said processor accessing the memory, a dose of electrical charges for application to a variable shaped electron beam during the individual printing of said each elementary geometric shape, doses for said each elementary geometric shape of the set in the model being chosen from among a discrete set of doses including several non-zero predetermined doses recorded in the memory,
- wherein the set of elementary geometric shapes is a bidimensional paving of identical elementary geometric shapes covering the pattern for printing, and
- wherein, when the doses for application for said each elementary geometric shape of the set in the model are determined, performing a discretisation error correction by dithering.