Discrepancy when using PBC

21 views
Skip to first unread message

Huan Kiat Koh

unread,
Jan 5, 2026, 3:29:32 AM (7 days ago) Jan 5
to mum...@googlegroups.com
I am running hysteresis loops on thin films, and I noticed differences in the generated loops depending on whether I use PBC or not. For example, if I run a 300x300nm thin film with no PBC, versus a 100x100nm thin film with PBC(1,1,0), I expect the same results as the dimensions are the same, but I get 2 different loops. Does anyone know why this is the case? Thank you so much. 

Антон Луценко

unread,
Jan 5, 2026, 3:58:21 AM (7 days ago) Jan 5
to mumax2
Naturally, you would have different loops. 
300x300nm thin film with no PBC is not big enough to fight off demag field (in my experience). You would have non-uniformities in magnetization on the edges.
100x100nm thin film with PBC(1,1,0) has forced periodicity constraint (which is really important in case of e.g. magnetic textures) but not enough PBC extent to simulate infinite film (it has to be larger than a few microns, so e.g. PBC(10,10,0), though I would go with even larger, maybe PBC(100,100,0) ).
What is the material you are simulating? Is it supposed to have some magnetic texture?

Huan Kiat Koh

unread,
Jan 5, 2026, 4:30:37 AM (6 days ago) Jan 5
to mum...@googlegroups.com
Thank you for your reply. Correct me if I am wrong, but wouldn't PBC(1,1,0) result in an overall dimension of 300x300nm (1 repetition on each side), which is the same as my no-PBC case? Are you saying that in using PBC, it forces the magnetic texture to be the same for each 100x100nm region, but in the no PBC case, the magnetic texture is free to relax in the entire 300x300nm space? Or am I missing something? I am simulating a permalloy thin film. 

--
You received this message because you are subscribed to the Google Groups "mumax2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mumax2/c21f1d88-3d11-4f31-be9e-70ee2c8022d5n%40googlegroups.com.

Антон Луценко

unread,
Jan 5, 2026, 2:25:38 PM (6 days ago) Jan 5
to mumax2
One can say that PBC creates a grid of virtual copies (virtual since they are not real, they are not independently simulated in memory; and copies since every one of them has the same magnetization as the simulated area, but shifted into a grid). However, technically there are no copies at all. PBC makes two(three) things: 
1) demag field is computed not from a single cell, but from a grid of virtual copies of a cell. the field is calculated using a pre-computed kernel, so the "grid of virtual copies" only "exists" during the calculation of the kernel. That is why it takes longer time to compute demag kernel for PBC(10, 10, 0) than (1,1,0) but the same time to compute demag field during every timestep. Demag kernel must be accurate enough, and the relevant value is L × PBC (how far do you assume two spins should be until they stop interacting via their dipolar magnetic field). That is why it is ofthen worth to invest some time into computing the demag kernel with large PBC, if you do multiple simulations with the same grid.
2) Internally, demag field is always computed using FFT, which always assumes infinite periodicity. To combat this for limited samples, the arrays are padded with zeros to 2x of every dimension every single timestep before FFT and cropped after. PBC in a dimension removes the need to pad the array in that dimension. That is why the computation becomes faster with each non-zero PBC.
3) PBC also is accounted in the exchange field calculation at the edges.

In short, PBC(1,1,0) does NOT result in an overall dimension of 300x300nm, it simulates infinitely periodic film with period of 100×100nm, with magnetic field extending 300 nm from each spin.
Reply all
Reply to author
Forward
0 new messages