pyviblib.io.parsers
index
/usr/lib/python2.4/site-packages/pyviblib/io/parsers.py

Module for parsing files.
 
The following classes are exported :
    AbstractFileParser      -- abstract base class for the parsers
    DaltonOutputParser      -- Dalton 1.x or 2.0 files
    FCHKFileParser          -- Gaussian Formatted Checkpoint files
    VOAVIEWFileParser       -- VOAVIEW files
    MOLDENFileParser        -- MOLDEN files
    XMolXYZFileParser       -- XMol XYZ files
    HESFileParser           -- cartesian hessian files of DALTON
    NumericDataFileParser   -- files with numeric data only
    FittedSpectraFileParser -- fitted spectra files of VOAPlot 4.2+
    FCMINTFileParser        -- cartesian hessian files of AcesII    
    ParserFactory           -- instantiating parsers

 
Modules
       
copy
os
pyviblib

 
Classes
       
__builtin__.object
ParserFactory
pyviblib.util.misc.PropertiesContainer(__builtin__.object)
AbstractFileParser
DaltonOutputParser
FCHKFileParser
HESFileParser
MOLDENFileParser
VOAVIEWFileParser
XMolXYZFileParser
NumericDataFileParser
FCMINTFileParser
FittedSpectraFileParser

 
class AbstractFileParser(pyviblib.util.misc.PropertiesContainer)
    Abstract base class for all parsers.
 
This class defines a set of protected methods which are called in the
constructor in the following sequence :
    _parse()              -- initialize some variables (*)
    _validate()           -- validate the read data (*)
 
The following static method is exported :
    get_description()     -- get the description of a parser (*)
 
Methods marked with an asterisk *must* be overridden in subclasses.
Their default implementations raise a NotImplementedError.
 
The following read-only common properties are exposed for all subclasses :
    filename              -- filename argument passed to the contructor
    Natoms                -- number of atoms in the molecule
    coords                -- cartesian coordinates
    elements              -- one-based list of elements
 
 
Method resolution order:
AbstractFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name or file object

Static methods defined here:
get_description()
Return the description of the parser.
 
Subclasses *must* override this static method.
Otherwise a NotImplementedError is raised.

Methods inherited from pyviblib.util.misc.PropertiesContainer:
__repr__(self)
Can be used to recreate an object with the same value.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class DaltonOutputParser(AbstractFileParser)
    Parser for DALTON 1.x or 2.x output files.
    
The following read-only properties are exposed :
    version         -- DALTON version
    NFreq           -- number of vibrations
    L               -- mass-weighted excursions for the vibrations
    Lx              -- cartesian excursions for the vibrations
    freqs           -- wavenumbers of vibrations in ascending order
    lambda_incident -- wavelength of the incident light  
    PP              -- gradients of the polarizability tensor
    PM              -- gradients of the G' tensor
    PQ              -- gradients of the A tensor (contracted)
    A               -- gradients of the A tensor (non-contracted)
    P               -- gradients of the electric dipole moment (APTs)
    M               -- gradients of the magnetic dipole moment (AATs)
 
 
Method resolution order:
DaltonOutputParser
AbstractFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name or file object
__repr__(self)
Can be used to recreate an object with the same value.

Static methods defined here:
get_description()
Get the description of the parser.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class FCHKFileParser(AbstractFileParser)
    Parser for Formatted Checkpoint files of Gaussian.
 
The following read-only properties are exposed :
    hessian         -- hessian matrix
    NBasis          -- number of basis function
    Etotal          -- total electronic energy in hartree
    comment         -- comment
    lambda_incident -- wavelength of the incident light  
    PP              -- gradients of the polarizability tensor
    PM              -- gradients of the G' tensor
    PQ              -- gradients of the A tensor (contracted)
    A               -- gradients of the A tensor (non-contracted)
    P               -- gradients of the electric dipole moment (APTs)
    M               -- gradients of the magnetic dipole moment (AATs)
 
 
Method resolution order:
FCHKFileParser
AbstractFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name or file object
__repr__(self)
Can be used to recreate an object with the same value.

Static methods defined here:
get_description()
Get the description of the parser.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class FCMINTFileParser(NumericDataFileParser)
    Parser for cartesian hessian files of AcesII (FCMINT).
 
The following read-only properties are exposed :
    Natoms  -- number of atoms
    hessian -- hessian
 
 
Method resolution order:
FCMINTFileParser
NumericDataFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name
__repr__(self)
Can be used to recreate an object with the same value.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class FittedSpectraFileParser(NumericDataFileParser)
    Parser for fitted spectra files of VOAPlot 4.2+.
 
This is *not* a subclass of AbstractFileParser.
 
