Spherical Surface in Volumetric Technique


The “volumetric technique” for calculating force defines a cube surrounding the object which the force applied on it should be calculated. Is there any way to specify a spherical surface surrounding the object?

I have a nano-sphere. It is located in free space, but it is very close to other objects. It is not possible to define a cubic that encompasses only the sphere not the nearby objects. I was wondering if there is a way to define a spherical volume (or surface) around the sphere in the “volumetric technique”. I appreciate any comment.

Thank you in advance


The total force result from the volumetric optical force analysis group is obtained by integrating the force components over the full volume. I think that if you wanted to, you could modify the analysis to integrate only over a spherical region that contains your object. There’s a good example on the following page which shows the use of a spherical filter in order to integrate results only over a spherical region - see the “absorbed power in spherical region” section:



Thank you very much for your explanation.

I read that article and modified the volumetric analysis. I added these lines at the end of the script:

`# create integration filter
filter= ((X-x_particle)^2 + (Y)^2 + (Z-z_particle)^2 ) < r_F_int^2;

F_total = matrixdataset(“F_total”);

But, when I run the analysis, I receive an error:
Error: prompt line 156: matrix arguments of * are not the same size
Line 156 is the last line.

Could you please help me how I can fix that?

By the way, in the “Variable Section”, it is not allowed to define a negative value (either for Length or Number). How can one define a negative value, say -1 as the x coordinate?

Thank you very much for your help.

1 Like

This error is occuring because the fx, fy, fz data is actually 4-dimensional where the 4th dimension corresponds to frequency, as the monitors are recording more than 1 frequency point.

You can correct the script by generating a 4D filter using the meshgrid4d script command, so the following lines should work:

filter= ((X-x_particle)^2 + (Y)^2 + (Z-z_particle)^2 ) < r_F_int^2;

There’s some more information about the meshgrid4d command here:

Please try it and let me know how it goes!


Thank you very much. It works!