How can I visualize the normal mode vibrations of a molecule in Mathematica? Something like the following GIF:

vibrational modes of benzene (from here)

I have the XYZ file of the benzene molecule and the normal mode coordinates.

  • $\begingroup$ What software makes the .mode file? Is there a standard file format for vibrational modes? $\endgroup$
    – Jason B.
    Nov 30, 2018 at 21:26

1 Answer 1


Using a few undocumented functions that have been discussed here on the stack exchange before,

{atoms, coords} = Import[
    {"XYZ", {"VertexTypes", "VertexCoordinates"}}
mode = Most @ Import[
    "https://www.dropbox.com/s/3pjxams7ndr0l7h/19.mode?dl=1", "Table"
mode = 100 * mode;
bonds = Graphics`MoleculePlotDump`InferBonds[atoms, coords, 40, 25];
range = Range[-0.5, 0.5, 0.025];
range = Join[range, Reverse @ range];
plot[v_] := ImportExport`MoleculePlot3D[
        "VertexCoordinates" -> (coords + v * mode),
        "VertexTypes" -> atoms, "EdgeRules" -> bonds
ListAnimate @ Map[plot, range] 

enter image description here

When importing the mode file, it returns an empty list as the last element so I need to use Most to make it a matrix. Then I multiplied it by 100 to convert to picometers. Finally I had to precompute the bonds, because as the molecule moves along the normal coordinate, the atoms could get far enough apart that the bonds wouldn't be detected by MoleculePlot3D.


  1. Connectivity in a molecule and permutations
  2. How can I access the internal function that plots a molecule from a formatted XYZ file?
  3. Visualizing .xyz file in Mathematica
  • $\begingroup$ Is there any way to make the List Animate window larger so the image is larger in the simulation? $\endgroup$
    – Moo
    Dec 1, 2018 at 13:24
  • 1
    $\begingroup$ You should be able to give an ImageSize option to the plotting function. $\endgroup$
    – Jason B.
    Dec 1, 2018 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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