Francesco Pietra ha scritto:
I come 'naked', which is unusual and unfair. However, I find it
difficult to give a correct start. The files consist, among other
things, of a huge number of blocks of the type
NSTEP = 1000 TIME(PS) = 152.000 TEMP(K) = 298.54 PRESS =89.4
Etot =
her blocks in the output file is the same.
francesco
-- Forwarded message --
From: Francesco Pietra
Date: Mon, Jun 8, 2009 at 11:55 PM
Subject: Re: Extract value and average
To: Tim Chase
On Mon, Jun 8, 2009 at 8:54 PM, Tim Chase wrote:
>> Of the various suggestions, of which I am most gra
Tim Chase wrote:
I would like to extract values corresponding to variable DIHED (here
4660.1650) and getting also the mean value from all DIHED.
To just pull the DIHED values, you can use this:
import re
find_dihed_re = re.compile(r'\bDIHED\s*=\s*([.-e\d]+)', re.I)
total = count = 0
Steven D'Aprano wrote:
...
Assuming no DIHED value will ever be split over two lines:
data = open(filename)
values = []
for line in data:
if line and line.strip(): # ignore blanks
words = line.strip().split()
words = line.split() # does the same as above
try:
On Mon, 08 Jun 2009 17:29:12 +0100, Steven D'Aprano
wrote:
On Mon, 08 Jun 2009 18:13:50 +0200, Francesco Pietra wrote:
I come 'naked', which is unusual and unfair.
???
Yeah, I had to go and scrub my brain out :-)
Assuming no DIHED value will ever be split over two lines:
data = open
Steven D'Aprano wrote:
On Mon, 08 Jun 2009 18:13:50 +0200, Francesco Pietra wrote:
I come 'naked', which is unusual and unfair.
???
However, I find it
difficult to give a correct start. The files consist, among other
things, of a huge number of blocks of the type
NSTEP = 1000 TIME(
I would like to extract values corresponding to variable DIHED (here
4660.1650) and getting also the mean value from all DIHED.
To just pull the DIHED values, you can use this:
import re
find_dihed_re = re.compile(r'\bDIHED\s*=\s*([.-e\d]+)', re.I)
total = count = 0
for line in file('fi
On Mon, 08 Jun 2009 18:13:50 +0200, Francesco Pietra wrote:
> I come 'naked', which is unusual and unfair.
???
> However, I find it
> difficult to give a correct start. The files consist, among other
> things, of a huge number of blocks of the type
>
>
> NSTEP = 1000 TIME(PS) = 152.
Francesco Pietra wrote:
I come 'naked', which is unusual and unfair. However, I find it
difficult to give a correct start. The files consist, among other
things, of a huge number of blocks of the type
NSTEP = 1000 TIME(PS) = 152.000 TEMP(K) = 298.54 PRESS =89.4
Etot = -1
I come 'naked', which is unusual and unfair. However, I find it
difficult to give a correct start. The files consist, among other
things, of a huge number of blocks of the type
NSTEP = 1000 TIME(PS) = 152.000 TEMP(K) = 298.54 PRESS =89.4
Etot = -134965.2123 EKtot =
10 matches
Mail list logo