Glyph plot for force vector


Is there any option/means to visualize the per-atom force vector as arrow glyphs using Ovito?
It is possible to visualize the glyphs plot for displacement as long as it is computed using the existing Modifiers within Ovito. I was thinking to use the Modifier Compute property to create local per-particle 3D vector variable but it is written in the manual that in the current program version, the modifier does not allow you to create user-defined vector properties. You can only create scalar user-defined properties."

I am wondering if there is any other option to plot the glyph arrow for any vector properties e.g, per-atom force.



Yes, you can use the Compute Property Modifier in OVITO Basic to generate a couple of standard vector properties, e.g. Velocity, Displacement, Force. If you select any of those from the “Output property” drop-down menu, the input expression field will expand and lets you enter a separate math expression for each vector component.

Moreover, if the per-atom forces are part of your input data, the corresponding visual element should be automatically created for you during file import. How does your data format look like?

1 Like

In OVITO Pro, you’ll have more flexibility creating custom vector properties by using a Python-based modifier function like the following

### Create Custom Vector Property
from import *
from ovito.pipeline import ModifierInterface
from ovito.traits import OvitoObject
from traits.trait_types import Str
from ovito.vis import *
import numpy as np

class CreateCustomVectorProperty(ModifierInterface):
    vector_vis = OvitoObject(VectorVis, flat_shading = False, alignment = VectorVis.Alignment.Base)
    title = Str("My vector property", label="Property Name")
    def modify(self, data: DataCollection, **kwargs):
        # Add a new vector property to the particles:
        vector_data = np.random.random_sample(size=(data.particles.count, 3))
        property = data.particles_.create_property(self.title, data=vector_data)

        # Attach the visual element to the output property:
        property.vis = self.vector_vis  
        property.vis.title = self.title

1 Like

Hi Constanze,

Thank you for your input!
Your first suggestion itself works. I misunderstood the writing part in the Vector properties.
I have cfg files that have force data computed due to the boost potential like this:

Number of particles = 7860
A = 1 Angstrom (basic length-scale)
H0(1,1) = 69.5753 A
H0(1,2) = 0 A
H0(1,3) = 0 A
H0(2,1) = 0 A
H0(2,2) = 73.1765 A
H0(2,3) = 0 A
H0(3,1) = 0 A
H0(3,2) = 0 A
H0(3,3) = 17.2444 A
entry_count = 8
auxiliary[0] = id
auxiliary[1] = c_CNA
auxiliary[2] = v_BoostForceX
auxiliary[3] = v_BoostForceY
auxiliary[4] = v_BoostForceZ

Now I am able to visualize the force as glyph plot.

Subhendu Chakraborty

1 Like