crdfactory.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                          crdfactory.h  -  description
00003                              -------------------
00004     begin                : Sat Jan 17 2004
00005     copyright            : (C) 2004-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00020 
00021 #ifndef CRDFACTORY_H
00022 #define CRDFACTORY_H
00023 
00025 
00026 // Qt forward class declarations
00027 class QString;
00028 class QStringList;
00029 
00030 // CrdView forward class declarations
00031 class AtomSet;
00032 
00034 class CrdFactory  
00035 {
00036   public:
00037     ~CrdFactory();                      // destructor
00038 
00039     static unsigned int readFromFile(AtomSet* atoms, QString filename);         // reads coordinates from a predefined file and fills the AtomSet
00040     static unsigned int readFromFile(AtomSet* atoms);       // reads coordinates from an unknown file and fills the AtomSet (overloaded)
00041     static unsigned int writeToFile(AtomSet* atoms, QString filename = QString::null, bool extendedFormat = false);     // writes coordinates from the AtomSet to a (predefined) file and a certain format for .crd files
00042     static unsigned int convert(const QString inputFileName, const QString outputFileName, const bool extendedFormat = false);    // converts between coordinate file formats
00043     static unsigned int readForces(AtomSet* atoms, QString filename); // reads the forces from a predefined file and fills the AtomSet
00044         
00045     enum returnCodes{OK, Cancelled, UnknownExtension, ErrorOpen, ErrorRead, ErrorWrite, UnknownFormat, NormalFormat, ExtendedFormat};  // return codes
00046 
00047   private:
00048     CrdFactory();                       // constructor
00049 
00050     static QStringList supportedInputFormats();   // returns a list of the supported file extensions that can be read
00051     static QStringList supportedOutputFormats();  // returns a list of the supported file extensions that can be written
00052     static bool validInputFormat(const QString filename);   // returns true if the given extension can be read
00053     static bool validForceInputFormat(const QString filename);        // returns true if forces can be read for the given extension
00054     static bool validOutputFormat(const QString filename);  // returns true if the given extension can be written
00055     static bool braboExtension(const QString filename);     // returns true if the extension is a Brabo format
00056     static bool xmolExtension(const QString filename);      // returns true if the extension is an Xmol format
00057     static bool gaussianExtension(const QString filename);  // returns true if the extension is a Gaussian format
00058 
00059     static unsigned int readBraboFile(AtomSet* atoms, const QString filename);  // reads a Brabo .crd/.c00
00060     static unsigned int writeBraboFile(AtomSet* atoms, const QString filename, const bool extendedFormat);    // reads a Brabo .crd/.c00
00061     static unsigned int readBraboForces(AtomSet* atoms, const QString filename);// reads a Brabo .pun/.f00
00062     static void readCrdAtoms(AtomSet* atoms, QStringList& lines, const bool extendedFormat);        // fills the AtomSet with the coordinates from the QStringList
00063     static void readPunchForces(AtomSet* atoms, QStringList& lines, const bool extendedFormat);     // fills the AtomSet with the forces from the QStringList
00064     static unsigned int determineCrdFormat(QStringList& lines);       // determines the format of the .crd file parsed into the QStringList
00065     static unsigned int determinePunchFormat(QStringList& lines);     // determines the format of the .pun file parsed into the QStringList
00066     static bool possiblyNormalCrd(const QString line);      // returns true if the QString can contain coordinates in normal format
00067     static bool possiblyExtendedCrd(const QString line);    // returns true if the QString can contain coordinates in extended format
00068 
00069     static unsigned int readXmolFile(AtomSet* atoms, const QString filename);      // reads an Xmol .xyz file
00070     static unsigned int readGaussianFile(AtomSet* atoms, const QString filename);  // reads a Gaussian .fchk file
00071 
00072           static const double AUTOANG;
00073 };
00074 
00075 #endif
00076 

Generated on Fri May 19 14:31:54 2006 for Brabosphere by  doxygen 1.4.6-NO