4
$\begingroup$

I want to plot one dimensional chain of atoms and interactions between them as shown similar to shown in following two figure. Any suggestions or help ??

enter image description here

enter image description here

$\endgroup$
2
  • $\begingroup$ Could you elaborate a bit about what exactly you want to plot? $\endgroup$ May 7 at 14:37
  • $\begingroup$ @DanielHuber, I want to plot figures similar to shown above . what else is required ? $\endgroup$
    – 2.1
    May 7 at 14:57
9
$\begingroup$

You can use RelationGraph with custom VertexShapeFunction and EdgeShapeFunction as follows:

vertexlist = Range[10];

relation = 1 <= Abs[#2 - #] <= 2 &;

vertexCoordinates = Thread[{vertexlist, 0}];

vSF = Inset[Graphics3D[{Green, Specularity[White, 10], Sphere[]}, 
     Boxed -> False], #, Center, Scaled[.3]] &;

eSF = GraphElementData[{"CurvedArc", 
      "Curvature" -> If[OddQ@#2[[1]], 1, -1] (Abs[Subtract @@ #2] - 1)}][##] &;

edgeLabelingRule = {UndirectedEdge[a_, b_] /; b - a == 2 && OddQ[a] :>
     Placed[Subscript[J, 1], {1/2, {0, -2}}]};

RelationGraph[relation, vertexlist, 
 VertexCoordinates -> vertexCoordinates, 
 EdgeLabels -> edgeLabelingRule,
 VertexShapeFunction -> vSF,
 EdgeShapeFunction -> eSF, 
 ImageSize -> Large]

enter image description here

$\endgroup$
1
  • $\begingroup$ You are wonderful, thank you very much $\endgroup$
    – 2.1
    May 8 at 16:38

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.