/* * $Id: template.c,v 1.4 2001/07/23 15:28:29 lindahl Exp $ * * This source code is part of * * G R O M A C S * * GROningen MAchine for Chemical Simulations * * VERSION 3.0 * * Copyright (c) 1991-2001 * BIOSON Research Institute, Dept. of Biophysical Chemistry * University of Groningen, The Netherlands * * 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. * * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org . * * And Hey: * Gyas ROwers Mature At Cryogenic Speed */ /* This line is only for CVS version info */ static char *SRCID_tstndx_c = "$Id: template.c,v 1.4 2001/07/23 15:28:29 lindahl Exp $"; #include "statutil.h" #include "typedefs.h" #include "smalloc.h" #include "vec.h" #include "copyrite.h" #include "statutil.h" #include "tpxio.h" // Stuff added for index - MB // #include "index.h" // Stuff added for index - MB - END // int main(int argc,char *argv[]) { static char *desc[] = { "this is a small test program demonstrating how to read ", "gromacs index files or determine the index on the fly ", "from a topology. It only serves test/development ", "purposes. Written by Marc Baaden, 2005." }; static int n=1; t_topology top; char title[STRLEN]; t_trxframe fr; rvec *xtop; matrix box; int status; int flags = TRX_READ_X; // Stuff added for index - MB // t_atoms *atoms; char *grpnm; atom_id *index; int i,nidx; // Stuff added for index - MB - END // t_filenm fnm[] = { { efTPS, NULL, NULL, ffREAD }, /* this is for the topology */ { efNDX, NULL, NULL, ffOPTRD } /* this is for the index file */ }; #define NFILE asize(fnm) CopyRight(stderr,argv[0]); /* This is the routine responsible for adding default options, * calling the X/motif interface, etc. */ parse_common_args(&argc,argv,PCA_CAN_TIME | PCA_CAN_VIEW, NFILE,fnm,0,NULL,asize(desc),desc,0,NULL); /* We don't need any topology information to write the coordinates, * but to show how it works we start by writing the name and * charge of the selected atom. It returns a boolean telling us * whether the topology was found and could be read */ read_tps_conf(ftp2fn(efTPS,NFILE,fnm),title,&top,&xtop,NULL,box,TRUE); sfree(xtop); // Stuff added for index - MB // atoms=&(top.atoms); printf("\n\nINDEX PART starts here.\n"); printf("Select group to process:\n"); get_index(atoms,ftp2fn_null(efNDX,NFILE,fnm),1,&nidx,&index,&grpnm); printf("The %d elements of the index are:\n",nidx); for(i=0; i