From: David van der Spoel Date: Sat, 17 Mar 2012 11:09:30 +0000 (+0100) Subject: Removed qhop files from this branch. X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=b7d1b57a1fcf8eab38e0fe41870ae40cbe4b61a4;p=alexxy%2Fgromacs.git Removed qhop files from this branch. Change-Id: I7b6038571caaf47313d3edcf7111b3d2d0a3420c --- diff --git a/src/mdlib/CMakeLists.txt b/src/mdlib/CMakeLists.txt index 18f3a6e337..e50df46373 100644 --- a/src/mdlib/CMakeLists.txt +++ b/src/mdlib/CMakeLists.txt @@ -3,8 +3,6 @@ file(GLOB MDLIB_SOURCES *.c) # Files called xxx_test.c are test drivers with a main() function for # module xxx.c, so they should not be included in the library -file(GLOB_RECURSE NOT_MDLIB_SOURCES *_test.c *\#*) -list(REMOVE_ITEM MDLIB_SOURCES ${NOT_MDLIB_SOURCES}) add_library(md ${MDLIB_SOURCES}) target_link_libraries(md gmx ${GMX_EXTRA_LIBRARIES} ${FFT_LIBRARIES} ${XML_LIBRARIES}) diff --git a/src/mdlib/gmx_qhop_db.h b/src/mdlib/gmx_qhop_db.h deleted file mode 100644 index 5dd9658250..0000000000 --- a/src/mdlib/gmx_qhop_db.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef _GMX_QHOP_DB_H -#define _GMX_QHOP_DB_H - -typedef struct{ - real alpha, beta, gamma; - real k_1, k_2, k_3, m_1, m_2, m_3; - real s_A, t_A, v_A, s_B, s_C, t_C, v_C; - real f, g, h; - real p_1, q_1, q_2, q_3, r_1, r_2, r_3; -} t_qhop_parameters; - -typedef struct gmx_qhop_db_t *gmx_qhop_db; - -/* Return database if successful, or NULL on failure */ -extern gmx_qhop_db gmx_qhop_db_read(char *forcefield); - -/* Write the database to a filename. Return 1 on success, or 0 for - failure */ -extern int gmx_qhop_db_write(char *fn,gmx_qhop_db qdb); - -/* Destroy the internal datastructures to free memory. Return 1 on - success, 0 for failure */ -extern int gmx_qhop_db_done(gmx_qhop_db qdb); - -/* Return the number of states in the database for a given residue - name: e.g. 1 for alanine, 2 for lysine, 4 for histidine. Returns - NOTSET when the residue is not present in the database. */ -extern int gmx_qhop_db_get_nstates(gmx_qhop_db qdb,char *resname); - -/* Return the net charge for a given state for a given - residue. Returns NOTSET when the residue is not in the database, or - when the state is invalid for the residue. */ -extern int gmx_qhop_db_get_qstate(gmx_qhop_db qdb,char *resname,int state); - -/* Return a NULL-terminated list of atomnames of the donors in the - residue for the indicated state. If NULL there are no donors in the - residue. This assumes atomnames are unique, which is true for - proteins and nucleic acids at least. */ -extern char **gmx_qhop_db_get_donors(gmx_qhop_db qdb,char *resname,int state); - -/* Return a NULL-terminated list of atomnames of the acceptors in the - residue for the indicated state. If NULL there are no acceptors in - the residue. This assumes atomnames are unique, which is true for - proteins and nucleic acids at least. */ -extern char **gmx_qhop_db_get_acceptors(gmx_qhop_db qdb,char *resname,int state); - -/* Fills the array q (length natoms) with the charges corresponding to - residue name and state. Return 1 on success, NOTSET if the resname - is not found or the state is incorrect. */ -extern int gmx_qhop_db_set_charges(gmx_qhop_db qdb,char *resname,int state, - int natoms,real q[]); - -/* Fill the qhop_parameters for a given donor/acceptor pair. Returns 1 - if OK or 0 if either donor or acceptor does not exist. */ -extern int gmx_qhop_db_get_parameters(gmx_qhop_db qdb, - char *donor,char *acceptor, - t_qhop_parameters *qp); - -#endif diff --git a/src/mdlib/gmx_qhop_db_test.c b/src/mdlib/gmx_qhop_db_test.c deleted file mode 100644 index fb0f9ec232..0000000000 --- a/src/mdlib/gmx_qhop_db_test.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*- - * - * This source code is part of - * - * G R O M A C S - * - * GROningen MAchine for Chemical Simulations - * - * VERSION 4.5 - * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others. - * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2008, The GROMACS development team, - * check out http://www.gromacs.org for more information. - - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * If you want to redistribute modifications, please consider that - * scientific software is very special. Version control is crucial - - * bugs must be traceable. We will be happy to consider code for - * inclusion in the official distribution, but derived work must not - * be called official GROMACS. Details are found in the README & COPYING - * files - if they are missing, get the official version at www.gromacs.org. - * - * To help us fund GROMACS development, we humbly ask that you cite - * the papers on the package - you can find them in the top README file. - * - * For more info, check our website at http://www.gromacs.org - * - * And Hey: - * Groningen Machine for Chemical Simulation - */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include "gmx_fatal.h" -#include "macros.h" -#include "gmx_qhop_db.h" - -int main(int argc,char *argv[]) -{ - gmx_qhop_db db; - char *donors[] = { "H3O+", "ACE" }; - char *acceptors[] = { "H2O", "GLU" }; - t_qhop_parameters qp; - int i,j; - - if ((db = gmx_qhop_db_read("ffoplsaa")) == NULL) - gmx_fatal(FARGS,"Can not read qhop database information"); - if (gmx_qhop_db_write("koe.dat",db) != 1) - gmx_fatal(FARGS,"Can not write qhop database information"); - - for(i=0; (i -#endif - -#include -#include -#include "smalloc.h" -#include "string2.h" - -#include "gmx_qhop_parm.h" - -typedef struct gmx_qhop { - char *donor,*acceptor; - int nparam,nparam_c; - char **value,**unit,**name; -} gmx_qhop; - -#define assign_str(dst,src) if (NULL != src) { if (NULL != dst) *dst = strdup(src); } else { *dst = NULL; } -#define assign_scal(dst,src) if (NULL != dst) *dst = src - -/* Return a new gmx_qhop structure */ -gmx_qhop_t gmx_qhop_init() -{ - struct gmx_qhop *qht; - - snew(qht,1); - - return qht; -} - -void gmx_qhop_set_donor(gmx_qhop_t gqh,char *donor) -{ - gqh->donor = strdup(donor); -} - -void gmx_qhop_set_acceptor(gmx_qhop_t gqh,char *acceptor) -{ - gqh->acceptor = strdup(acceptor); -} - -char *gmx_qhop_get_donor(gmx_qhop_t gqh) -{ - return gqh->donor; -} - -char *gmx_qhop_get_acceptor(gmx_qhop_t gqh) -{ - return gqh->acceptor; -} - -/* Add parameter to gqh, return 1 if OK, 0 if not OK */ -int gmx_qhop_add_param(gmx_qhop_t gqh,char *name,char *value,char *unit) -{ - srenew(gqh->name,gqh->nparam+1); - srenew(gqh->value,gqh->nparam+1); - srenew(gqh->unit,gqh->nparam+1); - gqh->name[gqh->nparam] = strdup(name); - gqh->value[gqh->nparam] = strdup(value); - gqh->unit[gqh->nparam] = strdup(unit); - gqh->nparam++; - - return 1; -} - -/* Lists the parameters, one by one on repeatedly calling the - function. Returns 1 if OK, 0 if not OK */ -int gmx_qhop_get_param(gmx_qhop_t gqh,char **name,char **value,char **unit) -{ - if (gqh->nparam_c < gqh->nparam) { - assign_str(name,gqh->name[gqh->nparam_c]); - assign_str(value,gqh->value[gqh->nparam_c]); - assign_str(unit,gqh->unit[gqh->nparam_c]); - gqh->nparam_c++; - - return 1; - } - else - gqh->nparam_c = 0; - - return 0; -} - -/* Return a value corresponding to name */ -int gmx_qhop_get_value(gmx_qhop_t gqh,char *name,double *x) -{ - int i; - - for(i=0; (inparam); i++) - if (gmx_strcasecmp(gqh->name[i],name) == 0) { - *x = strtod(gqh->value[i],NULL); - return 1; - } - - return 0; -} - -/* Liberate memory */ -void gmx_qhop_done(gmx_qhop_t gqh) -{ - int i; - - for(i=0; (inparam); i++) { - sfree(gqh->name[i]); - sfree(gqh->value[i]); - sfree(gqh->unit[i]); - } - if (gqh->nparam > 0) { - sfree(gqh->name); - sfree(gqh->value); - sfree(gqh->unit); - } - if (gqh->donor) - sfree(gqh->donor); - if (gqh->acceptor) - sfree(gqh->acceptor); -} - diff --git a/src/mdlib/gmx_qhop_parm.h b/src/mdlib/gmx_qhop_parm.h deleted file mode 100644 index a4197721a5..0000000000 --- a/src/mdlib/gmx_qhop_parm.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _GMX_QHOP_PARM_H -#define _GMX_QHOP_PARM_H - -typedef struct gmx_qhop *gmx_qhop_t; - -/* Return a new gmx_qhop structure */ -extern gmx_qhop_t gmx_qhop_init(); - -/* These function get and set the obvious */ -extern void gmx_qhop_set_donor(gmx_qhop_t gqh,char *donor); - -extern void gmx_qhop_set_acceptor(gmx_qhop_t gqh,char *acceptor); - -extern char *gmx_qhop_get_donor(gmx_qhop_t gqh); - -extern char *gmx_qhop_get_acceptor(gmx_qhop_t gqh); - -/* Add parameter to gqh, return 1 if OK, 0 if not OK */ -extern int gmx_qhop_add_param(gmx_qhop_t gqh,char *name,char *value,char *unit); - -/* Lists the parameters, one by one on repeatedly calling the - function. Returns 1 if OK, 0 if not OK */ -extern int gmx_qhop_get_param(gmx_qhop_t gqh,char **name,char **value,char **unit); - -/* Return a value corresponding to name in *x. Return 1 of OK, 0 if - not OK */ -extern int gmx_qhop_get_value(gmx_qhop_t gqh,char *name,double *x); - -/* Liberate memory */ -extern void gmx_qhop_done(gmx_qhop_t gqh); - -#endif diff --git a/src/mdlib/gmx_qhop_xml.c b/src/mdlib/gmx_qhop_xml.c deleted file mode 100644 index abc18db29f..0000000000 --- a/src/mdlib/gmx_qhop_xml.c +++ /dev/null @@ -1,377 +0,0 @@ -/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*- - * - * This source code is part of - * - * G R O M A C S - * - * GROningen MAchine for Chemical Simulations - * - * VERSION 4.5 - * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others. - * Copyright (c) 1991-2000, University of Groningen, The Netherlands. - * Copyright (c) 2001-2008, The GROMACS development team, - * check out http://www.gromacs.org for more information. - - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * If you want to redistribute modifications, please consider that - * scientific software is very special. Version control is crucial - - * bugs must be traceable. We will be happy to consider code for - * inclusion in the official distribution, but derived work must not - * be called official GROMACS. Details are found in the README & COPYING - * files - if they are missing, get the official version at www.gromacs.org. - * - * To help us fund GROMACS development, we humbly ask that you cite - * the papers on the package - you can find them in the top README file. - * - * For more info, check our website at http://www.gromacs.org - * - * And Hey: - * Groningen Machine for Chemical Simulation - */ -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include -#include "gmx_fatal.h" -#include "smalloc.h" -#include "macros.h" -#include "futil.h" -#include "gmx_qhop_parm.h" - -#ifdef HAVE_LIBXML2 -#include -#include - -extern int xmlDoValidityCheckingDefaultValue; - -#define NN(x) (NULL != (x)) - -static const char *xmltypes[] = { - NULL, - "XML_ELEMENT_NODE", - "XML_ATTRIBUTE_NODE", - "XML_TEXT_NODE", - "XML_CDATA_SECTION_NODE", - "XML_ENTITY_REF_NODE", - "XML_ENTITY_NODE", - "XML_PI_NODE", - "XML_COMMENT_NODE", - "XML_DOCUMENT_NODE", - "XML_DOCUMENT_TYPE_NODE", - "XML_DOCUMENT_FRAG_NODE", - "XML_NOTATION_NODE", - "XML_HTML_DOCUMENT_NODE", - "XML_DTD_NODE", - "XML_ELEMENT_DECL", - "XML_ATTRIBUTE_DECL", - "XML_ENTITY_DECL", - "XML_NAMESPACE_DECL", - "XML_XINCLUDE_START", - "XML_XINCLUDE_END" -}; -#define NXMLTYPES asize(xmltypes) - -enum { - exmlQHOPS, - exmlQHOP, exmlDONOR, exmlACCEPTOR, - exmlPARAM, exmlNAME, exmlVALUE, - exmlUNIT, - exmlNR -}; - -static const char *exml_names[exmlNR] = { - "qhops", - "qhop", "donor", "acceptor", "parameter", - "name", "value", "unit" -}; - -typedef struct { - int nqh; - gmx_qhop_t *gqh; -} t_xmlrec; - -static int find_elem(char *name,int nr,const char *names[]) -{ - int i; - - for(i=0; (inext != NULL) - ptr=ptr->next; - ptr->next = comm; - comm->prev = ptr; - comm->doc = doc; - - return comm; -} - -static char *sp(int n, char buf[], int maxindent) -{ - int i; - if(n>=maxindent) - n=maxindent-1; - - /* Don't indent more than maxindent characters */ - for(i=0; (iname; - attrval = (char *)attr->children->content; - -#define atest(s) ((gmx_strcasecmp(attrname,s) == 0) && (attrval != NULL)) - kkk = find_elem(attrname,exmlNR,exml_names); - if (attrval != NULL) - xbuf[kkk] = strdup(attrval); - - if (fp) - fprintf(fp,"%sProperty: '%s' Value: '%s'\n",sp(indent,buf,99), - attrname,attrval); - attr = attr->next; -#undef atest - } - - switch (elem) { - case exmlQHOP: - if (NN(xbuf[exmlDONOR]) && NN(xbuf[exmlACCEPTOR])) { - gmx_qhop_set_donor(qht,xbuf[exmlDONOR]); - gmx_qhop_set_acceptor(qht,xbuf[exmlACCEPTOR]); - } - break; - case exmlPARAM: - if (NN(xbuf[exmlNAME]) && NN(xbuf[exmlUNIT]) && NN(xbuf[exmlVALUE])) { - gmx_qhop_add_param(qht,xbuf[exmlNAME],xbuf[exmlVALUE], - xbuf[exmlUNIT]); - } - break; - default: - break; - } - for(i=0; (iname,exmlNR,exml_names); - if (fp) - fprintf(fp,"%sElement node name %s\n",sp(indent,buf,99), - (char *)tree->name); - if (elem == exmlQHOP) { - xml->nqh++; - srenew(xml->gqh,xml->nqh); - xml->gqh[xml->nqh-1] = gmx_qhop_init(); - } - if (elem != exmlQHOPS) - qhop_process_attr(fp,tree->properties,parent, - elem,indent+2,xml->gqh[xml->nqh-1]); -} - -static void qhop_process_tree(FILE *fp,xmlNodePtr tree,int parent, - int indent,t_xmlrec *xml) -{ - char buf[100]; - int elem; - - while (tree != NULL) { - if (fp) { - if ((tree->type > 0) && (tree->type < NXMLTYPES)) - fprintf(fp,"Node type %s encountered with name %s\n", - xmltypes[tree->type],(char *)tree->name); - else - fprintf(fp,"Node type %d encountered\n",tree->type); - } - - switch (tree->type) { - case XML_ELEMENT_NODE: - qhop_process_element(fp,tree,parent,indent+2,xml); - - if (tree->children) { - elem = find_elem((char *)tree->name,exmlNR,exml_names); - qhop_process_tree(fp,tree->children,elem,indent+2,xml); - } - break; - default: - break; - } - tree = tree->next; - } -} - -gmx_qhop_t * -gmx_qhops_read(char *fn,int *nqhop) -{ - xmlDocPtr doc; - int i,npd; - t_xmlrec *xml; - const char *db="qhops.dat"; - gmx_bool fna=FALSE; - - xmlDoValidityCheckingDefaultValue = 0; - if (NULL == fn) - { - fn = (char *)gmxlibfn(db); - fna=TRUE; - } - if ((doc = xmlParseFile(fn)) == NULL) { - fprintf(stderr,"Reading XML file %s. Run a syntax checker such as nsgmls.", - fn); - exit(1); - } - - snew(xml,1); - qhop_process_tree(NULL,doc->children,0,0,xml); - - xmlFreeDoc(doc); - if (fna) - sfree(fn); - - *nqhop = xml->nqh; - - return xml->gqh; -} - -static void add_xml_qhop(xmlNodePtr parent,gmx_qhop_t qht) -{ - xmlNodePtr ptr,child,grandchild,comp; - char *name,*type,*value,*unit; - - ptr = add_xml_child(parent,exml_names[exmlQHOP]); - add_xml_char(ptr,exml_names[exmlDONOR],gmx_qhop_get_donor(qht)); - add_xml_char(ptr,exml_names[exmlACCEPTOR],gmx_qhop_get_acceptor(qht)); - - while (gmx_qhop_get_param(qht,&name,&value,&unit) == 1) { - child = add_xml_child(ptr,exml_names[exmlPARAM]); - add_xml_char(child,exml_names[exmlNAME],name); - add_xml_char(child,exml_names[exmlVALUE],value); - add_xml_char(child,exml_names[exmlUNIT],unit); - sfree(name); - sfree(value); - sfree(unit); - } -} - -void gmx_qhops_write(char *fn,int nqhop,gmx_qhop_t qht[]) -{ - xmlDocPtr doc; - xmlDtdPtr dtd; - xmlNodePtr myroot; - int i,nmt; - xmlChar *libdtdname,*dtdname,*gmx; - - gmx = (xmlChar *) "qhops"; - dtdname = (xmlChar *) "qhops.dtd"; - libdtdname = dtdname; - - if ((doc = xmlNewDoc((xmlChar *)"1.0")) == NULL) - gmx_fatal(FARGS,"Creating XML document",""); - - if ((dtd = xmlCreateIntSubset(doc,dtdname,libdtdname,dtdname)) == NULL) - gmx_fatal(FARGS,"Creating XML DTD",""); - - if ((myroot = xmlNewDocNode(doc,NULL,gmx,NULL)) == NULL) - gmx_fatal(FARGS,"Creating root element",""); - dtd->next = myroot; - myroot->prev = (xmlNodePtr) dtd; - - /* Add molecule definitions */ - for(i=0; (i