chr1shr / voro

Voro++: a three-dimensional Voronoi cell library in C++
Other
154 stars 44 forks source link

command line utility (voro++: File import error) #30

Open 49n3r opened 1 year ago

49n3r commented 1 year ago

I used the command line utility for my file but ut does not work. I am probably doing something wrong and need help

here are some of the outputs i get:

$ which voro++

/usr/local/bin/voro++

$ voro++ 1.7 -1 11.42 -1 11.42 -1 11.42 file.txt

voro++: Unrecognized command-line options; type "voro++ -h" for more information.

$ voro++ -c 1.7 -1 11.42 -1 11.42 -1 11.42 file.txt

voro++: File import error

This is the format of file.txt

1 2.2022195764 0.0882639228 0.2652000719 2 0.061581751 0.9691128644 0.2866639925 3 5.4166190508 5.3541257598 2.620338246 4 1.6310048028 1.6326451092 4.3502133366 5 2.7096653697 0.6759740358 4.4542436774 6 0.3643502753 0.9240571118 4.5976255654 7 4.5862121436 1.9835610692 3.7784469093 8 4.0829712416 0.7441541825 4.2161691391 9 5.2724841356 4.028051288 2.9595762809 10 1.7034971813 2.9943995924 4.0509491695 11 0.4745472907 3.7241880652 4.0212346382 12 0.7596018007 5.1113110828 3.7226285345 13 2.2467716391 5.2040868219 3.5679059473 14 2.8257309397 3.8742132526 3.7674502882 15 4.1257520881 3.3557331052 3.5621434363 16 1.3031302888 1.5258780961 8.3183619035 17 2.6838537043 1.4291649176 8.0343168416 18 3.5019432891 2.5179376873 7.5111683185 19 5.3897838719 0.7850666458 7.5980058469 20 4.8528646713 2.1281372622 7.2049581742 21 0.746083309 2.8157883653 8.1837581849 22 0.7571463583 5.1937767629 7.6461557258 23 1.4673383034 3.9351736932 7.7037156419 24 4.8279491076 5.0031735687 6.0510078664 25 3.4626047744 4.9470427667 6.5944297033 26 2.8540016376 3.8118939667 7.2787048482 27 3.2001550244 0.1631769742 8.3226402782 28 0.5028964084 0.4017329886 8.7934080307 29 1.9439231676 2.3926837946 10.849739634 30 0.615337097 2.1788986379 11.2476402333 31 2.6863251027 1.2400779118 11.0496817175 32 4.7735738509 5.0292918775 9.9451946222 33 4.0117160924 1.3723532215 10.8056962156 ...

chr1shr commented 1 year ago

There is small issue with your command-line arguments. You don't need the 1.7 entry. Furthermore the -c option expects the next entry to be a custom output string. Hence, currently you are specifying 1.7 as the custom output string.

You could run Voro++ by omitting the -c and the 1.7 options like this:

voro++ -1 11.42 -1 11.42 -1 11.42 file.txt

Alternatively if you wanted to specify a custom output string (e.g. %i %q %v) you could write

voro++ -c "%i %q %v" -1 11.42 -1 11.42 -1 11.42

This small issue doesn't explain why you are getting the "File import error", though. From the text you included, it looks like your input file has the correct format with four entries per line, so I am not sure what is going on. But here are two options you could try.

Option 1. The main thing that Voro++ looks for is that the number of entries in the file is divisible by four. It might be that there is some problem later in the file. You could test this by making a small input data file with just the first 32 lines in, to see if it works with that.

Option 2. There is a troublesome and pervasive issue where newline characters on Linux/Mac operating systems are different from those on Windows/DOS systems. This is due to some fateful historical decisions that were made as these systems were developed. This has caused huge problems ever since, and it means that if you open text files created on one system in programs on another system, the newlines can be interpreted incorrectly. This is a broad issue that affects many programs, and not just Voro++.

This might have happened if you are running the program on a different operating system from where the input file was originally generated. Indeed, it can happen even on the same operating system: suppose you have a Mac and you output a CSV file using the Mac version of Excel, then because Excel is a Microsoft program, it will use the Windows newlines.

There are two small utilities called dos2unix and unix2dos that can convert files between the two newline formats. So you could try running those on your data file. You can read more about this problem online, and some text editors (e.g. Vim) will tell you what format a text file is using.