The most important columns of fitted spectra files are :
  nu      raman     roa     degree_of_circularity
 
The following read-only properties are exposed :
    type          -- type of the spectrum
    molecule_name -- the molecule name
    data          -- matrix with all read data
    Npoints       -- number of points read
 
 
Method resolution order:
FittedSpectraFileParser
NumericDataFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name
__repr__(self)
Can be used to recreate an object with the same value.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class HESFileParser(AbstractFileParser)
    Parser for cartesian hessian files of DALTON (*.hes).
 
The following read-only properties are exposed :
    hessian -- hessian matrix
 
 
Method resolution order:
HESFileParser
AbstractFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, hesfile)
Constructor of the class.
 
Positional arguments :
hesfile -- file name
__repr__(self)
Can be used to recreate an object with the same value.

Static methods defined here:
get_description()
Get the description of the parser.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class MOLDENFileParser(AbstractFileParser)
    Parser for MOLDEN files.
 
Currently extracts only the geometry and normal modes of a molecule.
 
The following read-only properties are exposed :
    NFreq           -- number of vibrations
    L               -- mass-weighted excursions for the vibrations
    Lx              -- cartesian excursions for the vibrations
    freqs           -- wavenumbers of vibrations in ascending order
    comment         -- comment
 
 
Method resolution order:
MOLDENFileParser
AbstractFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name or file object
__repr__(self)
Can be used to recreate an object with the same value.

Static methods defined here:
get_description()
Get the description of the parser.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class NumericDataFileParser(pyviblib.util.misc.PropertiesContainer)
    Parser for files containing only numbers.
 
The following read-only property is exposed :
    data -- read data as ndarray
 
 
Method resolution order:
NumericDataFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename, ncols=None)
Constructor of the class.
 
Positional arguments :
filename -- file name
 
Keyword arguments :
ncols    -- number of columns to be read (default None)
__repr__(self)
Can be used to recreate an object with the same value.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class ParserFactory(__builtin__.object)
    Instantiating parser objects based on a file's extension.
 
The following extensions (case insensitive) are recognized :
    '.out'                -- Dalton 1.x and 2.0 output files
    '.fchk' '.fch' '.fck' -- Gaussian Formatted Checkpoint files
    '.dat' '.voa'         -- VOAVIEW files
    '.mol'                -- MOLDEN files
    '.xyz'                -- XMol XYZ files
 
The class exports the only static method create_parser().
 
  Static methods defined here:
create_parser(filename)
Create an appropriate parser.
 
The extension of the file is analyzed and the approapriate parser object
is instantiated and returned.
 
Positional arguments :
filename -- file name

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'ParserFactory' objects>
list of weak references to the object (if defined)

 
class VOAVIEWFileParser(AbstractFileParser)
    Parser for VOAVIEW files.
 
The following read-only properties are exposed :
    NFreq           -- number of vibrations
    L               -- mass-weighted excursions for the vibrations
    Lx              -- cartesian excursions for the vibrations
    freqs           -- wavenumbers of vibrations in ascending order
    PP              -- gradients of the polarizability tensor
    PM              -- gradients of the G' tensor
    PQ              -- gradients of the A tensor (contracted)
    lambda_incident -- wavelength of the incident light
 
The wavelength of the incident light is implied to be always 532 nm.
 
 
Method resolution order:
VOAVIEWFileParser
AbstractFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name or file object
__repr__(self)
Can be used to recreate an object with the same value.

Static methods defined here:
get_description()
Get the description of the parser.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
class XMolXYZFileParser(AbstractFileParser)
    Parser for XMol XYZ files.
 
The following read-only property is exposed :
    comment -- comment
 
 
Method resolution order:
XMolXYZFileParser
AbstractFileParser
pyviblib.util.misc.PropertiesContainer
__builtin__.object

Methods defined here:
__init__(self, filename)
Constructor of the class.
 
Positional arguments :
filename -- file name or file object
__repr__(self)
Can be used to recreate an object with the same value.

Static methods defined here:
get_description()
Get the description of the parser.

Data and other attributes inherited from pyviblib.util.misc.PropertiesContainer:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PropertiesContainer' objects>
list of weak references to the object (if defined)

 
Data
        __all__ = ['AbstractFileParser', 'DaltonOutputParser', 'FCHKFileParser', 'VOAVIEWFileParser', 'MOLDENFileParser', 'XMolXYZFileParser', 'HESFileParser', 'NumericDataFileParser', 'FittedSpectraFileParser', 'FCMINTFileParser', 'ParserFactory']
__author__ = 'Maxim Fedorovsky'

 
Author
        Maxim Fedorovsky