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 output filter to generate XML file from the
23 descriptions =
struct( ...
24 'Decimation',
'Option for using Decimation. Type 1,2 or 3 to use it, 0 to not use it', ...
25 'Decimation_block',
'size of maximal block to decimate', ...
26 'magnetic_field',
'Type 0 not to use magnetic field, or 1 to use magnetic field', ...
27 'magnetic_field_trans_invariant',
'Set true (default) if a magnetic field is translational invariant along the scattering center, or false otherwise.', ...
28 'Lattice_Type',
'Stirng containing the lattice type. See the documantation.', ...
29 'Simple_Green_Function',
'Set 1 if a simple analytical surface Greens function computational method is about to use. (Only for square lattice without a magnetic field) ', ...
30 'Linear_Regression_in_B',
'Set to 1 to use linear regression to calculate peierls integrals between the sites. Useful when dealing with homogenius magnetic field', ....
31 'BdG',
'Set 1 to use the Bogoliubov de Gennes model, or 0 for normal system. ', ...
32 'Spin',
'Set 1 to include electron spin in the computations, or 0 otherwise. ', ...
33 'Silent',
'Set to 1 in order to supress output messages', ...
34 'usingDualModes',
'Set 1 to use dual modes in the calculations, or 0 to use the left and right sided eigenvectors instead. ', ...
35 'debug',
'Set 1 to export debug informations into the debug.txt file, or 0 otherwise.', ...
36 'workers',
'Number of the workers in the parallel for loops', ...
37 'custom_Hamiltonians',
'The identifier of the external source of Hamiltonians. See the documentation for details.', ...
38 'computing_parameters',
'Parameters used in calculations', ...
39 'Scatter_region',
'Parameters used to create scattering region', ...
40 'epsilon',
'On-site energy', ...
41 'vargamma',
'Hopping amplitude', ...
42 'vargamma2',
'Hopping amplitude', ...
43 'vargamma3',
'Hopping amplitude', ...
44 'pair_potential',
'Superconducting pair potential, with abs standing for the absolute value and phase for the phase of the complex number', ...
45 'End_Type',
'Lead end type in case of hexagonal lattice', ...
46 'Lead_parameters',
'Physical parameters of the individual leads.', ...
47 'NofLeads',
'Number of leads', ...
48 'vargamma_sc',
'Alternative hopping to the scattering reigon' , ...
49 'orientation',
'Orientation of the lead', ...
50 'lead',
'Physical parameters of a lead.' , ...
51 'shape',
'Dimensions of the scattering region', ...
52 'width',
'Width of the scattering center', ...
53 'height',
'length (height) of the scattering center' ,...
54 'M',
'Number of sites in the cross section of the lead', ...
55 'AtomNode',
'Description of an atomic site',...
56 'PL',
'Index of the principal layer',...
57 'Id',
'Identification number of the site',...
58 'Lead_Orientation',
'Orientation of the lead.' ...
71 cCommonFunctions.xmlwrite( filename, XMLtree );
78 if cCommonFunctions.isOctave()
79 % Create a Xerces DOM document
object 80 XMLtree = javaObject ('org.apache.xerces.dom.DocumentImpl');
81 % Append a root node to the document
82 XMLtree.appendChild (XMLtree.createElement ('parameters'));
85 XMLtree = com.mathworks.xml.XMLUtils.createDocument('parameters');
87 root = XMLtree.getDocumentElement;
88 root.setAttribute('identifier', cCommonFunctions.getProgramShortName() );
89 root.setAttribute('version', num2str( cCommonFunctions.getVersion() ) );
94 %% SetComputingParameters
96 computing_parametersNode = XMLtree.createElement('computing_parameters');
97 computing_parametersNode.setAttribute('description', descriptions.computing_parameters);
100 fieldnamesOpt = fieldnames(
Opt );
101 for idx = 1:length(fieldnamesOpt)
102 fieldname = fieldnamesOpt{idx};
103 if isempty(
Opt.(fieldname) )
108 computing_parametersNode.appendChild(XMLnode);
112 root.appendChild(computing_parametersNode);
118 if isempty(
param.scatter)
122 nodename = 'Scatter_region';
123 Scatter_regionNode = XMLtree.createElement( nodename );
124 Scatter_regionNode.setAttribute('description', descriptions.(nodename));
126 fieldnamesScatter = fieldnames(
param.scatter );
127 for idx = 1:length( fieldnamesScatter)
128 fieldname = fieldnamesScatter{idx};
133 if strcmp( fieldname,
'shape' )
134 shapeNodeName = '
shape';
135 ShapeNode = XMLtree.createElement( shapeNodeName );
136 ShapeNode.setAttribute('description', descriptions.(shapeNodeName));
146 fieldnamesShape = fieldnames(
param.scatter.
shape );
147 for jdx = 1:length( fieldnamesShape)
148 fieldnameShape = fieldnamesShape{jdx};
150 ShapeNode.appendChild(XMLnode);
153 Scatter_regionNode.appendChild(ShapeNode);
154 elseif strcmp( fieldname,
'Atom' )
161 Scatter_regionNode.appendChild(XMLnode);
167 root.appendChild(Scatter_regionNode);
171 if isempty(
param.Leads)
175 nodename = 'Lead_parameters';
176 LeadsNode = XMLtree.createElement( nodename );
177 LeadsNode.setAttribute('description', descriptions.(nodename));
179 XMLnode = XMLtree.createElement( 'NofLeads' );
180 XMLnode.setAttribute('value', num2str(length(
param.Leads)));
181 XMLnode.setAttribute('description', descriptions.('NofLeads'));
182 LeadsNode.appendChild(XMLnode);
184 for idx = 1:length(
param.Leads)
188 root.appendChild(LeadsNode);
190 % set individual leads
192 leadnodename = 'lead';
193 LeadNode = XMLtree.createElement( leadnodename );
194 LeadNode.setAttribute('num', num2str(leadnum));
196 fieldnamesLead = fieldnames(
param.Leads{leadnum} );
197 for jdx = 1:length( fieldnamesLead)
198 fieldname = fieldnamesLead{jdx};
199 if isempty(
param.
Leads{leadnum}.(fieldname) )
203 if strcmp( fieldname,
'Atom' )
211 LeadNode.appendChild(XMLnode);
215 LeadsNode.appendChild(LeadNode);
230 AtomNodeName =
'Atom';
231 numAtoms = length( structure );
233 AtomNode = XMLtree.createElement( AtomNodeName );
234 AtomNode.setAttribute(
'description', descriptions.AtomNode);
236 if isempty( structure )
240 fieldnamesAtom = fieldnames( structure(jdx) );
241 for kdx = 1:length( fieldnamesAtom)
242 fieldnameAtom = fieldnamesAtom{kdx};
244 XMLnode.setAttribute(
'description', descriptions.(fieldnameAtom));
245 AtomNode.appendChild(XMLnode);
247 parentXMLnode.appendChild(AtomNode);
256 XMLnode = XMLtree.createElement( fieldname );
257 if ischar( structure.(fieldname) )
258 paramval = structure.(fieldname);
259 XMLnode.setAttribute(
'value', paramval);
260 elseif isscalar( structure.(fieldname) ) && isreal(structure.(fieldname))
261 paramval = num2str( structure.(fieldname) );
262 XMLnode.setAttribute(
'value', paramval);
263 elseif isscalar( structure.(fieldname) ) && ~isreal(structure.(fieldname))
264 absval = num2str( abs(structure.(fieldname) ));
265 angleval = num2str( angle(structure.(fieldname) ));
266 XMLnode.setAttribute(
'abs', absval);
267 XMLnode.setAttribute(
'phase', angleval);
273 if isfield( descriptions, fieldname )
274 XMLnode.setAttribute(
'description', descriptions.(fieldname));
Structure Atom contains the atomic identifiers of the sites.
function appendAtomNodes(structure, parentXMLnode)
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.
function Transport(Energy, B)
Calculates the conductance at a given energy value.
function setRootElement()
function setScatteringRegion()
A class containing common basic functionalities.
Structure param contains data structures describing the physical parameters of the scattering center ...
function createXMLnode(fieldname, structure)
function setLead(leadnum)
scatter_param scatter
An instance of the structure scatter_param containing the physical parameters for the scattering regi...
function setComputingParameters()
function XMLoutput(filename, Opt, param)