<!--'abinitRun' must contain one or more
    dataSet child and one timeInfo element in the order listed-->
<!ELEMENT abinitRun (dataSet+,timeInfo?)>

<!-- element timeInfo has no child and five attributes -->
<!ELEMENT timeInfo EMPTY>
<!ATTLIST timeInfo cpu NMTOKEN #REQUIRED>
<!ATTLIST timeInfo wall NMTOKEN #REQUIRED>
<!ATTLIST timeInfo day NMTOKEN #REQUIRED>
<!ATTLIST timeInfo month NMTOKEN #REQUIRED>
<!ATTLIST timeInfo year NMTOKEN #REQUIRED>

<!-- element dataSet is the core of the output. -->
<!ELEMENT dataSet (inputVariables,scfcvLoop+,bfgsMinimisation?,outputVariables)>

<!-- the variable child is meant to hold all values from keywords
     and computed variables at the beginning of the dataset. The
     geometry element is quite special and store the box geometry and
     atomic position instead of defining these informations within a
     variable element. -->
<!ELEMENT inputVariables (atom+,geometry,variable+)>
<!ELEMENT outputVariables (geometry,variable+)>

<!-- atom element is used to define id of atoms and their chemical specy.
     The id of atoms is made as follow: 'a_<i>_<j>', where <i> is a
     number identifying the dataset and <j> a number itendifying the atom. -->
<!ELEMENT atom EMPTY>
<!ATTLIST atom id ID #REQUIRED>
<!ATTLIST atom znucl NMTOKEN #REQUIRED>

<!-- The geometry element gives the box definition and the atomic positions.
     Since the XML output file is intended for machine reading only,
     all lengths are given in Bohr. -->
<!ELEMENT geometry (rprimd,position+)>

<!ELEMENT rprimd EMPTY>
<!ATTLIST rprimd x1 NMTOKEN #REQUIRED>
<!ATTLIST rprimd x2 NMTOKEN #REQUIRED>
<!ATTLIST rprimd x3 NMTOKEN #REQUIRED>
<!ATTLIST rprimd y1 NMTOKEN #REQUIRED>
<!ATTLIST rprimd y2 NMTOKEN #REQUIRED>
<!ATTLIST rprimd y3 NMTOKEN #REQUIRED>
<!ATTLIST rprimd z1 NMTOKEN #REQUIRED>
<!ATTLIST rprimd z2 NMTOKEN #REQUIRED>
<!ATTLIST rprimd z3 NMTOKEN #REQUIRED>

<!-- The position element contains the position of the atom specified
     by 'atom' attribute. These coordinates are cartesian coordinates
     and given in Bohr. -->
<!ELEMENT position EMPTY>
<!ATTLIST position atom IDREF #IMPLIED>
<!ATTLIST position x NMTOKEN #REQUIRED>
<!ATTLIST position y NMTOKEN #REQUIRED>
<!ATTLIST position z NMTOKEN #REQUIRED>

<!-- The variable element uses the attribute type to know what kind of
     data are stored and the NMTOKENS allow to store values in the
     value attribute with space character as separators. -->
<!ELEMENT variable EMPTY>
<!ATTLIST variable name NMTOKEN #REQUIRED>
<!ATTLIST variable type (integer|logical|character|real|integer_array|real_array) #REQUIRED>
<!ATTLIST variable value NMTOKENS #REQUIRED>

<!-- The scfcvLoop stores data from the scfcv() routine. -->
<!ELEMENT scfcvLoop (initialConditions,scfcvStep+,status,finalConditions)>

<!ELEMENT initialConditions (geometry)>
<!-- The finalConditions element follow the results_gs_type data type. -->
<!ELEMENT finalConditions (energy,forces?)>

<!-- Energy parts are in hartree. -->
<!ELEMENT energy EMPTY>
<!ATTLIST energy type (direct|double-counting) #REQUIRED>
<!ATTLIST energy total NMTOKEN #REQUIRED>
<!ATTLIST energy kinetic NMTOKEN>
<!ATTLIST energy eigen-values NMTOKEN>
<!ATTLIST energy local NMTOKEN>
<!ATTLIST energy non-local NMTOKEN>
<!ATTLIST energy core NMTOKEN #REQUIRED>
<!ATTLIST energy hartree NMTOKEN #REQUIRED>
<!ATTLIST energy xc NMTOKEN #REQUIRED>
<!ATTLIST energy xcdc NMTOKEN>
<!ATTLIST energy ewald NMTOKEN>
<!ATTLIST energy ion-ion NMTOKEN>
<!ATTLIST energy entropy NMTOKEN>
<!ATTLIST energy electric-field NMTOKEN>
<!ATTLIST energy paw NMTOKEN>
<!ATTLIST energy pawdc NMTOKEN>
<!-- Forces are given in cartesian coordinates. -->
<!ELEMENT forces (force+)>
<!ELEMENT force EMPTY>
<!ATTLIST force atom IDREF #IMPLIED>
<!ATTLIST force x NMTOKEN #REQUIRED>
<!ATTLIST force y NMTOKEN #REQUIRED>
<!ATTLIST force z NMTOKEN #REQUIRED>

<!ELEMENT status EMPTY>
<!ATTLIST status cvState (Ok|Failed) #REQUIRED>
<!ATTLIST status stop-criterion (toldfe|toldff|tolmxf|tolvrs|tolwfr) #REQUIRED>

<!ELEMENT scfcvStep EMPTY>
<!ATTLIST scfcvStep eTotal NMTOKEN #REQUIRED>
<!ATTLIST scfcvStep deltaETotal NMTOKEN #REQUIRED>
<!ATTLIST scfcvStep maxResid NMTOKEN>
<!ATTLIST scfcvStep potResid NMTOKEN>
<!ATTLIST scfcvStep denResid NMTOKEN>
<!ATTLIST scfcvStep magn value NMTOKEN>
<!ATTLIST scfcvStep deltaForces NMTOKEN>
<!ATTLIST scfcvStep maxForces NMTOKEN>

<!-- The bfgsMinimisation stores information about the final
     status of a geometry optimisation using BFGS. -->
<!ELEMENT bfgsMinimisation (status)>

