Author Topic: Error involving particles xyz positions at 0/  (Read 273 times)

benjy

  • Newbie
  • *
  • Posts: 8
Error involving particles xyz positions at 0/
« on: April 11, 2019, 09:40:55 PM »
Hello, I'm currently having two problems.

First is regarding creating movies for some of my files, which are simple 3 atom simulations in the XYZ format, so I'm just passing in the atom type, and the xyz positions, and using the Affine Transformation to create a box around the particles for visualization purposes. For one of them, multiple atoms have a position that has an x, y, or z position at 0. At these frames the transformation gives an error, "Input simulation cell does not exist or is degenerate. Transformation to target cell would be singular." I'm not sure why its doing this.


I've also been running variations on a script for RDF calculation on the same XYZ files and it seems to run fine, however when it finishes the built in terminal gives this error: "Invalid Python script. It does not define the function named modify().". I've been having issues getting the results of the RDF script to agree with other sources, and was wondering if anyone could potentially have insight into what's going wrong. I've attached the python script in question.

Constanze Kalcher

  • Administrator
  • Sr. Member
  • *****
  • Posts: 299
Re: Error involving particles xyz positions at 0/
« Reply #1 on: April 15, 2019, 04:59:12 PM »
Hello benjy,

the basic XYZ format does not contain simulation cell information. OVITO takes the axis-aligned bounding box of particles as the simulation box instead. In your case of only 3 particles that might not always work properly
and then the Affine Transformation modifier cannot be applied onto a non-exisiting cell. In order to avoid this, I would recommend to use the extended http://libatoms.github.io/QUIP/io.html#module-ase.io.extxyz xyz format instead, which includes an extra line in the header that contains information on the simulation cell.

Please also have a look at the introduction on running scripts first:
http://www.ovito.org/manual_testing/python/introduction/running.html
Running a stand alone batch script (like the one you attached) using the ovitos script interpreter and defining a custom modifier function with the Python script modifier in the GUI are two different things.

In short, in order to fix your problem you should not use the Affine Transformation modifier. Instead, please use a Python script modifier, edit the script and insert the function set_cell() from your attached batch script. However, you need to make sure that when you do that in the GUI, the function has to be named modify(), that's why OVITO is complaining.

Code: [Select]
def modify(frame, data):
    with data.cell_:
        data.cell_[:,0] = [10., 0., 0.]
        data.cell_[:,1] = [0., 10., 0.]
        data.cell_[:,2] = [0., 0., 10.]
        #cell origin
        data.cell_[:,3] = [-5.,   -5.  ,  -5.]
        #set periodic boundary conditions
        data.cell_.pbc = (True, True, True)

The second error is possibly due to the fact that you somehow ran the script from within the GUI?  Let me know if that's not the case.
That's how it's supposed to be executed from the terminal:
Code: [Select]
ovitos neutest_T001_v4.py
-Constanze

benjy

  • Newbie
  • *
  • Posts: 8
Re: Error involving particles xyz positions at 0/
« Reply #2 on: April 17, 2019, 07:22:17 PM »
Constanze,

Thank you for the help. I've altered the my file to include the simulation cell lattice, but am having trouble to include the cell origin; ive tried specifying it as an additional parameter in the extended  file format or even in the Properties tab but it didn't quite seem to work... ultimately this doesn't matter for the visualization which is working just fine but is there a way for this to be done in the file format? I noticed there isn't a list of what you can specifically additionally in that line for extended xyz.

Regarding the script file i was running it from inside the Ovito GUI, i would choose the run python script option and load in my file and run it that way. It ran fine putting out data, it just output that error in the line afterwards for whatever reason. I haven't gotten around to modifying those script files but I'll let you know if the issue is resolved. I'm still very new to Python and scripting overall so I appreciate your help!

Constanze Kalcher

  • Administrator
  • Sr. Member
  • *****
  • Posts: 299
Re: Error involving particles xyz positions at 0/
« Reply #3 on: April 25, 2019, 01:49:59 PM »
Hello benjy,

ovito should accept the following argument in the header of your xyz file:
Code: [Select]
cell_origin="-5.0 -5.0 -5.0"
-Constanze