Skip to content

Commit

Permalink
Add MF functions to +postDMFT
Browse files Browse the repository at this point in the history
> this poses the problem of the naming convention... we may want to generalize everywhere <DMFT> to something else, maybe a reference to @QcmPlab as a whole? QcmP.mat.Lab sounds quite bad for sure.
  • Loading branch information
beddalumia committed Jan 12, 2022
1 parent 785196a commit 153e87a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
27 changes: 27 additions & 0 deletions +postDMFT/get_order_parameters.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function [names, order_parameters] = get_order_parameters()
%% Getting all information from order_parameters_[].dat
% names: a cell of strings, the names of the order parameters (from [])
% order_parameters: an array of floats, corresponding to the names above
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pattern = 'order_parameters_';
files = dir('.');
N = length(files);
for i = 1:N
temp_name = getfield(files,{i},'name');
found = strfind(temp_name,pattern);
if found
full_name = temp_name;
end
end
beheaded = erase(full_name,pattern); % Removes 'order_parameter_'
detailed = erase(beheaded,'.dat'); % Removes '.dat'
names = strsplit(detailed,'_'); % Reads the names separated by '_'
order_parameters = load(full_name);
if length(names) ~= length(order_parameters)
error('Something went wrong reading order parameters!');
end
end




39 changes: 39 additions & 0 deletions +postDMFT/order_parameter_line.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
function [ids,ordpms,U_list] = order_parameter_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 names of the order parameters
% ordpms: a cell of arrays, corresponding to the names above, for all 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);
cellordpms = 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, cellordpms{iU}] = get_order_parameters();
cd('..');
end
% We need some proper reshaping
Nordpms = length(ids);
ordpms = cell(1,Nordpms);
for jORDPMS = 1:Nordpms
ordpms{jORDPMS} = zeros(Nu,1);
for iU = 1:Nu
ordpms{jORDPMS}(iU) = cellordpms{iU}(jORDPMS);
end
end
U_list = U_LIST;
end

0 comments on commit 153e87a

Please sign in to comment.