CrdFactory Class Reference

#include <crdfactory.h>

List of all members.


Detailed Description

Allows loading and saving of a number of coordinate file formats.

This class is a utility class providing a unified interface to loading and saving coordinates from/to Brabo .crd files and formats supported by the Open Babel library. This interface eases the use of this library in the Qt framework. It is a pure utility class, so no instances can be made (private constructor) and only static functions are available.

Defines 'USE_OPENBABEL1' and 'USE_OPENBABEL2' are made available. If neither is defined, the openbabel library is not needed for compilation.

Definition at line 34 of file crdfactory.h.

Public Types

enum  returnCodes {
  OK, Cancelled, UnknownExtension, ErrorOpen,
  ErrorRead, ErrorWrite, UnknownFormat, NormalFormat,
  ExtendedFormat
}

Public Member Functions

 ~CrdFactory ()
 The default destructor.

Static Public Member Functions

static unsigned int readFromFile (AtomSet *atoms, QString filename)
 Reads the contents of a coordinate file filename and fills the AtomSet atoms.
static unsigned int readFromFile (AtomSet *atoms)
 Reads the contents of a coordinate file filename and fills the AtomSet.
static unsigned int writeToFile (AtomSet *atoms, QString filename=QString::null, bool extendedFormat=false)
 Saves the coordinates in the AtomSet to a file with a (predefined) filename, and for the Brabo format a predefined precision.
static unsigned int convert (const QString inputFileName, const QString outputFileName, const bool extendedFormat=false)
 Converts the coordinates in inputFileName to outputFileName.
static unsigned int readForces (AtomSet *atoms, QString filename)
 Reads the contents of a forces file filename and fills the AtomSet atoms.

Private Member Functions

 CrdFactory ()
 The default constructor.

Static Private Member Functions

static QStringList supportedInputFormats ()
 Returns a QStringList containing the supported coordinate input formats, ready for use in a QFileDialog filter.
static QStringList supportedOutputFormats ()
 Returns a QStringList containing the supported coordinate output formats, ready for use in a QFileDialog filter.
static bool validInputFormat (const QString filename)
 Returns true if the contents of the filename can be read.
static bool validForceInputFormat (const QString filename)
 Returns true if the contents of the filename can be read.
static bool validOutputFormat (const QString filename)
 Returns true if the filename can be written.
static bool braboExtension (const QString filename)
 Returns true if the extension of the given filename corresponds to a Brabo format.
static bool xmolExtension (const QString filename)
 Returns true if the extension of the given filename corresponds to a Xmol format.
static bool gaussianExtension (const QString filename)
 Returns true if the extension of the given filename corresponds to a Gaussian format.
static unsigned int readBraboFile (AtomSet *atoms, const QString filename)
 Reads coordinates from a given Brabo coordinate file.
static unsigned int writeBraboFile (AtomSet *atoms, const QString filename, const bool extendedFormat)
 Writes coordinates to a file with a specified filename in a specified format.
static unsigned int readBraboForces (AtomSet *atoms, const QString filename)
 Reads forces from a given Brabo forces file.
static void readCrdAtoms (AtomSet *atoms, QStringList &lines, const bool extendedFormat)
 Reads atom coordinates from a .crd file in QStringList form with the specified format (extended/normal).
static void readPunchForces (AtomSet *atoms, QStringList &lines, const bool extendedFormat)
 Reads atom forces from a .pun file in QStringList form with the specified format (extended/normal).
static unsigned int determineCrdFormat (QStringList &lines)
 Tries to determine the format of the .crd file parsed in lines.
static unsigned int determinePunchFormat (QStringList &lines)
 Tries to determine the format of the .pun file parsed in lines.
static bool possiblyNormalCrd (const QString line)
 Returns true if line contains a .crd line that is possibly in normal format.
static bool possiblyExtendedCrd (const QString line)
 Returns true if line contains a .crd line that is possibly in extended format.
static unsigned int readXmolFile (AtomSet *atoms, const QString filename)
 Reads coordinates from a given Xmol coordinate file.
static unsigned int readGaussianFile (AtomSet *atoms, const QString filename)
 Reads coordinates from a given Gaussian formatted checkpoint file.

Static Private Attributes

static const double AUTOANG = 1.0/1.889726342
 A conversion factor from atomic units to Angstrom.


Member Enumeration Documentation

enum CrdFactory::returnCodes
 

Enumerator:
OK 
Cancelled 
UnknownExtension 
ErrorOpen 
ErrorRead 
ErrorWrite 
UnknownFormat 
NormalFormat 
ExtendedFormat 

Definition at line 45 of file crdfactory.h.


Constructor & Destructor Documentation

CrdFactory::~CrdFactory  ) 
 

The default destructor.

Definition at line 93 of file crdfactory.cpp.

CrdFactory::CrdFactory  )  [private]
 

The default constructor.

Made private to inhibit instantiations of this utility class.

Definition at line 434 of file crdfactory.cpp.


Member Function Documentation

unsigned int CrdFactory::readFromFile AtomSet atoms,
QString  filename
[static]
 

Reads the contents of a coordinate file filename and fills the AtomSet atoms.

If the filename is empty, a dialog is shown allowing the choice of one.

Definition at line 100 of file crdfactory.cpp.

unsigned int CrdFactory::readFromFile AtomSet atoms  )  [static]
 

Reads the contents of a coordinate file filename and fills the AtomSet.

Overloaded version allowing reading a coordinate file when the filename isn't needed by the calling routine.

