# Visualization of Two-Dimensional, Asymmetric Particles via Quaternion

Hi OVTIO Forum,

I use corse-grained, molecular simulations in two dimensions to model the behavior of asymmetric square particles. Fortunately, calculating the quaternion in Two-Dimension is relatively simpler, in comparison to its three-dimensional analogue. First, I calculate rotation angle of the particle relative to the x-axis. Using the single rotation angle, I can determine the rotation matrix of the particle (https://www.youtube.com/watch?v=a95hMNXcGAc&t=18s). Finally, I translate the rotation matrix of the particle to its quaternion (https://d3cw3dd2w32x2b.cloudfront.net/wp-content/uploads/2015/01/matrix-to-quat.pdf). I calculate these components in the molecular dynamics software and then pipe them into OVITO, along with their positions, using a .xyz file type and column mapping.

When I visualize the particles as cubes, using two position coordinates, this method works perfectly: the orientation of the particles is accurately represented. However, I would prefer to visualize the particles as two dimensional objects. When I visualize the particles are two-dimensional squares, this method does not work. If I choose to input data for all four components of the quaternion, the particles lose their orientation (please see attached screenshots). I noticed that when calculating the quaternion in two dimensions, the x and y components are always zero. So I tried removing these two components from the column mapping and then re-visualizing both the cubes and the squares. This does not effect their visualization of either type of particles: the cubes are still accurately represented and the squares still do not have an orientation.

I was wondering if there is some aspect of either the quaternion or the two-dimensional particles (vs. three-dimensional) that I am missing, which would allow me to correctly visualize the two-dimensional particles.

Thank you and I really appreciate your product! As someone who uses molecular dynamics for particles other than molecules, you have made the task of visualizing my work so much easier thanks to your software.

Matt

Hi Matt,

I'm sorry that the user documentation doesn't make it very clear, but there is indeed an important difference between the particle display modes "Cube/Box" and "Square". The square mode renders so-called billboards, which means the orientation of the squares is automatically calculated at render time to always face the viewer in 3d space. In other words, the orientations are view-dependent (note that the squares have different orientations in each of the viewport windows of OVITO) and cannot be specified by the user through a particle property. In contrast, when mode "Cube/Box" is selected, the particles orientations are view-independent (they do not follow the camera) and they may be controlled explicitly by assigning values to the "Orientation" particle property.

It would not be a simple development task to change the behavior of the "Square" rendering mode, because such a change would affect various components of OVITO including the real-time renderer implementations.

If you really don't like using the "Cube/Box" particle style, maybe you could use a user-defined particle shape instead which has the shape of a simple 2d square? OVITO allows you to load a user-defined particle shape from a geometry file (in OBJ, STL, or VTK format) and assign it to a particle type.

This requires that your particles have a type in the first place. If this is not the case yet, extend your .xyz file by adding an extra column. Fill the column with the uniform value "1" and map it to the particle property "Particle Type" in OVITO during file import. After import, go to the "Particle types" panel (see screenshot), where you can load a geometry file to be used as display shape for particles of the type.

The attached screenshot shows how I loaded this STL file containing geometry in the form of the letter "A" as user-defined particle shape.

-Alex

Hi Alex,

Thanks for the quick reply. That is unfortunate to hear that the two dimensional shapes are not supported correctly.

I like the idea of uploading custom particle types to the OVITO. I would prefer this as there are some additional unique features to the asymmetrical square particles that I am modeling which I would prefer to designate in the visualization software. Unfortunately, it appears in order to do that, the "pro" version of the software is required and at this point my advisor is unwilling to pay for the software at this point.

I am correct in thinking that particle type designation requires the ungraded software? Or is there a potential work around this?

Thanks,

Matt

Hi Matt,

you can use OVITO Basic to follow the instructions given by Alex.

Also see

https://www.ovito.org/docs/current/reference/pipelines/data_objects/particles.html#scene-objects-particles

Awesome, thanks so much!

### 新的OVITO微信频道!New for our users in China: OVITO on WeChat

Official OVITO WeChat channel operated by Foshan Diesi Technology Co., Ltd.