Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

PDB.h

Go to the documentation of this file.
00001 
00007 /*
00008    PDB Class
00009      Given a PDB file name, read in all the data.
00010 */
00011 
00012 #ifndef PDB_H
00013 #define PDB_H
00014 
00015 // These are added to the global namespace:
00016 //   whatever is in PDBData.h
00017 //   the typedef PDBAtomList (a singly linked list of PDBAtom *
00018 //   the class PDB
00019 
00020 #include "parm.h"
00021 #include "ResizeArray.h"
00022 #include "GromacsTopFile.h"
00023 
00024 #include "PDBData.h"
00025 #include "Vector.h"
00026 #include "Lattice.h"
00027 
00028 typedef PDBAtom *PDBAtomPtr ;
00029 typedef struct PAL {
00030   PDBAtom *data;
00031   struct PAL *next;
00032 } PDBAtomList;
00033   
00034 class PDB {
00035   private:
00036     PDBAtomList *atomListHead, *atomListTail;
00037 
00038 #ifdef MEM_OPT_VERSION
00039     PDBCoreData *atomArray;
00040 #else
00041     PDBAtom **atomArray;
00042 #endif
00043       // this doesn't create a copy 
00044     void add_atom_element(PDBAtom *newAtom); 
00045     int atomCount;
00046     
00047   public:
00048     PDB(const char *pdbfilename);   // read in PDB from a file
00049 
00050 #ifdef MEM_OPT_VERSION
00051     //read in PDB from a file and eliminate the temporary memory usage of pdb atom list    
00052     PDB(const char *pdbfilename, int expectedNumAtoms); 
00053 #endif
00054     
00055     PDB(const char *, Ambertoppar *);  // read AMBER coordinate file
00056 
00057     /* This constructor initializes the PDB data using a Gromacs
00058        coordinate file, generating an error message if the file
00059        can't be parsed or if its contents don't jive with what is in
00060        the topo file <topology>. */
00061     PDB(const char *filename, const GromacsTopFile *topology);
00062 
00063     ~PDB(void);               // clear everything
00064     void write(const char *outfilename, const char *commentline=NULL); // write the coordinates to a file
00065        // the following deals only with ATOMs and HETATMs
00066     int num_atoms( void);
00067 
00068 #ifdef MEM_OPT_VERSION
00069     PDBCoreData *atom(int place);           
00070     
00071     void delPDBCoreData() { delete [] atomArray; atomArray=NULL; } 
00072 #else
00073     PDBAtom *atom(int place); // get the nth atom in the PDB file
00074 #endif    
00075          // return linked list containing all atoms
00076     PDBAtomList *atoms(void ) { return atomListHead; }  
00077          
00078         // Find the extreme edges of the molecule
00079     void find_extremes(BigReal *min, BigReal *max, Vector rec,
00080                                                   BigReal frac=1.0) const;
00081 
00082     void set_all_positions(Vector *);   //  Reset all the positions in PDB
00083 
00084     void get_all_positions(Vector *);   //  Get all positions in PDB
00085 
00086     void get_position_for_atom(Vector *, int); //Get the position for an atom
00087 };
00088 
00089 #endif // PDB_H
00090 

Generated on Fri Oct 10 04:07:43 2008 for NAMD by  doxygen 1.3.9.1