Skip to content
Alex Zech edited this page Sep 26, 2017 · 5 revisions

CCParser wiki!

How to implement new parsing functions

  1. If it doesn't exist yet, create qcname.py where qcname is the label for the quantum chemistry software.

  2. Create a class for every method derived from the CCParser class QCMethod, for instance:

    class SCF(QCMethod):
        def __init__(self):
            super().__init__()
            self.hooks = {}
    
  3. Implement a new parsing function. All parsing functions must have two arguments:

    • l_index - the line index
    • data - the file content (file.readlines())

    Such a function could look like this:

     def scf_energy(self, l_index, data):
         self.add_variable(self.func_name(), VarNames.scf_energy)
         return float(data[l_index].split()[-1])
    

    The first line after the def statement is necessary to register the function's name to the list of parsable functions.

  4. Create a hook for the new function. The hook identifies the same line as the desired quantity or a line close to it. The entry into the hooks dictionary is created as follows: Use the function's name as the key and the identifying string as the value, for instance:

    self.hooks = {"scf_energy": "SCF Energy in (a.u.): "}
    
  5. In QCBase.py, add your function to the class VarNames.

Clone this wiki locally