Whithammodulation theory for the Kadomtsev– Petviashvili equation