using DFTK using StaticArrays using Plots a = 10 lattice = a .* [[1 0 0.]; [0 1 0]; [0 0 0]]; pot(x, y, z) = (x - a/2)^2 + (y - a/2)^2 Apot(x, y, z) = .2 * @SVector [y - a/2, -(x - a/2), 0] Apot(X) = Apot(X...); Ecut = 20 # Increase this for production C = 500.0 α = 2 n_electrons = 1; # Increase this for fun terms = [Kinetic(), ExternalFromReal(X -> pot(X...)), PowerNonlinearity(C, α), Magnetic(Apot), ] model = Model(lattice; n_electrons=n_electrons, terms=terms, spin_polarization=:spinless) # "spinless electrons" basis = PlaneWaveBasis(model, Ecut, kgrid=(1, 1, 1)) scfres = direct_minimization(basis, tol=1e-5) # Reduce tol for production heatmap(scfres.ρ.real[:, :, 1], c=:blues)