Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Molecule.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: Molecule.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.67 $       $Date: 2020/10/28 17:26:39 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * Main Molecule objects, which contains all the capabilities necessary to
00020  * store, draw, and manipulate a molecule.  This adds to the functions of
00021  * DrawMolecule and BaseMolecule by adding file I/O interfaces
00022  *
00023  ***************************************************************************/
00024 #ifndef MOLECULE_H
00025 #define MOLECULE_H
00026 
00027 #include "DrawMolecule.h"
00028 #include "ResizeArray.h"
00029 #include "utilities.h"
00030 
00031 class VMDApp;
00032 class CoorData;
00033 
00037 class Molecule : public DrawMolecule {
00038 
00039 private:
00040   ResizeArray<char *> fileList;       
00041   ResizeArray<char *> fileSpecList;   
00042   ResizeArray<char *> typeList;       
00043   ResizeArray<char *> dbList;         
00044   ResizeArray<char *> accessionList;  
00045   ResizeArray<char *> remarksList;    
00046     
00047 public:
00051   Molecule(const char *, VMDApp *, Displayable *);
00052   
00054   virtual ~Molecule(void);
00055 
00058   int rename(const char *newname);
00059 
00061   int num_files() const { return int(fileList.num()); }
00062  
00064   const char *get_type(int i) const {
00065     if (i < 0 || i >= typeList.num()) return NULL;
00066     return typeList[i];
00067   } 
00068 
00070   const char *get_file(int i) const {
00071     if (i < 0 || i >= fileList.num()) return NULL;
00072     return fileList[i];
00073   } 
00074 
00076   const char *get_file_specs(int i) const {
00077     if (i < 0 || i >= fileSpecList.num()) return NULL;
00078     return fileSpecList[i];
00079   } 
00080 
00082   const char *get_database(int i) const {
00083     if (i < 0 || i >= dbList.num()) return NULL;
00084     return dbList[i];
00085   }
00086 
00088   const char *get_accession(int i) const {
00089     if (i < 0 || i >= accessionList.num()) return NULL;
00090     return accessionList[i];
00091   }
00092 
00094   const char *get_remarks(int i) const {
00095     if (i < 0 || i >= remarksList.num()) return NULL;
00096     return remarksList[i];
00097   }
00098 
00100   void record_file(const char *filename, const char *filetype, const char *filespecs) {
00101     fileList.append(stringdup(filename));
00102     typeList.append(stringdup(filetype));
00103     fileSpecList.append(stringdup(filespecs));
00104   }
00105 
00108   void record_database(const char *dbname, const char *dbcode) {
00109     dbList.append(stringdup(dbname));
00110     accessionList.append(stringdup(dbcode));
00111   }
00112 
00114   void record_remarks(const char *remarks) {
00115     remarksList.append(stringdup(remarks));
00116   }
00117     
00121   void add_coor_file(CoorData *);
00122 
00125   void close_coor_file(CoorData *);
00126 
00128   int get_new_frames();
00129 
00132   int next_frame();
00133   
00136   int cancel();
00137 
00139   int file_in_progress() { return int(coorIOFiles.num()); }
00140 
00143   virtual void prepare();
00144 
00145   // Forces: Various UIObjects add forces to the molecule during the 
00146   // check_event stage.  In prepare, Molecule sums all the forces, sets
00147   // the forces in Timestep, and calls app->imd_sendforces() if there's
00148   // anything to send.  Only Molecule should modify the forces in Timestep
00149   // directly.
00150 
00152   void addForce(int theatom, const float * f);
00153 
00157   void addPersistentForce(int theatom, const float * f);
00158   
00159 private:
00162   ResizeArray<int> force_indices;
00163   ResizeArray<float> force_vectors;
00164 
00165   ResizeArray<int> persistent_force_indices;
00166   ResizeArray<float> persistent_force_vectors;
00167 
00169   ResizeArray<int> last_force_indices;
00170 
00173   ResizeArray<CoorData *> coorIOFiles;
00174 };
00175 
00176 #endif
00177 

Generated on Fri Apr 19 02:44:41 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002