Definition at line 195 of file crdfactory.cpp.

unsigned int CrdFactory::writeToFile AtomSet atoms,
QString  filename = QString::null,
bool  extendedFormat = false
[static]
 

Saves the coordinates in the AtomSet to a file with a (predefined) filename, and for the Brabo format a predefined precision.

If filename = QString::null, a filename is asked. If the resulting format is .crd, a precision is asked

Definition at line 205 of file crdfactory.cpp.

unsigned int CrdFactory::convert const QString  inputFileName,
const QString  outputFileName,
const bool  extendedFormat = false
[static]
 

Converts the coordinates in inputFileName to outputFileName.

Definition at line 315 of file crdfactory.cpp.

unsigned int CrdFactory::readForces AtomSet atoms,
QString  filename
[static]
 

Reads the contents of a forces file filename and fills the AtomSet atoms.

Definition at line 411 of file crdfactory.cpp.

QStringList CrdFactory::supportedInputFormats  )  [static, private]
 

Returns a QStringList containing the supported coordinate input formats, ready for use in a QFileDialog filter.

Definition at line 442 of file crdfactory.cpp.

QStringList CrdFactory::supportedOutputFormats  )  [static, private]
 

Returns a QStringList containing the supported coordinate output formats, ready for use in a QFileDialog filter.

Definition at line 489 of file crdfactory.cpp.

bool CrdFactory::validInputFormat const QString  filename  )  [static, private]
 

Returns true if the contents of the filename can be read.

Definition at line 533 of file crdfactory.cpp.

bool CrdFactory::validForceInputFormat const QString  filename  )  [static, private]
 

Returns true if the contents of the filename can be read.

Definition at line 561 of file crdfactory.cpp.

bool CrdFactory::validOutputFormat const QString  filename  )  [static, private]
 

Returns true if the filename can be written.

Definition at line 572 of file crdfactory.cpp.

bool CrdFactory::braboExtension const QString  filename  )  [static, private]
 

Returns true if the extension of the given filename corresponds to a Brabo format.

Definition at line 600 of file crdfactory.cpp.

bool CrdFactory::xmolExtension const QString  filename  )  [static, private]
 

Returns true if the extension of the given filename corresponds to a Xmol format.

Definition at line 613 of file crdfactory.cpp.

bool CrdFactory::gaussianExtension const QString  filename  )  [static, private]
 

Returns true if the extension of the given filename corresponds to a Gaussian format.

Definition at line 625 of file crdfactory.cpp.

unsigned int CrdFactory::readBraboFile AtomSet atoms,
const QString  filename
[static, private]
 

Reads coordinates from a given Brabo coordinate file.

This function does not check the validity of the given filename.

Definition at line 637 of file crdfactory.cpp.

unsigned int CrdFactory::writeBraboFile AtomSet atoms,
const QString  filename,
const bool  extendedFormat
[static, private]
 

Writes coordinates to a file with a specified filename in a specified format.

This function does not check the validity of the given filename.

Definition at line 734 of file crdfactory.cpp.

unsigned int CrdFactory::readBraboForces AtomSet atoms,
const QString  filename
[static, private]
 

Reads forces from a given Brabo forces file.

This function does not check the validity of the given filename.

Definition at line 767 of file crdfactory.cpp.

void CrdFactory::readCrdAtoms AtomSet atoms,
QStringList &  lines,
const bool  extendedFormat
[static, private]
 

Reads atom coordinates from a .crd file in QStringList form with the specified format (extended/normal).

Definition at line 811 of file crdfactory.cpp.

void CrdFactory::readPunchForces AtomSet atoms,
QStringList &  lines,
const bool  extendedFormat
[static, private]
 

Reads atom forces from a .pun file in QStringList form with the specified format (extended/normal).

Definition at line 854 of file crdfactory.cpp.

unsigned int CrdFactory::determineCrdFormat QStringList &  lines  )  [static, private]
 

Tries to determine the format of the .crd file parsed in lines.

Only check a maximum of 100 lines. Even as little as 10 could be sufficient though.

Definition at line 882 of file crdfactory.cpp.

unsigned int CrdFactory::determinePunchFormat QStringList &  lines  )  [static, private]
 

Tries to determine the format of the .pun file parsed in lines.

Only check the first 100 lines

Definition at line 923 of file crdfactory.cpp.

bool CrdFactory::possiblyNormalCrd const QString  line  )  [static, private]
 

Returns true if line contains a .crd line that is possibly in normal format.

Definition at line 964 of file crdfactory.cpp.

bool CrdFactory::possiblyExtendedCrd const QString  line  )  [static, private]
 

Returns true if line contains a .crd line that is possibly in extended format.

Definition at line 982 of file crdfactory.cpp.

unsigned int CrdFactory::readXmolFile AtomSet atoms,
const QString  filename
[static, private]
 

Reads coordinates from a given Xmol coordinate file.

This function does not check the validity of the given filename.

Definition at line 1000 of file crdfactory.cpp.

unsigned int CrdFactory::readGaussianFile AtomSet atoms,
const QString  filename
[static, private]
 

Reads coordinates from a given Gaussian formatted checkpoint file.

This function does not check the validity of the given filename.

Definition at line 1060 of file crdfactory.cpp.


Member Data Documentation

const double CrdFactory::AUTOANG = 1.0/1.889726342 [static, private]
 

A conversion factor from atomic units to Angstrom.

Definition at line 72 of file crdfactory.h.


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