Commit e6071712 authored by Daniel Wortmann's avatar Daniel Wortmann

ATTENTION! fleurInputVersion=0.32 in inp.xml!!

First changes to allow reading of old inp.xml files!
parent dc1a95bd
......@@ -16,7 +16,7 @@ types_econfig.F90 types_field.F90 types_xcpot.F90
types_enparaXML.f90 types_forcetheo_data.f90
types_mpinp.f90 types_gfinp.F90 types_hub1inp.f90
types_xml.f90
calculator.f constants.f90 mpi_bc_tool.F90 ../io/xml/inputSchema.h ../io/xml/dropInputSchema.c ../io/xml/xmlInterfaceWrapper.c
calculator.f constants.f90 mpi_bc_tool.F90 ../io/xml/inputSchema.h ../io/xml/dropInputSchema.c ../io/xml/inputSchema_old.h ../io/xml/xmlInterfaceWrapper.c
../math/d_wigner.F90 ../math/inv3.f90 ../math/ExpSave.f90 ../math/grule.f90
)
#Set module directories
......
......@@ -50,44 +50,69 @@ CONTAINS
xml%basepath=xpath
end subroutine
SUBROUTINE init(xml)
subroutine validate_with_schema(version)
USE iso_c_binding
character(len=4,kind=c_char),intent(in):: version
integer :: errorStatus
character(len=200,KIND=c_char):: schemaFilename
INTERFACE
FUNCTION dropInputSchema(version) BIND(C, name="dropInputSchema")
USE iso_c_binding
INTEGER(c_int) ::dropInputSchema
CHARACTER(kind=c_char) ::version
END FUNCTION dropInputSchema
END INTERFACE
!Now validate with schema
errorStatus = 0
errorStatus=dropInputSchema(version//C_NULL_CHAR)
IF(errorStatus.NE.0) THEN
CALL juDFT_error('Error: Cannot print out FleurInputSchema.xsd for version '//version)
END IF
schemaFilename = "FleurInputSchema.xsd"//C_NULL_CHAR
CALL ParseSchema(schemaFilename)
CALL ValidateDoc()
CALL InitXPath()
end
SUBROUTINE init(xml,old_version)
USE iso_c_binding
CLASS(t_xml),INTENT(IN)::xml
LOGICAL,OPTIONAL,INTENT(inout):: old_version
LOGICAL :: l_allow_old
INTEGER :: errorStatus
CHARACTER(LEN=200,KIND=c_char) :: schemaFilename, docFilename
CHARACTER(LEN=200,KIND=c_char) :: docFilename
INTEGER :: i,numberNodes
CHARACTER(LEN=255) :: xPathA,xPathB,valueString,versionString
REAL :: tempReal
INTERFACE
FUNCTION dropInputSchema() BIND(C, name="dropInputSchema")
USE iso_c_binding
INTEGER(c_int) dropInputSchema
END FUNCTION dropInputSchema
END INTERFACE
if (INITIALIZED) RETURN
INITIALIZED=.true.
errorStatus = 0
errorStatus = dropInputSchema()
IF(errorStatus.NE.0) THEN
CALL juDFT_error('Error: Cannot print out FleurInputSchema.xsd')
END IF
schemaFilename = "FleurInputSchema.xsd"//C_NULL_CHAR
l_allow_old=.false.
if (present(old_version)) then
l_allow_old=old_version
old_version=.false.
endif
!Open inp.xml
docFilename = "inp.xml"//C_NULL_CHAR
CALL InitInterface()
CALL ParseSchema(schemaFilename)
CALL ParseDoc(docFilename)
CALL ValidateDoc()
CALL InitXPath()
! Check version of inp.xml
versionString = xml%GetAttributeValue('/fleurInput/@fleurInputVersion')
IF((TRIM(ADJUSTL(versionString)).NE.'0.30')) THEN
CALL juDFT_error('version number of inp.xml file is not compatible with this fleur version')
IF((TRIM(ADJUSTL(versionString)).NE.'0.32')) THEN
if (.not.l_allow_old) CALL juDFT_error('version number of inp.xml file is not compatible with this fleur version')
old_version=.true.
END IF
call validate_with_Schema(trim(adjustl(versionString)))
! Read in constants
xPathA = '/fleurInput/constants/constant'
numberNodes = xml%GetNumberOfNodes(xPathA)
......
......@@ -135,7 +135,7 @@ CONTAINS
filenum = 98
OPEN (fileNum, file=TRIM(ADJUSTL(filename)), form='formatted', status='replace')
WRITE (fileNum, '(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
WRITE (fileNum, '(a)') '<fleurInput fleurInputVersion="0.30">'
WRITE (fileNum, '(a)') '<fleurInput fleurInputVersion="0.32">'
ELSE
fileNum = getXMLOutputUnitNumber()
CALL openXMLElementNoAttributes('inputData')
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="0.30">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="0.32">
<xsd:element name="fleurInput" type="FleurInputType"/>
......@@ -21,8 +21,7 @@
<xsd:simpleType name="FleurVersionType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="0.30"/>
<xsd:enumeration value="0.31"/>
<xsd:enumeration value="0.32"/>
</xsd:restriction>
</xsd:simpleType>
......
......@@ -7,21 +7,33 @@
#include <stdio.h>
#include "inputSchema.h"
#include "inputSchema_old.h"
/*
* This method together with the variables defined in inputSchema.h
* writes out the file FleurInputSchema.xsd.
* GM'16
*/
int dropInputSchema()
int dropInputSchema(char* version)
{
char schemaString[FleurInputSchema_xsd_len + 1];
char * xsd_txt;
int xsd_len;
if (strcmp(version,"0.32")==0){
xsd_len=FleurInputSchema_xsd_len;
xsd_txt = FleurInputSchema_xsd;
}else if(strcmp(version,"0.31")==0){
xsd_len=FleurInputSchema0_31_xsd_len;
xsd_txt = FleurInputSchema0_31_xsd;
}else{
return 1;
}
char schemaString[xsd_len + 1];
int i = 0;
int errorCode = 0;
FILE *file;
for (i = 0 ; i < FleurInputSchema_xsd_len ; ++i)
for (i = 0 ; i < xsd_len ; ++i)
{
schemaString[i] = FleurInputSchema_xsd[i];
schemaString[i] = xsd_txt[i];
}
schemaString[FleurInputSchema_xsd_len] = '\0';
file = fopen("FleurInputSchema.xsd", "w");
......@@ -38,7 +50,7 @@ int dropInputSchema()
* You have to write it by hand. ;)
* ...But if you prefer an automatic generation just follow this recipe:
*
* 1. Generate the file FleurInputSchema.xsd with the dropInputSchema
* 1. Generate the file FleurInputSchema.xsd with the dropInputSchema
* method in this file.
* 2. Change the XML Schema file as desired.
* 3. run: xxd -i FleurInputSchema.xsd inputSchema.h
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -46,7 +46,7 @@ int parseXMLSchema(const char* schemaFilename)
{
schemaDoc = xmlReadFile(schemaFilename, NULL, 0);
//printf("Parsing XML Schema file: %s\n", schemaFilename);
if (schemaDoc == NULL)
if (schemaDoc == NULL)
{
fprintf(stderr, "Failed to parse xml schema file %s\n", schemaFilename);
return -1;
......@@ -82,7 +82,7 @@ int parseXMLDocument(const char* docFilename)
{
xmlDocument = xmlReadFile(docFilename, NULL,0);
xmlXIncludeProcess(xmlDocument) ;
if (xmlDocument == NULL)
if (xmlDocument == NULL)
{
fprintf(stderr, "Failed to parse xml file %s\n", docFilename);
return -1;
......@@ -101,7 +101,7 @@ int validateXMLDocument()
fprintf(stderr, "Error: schemaValidCtxt is null in validateDocument()");
return -1;
}
if (xmlDocument == NULL)
if (xmlDocument == NULL)
{
fprintf(stderr, "Error: xmlDocument is null in validateDocument()");
return -1;
......@@ -113,18 +113,20 @@ int validateXMLDocument()
int initializeXPath()
{
if (xmlDocument == NULL)
if (xmlDocument == NULL)
{
fprintf(stderr, "Error: xmlDocument is null in initializeXPath()");
return -1;
}
}
if(xPathObj) xmlXPathFreeObject(xPathObj);
if(xPathCtxt) xmlXPathFreeContext(xPathCtxt);
xPathCtxt = xmlXPathNewContext(xmlDocument);
return 0;
}
int getNumberOfXMLNodes(const unsigned char* xPathExpression)
{
if (xPathCtxt == NULL)
if (xPathCtxt == NULL)
{
fprintf(stderr, "Error: xPathCtxt is null in getNumberOfNodes(...)");
return -1;
......@@ -150,7 +152,7 @@ int getNumberOfXMLNodes(const unsigned char* xPathExpression)
extern const unsigned char* getXMLAttributeValue(const unsigned char* xPathExpression)
{
if (xPathCtxt == NULL)
if (xPathCtxt == NULL)
{
fprintf(stderr, "Error: xPathCtxt is null in getAttributeValue(...)");
return NULL;
......@@ -175,7 +177,7 @@ extern const unsigned char* getXMLAttributeValue(const unsigned char* xPathExpre
int setXMLAttributeValue(const unsigned char* xPathExpression,const unsigned char * value)
{
if (xPathCtxt == NULL)
if (xPathCtxt == NULL)
{
fprintf(stderr, "Error: xPathCtxt is null in getAttributeValue(...)");
return 1;
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
hcp Cobalt
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
hcp Cobalt
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Cobalt bulk in hcp structure exp:a=b=250.71pm,c=406.95pm 2x2x1 super-cell C defe
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
FLEUR in
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
FLEUR in
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
FLEUR in
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
fcc FePt
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
FeHybrid
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
A Fleur input generator calculation with aiida
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
A Fleur input generator calculation with aiida
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
A Fleur input generator calculation with aiida
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
A Fleur input generator calculation with aiida
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Fe Monol
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Fe Monol
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Fe preconditioning testcase
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
bcc Fe
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
bcc Fe
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
bcc Fe
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
bcc Fe
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
bcc Fe
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Fe fcc 2
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Fe fcc 2
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Fe fcc 2
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Fe fcc
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Ga1As1
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
GaAs bulk zinc-blende structure
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
GaAs bulk zinc-blende structure
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
GaAs bulk zinc-blende structure
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
hcp Gadolinium
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
hcp Gadolinium
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
KCl
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
tet mang
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
FLEUR in
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
FLEUR in
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
bcc Fe
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Si (111) film 6 layers
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Si (111) film 6 layers
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
alpha Si
</comment>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fleurInput fleurInputVersion="0.30">
<fleurInput fleurInputVersion="0.32">
<comment>
Si bulk
</comment>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment