<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.quantum-simulation.org/ns/fpmd/fpmd-1.0"
  xmlns:fpmd="http://www.quantum-simulation.org/ns/fpmd/fpmd-1.0">

  <annotation>
    <documentation>
      version 2015-05-20
      http://www.quantum-simulation.org
      FPMD atomic species XML Schema specification.
      Copyright (c) 2006-2014 The Regents of the University of California.
    </documentation>
  </annotation>

  <element name="species" type="fpmd:speciesType"/>

  <complexType name="speciesType">
    <sequence minOccurs="0">
      <element name="description" type="string" minOccurs="0" maxOccurs="1"/>
      <element name="symbol" type="NMTOKEN"/>
      <element name="atomic_number" type="nonNegativeInteger"/>
      <element name="mass" type="fpmd:positiveDouble"/>
      <choice>
        <element name="norm_conserving_pseudopotential"
          type="fpmd:norm_conserving_pseudopotentialType"/>
        <element name="norm_conserving_semilocal_pseudopotential"
          type="fpmd:norm_conserving_semilocal_pseudopotentialType"/>
      </choice>
    </sequence>
    <attribute name="name" type="NMTOKEN" use="optional"/>
    <attribute name="href" type="anyURI" use="optional"/>
  </complexType>

  <complexType name="norm_conserving_pseudopotentialType">
    <sequence>
      <element name="valence_charge" type="nonNegativeInteger"/>
      <element name="lmax" type="nonNegativeInteger"/>
      <element name="llocal" type="nonNegativeInteger"/>
      <element name="nquad" type="nonNegativeInteger"/>
      <element name="rquad" type="fpmd:nonNegativeDouble"/>
      <element name="mesh_spacing" type="fpmd:positiveDouble"/>
      <element name="core_density" minOccurs="0" maxOccurs="1">
        <complexType>
          <simpleContent>
            <extension base="fpmd:doubleListType">
              <attribute name="size" type="positiveInteger" use="required"/>
            </extension>
          </simpleContent>
        </complexType>
      </element>
      <element name="projector" minOccurs="1" maxOccurs="unbounded">
        <complexType>
          <sequence>
            <element name="radial_potential" type="fpmd:doubleListType"/>
            <element name="radial_function" minOccurs="0"
              type="fpmd:doubleListType"/>
          </sequence>
          <attribute name="l" type="nonNegativeInteger" use="required"/>
          <attribute name="size" type="positiveInteger" use="required"/>
        </complexType>
      </element>
    </sequence>
  </complexType>

  <complexType name="norm_conserving_semilocal_pseudopotentialType">
    <sequence>
      <element name="valence_charge" type="nonNegativeInteger"/>
      <element name="mesh_spacing" type="fpmd:positiveDouble"/>
      <element name="core_density" minOccurs="0" maxOccurs="1">
        <complexType>
          <simpleContent>
            <extension base="fpmd:doubleListType">
              <attribute name="size" type="positiveInteger" use="required"/>
            </extension>
          </simpleContent>
        </complexType>
      </element>
      <element name="local_potential">
        <complexType>
          <simpleContent>
            <extension base="fpmd:doubleListType">
              <attribute name="size" type="positiveInteger" use="required"/>
            </extension>
          </simpleContent>
        </complexType>
      </element>
      <element name="projector" minOccurs="0" maxOccurs="unbounded">
        <complexType>
          <simpleContent>
            <extension base="fpmd:doubleListType">
              <attribute name="l" type="nonNegativeInteger" use="required"/>
              <attribute name="i" type="nonNegativeInteger" use="required"/>
              <attribute name="size" type="positiveInteger" use="required"/>
            </extension>
          </simpleContent>
        </complexType>
      </element>
      <element name="d_ij" minOccurs="0" maxOccurs="unbounded">
        <complexType>
          <simpleContent>
            <extension base="double">
              <attribute name="l" type="nonNegativeInteger" use="required"/>
              <attribute name="i" type="nonNegativeInteger" use="required"/>
              <attribute name="j" type="nonNegativeInteger" use="required"/>
            </extension>
          </simpleContent>
        </complexType>
      </element>
    </sequence>
  </complexType>

  <simpleType name="doubleListType">
    <list itemType="double"/>
  </simpleType>

  <simpleType name="positiveDouble">
    <restriction base="double">
      <minExclusive value="0"/>
    </restriction>
  </simpleType>

  <simpleType name="nonNegativeDouble">
    <restriction base="double">
      <minInclusive value="0"/>
    </restriction>
  </simpleType>

</schema>
