Pallavi-Banerjee21 / votca

Automatically exported from code.google.com/p/votca
0 stars 0 forks source link

(Convert)ToVector after getline fails for files with windows line ending #146

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If one reads a line from a file with windows line ending (\r\n) and calls 
ToVector afterwards the \r will screw up things.

Steps:
1.) Get http://www.ccp5.ac.uk/DL_POLY/TUTORIAL/EXERCISES/TEST9.tar.gz
2.) Run csg_stat --top .dpoly
bad lexical cast: source type value could not be interpreted as target
3.) perl -pi -e 's/\r\n/\n/g' CONFIG
4.) Run csg_stat --top .dpoly

Works!

After discussing with Victor, I think, we have two possible solutions:
- implement our own getline, which removes \r and the normal end (\n)
- tokenize not only in spaces, but also in all kind of whitespaces 
(\n,\t,\r,space).

Denis, any opinion on that?

Original issue reported on code.google.com by christop...@gmail.com on 11 Nov 2013 at 8:50

GoogleCodeExporter commented 8 years ago
i would add \r to the tokenizer. can you also post .dpoly?
i hope ms word format support is not planned ;)

Original comment by andrienko@googlemail.com on 11 Nov 2013 at 9:26

GoogleCodeExporter commented 8 years ago
I agree with Denis...

Original comment by abruk...@googlemail.com on 11 Nov 2013 at 9:29

GoogleCodeExporter commented 8 years ago
".dploy" just means read from the default dlpoly files, which are FIELD and 
CONFIG (inside TEST9.tar.gz).

This problem can appear whenever we read a file with Windows line endings, in 
csg that would be the lammps, dlpoly, gro and the xyz reader.

Original comment by christop...@gmail.com on 11 Nov 2013 at 9:41

GoogleCodeExporter commented 8 years ago
ok, then post options.xml? csg_stat --top .dpoly tells "missing argument 
options". 
if you want to make all of the code windows-compatible then overwriting getline 
is a cleaner solution but is also quite some work. i would make a quick fix of 
the current problem and hope that similar issues will not show up too often ;)

Original comment by andrienko@googlemail.com on 11 Nov 2013 at 9:58

GoogleCodeExporter commented 8 years ago
Sorry, it should be csg_dump instead of csg_stat!

Original comment by christop...@gmail.com on 11 Nov 2013 at 10:01

GoogleCodeExporter commented 8 years ago
#include <votca/tools/getline.h> should do the job for you. To test I need to 
see where this is called in csg_dump - could not find exact place where DLPOLY 
io calls getline.

Original comment by andrienko@googlemail.com on 12 Nov 2013 at 8:23

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 70a7028c55fb.

Original comment by jungh...@votca.org on 12 Nov 2013 at 4:16