|
| 1 | +How to parse and write |
| 2 | +====================== |
| 3 | + |
| 4 | +The cclib package provides three scripts to parse and write data i.e. ``ccget``, ``ccwrite``, and ``cda`` |
| 5 | + |
| 6 | +1. **ccget** is used to parse attribute data from output files. |
| 7 | +2. **ccwrite** has the ability to list out all valid attribute data that can be parsed from an output format. It has the added feature of writing the output file into four different formats i.e. ``json``, ``cjson``, ``cml``, ``xyz``. |
| 8 | +3. **cda** is used for the chemical decomposition analysis of output files. |
| 9 | + |
| 10 | +This page describes how to use the ccget and ccwrite scripts to obtain data from output files. |
| 11 | + |
| 12 | +ccget |
| 13 | +----- |
| 14 | + |
| 15 | +The data types that can be parsed from the output file depends on the type of computation being conducted. The name of the output file used to show example usage is ``Benzeneselenol.out``. |
| 16 | + |
| 17 | +Data type can be parsed from the output file by following this format |
| 18 | + |
| 19 | +.. code-block:: bash |
| 20 | + |
| 21 | + ccget <attribute> [<attribute>] <CompChemLogFile> [<CompChemLogFile>] |
| 22 | + |
| 23 | +where attribute can be any one of the attribute names available `here`_ |
| 24 | + |
| 25 | +.. _`here`: data_dev.html |
| 26 | + |
| 27 | +1. Atomic Charges |
| 28 | + The atomic charges are obtained by using the ``atomcharges`` attribute with ``ccget`` |
| 29 | + |
| 30 | +.. code-block:: bash |
| 31 | + |
| 32 | + $ ccget atomcharges Benzeneselenol.out |
| 33 | + Attempting to read Benzeneselenol.out |
| 34 | + atomcharges: |
| 35 | + {'mulliken': array([-0.49915 , 0.056965, 0.172161, 0.349794, -0.153072, 0.094583, |
| 36 | + 0.016487, 0.050249, 0.002149, 0.01161 , 0.053777, -0.173671, |
| 37 | + 0.018118])} |
| 38 | + |
| 39 | +2. Electronic Energies |
| 40 | + The molecular electronic energies after SCF (DFT) optimization of the input molecule is obtained by using the ``scfenergies`` attribute with ``ccget`` |
| 41 | + |
| 42 | +.. code-block:: bash |
| 43 | + |
| 44 | + $ ccget scfenergies Benzeneselenol.out |
| 45 | + Attempting to read Benzeneselenol.out |
| 46 | + scfenergies: |
| 47 | + [-71671.43702915 -71671.4524142 -71671.4534768 -71671.45447492 |
| 48 | + -71671.4556548 -71671.45605671 -71671.43194906 -71671.45761021 |
| 49 | + -71671.45850275 -71671.39630296 -71671.45915119 -71671.45935854 |
| 50 | + -71671.4594614 -71671.45947338 -71671.45948807 -71671.4594946 |
| 51 | + -71671.4594946 ] |
| 52 | + |
| 53 | + |
| 54 | +3. Geometry Targets |
| 55 | + The targets for convergence of geometry optimization can be obtained by using the ``geotargets`` attribute with ``ccget`` |
| 56 | + |
| 57 | +.. code-block:: bash |
| 58 | + |
| 59 | + $ ccget geotargets Benzeneselenol.out |
| 60 | + Attempting to read Benzeneselenol.out |
| 61 | + geotargets: |
| 62 | + [ 0.00045 0.0003 0.0018 0.0012 ] |
| 63 | + |
| 64 | +**Chaining of attributes** |
| 65 | + |
| 66 | +ccget provides the user with the option to chain attributes to obtain more than one type of data with a command call. The attributes can be chained in any particular order. A few chained examples are provided below. |
| 67 | + |
| 68 | +1. Molecular Orbitals and Multiplicity |
| 69 | + The number of molecular orbitals and the number of basis functions used to optimize the molecule can be obtained by running the following command |
| 70 | + |
| 71 | +.. code-block:: bash |
| 72 | + |
| 73 | + $ ccget nmo nbasis Benzeneselenol.out |
| 74 | + Attempting to read Benzeneselenol.out |
| 75 | + nmo: |
| 76 | + 405 |
| 77 | + nbasis: |
| 78 | + 407 |
| 79 | + |
| 80 | +2. Enthalpy and Vibrational Frequency |
| 81 | + The enthalpy and the vibrational frequencies of the optimized molecule is conducted is obtained below: |
| 82 | + |
| 83 | +.. code-block:: bash |
| 84 | + |
| 85 | + $ ccget enthalpy vibfreqs Benzeneselenol.out |
| 86 | + Attempting to read Benzeneselenol.out |
| 87 | + enthalpy: |
| 88 | + -2633.77264 |
| 89 | + vibfreqs: |
| 90 | + [ 129.5512 170.6681 231.4278 304.8614 407.8299 472.5026 |
| 91 | + 629.9087 679.9032 693.2509 746.7694 812.5113 850.2578 |
| 92 | + 915.8742 987.1252 988.1785 1002.8922 1038.1073 1091.4005 |
| 93 | + 1102.3417 1183.3857 1209.2727 1311.3497 1355.6441 1471.4447 |
| 94 | + 1510.1919 1611.9088 1619.0156 2391.2487 3165.1596 3171.3909 |
| 95 | + 3182.0753 3188.5786 3198.0359] |
| 96 | + |
| 97 | +ccwrite |
| 98 | +------- |
| 99 | + |
| 100 | +The same Benzeneselenol.out file used in the previous examples will be used as the input file for ccwrite. When the ccwrite script is used with a valid input, it prints out the valid attributes that can be parsed from the file. |
| 101 | + |
| 102 | +Command line format: |
| 103 | + |
| 104 | +.. code-block:: bash |
| 105 | + |
| 106 | + ccwrite <OutputFileFormat> <CompChemLogFile> [<CompChemLogFile>] |
| 107 | + |
| 108 | +The valid output file formats are ``json``, ``cjson``, ``cml``, ``xyz`` |
| 109 | + |
| 110 | +1. CML |
| 111 | + |
| 112 | +.. code-block:: bash |
| 113 | + |
| 114 | + $ ccwrite cml Benzeneselenol.out |
| 115 | + Attempting to parse Benzeneselenol.out |
| 116 | + cclib can parse the following attributes from Benzeneselenol.out: |
| 117 | + atomcharges |
| 118 | + atomcoords |
| 119 | + atomnos |
| 120 | + charge |
| 121 | + coreelectrons |
| 122 | + enthalpy |
| 123 | + geotargets |
| 124 | + geovalues |
| 125 | + grads |
| 126 | + homos |
| 127 | + moenergies |
| 128 | + mosyms |
| 129 | + mult |
| 130 | + natom |
| 131 | + nbasis |
| 132 | + nmo |
| 133 | + optdone |
| 134 | + optstatus |
| 135 | + scfenergies |
| 136 | + scftargets |
| 137 | + temperature |
| 138 | + vibdisps |
| 139 | + vibfreqs |
| 140 | + vibirs |
| 141 | + vibsyms |
| 142 | + |
| 143 | +A *Benzeneselenol.cml* output file is generated in the same directory as the Benzeneselenol.out file. |
| 144 | + |
| 145 | +.. code-block:: bash |
| 146 | + |
| 147 | + <?xml version='1.0' encoding='utf-8'?> |
| 148 | + <molecule id="Benzeneselenol.out" xmlns="http://www.xml-cml.org/schema"> |
| 149 | + <atomArray> |
| 150 | + <atom elementType="C" id="a1" x3="-2.8947620000" y3="-0.0136420000" z3="-0.0015280000" /> |
| 151 | + <atom elementType="C" id="a2" x3="-2.2062510000" y3="1.1938510000" z3="-0.0025210000" /> |
| 152 | + <atom elementType="C" id="a3" x3="-0.8164260000" y3="1.2153020000" z3="-0.0022010000" /> |
| 153 | + <atom elementType="C" id="a4" x3="-0.1033520000" y3="0.0183920000" z3="0.0031060000" /> |
| 154 | + <atom elementType="C" id="a5" x3="-0.7906630000" y3="-1.1943840000" z3="0.0058500000" /> |
| 155 | + <atom elementType="C" id="a6" x3="-2.1799570000" y3="-1.2059710000" z3="0.0017890000" /> |
| 156 | + <atom elementType="H" id="a7" x3="-3.9758430000" y3="-0.0253010000" z3="-0.0029040000" /> |
| 157 | + <atom elementType="H" id="a8" x3="-2.7502340000" y3="2.1291370000" z3="-0.0052760000" /> |
| 158 | + <atom elementType="H" id="a9" x3="-0.2961840000" y3="2.1630180000" z3="-0.0073260000" /> |
| 159 | + <atom elementType="H" id="a10" x3="-0.2474670000" y3="-2.1302310000" z3="0.0132260000" /> |
| 160 | + <atom elementType="H" id="a11" x3="-2.7028960000" y3="-2.1530750000" z3="0.0036640000" /> |
| 161 | + <atom elementType="Se" id="a12" x3="1.8210800000" y3="-0.0433780000" z3="-0.0038760000" /> |
| 162 | + <atom elementType="H" id="a13" x3="2.0043580000" y3="1.4100070000" z3="0.1034490000" /> |
| 163 | + </atomArray> |
| 164 | + <bondArray> |
| 165 | + <bond atomRefs2="a9 a3" order="1" /> |
| 166 | + <bond atomRefs2="a8 a2" order="1" /> |
| 167 | + <bond atomRefs2="a12 a4" order="1" /> |
| 168 | + <bond atomRefs2="a12 a13" order="1" /> |
| 169 | + <bond atomRefs2="a7 a1" order="1" /> |
| 170 | + <bond atomRefs2="a2 a3" order="2" /> |
| 171 | + <bond atomRefs2="a2 a1" order="1" /> |
| 172 | + <bond atomRefs2="a3 a4" order="1" /> |
| 173 | + <bond atomRefs2="a1 a6" order="2" /> |
| 174 | + <bond atomRefs2="a6 a11" order="1" /> |
| 175 | + <bond atomRefs2="a6 a5" order="1" /> |
| 176 | + <bond atomRefs2="a4 a5" order="2" /> |
| 177 | + <bond atomRefs2="a5 a10" order="1" /> |
| 178 | + </bondArray> |
| 179 | + </molecule> |
| 180 | + |
| 181 | +2. xyz |
| 182 | + |
| 183 | +Using ``xyz`` as the <OutputFileFormat> with Benzeneselenol.out, we obtain the following *Benzeneselenol.xyz* file |
| 184 | + |
| 185 | +.. code-block:: bash |
| 186 | + |
| 187 | + 13 |
| 188 | + Benzeneselenol.out: Geometry 17 |
| 189 | + C -2.8947620000 -0.0136420000 -0.0015280000 |
| 190 | + C -2.2062510000 1.1938510000 -0.0025210000 |
| 191 | + C -0.8164260000 1.2153020000 -0.0022010000 |
| 192 | + C -0.1033520000 0.0183920000 0.0031060000 |
| 193 | + C -0.7906630000 -1.1943840000 0.0058500000 |
| 194 | + C -2.1799570000 -1.2059710000 0.0017890000 |
| 195 | + H -3.9758430000 -0.0253010000 -0.0029040000 |
| 196 | + H -2.7502340000 2.1291370000 -0.0052760000 |
| 197 | + H -0.2961840000 2.1630180000 -0.0073260000 |
| 198 | + H -0.2474670000 -2.1302310000 0.0132260000 |
| 199 | + H -2.7028960000 -2.1530750000 0.0036640000 |
| 200 | + Se 1.8210800000 -0.0433780000 -0.0038760000 |
| 201 | + H 2.0043580000 1.4100070000 0.1034490000 |
0 commit comments