1
$\begingroup$

I create a simple lattice structure by the following code:

SimCube = Normal@LatticeData["SimpleCubic", "Basis"]
Lat = Flatten[Table[i SimCube[[1]] + j SimCube[[2]] + k SimCube[[3]], {i, 0, 5}, {j, 0, 5}, {k, 0, 2}], 2];
Graphics3D[Map[Sphere[#, .2] &, #], Boxed -> True, Axes -> True,ImageSize -> 300] & /@ {Lat}

That gives me the above lattice picture. Simple cubic lattice

However, I need to change the position of the lattice points randomly. It is like the lattice points start to oscillate around their original locations. Each of them needs to be transferred to a new point in a random direction.

I appreciate your help.

$\endgroup$
  • $\begingroup$ Bahar, welcome to mma.se! We suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign $\endgroup$ – kglr Jan 17 '18 at 1:59
2
$\begingroup$
Graphics3D[Map[Translate[Sphere[#, .2], RandomReal[{-1, 1}, 3]] &, Lat], 
 Boxed -> True, Axes -> True, ImageSize -> 300]

enter image description here

Manipulate[Graphics3D[
  Map[Sphere[# (1 - t) + t RandomReal[{-1, 1}, 3], .2] &, Lat], 
  Boxed -> True, Axes -> True, ImageSize -> 300, 
  SphericalRegion -> True, PlotRange -> {{-6, 6}, {-6, 6}, {-6, 6}}], 
{t, 0, 1}]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you so much. It works perfectly. $\endgroup$ – Bahar Jan 17 '18 at 1:51
  • $\begingroup$ @Bahar, my pleasure. $\endgroup$ – kglr Jan 17 '18 at 5:47

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.