/* _______________________________________________________________________ * * RDPARM/PTRAJ: APR 2000 * _______________________________________________________________________ * * $Header: /thr/gamow/cvsroot/amber7/src/ptraj/main.c,v 1.6 2000/05/10 21:53:20 cheatham Exp $ * * Revision: $Revision: 1.6 $ * Date: $Date: 2000/05/10 21:53:20 $ * Last checked in by $Author: cheatham $ * * This source is now archived under CVS at Scripps in the amber7 tree. * * NOTE: this is a beta, pre-release version, is under constant development, * probably contains some bugs and is under constant revision; therefore * take care. Please report bugs (and fixes!) to cheatham@chpc.utah.edu or * cheatham@cgl.ucsf.edu * * Do not distribute this code without explicit permission. * Do not incorporate into other codes without explicit permission. * * Current contact information: * * Thomas Cheatham, III * 2000 East, 30 South, Skaggs Hall 201 * Department of Medicinal Chemistry * University of Utah * Salt Lake City, UT 84112-5820 * cheatham@chpc.utah.edu * (801) 587-9653 * FAX: (801) 585-5366 * * Other contributors: * * David Case (Scripps) * Michael Crowley (Scripps) * Jed Pitera (UCSF) * Vickie Tsui (Scripps) * * _______________________________________________________________________ * * * This is the main routine of ptraj and rdparm * * * This program is used for reading and processing AMBER (and potentially * other) topology and trajectory files. * * The program is command driven via a simple textual interface converting * text typed by the user into a commands and arguments run to process * trajectory and topology/parameter files. For more information, read the * documents provided with AMBER. Information is also maintained in a HTML * file "rdparm.html" in this directory. Developers may also want to read * the detailed comments provided in the source code and in particular in * files ptraj.c, actions.c and dispatch.c and the associated header files. * * In order to create an executable, various ancillary code is required and * not all of it is described in detail here. * * o interface.c --- code defining the basic user interface. Note that * much of the underlying functionality is implemented * in dispatch.c * * o utility.c --- defines error routines, safe memory allocation, etc. * * o rdparm.c --- defines much of the functionality for reading and * processing AMBER (and other) topologies/parameters. * User access to many of these routines is accessed * indirectly through the ptraj interface with the * command rdparm or directly if the executable is * named rdparm. * * o ptraj.c --- the main code for trajectory processing. * * o actions.c --- the code implementing the ptraj "actions" * * o dispatch.c --- defines the token lookup, and string stack processing, * and handles the conversion from strings typed by the * user to subroutines run. * * o io.c --- input/output routines, file handing. Note: * coordinate/trajectory IO is in trajectory.c * * o trajectory.c --- special input/output routines for * trajectories/coordinates * * o rms.c --- code to calculate root-mean-squared deviations between * conformations. * * o display.c --- code for printing 2D RMS plots * * o torsion.c --- code for calculating torsions * * o experimental.c --- new stuff * * o pdb/ --- code to read/write PDB files from the Computer Graphics * lab at UCSF * * o main. c --- this routine * ***********************************************************************/ #include #include #include #define MAIN_MODULE #include "ptraj.h" void calculateConstants() { PI = 4.0 * (double) atan( (double) 1.0 ); RADDEG = (double) 180.0 / PI; DEGRAD = PI / (double) 180.0; SMALL = 0.00000000000001; } void main(unsigned int argCount, char **argPointer) { ptrajState **statep; char *name; calculateConstants(); name = strrchr(argPointer[0], (char) '/'); if (name == NULL) name = argPointer[0]; if (strstr(name, "rdparm") != NULL) { statep = ptrajCurrentState(); if (argCount > 1) { ptrajInitializeState( statep, argPointer[1] ); } else { printf("\nUsage: %s \n\n", argPointer[0]); ptrajInitializeState( statep, NULL ); } /* if (argCount <= 1) { printf("\nUsage: %s \n\n", argPointer[0]); getParm(""); } else getParm(argPointer[1]); */ /* * If the executable name contains the string rdparm, start up the * rdparm parser */ interface(INTERFACE_RDPARM, NULL); } else { /* * otherwise, start up the PTRAJ parser */ statep = ptrajCurrentState(); if (argCount > 1) ptrajInitializeState( statep, argPointer[1] ); else ptrajInitializeState( statep, NULL ); if (argCount > 2) interface(INTERFACE_PTRAJ, argPointer[2]); else interface(INTERFACE_PTRAJ, NULL); } }