Skip to content

Commit

Permalink
More functionality for +postDMFT
Browse files Browse the repository at this point in the history
> energy U-driven lines
  • Loading branch information
beddalumia committed Jan 12, 2022
1 parent 3d0cd2b commit 00c06be
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 1 deletion.
40 changes: 40 additions & 0 deletions +postDMFT/energy_line.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function [ids,ens,U_list] = energy_line(U_LIST)
%% Getting a list of energy values, from directories.
% U_LIST: an array of values for Hubbard interaction U (could be empty!)
% ids: a cell of strings, the QcmPlab names for the pot-energy terms
% ens: a cell of float-arrays, corresponding to the names above
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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);
cellEn = 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, cellEn{iU}] = get_energies();
cd('..');
end
% We need some proper reshaping
Nids = length(ids);
ens = cell(1,Nids);
for jEn = 1:Nids
ens{jEn} = zeros(Nu,1);
for iU = 1:Nu
ens{jEn}(iU) = cellEn{iU}(jEn);
end
end
U_list = U_LIST;
end

15 changes: 15 additions & 0 deletions +postDMFT/get_energies.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function [names, energies] = get_energies()
%% Getting all information from energy_last.ed and energy_info.ed
% names: a cell of strings, the QcmPlab names for the pot-energy terms
% energies: an array of float values, corresponding to the names above
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
names = readcell('energy_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
energies = load('energy_last.ed');
end
39 changes: 39 additions & 0 deletions +postDMFT/kinetic_line.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
function [kins,U_list] = kinetic_line(U_LIST)
%% Getting a list of energy values, from directories.
% U_LIST: an array of values for Hubbard interaction U (could be empty!)
% kins: an array of values for Kinetic energies, 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);
kins = zeros(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);

% The dmft_kinetic_energy.dat file has a weird structure...
strCell = readcell('dmft_kinetic_energy.dat'); % cell of strings
tempStr = strCell{1}; % single string
tempVec = sscanf(tempStr,'%f'); % extract all the %f
kins(iU) = tempVec(1); % For sure the 1st value is the total K.E.

cd('..');
end

U_list = U_LIST;
end



3 changes: 2 additions & 1 deletion +postDMFT/extract_line.m → +postDMFT/observables_line.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [ids,obs,U_list] = extract_line(U_LIST)
function [ids,obs,U_list] = observables_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
Expand Down Expand Up @@ -37,3 +37,4 @@
end
U_list = U_LIST;
end

0 comments on commit 00c06be

Please sign in to comment.