Skip to content
Alex Zech edited this page Mar 7, 2019 · 5 revisions

CCParser wiki!

New software / new method

  1. The parsing functions for every software are collected in one file.If it doesn't exist yet, create ccname.py where ccname is the label for the computational chemistry software. It will be called from Parser.load_methods() in Parser.py.

  2. Create a class for every method (or logical unit) derived from the CCParser class QCMethod, for instance:

    class SCF(QCMethod):
        def __init__(self):
            super().__init__()
            self.hooks = {}
    

How to implement new parsing functions

  1. Parsing functions should be member functions of a method class. All parsing functions must have two arguments:

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

    Such a function could look like this:

     @var_tag(VarNames.scf_nrg)
     def my_scf_energy(self, i, data):
         return float(data[l_index].split()[-1])
    

    The var_tag decorator is necessary to register the function's name to the list of parseable functions.

  2. 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 = {"my_scf_energy": "SCF Energy in (a.u.): "}
    
  3. In QCBase.py, add the target of your function to the class VarNames, for instance:

    scf_nrg = "scf_energy"
    
Clone this wiki locally