⛄一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【晶体】基于matlab方晶格上紧束缚求解px+ipy超导体【含Matlab源码 7204期】
点击上面蓝色字体,直接付费下载,即可。
获取代码方式2:
付费专栏Matlab物理应用(初级版)
备注:
点击上面蓝色字体付费专栏Matlab物理应用(初级版),扫描上面二维码,付费29.9元订阅海神之光博客付费专栏Matlab物理应用(初级版),凭支付凭证,私信博主,可免费获得1份本博客上传CSDN资源代码(有效期为订阅日起,三天内有效);
点击CSDN资源下载链接:1份本博客上传CSDN资源代码
⛄二、部分源代码
% main.m
clc;
% Step 1: Initialize Parameters
Nx = 20; % Lattice size in x-direction
Ny = 20; % Lattice size in y-direction
t = 1; % Hopping parameter
Delta_0 = 2; % p-wave pairing potential
mu_start = 0; % Start value of chemical potential
mu_end = 5; % End value of chemical potential
mu_step = 0.2; % Step size for chemical potential
mu_values = mu_start:mu_step:mu_end; % Array of mu values
num_mu = length(mu_values); % Number of mu values
num_eigenvalues = 2*Nx * Ny; % Number of eigenvalues to compute
% Initialize array to store eigenvalues
eigE_matrix = zeros(num_eigenvalues, num_mu);
% Initialize cell array to store eigenvectors
eigVecs_cell = cell(1, num_mu);
%pdf_p_n_h_real_space
% Initialize array to store probability densities
pdf_p_n_h_real_space = zeros(Nx, Ny, num_eigenvalues, num_mu);
Dipole_x = zeros(1,1,num_eigenvalues,num_mu);
% [X,Y] = ndgrid(1:Nx,1:Ny);
% X = X’;
% Y = Y’;
% Loop over mu values
for k = 1:num_mu
mu = mu_values(k);
% Update parameters
parameters = [Nx, Ny, t, mu, Delta_0];
% fprintf('Generating H_BdG:\n')
% Generate the BdG Hamiltonian
H_BdG = Generate_H_BdG(parameters);
% tic;
% fprintf('Finding Eigen States for H_BdG:')
% Find eigenvalues and eigenvectors
[eigVec, eigE] = eigs(H_BdG, num_eigenvalues, 'smallestabs');
% elapsed_time = toc;
% disp(['Elapsed time: ', num2str(elapsed_time), ' seconds']);
% Convert the diagonal matrix eigE to a vector
eigE = diag(eigE);
% Sort eigenvalues and eigenvectors
[eigE, sortIdx] = sort(eigE);
eigVec = eigVec(:, sortIdx);
% Store eigenvalues and eigenvectors
eigE_matrix(:, k) = eigE;
eigVecs_cell{k} = eigVec;
for n = 1:num_eigenvalues
psi_p = eigVec(1:Nx*Ny, n); % Only take the electron part
psi_p = reshape(psi_p,Nx,Ny)';
psi_h = eigVec(Nx*Ny+1:end, n); % Only take the electron part
psi_h = reshape(psi_h,Nx,Ny)';
pdf_p_n_h_real_space(:, :, n, k) = abs(psi_p).^2+abs(psi_h).^2;
end
⛄三、运行结果
⛄四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1]刘萍.如何理解空气质量分指数(IAQI)计算公式并速算[J].黑龙江环境通报. 2014,38(02)
3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除