Re: 'cutting' colvars.traj file

From: Branko (bdrakuli_at_chem.bg.ac.rs)
Date: Tue May 03 2011 - 06:41:34 CDT

Bjoern,

 From command line (not Python shell) both scripts (previous and
instant) works great, even under win. As a note, all calculation were
done in Linux, so end of lines in input files are Unix stile. So far
there is no need to change scripts, but I'll have in mind end of lines
note as you mention.

Kind regards

Branko

On 5/3/2011 12:45 PM, Bjoern Olausson wrote:
> On Monday 02 May 2011 19:34:26 you wrote:
>> Hi Bjoern,
>>
>> Unfortunately, same problem in Linux, I suppose that "header" line in
>> colvars.traj file could be a problem, so I try to delete this line
>> manually, but file is huge and could not be edited because I have no
>> enough memory in computer (still configuration is OK). Please let me
>> know which version of python you use in order to try to really be able
>> to use script. Out the script problem, I simply try to obtain rgyr (that
>> I use as one of colvars) for my simulations and very obviously that NAMD
>> "write" this data (numerical values of rgyr) in different way comparing
>> to tools that I am able to use for analysis (VMD with script, VegaZZ,
>> PluMed). Because of that I was really satisfied when conclude that 2.8
>> indeed write colvars.traj, you see the rest of story..
>>
>> Kind regards
> Regarding your tries under Windows/Linux:
> No matter what OS you use, start cattraj.py with python and not from within
> the python shell. You approach is completely wrong. The same syntax applies to
> Windows and Linux:
>
> If Python is in the Windows/Linux executable path type:
> python cattraj.py -f 1 -l 500 -s 2 -i test.traj -o test.out
>
> If Python is not in the Windows/Linux executable path, type:
> /your/path/to/python cattraj.py -f 1 -l 500 -s 2 -i test.traj -o test.out
>
>
> The header has nothing to do with my script.
> My script is "stupid", it simply counts lines and ignores commented (#) lines.
> Thats it. You could basically run this script on any file, even on some lyrics
> text, and it would print out something.
>
> Memory shouldn't be a problem with my script, since I read a line and dump it
> to the new file, I don't glob the entire file to memory. This might not be the
> fastest way, but spares memory.
>
> I am using Python 2.6 but it works with 2.7 and 3.1.
> As you can see it works for me with all versions (for python 3 I had to change
> the print syntax slightly, or simply use 2to3 to convert it).
>
> I uploaded a newer version (v1.1) with cleaner indentation (Your error might
> be related) and a default output file value of "cattraj.out.traj" so the "-o"
> option is no longer mandatory.
> http://olausson.de/downloads/view.download/6/13
>
> Please keep in mind that Linux uses UNIX-Style line-breaks, just in case you
> want to edit the file under Windows.
>
>
> ~~~~~Python 2.6.6~~~~~
> #python2.6 cattraj.py -f 1 -l 500 -s 2 -i test.traj -o test.out
>
> Reading colvars.traj
> Frames - r: 500
> Frames - w: 250
>
> -----------------------------------
> -----------------------------------
> Overall frames - r: 500
> Overall frames - w: 250
>
>
> ~~~~~Python 2.7.1~~~~~
> #python2.7 cattraj.py -f 1 -l 500 -s 2 -i test.traj -o test.out
>
> Reading test.traj
> Frames - r: 500
> Frames - w: 250
>
> -----------------------------------
> -----------------------------------
> Overall frames - r: 500
> Overall frames - w: 250
>
>
> ~~~~~Python 3.1.3~~~~~
> python3.1 cattraj3.py -f 1 -l 500 -s 2 -i test.traj -o test.out
>
> Reading test.traj
> Frames - r: 500
> Frames - w: 250
>
> -----------------------------------
> -----------------------------------
> Overall frames - r: 500
> Overall frames - w: 250
>
>
>
> Cheers,
> Bjoern
>

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 05:23:53 CST