diff --git a/KMH-DMFT/KMH-DMFT_mat/RunningDMFT_refresh.m b/KMH-DMFT/KMH-DMFT_mat/RunningDMFT_refresh.m deleted file mode 100644 index 4d74b26..0000000 --- a/KMH-DMFT/KMH-DMFT_mat/RunningDMFT_refresh.m +++ /dev/null @@ -1,110 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% HOW TO USE? -% -% - Put this script in the home path of a pre-existent calculation -% > A path already containing the folders for all the computed U values. -% - Set-up the name of your *updated* driver program (no .f90 extension) -% > e.g. driver = 'ed_kane_mele_SomeNewOption'; -% - Select doMPI (true.or.false) to run with openMPI or not -% - Select ignConv (true.or.false) to ignore unvconverged points or not -% - Define how much loops the refresh will have at most: Nnew int variable -% - Run everything with $ matlab -batch RunningDMFT_refresh -% - At the end you will find some additional output in the U=%f folders -% > LOG_dmft_refr.txt giving just the stdout, for the new DMFT loops -% > LOG_time_refr.txt giving the wall-clock time, for the new DMFT loops -% - Also you may have some update to -% > U_list.txt, if some points that were unconverged now are converged! -% i.e. only the *newly* converged calculations will update the list :D -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -driver = 'ed_kane_mele'; doMPI = true; ignConv = true; Nnew = 1; - -% Let MATLAB see the goddamn PATH %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% --> works only if matlab has been started from a unix terminal! (0^0~~,) -path = getenv('PATH'); -path = [path ':/usr/local/bin']; -setenv('PATH', path) -clear path -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% Open file to write/update converged U-values -fileID_Ulist = fopen('U_list.txt','a'); - -%% Retrieve the list of the *converged* U-values -U_converged = unique(sort(load('U_list.txt'))); - -%% Build the list of all U-values or use the converged ones only -if isempty(U_converged) || ignConv == true - [U_list, ~] = get_list('U'); -else - U_list = U_converged; -end - -%% Phase-Line: single loop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -for U = U_list' % Hubbard loop ~~~~~~~~~~~~~~~~~~~~~~~~~~~~> - -UDIR= sprintf('U=%f',U); % Define the U-folder name. -if isfolder(UDIR) - cd(UDIR); % Enter the U-folder (if exists) -else - errstr = 'U_list file appears to be inconsistent: '; - errstr = [errstr,UDIR]; - errstr = [errstr,' folder has not been found.']; - error(errstr); -end - -%% Run FORTRAN code (already compiled and added to PATH!) %%%%%%%%%%%%%%%%% -if doMPI -mpi = 'mpirun '; % Control of MPI -else % boolean flag... -mpi = []; -end -HUBBARD = sprintf(' uloc=%f',U); % OVERRIDE of U-VALUE -NLOOP = sprintf(' nloop=%d',Nnew); % OVERRIDE of #{loops} -outLOG = ' > LOG_dmft_refr.txt'; % STDOUT destination -dmft_ed_call = [mpi,driver,HUBBARD,NLOOP,outLOG]; -tic -system(dmft_ed_call); % Fortran-call -chrono = toc; -file_id = fopen('LOG_time_refr.txt','w'); % Write on time-log -fprintf(file_id,'%f\n', chrono); -fclose(file_id); -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% HERE WE CATCH A *NEWLY* CONVERGED DMFT POINT -if ~isfile('ERROR.README') && isempty(find(U_converged == U,1)) - fprintf(fileID_Ulist,'%f\n', U); % Update U-list, only -end % if *newly* converged -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -cd .. % Exit the U-folder - -end % <~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -fclose(fileID_Ulist); - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Additional Functions -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -function [flist, strlist] = get_list(VARNAME) -%% Getting a list of variable values, from directories. -% VARNAME: a string, identifying the listed variable (e.g. 'U') -% flist: an array of float_values (e.g. U=[:] ) -% strlist: an array of dir_name strings (e.g. ['U=%f'] ) -% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - subthings = dir('.'); % Retrieves every subdir and file inside pwd - subfolders = subthings([subthings(:).isdir]); % Keeps only subfolders - subfolders = subfolders(~ismember({subfolders(:).name},{'.','..'})); - N = length(subfolders); flist = zeros(N,1); strlist = strings(N,1); - for i = 1:N - DIR = subfolders(i).name; % Let's get the indexed string... - flist(i) = sscanf(DIR, [VARNAME,'=%f']); %...and extract the value! - strlist(i) = DIR; - end - % We need to sort the lists by floats (not strings, as it is now) - [flist, sortedIDX] = sort(flist); strlist = strlist(sortedIDX); -end diff --git a/KMH-DMFT/Testing/GifSpectralPlotting.m b/KMH-DMFT/Testing/GifSpectralPlotting.m deleted file mode 100644 index dcf7093..0000000 --- a/KMH-DMFT/Testing/GifSpectralPlotting.m +++ /dev/null @@ -1,117 +0,0 @@ -load('spectral_line.mat','DOS','SE','U_list'); -L = length(U_list); -for i = 46:L - - U = U_list(i); - TitleString = sprintf('U=%s', U) - - %% G(w) - - %Gw = importdata(append(TitleString,'\Greal_l11_s1_realw.dat')); - Gw = importdata('Greal_l11_s1_realw_indx000001.dat'); - %%% Structure %%%%%%%%%%%%%%%%%% - % Gw(:,1) gives frequencies w % - % Gw(:,2) gives Im(G(w)) % - % Gw(:,3) gives Re(G(w)) % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - %f = figure("Name", 'DOS','visible','off'); - w = Gw(:,1); - Aw = -Gw(:,2); - FilledStates = w(w<=0); - FilledDOS = Aw(w<=0); - EmptyStates = w(w>0); - EmptyDOS = Aw(w>0); - area(FilledStates, FilledDOS, 'FaceColor', [0.7 0.7 0.7]); hold on - area(EmptyStates, EmptyDOS, 'FaceColor', [1 1 1]); - %xlabel('\omega') - %ylabel('\piA(\omega)') - xlabel('Real Frequency') - ylabel('Density of States') - %title(TitleString); - id = 'SOI = 0 | U = 10.50'; - title(id) - xlim([-6,6]); - %print(append('DOS\',TitleString,'.png'),'-dpng','-r1200') - print(append(id,'.png'),'-dpng','-r300') - %close(f); - clc - - %f = figure("Name", 'smoothedDOS','visible','off'); - FilledDOS = smoothdata(Aw(w<=0),'gaussian'); - EmptyDOS = smoothdata(Aw(w>0),'gaussian'); - area(FilledStates, FilledDOS, 'FaceColor', [0.7 0.7 0.7]); hold on - area(EmptyStates, EmptyDOS, 'FaceColor', [1 1 1]); - xlabel('\omega') - ylabel('\piA(\omega)') - %title(TitleString); - xlim([-6,6]); - %print(append('smoothedDOS\',TitleString,'.png'),'-dpng','-r1200') - print(append('DOS.png'),'-dpng','-r1200') - close(f); - - %% Sigma(w) - - %Ew = importdata(append(TitleString,'\impSigma_l11_s1_realw.ed')); - Gw = importdata('Greal_l11_s1_realw_indx000001.dat'); - Ew = importdata('impSigma_l11_s1_realw.dat'); - %%% Structure %%%%%%%%%%%%%%%%%% - % Ew(:,1) gives frequencies w % - % Ew(:,2) gives Im(\Sigma(w)) % - % Ew(:,3) gives Re(\Sigma(w)) % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - %f = figure("Name",'DOS_and_Self-Energy','visible','off'); - w = Ew(:,1); - Re = Ew(:,3); - Im = Ew(:,2); - w = Gw(:,1); - Aw = -Gw(:,2); - %oldmax = max(abs(Im)); - %newmax = max(Aw); - %Re = Re*newmax/oldmax; - %Im = Im*newmax/oldmax; - plot(w,Aw,'LineWidth',1.1); hold on - plot(w,Re,'LineWidth',1.1, 'Color', [0.9290 0.6940 0.1250]); - plot(w,Im,'LineWidth',1.1,'Color', [0.4660 0.6740 0.1880]); - legend('\piA(\omega)','Re(\Sigma(\omega))', 'Im(\Sigma(\omega))'); - xlabel('\omega') - %title(TitleString); - xlim([-6,6]); - %yticks([]); - %ylabel('Arb. Units') - %print(append('All\',TitleString,'.png'),'-dpng','-r1200') - %close(f); - -% f = figure("Name",'smoothed_DOS_and_Self-Energy','visible','off'); -% ReSmooth = smoothdata(Re,'gaussian'); -% ImSmooth = smoothdata(Im,'gaussian'); -% Aw = smoothdata(Aw,'gaussian'); -% plot(w,Aw,'LineWidth',1.1); hold on -% plot(w,ReSmooth,'LineWidth',1.1, 'Color', [0.9290 0.6940 0.1250]); -% plot(w,ImSmooth,'LineWidth',1.1,'Color', [0.4660 0.6740 0.1880]); -% legend('\piA(\omega)','Re(\Sigma(\omega))', 'Im(\Sigma(\omega))'); -% xlabel('\omega') -% title(TitleString); -% xlim([-6,6]); -% yticks([]); -% ylabel('Arb. Units') -% print(append('smoothedALL\',TitleString,'.png'),'-dpng','-r1200') -% close(f); - - %% G(iw) - Giw = importdata(append(TitleString,'\Gloc_l11_s1_iw.dat')); - %%% Structure %%%%%%%%%%%%%%%%%%%% - % Giw(:,1) gives frequencies w % - % Giw(:,2) gives Im(G(iw)) % - % Giw(:,3) gives Re(G(iw)) % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - f = figure("Name",'smoothed_DOS_and_Self-Energy','visible','off'); - plot(Giw(:,1),Giw(:,2),'r','LineWidth', 1.1) - xlabel('i\omega') - ylabel('Im(G(i\omega))') - title(TitleString); - print(append('Giw\',TitleString,'.png'),'-dpng','-r1200') - close(f); - -end diff --git a/KMH-DMFT/Testing/PostAnalyzeTest.m b/KMH-DMFT/Testing/PostAnalyzeTest.m deleted file mode 100644 index a4884a5..0000000 --- a/KMH-DMFT/Testing/PostAnalyzeTest.m +++ /dev/null @@ -1,21 +0,0 @@ -clear all -clc -global ignUlist -ignUlist = false; -% We don't have a SOI-values list, but we can obtain that by just -% inspecting the subdirectories... -[SOI_list, SOI_names] = postDMFT.get_list('SOI'); -Nlines = length(SOI_list); -for iSOI = 1:Nlines - SOIDIR = SOI_names(iSOI); - fprintf(strcat(SOIDIR)); - cd(SOIDIR); - if isfile('U_list.txt') - U_list = load('U_list.txt'); - else - U_list = []; - end - [ids,obs,U_list] = postDMFT.extract_line(U_list); fprintf('..DONE\n'); - save('observables_line.mat','ids','obs','U_list'); - cd('..'); -end diff --git a/KMH-DMFT/Testing/PostDMFT_spectral.m b/KMH-DMFT/Testing/PostDMFT_spectral.m deleted file mode 100644 index 48f5bf2..0000000 --- a/KMH-DMFT/Testing/PostDMFT_spectral.m +++ /dev/null @@ -1,157 +0,0 @@ -%% Main -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -clear all -clc - -global ignUlist -ignUlist = true; - -% We don't have a SOI-values list, but we can obtain that by just -% inspecting the subdirectories... -%[SOI_list, SOI_names] = get_list('SOI'); -%Nlines = length(SOI_list); -%for iSOI = 1:Nlines - SOIDIR = "SOI=0.060000";%SOI_names(iSOI); - fprintf(strcat(SOIDIR)); - cd(SOIDIR); - if isfile('U_list.txt') - U_list = load('U_list.txt'); - else - U_list = []; - end - %[ids,obs,U_list] = extract_line(U_list); fprintf('..DONE\n'); - [DOS,SE,U_list] = spectral_line(U_list); fprintf('..DONE\n'); - save('soectral_line.mat','DOS','SE','U_list'); - cd('..'); -%end - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Functions -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -function [flist, strlist] = get_list(VARNAME) -%% Getting a list of variable values, from directories. -% VARNAME: a string, identifying the listed variable (e.g. 'U') -% flist: an array of float_values (e.g. U=[:] ) -% strlist: an array of dir_name strings (e.g. ['U=%f'] ) -% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - subthings = dir('.'); % Retrieves every subdir and file inside pwd - subfolders = subthings([subthings(:).isdir]); % Keeps only subfolders - subfolders = subfolders(~ismember({subfolders(:).name},{'.','..'})); - N = length(subfolders); flist = zeros(N,1); strlist = strings(N,1); - for i = 1:N - DIR = subfolders(i).name; % Let's get the indexed string... - flist(i) = sscanf(DIR, [VARNAME,'=%f']); %...and extract the value! - strlist(i) = DIR; - end - % We need to sort the lists by floats (not strings, as it is now) - [flist, sortedIDX] = sort(flist); strlist = strlist(sortedIDX); -end - -function [ids,obs,U_list] = extract_line(U_LIST) -%% Getting a list of variable values, from directories. -% U_LIST: an array of values for Hubbard interaction U (could be empty!) -% ids: a cell of strings, the QcmPlab names of the observables -% obs: a cell of float-arrays, corresponding to the names above, forall U -% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - global ignUlist - if isempty(U_LIST) | ignUlist == true - [U_LIST, ~] = get_list('U'); - else - U_LIST = sort(U_LIST); - end - % Then we can proceed spanning all the U-values - Nu = length(U_LIST); - cellobs = cell(Nu,1); - for iU = 1:length(U_LIST) - U = U_LIST(iU); - UDIR= sprintf('U=%f',U); - if ~isfolder(UDIR) - errstr = 'U_list file appears to be inconsistent: '; - errstr = [errstr,UDIR]; - errstr = [errstr,' folder has not been found.']; - error(errstr); - end - cd(UDIR); - [ids, cellobs{iU}] = get_observables(); - cd('..'); - end - % We need some proper reshaping - Nobs = length(ids); - obs = cell(1,Nobs); - for jOBS = 1:Nobs - obs{jOBS} = zeros(Nu,1); - for iU = 1:Nu - obs{jOBS}(iU) = cellobs{iU}(jOBS); - end - end - U_list = U_LIST; -end - -function [names, observables] = get_observables() -%% Getting all information from observables_last.ed and observables_info.ed -% names: a cell of strings, the QcmPlab names of the observables -% observables: an array of float values, corresponding to the names above -% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - names = readcell('observables_info.ed','FileType','fixedwidth'); - names(strcmp(names,'#'))=[]; - for i = 1:length(names) - tempstr = names{i}; % Temporary string variable - head = sscanf(tempstr,'%d'); % Extracts the initial integer - head = int2str(head); % Int to Str conversion - names{i} = erase(tempstr,head); % Proper beheading ;D - end - observables = load('observables_last.ed'); -end - -function [DOS,SE,U_list] = spectral_line(U_LIST) -%% Getting a list of spectral functions, from directories. -% U_LIST: an array of values for Hubbard interaction U (could be empty!) -% DOS: a cell of tensors -% SE: a cell of tensors -% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - global ignUlist - if isempty(U_LIST) | ignUlist == true - [U_LIST, ~] = get_list('U'); - else - U_LIST = sort(U_LIST); - end - % Then we can proceed spanning all the U-values - Nu = length(U_LIST); - cellDOS = cell(Nu,1); - cellSE = cell(Nu,1); - for iU = 1:length(U_LIST) - U = U_LIST(iU); - UDIR= sprintf('U=%f',U); - if ~isfolder(UDIR) - errstr = 'U_list file appears to be inconsistent: '; - errstr = [errstr,UDIR]; - errstr = [errstr,' folder has not been found.']; - error(errstr); - end - cd(UDIR); - [cellDOS{iU}, cellSE{iU}] = get_spectrals(); - cd('..'); - end - U_list = U_LIST; -end - -function [Ew, Gw] = get_spectrals() -%% -% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Gw = importdata(append(TitleString,'\Greal_l11_s1_realw_indx000001.dat')); - %%% Structure %%%%%%%%%%%%%%%%%% - % Gw(:,1) gives frequencies w % - % Gw(:,2) gives Im(G(w)) % - % Gw(:,3) gives Re(G(w)) % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - Ew = importdata(append(TitleString,'\impSigma_l11_s1_realw.ed')); - %%% Structure %%%%%%%%%%%%%%%%%% - % Ew(:,1) gives frequencies w % - % Ew(:,2) gives Im(\Sigma(w)) % - % Ew(:,3) gives Re(\Sigma(w)) % - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -end - diff --git a/Libraries/DMFT-LAB b/Libraries/DMFT-LAB index 7639f80..015d632 160000 --- a/Libraries/DMFT-LAB +++ b/Libraries/DMFT-LAB @@ -1 +1 @@ -Subproject commit 7639f8056fd8afd210972908313b6dd2e781c93f +Subproject commit 015d63279f6475cd8ed21e85a066ad19327a0c87