5
$\begingroup$

I want to plot transition dipole moment vectors at their respective positions. For example, given a transition dipole moment with position vector R, I want to draw a vector at the coordinates of R, which represents the transition dipole moment itself.

I want to create a structure which looks like the figure shown here.

For the simplest case I tried a situation in which all the dipole vectors are parallel along the z-axis. The vectors are positioned in a cylindrical structure. This cylinder is made of 20 rings or stack and each stack has 4 transition dipole moment.

This structure resembles the structure of a Chlorosome which some bacteria use to harvest light energy and do photosynthesis. The positions of these transition dipole moments I'm interested in are the positions for bacterichlorophylls I'd like to visualize.

I tried the following code to generate a plot:

teta = 0;
fi = 0;
\[Mu][i_, j_] := 
 Evaluate[Chop[
   N[Sqrt[30.0]*{Sin[teta]*Cos[fi], Sin[teta]*Sin[fi], Cos[teta]}], 
   10^-6]];(*Transition dipole moments*)
R[i_, j_] := ({26.82 Cos[(2 Pi)/4.0 i], 26.82 Sin[(2 Pi)/4.0 i], 
   10 j})(*Position vector of each transition dipole moment*)
dataset = 
  Flatten[Table[{R[i, j], \[Mu][i, j]}, {i, 1, 4}, {j, 1, 20}], 1];

 dataset // Dimensions
 {80, 2, 3}

 ListVectorPlot3D[dataset]

It returns:

enter image description here

I think this may be because my Dataset has points like:

{{0, 26.82, 10}, {0, 0, 5.477225575051661}}

which have one zero element. How can I represent those vectors at the positions determined? I'm using Mathematica 9.


Edit

I also tried to mimic what documentation provide as an example:

 vectors = 
  Table[{{x, y, z}, {Sin[x], Cos[y], Sin[z]}}, {x, 1.0, 2, 
    1}, {y, -1.0, 0, 1}, {z, -1.0, 0, 1}];

returns:

enter image description here

Two points: 1- I could not export the image in jpeg format. I used PDF format. 2- I have no idea why there are so many vectors in the image while the number of positions and vectors are few in the vectors

Then I changed the code a little bit:

vectors = 
      Table[{{x, y, x+y}, {Sin[x], Cos[y], Sin[z]}}, {x, 1.0, 2, 
        1}, {y, -1.0, 0, 1}, {z, -1.0, 0, 1}];

I changed z to x+y. If I plot this it returns an empty cube. Does anybody know the cause of this?

$\endgroup$
  • $\begingroup$ Although it does look like ListVectorPlot3D isn't working right, you can do 2 things: first, file a bug report at Wolfram Tech support (and maybe point out that ListVectorPlot3D[RandomReal[{0, 1}, {10, 2, 3}]] doesn't work, even though the documentation says it should), and second, you can create your own version of the plot you want using Graphics3D primitives, by assembling a bunch of Arrow objects. Are you familiar enough with Mathematica graphics to do this? If not, then I can help show you how to do this. $\endgroup$ – DumpsterDoofus Nov 12 '14 at 0:39
  • $\begingroup$ @DumpsterDoofus I am not familiar with this part of MMA. Tomorrow I will try if I couldn't, I will tell you. $\endgroup$ – MOON Nov 12 '14 at 0:43
  • $\begingroup$ dataset should be a three dimensional array of vector field values, i.e. dataset //Dimensions should be like {l,m,n,3}. No bug here in my opinion, thought the documentation could be better. $\endgroup$ – george2079 Aug 18 '15 at 13:46
3
$\begingroup$

No, the problem is not the zeros. You can see this by adding random reals to the resulting field:

dataset = Flatten[Table[{RandomReal[{0, 1}, 3] + R[i, j], 
   RandomReal[{0, 1}, 3] + \[Mu][i, j]}, {i, 1, 4}, {j, 1, 20}], 1]

The resulting dataset still does not plot correctly. I'll post later once I figure out what the problem actually is.

Update 1: The V10 documentation appears to be broken (can't confirm whether the problem exists in V9). Here's a screenshot:

enter image description here

The amusing thing about this error is that I didn't have to execute it to get the error message; the error message is already hard-coded into the documentation page itself. Based on the context, this appears to have been designed to show two different ways to specify data range (one with an explicit DataRange, and another with explicit $(\mathbf{x},\mathbf{v})$ coordinates), and was not an intentional error, as there is no prior warning or explanation of the resulting error message.

Whether this is a result of changes introduced in the V10 update, I have no idea. In any case, something is wrong.

Update 2: I can't figure out what is wrong, but I suspect either the documentation or ListVectorPlot3D itself is broken (or both). From the documentation:

enter image description here

As you can see, ListVectorPlot3D is designed to take an $(N,2,3)$-dimensional array as input. However,

ListVectorPlot3D[RandomReal[{0, 1}, {10, 2, 3}]]

returns a blank Graphics3D box, contradicting the documentation.

$\endgroup$
  • $\begingroup$ The error doesn't show up in the v9 documentation; however attempting to execute that code in v9 throws the same error. $\endgroup$ – bobthechemist Nov 11 '14 at 15:02
  • $\begingroup$ Can somebody check if the problem still exist in V10.0.2? $\endgroup$ – MOON Dec 19 '14 at 15:07
1
$\begingroup$

Yes, the problem is these zeros. The simplest way to overcome is to use Legacy ListVectorFieldPlot3D. For example the following works

Needs["VectorFieldPlots`"]; 
VectorFieldPlots`ListVectorFieldPlot3D[dataset]
$\endgroup$
  • $\begingroup$ The result does the job but it is not as good as I expected. Is there anyway to do this with ListVectorPlot3D? $\endgroup$ – MOON Nov 11 '14 at 13:30
  • $\begingroup$ You can use options Options[VectorFieldPlots`ListVectorFieldPlot3D] to make results better. I have bad experience with ListVectorPlot3D when it don't like data. $\endgroup$ – user18792 Nov 11 '14 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.