OpenMM: added combination rule check, disabled restraint check for now as it's buggy
[gromacs/qmmm-gamess-us.git] / src / kernel / gmx_xml.c
blobe7c485f404adc0d6fffd07addafb9cf9fc509192
1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
4 #include "gmx_fatal.h"
7 #ifdef HAVE_LIBXML2
8 #include <libxml/parser.h>
9 #include <libxml/tree.h>
10 #include "gmx_xml.h"
12 void add_xml_int(xmlNodePtr ptr,xmlChar *name,int val)
14 xmlChar buf[32];
16 sprintf((char *)buf,"%d",val);
17 if (xmlSetProp(ptr,name,buf) == 0)
18 gmx_fatal(FARGS,"Setting %s",(char *)name);
21 void add_xml_double(xmlNodePtr ptr,xmlChar *name,double val)
23 xmlChar buf[32];
25 sprintf((char *)buf,"%g",val);
26 if (xmlSetProp(ptr,name,buf) == 0)
27 gmx_fatal(FARGS,"Setting %s",(char *)name);
30 void add_xml_char(xmlNodePtr ptr,xmlChar *name,char *val)
32 if (xmlSetProp(ptr,name,(xmlChar *)val) == 0)
33 gmx_fatal(FARGS,"Setting %s",(char *)name);
36 xmlNodePtr add_xml_child(xmlNodePtr parent,char *type)
38 xmlNodePtr child;
40 if ((child = xmlNewChild(parent,NULL,(xmlChar *)type,NULL)) == NULL)
41 gmx_fatal(FARGS,"Creating element %s",(char *)type);
43 return child;
46 xmlNodePtr add_xml_comment(xmlDocPtr doc,
47 xmlNodePtr prev,xmlChar *comment)
49 xmlNodePtr comm,ptr;
51 if ((comm = xmlNewComment(comment)) == NULL)
52 gmx_fatal(FARGS,"Creating doc comment element");
53 ptr = prev;
54 while (ptr->next != NULL)
55 ptr=ptr->next;
56 ptr->next = comm;
57 comm->prev = ptr;
58 comm->doc = doc;
60 return comm;
63 #endif