Commit ec56a4d4 authored by Gregor Michalicek's avatar Gregor Michalicek

Added output of XML Schema for the input file

With this commit the file FleurInputSchema.xsd is created whenever
a new inp.xml file is generated. Note that the recipe for changing
the Schema file is found as a comment in io/xml/dropInputSchema.c.
parent df43c4e8
set(c_files io/xml/inputSchema.h io/xml/dropInputSchema.c)
set(fleur_F90 main/fleur.F90)
set(fleur_F77 "")
......@@ -59,12 +61,12 @@ add_executable(fleur ${fleur_SRC} ${c_files})
target_link_libraries(fleur ${HDF5_LIBS} ${LAPACK_LIBS})
set_target_properties(fleur PROPERTIES Fortran_MODULE_DIRECTORY fleur_modules COMPILE_OPTIONS -Ifleur_modules)
add_executable(fleur_INVS ${fleur_SRC})
add_executable(fleur_INVS ${fleur_SRC} ${c_files})
target_link_libraries(fleur_INVS ${HDF5_LIBS} ${LAPACK_LIBS})
target_compile_definitions(fleur_INVS PUBLIC -DCPP_INVERSION)
set_target_properties(fleur_INVS PROPERTIES Fortran_MODULE_DIRECTORY fleur_INVS_modules COMPILE_OPTIONS -Ifleur_INVS_modules)
add_executable(fleur_SOC ${fleur_SRC})
add_executable(fleur_SOC ${fleur_SRC} ${c_files})
target_link_libraries(fleur_SOC ${HDF5_LIBS} ${LAPACK_LIBS})
target_compile_definitions(fleur_SOC PUBLIC -DCPP_SOC)
set_target_properties(fleur_SOC PROPERTIES Fortran_MODULE_DIRECTORY fleur_SOC_modules COMPILE_OPTIONS -Ifleur_SOC_modules)
......@@ -85,21 +87,21 @@ if(${Fleur_uses_MPI})
add_executable(fleur_MPI ${juDFT_HDF} ${juDFT_SRC_F90} ${fleur_SRC}
add_executable(fleur_MPI ${juDFT_HDF} ${juDFT_SRC_F90} ${fleur_SRC} ${c_files}
target_compile_definitions(fleur_MPI PUBLIC ${MPI_DEFINITIONS})
target_link_libraries(fleur_MPI ${HDF5_LIBS} ${LAPACK_LIBS})
set_target_properties(fleur_MPI PROPERTIES Fortran_MODULE_DIRECTORY fleur_MPI_modules COMPILE_OPTIONS -Ifleur_MPI_modules)
add_executable(fleur_INVS_MPI ${juDFT_HDF} ${juDFT_SRC_F90} ${fleur_SRC}
add_executable(fleur_INVS_MPI ${juDFT_HDF} ${juDFT_SRC_F90} ${fleur_SRC} ${c_files}
target_link_libraries(fleur_INVS_MPI ${HDF5_LIBS} ${LAPACK_LIBS})
target_compile_definitions(fleur_INVS_MPI PUBLIC ${MPI_DEFINITIONS} -DCPP_INVERSION)
set_target_properties(fleur_INVS_MPI PROPERTIES Fortran_MODULE_DIRECTORY fleur_INVS_MPI_modules COMPILE_OPTIONS -Ifleur_INVS_MPI_modules)
add_executable(fleur_SOC_MPI ${juDFT_HDF} ${juDFT_SRC_F90} ${fleur_SRC}
add_executable(fleur_SOC_MPI ${juDFT_HDF} ${juDFT_SRC_F90} ${fleur_SRC} ${c_files}
target_link_libraries(fleur_SOC_MPI ${HDF5_LIBS} ${LAPACK_LIBS})
target_compile_definitions(fleur_SOC_MPI PUBLIC ${MPI_DEFINITIONS} -DCPP_SOC)
......@@ -108,7 +110,7 @@ ${fleur_SRC_MPI})
endif ()
#inpgen executable
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90})
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_files})
set_target_properties(inpgen PROPERTIES Fortran_MODULE_DIRECTORY inpgen_modules COMPILE_OPTIONS -Iinpgen_modules)
......@@ -13,6 +13,7 @@
& atomTypeSpecies,speciesRepAtomType,&
& a1,a2,a3)
USE iso_c_binding
USE m_chkmt
USE m_constants
USE m_atominput
......@@ -58,7 +59,7 @@
CHARACTER(len=3) :: latnamTemp
INTEGER nu,iofile
INTEGER iggachk
INTEGER n ,iostat
INTEGER n ,iostat, errorStatus
REAL scale,scpos ,zc
REAL el0(0:3,atoms%ntype),ello0(atoms%nlod,atoms%ntype),evac0(2)
......@@ -90,6 +91,14 @@
LOGICAL :: xmlPrintCoreStates(29,atoms%ntype)
REAL :: xmlCoreOccs(2,29,atoms%ntype)
REAL :: xmlCoreRefOccs(29)
function dropInputSchema() bind(C, name="dropInputSchema")
use iso_c_binding
INTEGER(c_int) dropInputSchema
end function dropInputSchema
end interface
DATA xmlCoreRefOccs /2,2,2,4,2,2,4,2,4,6,2,4,2,4,6,2,4,2,6,8,4,&
& 6,2,4,2,6,8,4,6/
xmlCoreStates = .FALSE.
......@@ -386,6 +395,12 @@
cell%latnam = 'any'
errorStatus = 0
errorStatus = dropInputSchema()
IF(errorStatus.NE.0) THEN
STOP 'Error: Cannot print out FleurInputSchema.xsd'
CALL w_inpXML(&
& atoms,obsolete,vacuum,input,stars,sliceplot,banddos,&
& cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,div,l_gamma,&
#include <stdio.h>
#include "inputSchema.h"
* This method together with the variables defined in inputSchema.h
* writes out the file FleurInputFormat.xsd.
* GM'16
int dropInputSchema()
char schemaString[FleurInputFormat_xsd_len + 1];
int i = 0;
int errorCode = 0;
FILE *file;
for (i = 0 ; i < FleurInputFormat_xsd_len ; ++i)
schemaString[i] = FleurInputFormat_xsd[i];
schemaString[FleurInputFormat_xsd_len] = '\0';
file = fopen("FleurInputSchema.xsd", "w");
errorCode = fprintf(file,"%s", schemaString);
if(errorCode < 0) return 1;
return 0;
* How to create the file inputSchema.h if the XML Schema has to be
* changed:
* You have to write it by hand. ;)
* ...But if you prefer an automatic generation just follow this recipe:
* 1. Generate the file FleurInputFormat.xsd with the dropInputSchema
* method in this file.
* 2. Change the XML Schema file as desired.
* 3. run: xxd -i FleurInputSchema.xsd inputSchema.h
* (Note that the name of the file FleurInputSchema.xsd determines
* the names of the variables)
* 4. The new inputSchema.h is generated.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment