/* 
	Test correct wrapping for exchange with PBC.
*/

setpbc(2, 2, 0)
Nx := 128
Ny := Nx/2
setgridsize(Nx, Ny, 1)
c := 5e-9
setcellsize(c, c, c)

Msat  = 1000e3
Aex   = 10e-12
alpha = 1

r := rect(Nx/2*c, Ny/2*c)
deltax := Nx/2*c
deltay := Ny/2*c

setgeom( r.repeat(Nx*c, Ny*c, 0).transl(deltax, deltay, 0) )
m = uniform(1, 0.1, 0.01)
save(m)
run(1e-9)
save(m)

expectv("m", m.average(), vector(0.89947968, 0.23352228, -0.00010287), 1e-3)


setgeom( r.repeat(Nx*c, Ny*c, 0))
m = uniform(1, 0.1, 0.01)
run(1e-9)

expectv("m", m.average(), vector(0.89947968, 0.23352228, -0.00010287), 1e-3)

