> my suggestion would be that we pool our efforts to write subroutine > packages in both Fortran and C that define the needed data > structures, read in and parse the XML file, and assign the data in > the data structures. These subroutines would be "templates" in the > sense that they do nothing but "read and die". But any code > developers could then use them to build the input routines that are > needed for their own solid-state code.
What follows is a proof-of-concept exhibit for the Fortran side of things.
The first ingredient is a prototype XML pseudopotential file (for norm-conserving pseudopotentials), containing, apart from identification information, several datasets representing functions of a radial coordinate (Non-local pseudos, valence and pseudo-core charge density). These functions are given as tables with an underlying grid. The grid can be common to all, or each radial function ("radfunc") can have its own.
The second ingredient is a set of fortran data structures to represent internally the data in the pseudopotential file. There are derived types for all the interesting "objects".
The final ingredient is a routine to read the information in the XML file and populate the internal data structures. Using it, any program can process the information in the file. The basic idiom would be:
program pseudo
use flib_pseudo ! Fortran library for pseudo handling
type(pseudo_t) :: pp
...
call read_pseudo(pp,"pseudo.xml")
...
! use the information in the pp structure
call dump_pseudo(pp)
end program pseudo
The read_pseudo routine is built using the SAX (or XPATH) primitives of the XML parser, and a set of handlers tailored to the problem at hand. You can see the typical code idioms in the Examples/sax/pseudo and Examples/xpath/pseudo directories of the xmlf90 distribution, and the source for a prototype implementation of flib_pseudo can be found here.
Work on a pseudopotential XML format for norm-conserving pseudopotentials (used among other codes by Siesta and Abinit) has been going on since the spring, with the initial goal of Siesta-Abinit interoperability. Javier Junquera, Mattieu Verstraete, among others, are involved in the project, and tools will be released soon. This will be one of the first relevant deliverables from the FSAtom workgroup on pseudopotentials. It is hoped that the availability of software tools such as the Fortran XML parser and of prototype implementations will spur progress toward the wider goals of the FSAtom project.