From owner-chemistry@ccl.net Fri Feb 23 00:34:00 2018 From: "Karol Langner karol.langner()gmail.com" To: CCL Subject: CCL: Use cclib functionality as part of Python script? Message-Id: <-53204-180223003234-30748-ERoALyZkYgZ6BqC9EyV6Vg * server.ccl.net> X-Original-From: Karol Langner Content-Type: multipart/alternative; boundary="001a1143d3acf3e7470565da7b91" Date: Thu, 22 Feb 2018 21:32:20 -0800 MIME-Version: 1.0 Sent to CCL by: Karol Langner [karol.langner*o*gmail.com] --001a1143d3acf3e7470565da7b91 Content-Type: text/plain; charset="UTF-8" Hi Francisco, Here's one way to do it: import cclib logfile = cclib.parser.ccopen('filename.out') data = logfile.parse() print data.ccenergies On Thu, Feb 22, 2018 at 2:21 PM, Guzman, Francisco fg58_-_njit.edu < owner-chemistry^^ccl.net> wrote: > Hello CCL'ers > > Does anyone have experience using/importing parts cclib as part of a > Python script? > > I want to be able to extract the CCSD(T) energies, convert from eV to > Hartrees, and use plug these energies into an equation extrapolation to the > CBS limit. This is straight forward enough to do in bash, but I can't > extract these energies the same way I would using a terminal using a Python > script. > > Using a terminal, I can extract the energies executing: > ccget ccenergies filname.out > > However, I want to be able to store this ouput as a new variable as part > of a larger Python script I am making for my own post processing. > > I've tried to "import cclib" in my script, but I don't know how to repeat > the output of "ccget ccenergies" as I would using a terminal. > > Thanks, > > /python novice > > -- > Francisco Guzman > PhD Candidate > Otto H. York Department of Chemical, Biological and Pharmaceutical > Engineering > New Jersey Institute of Technology > Email: fg58---njit.edu, guzman.research---gmail.com > --001a1143d3acf3e7470565da7b91 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Francisco,

Here's one way to do = it:

import cclib
logfile =3D cclib.parse= r.ccopen('filename.out')
data =3D logfile.parse()
print data.ccenergies


On Thu, Feb 22, 2018 at 2:21 PM, Guzman, = Francisco fg58_-_njit.edu <o= wner-chemistry^^ccl.net> wrote:
Hello CCL'ers

Does any= one have experience using/importing parts cclib as part of a Python script?=

I want to be able to extract the CCSD(T) energies, convert from eV= to Hartrees, and use plug these energies into an equation extrapolation to= the CBS limit. This is straight forward enough to do in bash, but I can= 9;t extract these energies the same way I would using a terminal using a Py= thon script.

Using a terminal, I can extract the energies exec= uting:
ccget ccenergies filname.out

However, I want to be able to store this ouput a= s a new variable as part of a larger Python script I am making for my own p= ost processing.

I've tried to "import cclib&quo= t; in my script, but I don't know how to repeat the output of "ccg= et ccenergies" as I would using a terminal.

Thanks,<= br>
/python novice
=

--
Francisco Guzman
PhD Candidate
Otto H. York Department of Chemical, Biologic= al and Pharmaceutical Engineering
New Jersey Institute of Technology

--001a1143d3acf3e7470565da7b91-- From owner-chemistry@ccl.net Fri Feb 23 05:23:01 2018 From: "=?iso-8859-1?Q?V=EDctor_Lua=F1a?= Cabal victor##fluor.quimica.uniovi.es" To: CCL Subject: CCL: Use cclib functionality as part of Python script? Message-Id: <-53205-180223051659-17537-kuOn/jYh9qd8O0coJBtaaA,,server.ccl.net> X-Original-From: =?iso-8859-1?Q?V=EDctor_Lua=F1a?= Cabal Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1 Date: Fri, 23 Feb 2018 10:09:51 +0100 MIME-Version: 1.0 Sent to CCL by: =?iso-8859-1?Q?V=EDctor_Lua=F1a?= Cabal [victor:-:fluor.quimica.uniovi.es] On Thu, Feb 22, 2018 at 05:21:13PM -0500, Guzman, Francisco fg58_-_njit.edu wrote: > Hello CCL'ers > > Does anyone have experience using/importing parts cclib as part of a Python > script? > > I want to be able to extract the CCSD(T) energies, convert from eV to > Hartrees, and use plug these energies into an equation extrapolation to the > CBS limit. This is straight forward enough to do in bash, but I can't > extract these energies the same way I would using a terminal using a Python > script. > > Using a terminal, I can extract the energies executing: > ccget ccenergies filname.out > > However, I want to be able to store this ouput as a new variable as part of > a larger Python script I am making for my own post processing. > > I've tried to "import cclib" in my script, but I don't know how to repeat > the output of "ccget ccenergies" as I would using a terminal. Francisco, Why don't you create a bash script? You don't need to ask anybody using his/her time to help you. If ccget already works on your terminal #! /bin/bash energy=$(ccget ccenergies filname.out) ... When you are more proficient with python ... Best regards, Víctor Luaña -- . . "Never let your sense of morals prevent you from / `' \ doing what is right." /(o)(o)\ -- Salvor Hardin, "Foundation" /`. \/ .'\ / '`'` \ "Freedom!, freedom!, freedom! After that put whatever | \'`'`/ | term you like" | |'`'`| | --Largo Caballero (socialist, spanish president in the exile, \/`'`'`'\/ shortly before dying) ==(((==)))===================================+=========================== ! Dr.Víctor Luaña, in silico chemist & prof. ! ! Departamento de Química Física y Analítica ! ! Universidad de Oviedo, 33006-Oviedo, Spain ! ! e-mail: ! ! phone: +34-984080927 fax: +34-985103125 ! +--------------------------------------------+ GroupPage: Articles: git-hub: ORCID: 0000-0003-4585-4627; RID: H-2045-2015