uniform random nanowire


I would like to simulate uniform random nanowire as according to the follwoinfgfile se wire1.fsp (265.3 KB)
…but here i used uniform random circles…how could i convert this into wires…?
thanks a lot

randomly oriented nanowire simulation

The change should be pretty easy. The main change you need to do is instead of creating spheres you will have to create circles. In the screenshot below, you can see that the script uses the command addsphere to create the spheres. You can simply replace this with addcircle to place cylinders in place of spheres. Of course you may need to edit the properties in the subsequent lines a little but that is basically the main place where you need to edit.


thanks a lot for your advice…however i would like to orient them also randomly…my file is herese wire1.fsp (271.4 KB)

how could i change in the code to orient them randomly?
do i need to introduce another term called theta like r?
and how do i do that?
thanks a lot again


I think that would be the way to go although if you want to be very realistic then you may need to define three angles (thetas). The three angles can then be used to rotate the cylinders along the three axes.


I am coming back again to random wire generation.
Here is my file:
se wire1rando distribution.fsp (266.3 KB)
I see an error while trying to write the code as you said to generate random wires with random orientations.

Could you please help?


Also i would like to increase the aspect ratio 200nm radius and 10 micron height…

  1. There was a typo is the name of the variable theta1 (lines 58, 71) which was creating an error.
  2. The property name for setting the rotation was wrong and also you need to set the rotation axes:

  1. Finally the values of theta1span, theta2span, … need to be nonzero for the random rotation.

Here is the modified file: se_wire_rand_dist_MOD.fsp (272.8 KB).

Do you mean that you want to fix the radius and the height? in that case simply use a constant value for “rl” and “zl” in the script.


Thanks Alam…
I mean the height of the cylinders will be set to 10 micron. The radius is ok…
I already put the variable I suppose it is h height and tried to put 10 micron but in the image the aspect rato seems to not change.
r1 and r2 are the radius of the cylinders which i varied from 100nm to 200nm.
I would like to keep the height of the cylinerds fixed.
thanks agian


Hi. Sorry for the late reply. In your script, even though you have the variable h_height for the height of the cylinder, it has not been used in the script. I have added an extra line [ line 108: set("z span",h_height); ] to set the height of the cylinders. The cylinders will now all have the same height.

Here’s the modified file: se_wire_rand_dist_MOD_v2.fsp (272.9 KB).