2 % Copyright (C) 2009-2017 Peter Rakyta, Ph.D.
4 % This program is free software: you can redistribute it and/or modify
5 % it under the terms of the GNU General Public License as published by
6 % the Free Software Foundation, either version 3 of the License, or
7 % (at your option) any later version.
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 % GNU General Public License
for more details.
14 % You should have received a copy of the GNU General Public License
15 % along with
this program. If not, see http:
17 % This
function is the input filter to generate running parameters from
26 parameter_names = {
'Decimation',
'Decimation_block',
'magnetic_field',
'magnetic_field_trans_invariant',
'Lattice_Type', ...
27 'Simple_Green_Function',
'Linear_Regression_in_B',
'BdG',
'Spin',
'Silent',
'usingDualModes',
'debug',
'workers',
'custom_Hamiltonians' };
32 % Old format of lattice types
33 if
Opt.Lattice_Type == 0
34 Opt.Lattice_Type = 'Square';
35 elseif
Opt.Lattice_Type == 1
36 Opt.Lattice_Type = 'Graphene';
37 elseif
Opt.Lattice_Type == 2
38 Opt.Lattice_Type = 'Silicene';
42 % This sets default values to the parameter
structures 47 Opt.Decimation_block = 151;
49 Opt.magnetic_field = 0;
50 Opt.magnetic_field_trans_invariant = true;
51 Opt.Lattice_Type = []; %New default value
52 Opt.Simple_Green_Function = 0;
53 Opt.Linear_Regression_in_B = 1;
57 Opt.usingDualModes = 1;
60 Opt.custom_Hamiltonians = [];
64 param.scatter.epsilon = 0;
65 param.scatter.vargamma = 0;
67 param.scatter.Overlap_in_Scatter = 0;
69 param.Leads = cell(0);
74 % This opens the XML file and fills up the parameter
structures 78 if cCommonFunctions.isOctave()
79 parser = javaObject('org.apache.xerces.parsers.DOMParser');
80 parser.parse(filename);
81 tree = parser.getDocument;
83 tree = xmlread(filename);
92 % This parses over the attributes of the tree node
94 % Recurse over node children.
96 if theNode.hasChildNodes
97 childNodes = theNode.getChildNodes;
98 numChildNodes = childNodes.getLength;
104 for count = 1:numChildNodes
105 theChild = childNodes.item(count-1);
107 if strcmpi(
char(theChild.getNodeName), 'parameters' )
109 elseif strcmpi(
char(theChild.getNodeName), 'computing_parameters' )
111 elseif strcmpi(
char(theChild.getNodeName), 'Scatter_region' )
113 elseif strcmpi(
char(theChild.getNodeName), 'Lead_parameters' )
119 %children(count) = makeStructFromNode(theChild);
124 % This sets computing parameters in the
structures 126 if theNode.hasChildNodes
127 childNodes = theNode.getChildNodes;
128 numChildNodes = childNodes.getLength;
133 for count = 1:numChildNodes
134 theChild = childNodes.item(count-1);
136 if ismember(
char(theChild.getNodeName), parameter_names )
138 setOptValue( attributes,
char(theChild.getNodeName) )
145 %% setScatterParameter
146 % This sets parameters for the scattering region
148 if theNode.hasChildNodes
149 childNodes = theNode.getChildNodes;
150 numChildNodes = childNodes.getLength;
155 for count = 1:numChildNodes
156 theChild = childNodes.item(count-1);
158 if ismember(
char(theChild.getNodeName), parameter_names )
160 setOptValue( attributes,
char(theChild.getNodeName) )
161 elseif strcmpi(
char(theChild.getNodeName), 'shape' )
171 % This creates shape for scattering region
173 if theNode.hasChildNodes
174 childNodes = theNode.getChildNodes;
175 numChildNodes = childNodes.getLength;
182 for count = 1:numChildNodes
183 theChild = childNodes.item(count-1);
185 if strcmpi(
char(theChild.getNodeName), 'width' )
187 shape.width = str2double( attributes.value );
188 elseif strcmpi(
char(theChild.getNodeName), 'height' )
190 shape.height = str2double( attributes.value );
194 param.scatter.shape = shape;
199 % This sets parameters for Leads
201 if theNode.hasChildNodes
202 childNodes = theNode.getChildNodes;
203 numChildNodes = childNodes.getLength;
208 for count = 1:numChildNodes
209 theChild = childNodes.item(count-1);
211 if strcmpi(
char(theChild.getNodeName), 'lead' )
220 % This fills up data from one lead node
223 num = str2double(lead_attributes.num);
226 params = param.Leads{num};
231 if theNode.hasChildNodes
232 childNodes = theNode.getChildNodes;
233 numChildNodes = childNodes.getLength;
240 for count = 1:numChildNodes
241 theChild = childNodes.item(count-1);
252 % This sets a value
for a field in the
Opt structure
255 if ( isfield( attributes,
'value') )
256 if ~isnan( str2double( attributes.(
'value') ) )
257 Opt.( attribname ) = str2double( attributes.(
'value') );
259 Opt.( attribname ) = attributes.(
'value');
262 display([
'bad attribute: ', attribname ])
268 % This sets a value
for a field in the
Opt structure
269 function param_structure =
setParamValue( param_structure, node )
271 if strcmpi(
char(node.getNodeName),
'epsilon' )
273 param_structure.epsilon = str2double(attributes.value);
274 elseif strcmpi(
char(node.getNodeName), 'vargamma' )
276 param_structure.vargamma = str2double(attributes.value);
277 elseif strcmpi(
char(node.getNodeName), 'vargamma_sc' )
279 param_structure.vargamma_sc = str2double(attributes.value);
280 elseif strcmpi(
char(node.getNodeName), 'vargamma1' )
282 param_structure.vargamma1 = str2double(attributes.value);
283 elseif strcmpi(
char(node.getNodeName), 'vargamma2' )
285 param_structure.vargamma2 = str2double(attributes.value);
286 elseif strcmpi(
char(node.getNodeName), 'vargamma3' )
288 param_structure.vargamma3 = str2double(attributes.value);
289 elseif strcmpi(
char(node.getNodeName), 'SOintrinsic' )
291 param_structure.SOintrinsic = str2double(attributes.value);
292 elseif strcmpi(
char(node.getNodeName), 'deltaAB' )
294 param_structure.deltaAB = str2double(attributes.value);
295 elseif strcmpi(
char(node.getNodeName), 'SO_rashba_intrinsic' )
297 param_structure.SO_rashba_intrinsic = str2double(attributes.value);
298 elseif strcmpi(
char(node.getNodeName), 'pair_potential' )
300 if isfield( attributes, 'value' )
301 param_structure.pair_potential = str2double(attributes.value);
303 param_structure.pair_potential = str2double(attributes.abs)*exp(1i*str2double(attributes.phase));
305 elseif strcmpi(
char(node.getNodeName), 'Overlap_in_Leads' )
307 param_structure.Overlap_in_Leads = str2double(attributes.value);
308 elseif strcmpi(
char(node.getNodeName), 'Filename' )
310 param_structure.Filename = attributes.value;
311 elseif strcmpi(
char(node.getNodeName), '
Atom' )
312 if isempty( param_structure.
Atom )
316 atom_idx = length( param_structure.Atom ) + 1;
318 if node.hasChildNodes
319 childNodes = node.getChildNodes;
320 numChildNodes = childNodes.getLength;
322 for count = 1:numChildNodes
323 theChild = childNodes.item(count-1);
325 if strcmpi(
char(theChild.getNodeName), 'PL' )
327 param_structure.Atom(atom_idx).PL = str2double(attributes.value);
328 elseif strcmpi(
char(theChild.getNodeName), 'Id' )
330 param_structure.Atom(atom_idx).Id = str2double(attributes.value);
336 elseif strcmpi(
char(node.getNodeName), 'Lead_Orientation' ) || strcmpi(
char(node.getNodeName), 'orientation' )
338 param_structure.Lead_Orientation = str2double(attributes.value);
339 elseif strcmpi(
char(node.getNodeName), 'M' )
341 param_structure.M = str2double(attributes.value);
342 elseif strcmpi(
char(node.getNodeName), 'End_Type' )
344 param_structure.End_Type = attributes.value;
352 % This function parses the attributes of the XML node
353 % ----- Local function PARSEATTRIBUTES -----
355 % Create attributes structure.
358 if theNode.hasAttributes
359 theAttributes = theNode.getAttributes;
360 numAttributes = theAttributes.getLength;
361 attributes = struct();
366 for count = 1:numAttributes
367 attrib = theAttributes.item(count-1);
368 attributes.(
char(attrib.getName) ) =
char(attrib.getValue);
Structure Atom contains the atomic identifiers of the sites.
lead_param Leads
A list of structures lead_param containing the physical parameters for the scattering region...
Structure Opt contains the basic computational parameters used in EQuUs.
Structure shape contains data about the geometry of the scattering region.
Structure scatter_param contains the physical parameters describing the scattering region...
function Transport(Energy, B)
creating the Ribbon class representing the twoterminal setup
A class providing function handle to reduce the number of sites in the Hamiltonian via decimation pro...
A class containing common basic functionalities.
Structure param contains data structures describing the physical parameters of the scattering center ...
function structures(name)