def F_M(T, B, J, gJ, TC, lamb, Nm): """Magnetic free energy of 1 spin. Parameters ---------- T : 2D array Temepratures. B : 2D array Magnetic fields. J : scalar Total angular momentum. gJ : scalar Landé g-factor. TC : scalar Curie temperature. lamb : scalar Value of the strength of the parameter of the Molecular Field. Nm : scalar Number of spins. Returns ------- y : 2D array Magnetic free energy. """ h = B / (lamb * Nm * gJ * mu_B * J ) # relative field to the saturation magnetization sigma = mag.Brillouin(T, B, J, gJ, TC, lamb, Nm) # reduced magnetization y = 3. * J / (J + 1.) * (h + sigma) * TC / T A = np.sinh((2. * J + 1.) * y / (2. * J)) B = np.sinh(y / (2. * J)) return -T * k_B * np.log(A / B) # magnetic free energy of 1 spin
def S_M(T, B, J, gJ, TC, lamb, Nm): """Computes the magnetic entropy for 1 spin. Parameters ---------- T : scalar, 2D array Temperatures. B : scalar, 2D array Magnetic fields. J : scalar Angular momentum. TC : scalar Curie temperature. lamb : scalar Value of the strength of the parameter of the Molecular Field. Returns ------- y : scalar, 2D array Magnetic entropy. """ h = B / (lamb * Nm * gJ * mu_B * J ) # relative field to the saturation magnetization sigma = mag.Brillouin(T, B, J, gJ, TC, lamb, Nm) # reduced magnetization y = 3. * J / (J + 1.) * (h + sigma) * TC / T # temporary variable A = np.sinh((2. * J + 1.) * y / (2. * J)) B = np.sinh(y / (2. * J)) return k_B * (np.log(A / B) - sigma * y)
def F_M_vs_M(sigma, T, B, J, gJ, TC, lamb, Nm): """Magnetic Free Energy as a functio of Reduced Magnetization. Parameters ---------- sigma : scalar, 1D array Reduced Magnetization. T : scalar Temperature. B : scalar Applied Magnetic Field. J : scalar Total Angular Momentum. TC : scalar Curie Temperature. lamb : scalar Value of the strength of the parameter of the Molecular Field. Returns -------- y : scalar, array Magnetic Free Energy """ def f(sigma, T, B, J, TC, lamb): A = np.sinh(3. / (2. * (J + 1.)) * (B / (lamb * Nm * gJ * mu_B * J) + sigma) * TC / T) B = np.sinh(3. * (2. * J + 1.) / (2. * (J + 1.)) * (B / (lamb * Nm * gJ * mu_B * J) + sigma) * TC / T) return (sigma**2.) / 2. + (J + 1.) / (3. * J) * T / TC * np.log(A / B) # reduced magnetization of absolute minimum sigma0 = mag.Brillouin(T, B, J, gJ, TC, lamb, Nm) h = B / (lamb * Nm * gJ * mu_B * J ) # relative field to the saturation magnetization y = 3. * J / (J + 1.) * (h + sigma0) * TC / T C = np.sinh((2. * J + 1.) * y / (2. * J)) D = np.sinh(y / (2. * J)) F0 = -k_B * T * np.log(C / D) # value of free energy at absolute minimum return f(sigma, T, B, J, TC, lamb) - f(sigma0, T, B, J, TC, lamb) + F0
def F2(T, B, J, gJ, TC, lamb, Nm, theta_D, N, F0): """Total free energy as a functions of temperature and magnetic field in the unit cell. (Less efficient than function F) Parameters --------- T : 2D array Temperatures. B : 2D array Magnetic fields. J : scalar Total angular momentum. theta_D : scalar Debye temperature. F0 : scalar Electronic free enery at 0 K. lamb : scalar Value of the strength of the parameter of the Molecular Field. Returns ------- y : 2D array Total free energy. """ sigma = mag.Brillouin(T, B, J, TC, lamb) # reduced magnetization s_M = ent.S_M(T, B, J, TC, lamb) # magnetic entropy from MFT s_L = ent.S_L(T[0], theta_D) # lattice entropy from Debye model # turn array into a matrix with equal rows for matrix multiplication s_L = s_L * np.ones(np.shape(T)) f0 = F0 * np.ones(T.shape) # offset of free energies tomake F start at 0 with no magnetic field F_0 = Nm * (3. * J / (J + 1.) * k_B * TC) + f0 return F_0 + Nm * (-gJ * mu_B * J * B * sigma - 3. * J / (J + 1.) * k_B * TC * (sigma**2.) - T * s_M) - N * T * s_L
def plt_M(MvsT=0, MvsB=0, MvsTB=0, UvsT=0, M_hys_vs_T=0, save=0, TT=None, BB=None, J1=None, J2=None, TC1=None, TC2=None, lamb1=None, lamb2=None, Delta_T=None, Delta_B=None, theta_D1=None, theta_D2=None, gJ=None, F01=None, F02=None, Nm=None, N=None): """Menu for the magnetization plots. Parameters ---------- MvsT : bool Plots the magnetization vs temperature. MvsB : bool Plots the magnetization vs magnetic field. MvsTB : bool Plots the magnetization vs temperature and magnetic field. UvsT : bool Plots the internal energy vs temperature. M_hys_vs_T : bool Plots the hysteresis of the magnetization vs tempeperature, magnetic field and both. """ print('Magnetization') if MvsT or MvsB or MvsTB or UvsT: # magnetization of phase 1 sig_1 = mag.Brillouin(TT, BB, J1, gJ, TC1, lamb1, Nm) # magnetization of phase 2 sig_2 = mag.Brillouin(TT, BB, J2, gJ, TC2, lamb2, Nm) # magnetization of stable phase sig_stable = mag.Brillouin_stable(TT, BB, J1, J2, TC1, TC2, lamb1, lamb2, theta_D1, theta_D2, F01, F02, gJ, Nm, N) if MvsT: # plot of M vs T plt_M_vs_T(Delta_T, Delta_B, sig_1, sig_2, sig_stable, Bstep=1, save=save) if MvsB: # plot of M vs B plt_M_vs_B(Delta_T, Delta_B, sig_1, sig_2, sig_stable, Tstep=1, save=save) if MvsTB: # plot of M vs T and B plt_M_vs_TB(Delta_T, Delta_B, sig_stable) if UvsT: # plot of U vs T plt_U_vs_T(Delta_T, Delta_B, sig_1, sig_2, Bstep=1, save=save, BB=BB, J1=J1, J2=J2, gJ=gJ, TC1=TC1, TC2=TC2) if M_hys_vs_T: # magnetization on heating sig_heat = mag.RedMag_heat(TT, BB, J1, TC1, lamb1, theta_D1, F01, J2, TC2, lamb2, theta_D2, F02, gJ, Nm, N) # magnetization on cooling sig_cool = mag.RedMag_cool(TT, BB, J1, TC1, lamb1, theta_D1, F01, J2, TC2, lamb2, theta_D2, F02, gJ, Nm, N) # plot of magnetic hysteresis vs T plt_M_hys_vs_T(Delta_T, Delta_B, sig_heat, sig_cool, Bstep=1, save=save) # plot of magnetic hysteresus vs B plt_M_hys_vs_B(Delta_T, Delta_B, sig_heat, sig_cool, Tstep=1, save=save) # plot of magnetic hysteresis vs T and B plt_M_hys_vs_TB(Delta_T, Delta_B, sig_heat, sig_cool) return None