/*
	Test demag field for rod, using PBC to make the rod long.
	Kernel should be approximately -.5 -.5 0
*/

SetPBC(0, 0, 16)
SetGridSize(2, 2, 2)
SetCellSize(1e-9, 1e-9, 2e-9)

Msat = 1 / mu0

m = uniform(1, 0, 0)
expect("kxx", B_demag.Average()[0], -0.496, 1e-2)
expect("kxy", B_demag.Average()[1],  0,     1e-2)
expect("kxz", B_demag.Average()[2],  0,     1e-2)

m = uniform(0, 1, 0)
expect("kyx", B_demag.Average()[0],  0,     1e-2)
expect("kyy", B_demag.Average()[1], -0.496, 1e-2) 
expect("kyz", B_demag.Average()[2],  0,     1e-2)

m = uniform(0, 0, 1)
expect("kzx", B_demag.Average()[0], 0, 1e-2)
expect("kzy", B_demag.Average()[1], 0, 1e-2)
expect("kzz", B_demag.Average()[2], 0, 1e-2) 

