Author Topic: Open a xyz file with quaternion's orientatiton  (Read 324 times)

ramonjgt

  • Newbie
  • *
  • Posts: 3
Open a xyz file with quaternion's orientatiton
« on: March 19, 2018, 06:24:49 AM »
Hi, good night.

My problem is the next, I have a file with seven columns. The first three are the xyz components of the position of each atom, and the last four are the xyzw components of the orientation by a quaternion. When I open the file, I tell to ovito what is each column but only display 4 atoms of the 80000.

Any idea of the problem?  :( :(

P.S: I attachment an image of my xyz file and the configuration on ovito

Alexander Stukowski

  • Administrator
  • Sr. Member
  • *****
  • Posts: 409
Re: Open a xyz file with quaternion's orientatiton
« Reply #1 on: March 19, 2018, 08:57:46 AM »
Hi,

Two problems here:

Your file doesn't follow the specification of the XYZ format. Note that an XYZ file should begin with the number of atoms on the first line, followed by a comment line, followed by the actual data columns. Your file is lacking the first two header lines. The second problem is on OVITO's side: The program doesn't recognize the format error and reads the number of atom from the first line, which starts with "4.549...". The file parser simply takes this as a "4" and reads four particles starting at line 3. I think this is a bug in the program: OVITO is too tolerant and should instead inform you about the fact that the first line doesn't consist of a single integer number. I will try to fix this in the code.

Here is another useful hint: There exists an extended XYZ file format specification, which OVITO can parse:  http://libatoms.github.io/QUIP/io.html#module-ase.io.extxyz

This extension allows you to embed parsing information in the second line of the XYZ file, the comment line, telling OVITO how to interpret  the 7 columns of your file. You should add the following two lines to the header of your file and OVITO will load the file without even asking you for the meaning of the 7 columns:

Code: [Select]
80000
Properties=pos:R:3:orientation:R:4
4.5493... ... ... ... ... ... ....

-Alex
« Last Edit: March 19, 2018, 09:01:13 AM by Alexander Stukowski »

ramonjgt

  • Newbie
  • *
  • Posts: 3
Re: Open a xyz file with quaternion's orientatiton
« Reply #2 on: March 19, 2018, 05:29:36 PM »
Thank you very much, now I can see all the particles. But now I have a new question, I put other three columns for the Aspherical Shape of the particles, but in the extended xyz I don't know how to put that properties in the second line. What is the keyword for Aspherical Shape?

Code: [Select]
80000
Properties=pos:R:3:orientation:R:4??????
4.5493... ... ... ... ... ... ....

Alexander Stukowski

  • Administrator
  • Sr. Member
  • *****
  • Posts: 409
Re: Open a xyz file with quaternion's orientatiton
« Reply #3 on: March 19, 2018, 05:41:05 PM »
Well, unfortunately, the Aspherical Shape property is not automatically mapped yet. You can look up the keywords to put in the XYZ file header for the various standard properties in the source code here:

https://gitlab.com/stuko/ovito/blob/master/src/plugins/particles/import/xyz/XYZImporter.cpp#L169-201

I will add the Aspherical Shape property to the code and publish a new development version of OVITO within the coming days. In the meantime, you have to go back to the standard XYZ format and set up the mapping of columns to particle properties by hand.

Alexander Stukowski

  • Administrator
  • Sr. Member
  • *****
  • Posts: 409
Re: Open a xyz file with quaternion's orientatiton
« Reply #4 on: March 19, 2018, 09:32:29 PM »
I've already put a new program version online (3.0.0-dev146) which contains the small addition mentioned above. With this version, you should be able to read extended XYZ files containing a field specification like this:

Code: [Select]
Properties=pos:R:3:orientation:R:4:aspherical_shape:R:3

ramonjgt

  • Newbie
  • *
  • Posts: 3
Re: Open a xyz file with quaternion's orientatiton
« Reply #5 on: March 21, 2018, 12:52:51 AM »
Ok, thanks a lot for your help and time  :)