Test driver: Extracts info from a VASP vasprun.xml file.
Command line parameters:
| Parameter | Type | Description | 
|---|---|---|
| -bugLev | integer | Debug level. Normally 0. | 
| -inFile | string | Input file | 
| -maxLev | int | max xml print level | 
Extracts info from the vasprun.xml file from a VASP run, using the Python xml.etree.cElementTree API.
Parameters:
Returns:
Recursively prints an XML tree, given an xml.etree.cElementTree node.
Parameters:
Returns:
Splits text into tokens, and converts each token to dtype.
Called by getVec, getRawArray.
Parameters:
Returns:
Gets text at the specified XML path, splits, and converts tokens dtype.
Parameters:
Returns:
Gets text at the specified XML path, insures there’s just 1, and returns it.
Parameters:
Returns:
Gets text at the specified XML path, and converts it to dtype.
Parameters:
Returns:
Gets text at the specified XML path, and converts to a 2D numpy array of dtype.
The text must be organized as one text element per row.
Parameters:
Returns:
Converts an XML <array> element in vasprun.xml to a map with an array.
See getArrayByNode() for details.
Parameters:
Returns:
Converts an XML <array> element in vasprun.xml to a map with an array.
Calls getArraySub to extract each field. The output Python map has the following structure:
| key | value | 
|---|---|
| _dimLens | numpy vec of dimension lengths. len( dimLens) == n == numDimensions. | 
| _dimNames | numpy vec of dimension names. len( dimLens) == n == numDimensions. | 
| _fieldNames | numpy vec of field names in the parallel arrays. len( fieldNames) == numVariables. | 
| _fieldTypes | numpy vec of field types in the parallel arrays. len( fieldTypes) == numVariables. The types are: ‘i’: int, ‘f’: float, ‘s’: str | 
| <fieldName> | numpy n-dimensional array of the field <fieldName> | 
| <fieldName> | numpy n-dimensional array of the field <fieldName> | 
| <fieldName> | numpy n-dimensional array of the field <fieldName> | 
| ... | 
Example XML for a 1-dimensional array with 2 fields:
<array name="atoms" >
 <dimension dim="1">ion</dimension>
 <field type="string">element</field>
 <field type="int">atomtype</field>
 <set>
  <rc><c>C </c><c>   1</c></rc>
  <rc><c>Fe</c><c>   2</c></rc>
  <rc><c>Fe</c><c>   2</c></rc>
  <rc><c>Fe</c><c>   2</c></rc>
  <rc><c>Fe</c><c>   2</c></rc>
 </set>
</array>
Example resulting map:
_dimLens: [5]
_dimNames: ['ion']
_fieldNames: ['element' 'atomtype']
_fieldTypes: ['s' 'i']
element: ['C' 'Fe' 'Fe' 'Fe' 'Fe']
atomtype: [1 2 2 2 2]
Multiple dimension arrays also are supported.
The vasprun.xml handling of dimensions is unusual. What they claim is dim="1" actually is the least significant dimension and varies fastest, both in the XML data and in our resulting Python array.
So the XML <dimension dim="1">band</dimension> becomes the last dimension in the resulting Python array.
Example XML for a 3 dimensional array with 2 fields:
<array>
 <dimension dim="1">band</dimension>
 <dimension dim="2">kpoint</dimension>
 <dimension dim="3">spin</dimension>
 <field>eigene</field>
 <field>occ</field>
 <set>
  <set comment="spin 1">
   <set comment="kpoint 1">
    <r>   -6.5058    1.0000 </r>
    <r>    0.2537    1.0000 </r>
    <r>    0.7101    1.0000 </r>
    ...
    <r>    8.1390    0.0000 </r>
   </set>
   <set comment="kpoint 2">
    <r>   -6.3718    1.0000 </r>
    <r>   -0.0841    1.0000 </r>
    <r>    0.7508    1.0000 </r>
   ...
   </set>
   <set comment="kpoint 101">
    <r>   -5.8567    1.0000 </r>
    <r>   -0.0854    1.0000 </r>
    <r>    0.9602    1.0000 </r>
    <r>    7.7174    0.0000 </r>
    <r>    7.8556    0.0000 </r>
   </set>
  </set>
 </set>
</array>
Example resulting map:
_dimLens: [  1 101  22]
_dimNames: ['spin' 'kpoint' 'band']
_fieldNames: ['eigene' 'occ']
_fieldTypes: ['f' 'f']
eigene: [[[-6.5058  0.2537  0.7101 ...,  7.6096  7.8817  8.139 ]
    [-6.3718 -0.0841  0.7508 ...,  7.481   7.8491  7.9595]
    [-6.1332 -0.611   1.0672 ...,  7.0857  7.8655  7.9314]
    ...,
    [-5.8462  0.3687  0.9498 ...,  7.1721  7.4739  7.6631]
    [-5.8016  0.5503  0.5886 ...,  7.4113  7.5794  7.7332]
    [-5.8567 -0.0854  0.9602 ...,  7.2729  7.7174  7.8556]]]
occ: [[[ 1.      1.      1.     ...,  0.      0.      0.    ]
    [ 1.      1.      1.     ...,  0.      0.      0.    ]
    [ 1.      1.      1.     ...,  1.      0.      0.    ]
    ...,
    [ 1.      1.      1.     ...,  1.      0.      0.    ]
    [ 1.      1.      1.     ...,  0.      0.      0.    ]
    [ 1.      1.      1.     ...,  0.9751  0.      0.    ]]]
Parameters:
Returns:
Decodes the XML for one field (one variable) for an <array>.
Called by getArrayByNode. See getArrayByNode() for details.
Parameters:
Returns:
Returns the max abs diff between two 2D numpy matrices.
Parameters:
Returns:
Returns the max abs diffs between adjacent pairs of a list of 2D numpy matrices.
Parameters:
Returns: