visualizing a normal mode vibration of a molecule in mathematica











up vote
8
down vote

favorite
2












How can I visualize the normal mode vibrations of a molecule in Mathematica?
Something like the gif shown in the following link.benzene b_2u vibrational mode.
I have the XYZ fileben-xyz-file of the benzene molecule and the normal mode coordinates normal-mode.










share|improve this question






















  • What software makes the .mode file? Is there a standard file format for vibrational modes?
    – Jason B.
    4 hours ago















up vote
8
down vote

favorite
2












How can I visualize the normal mode vibrations of a molecule in Mathematica?
Something like the gif shown in the following link.benzene b_2u vibrational mode.
I have the XYZ fileben-xyz-file of the benzene molecule and the normal mode coordinates normal-mode.










share|improve this question






















  • What software makes the .mode file? Is there a standard file format for vibrational modes?
    – Jason B.
    4 hours ago













up vote
8
down vote

favorite
2









up vote
8
down vote

favorite
2






2





How can I visualize the normal mode vibrations of a molecule in Mathematica?
Something like the gif shown in the following link.benzene b_2u vibrational mode.
I have the XYZ fileben-xyz-file of the benzene molecule and the normal mode coordinates normal-mode.










share|improve this question













How can I visualize the normal mode vibrations of a molecule in Mathematica?
Something like the gif shown in the following link.benzene b_2u vibrational mode.
I have the XYZ fileben-xyz-file of the benzene molecule and the normal mode coordinates normal-mode.







graphics3d






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 6 hours ago









sravankumar perumalla

753




753












  • What software makes the .mode file? Is there a standard file format for vibrational modes?
    – Jason B.
    4 hours ago


















  • What software makes the .mode file? Is there a standard file format for vibrational modes?
    – Jason B.
    4 hours ago
















What software makes the .mode file? Is there a standard file format for vibrational modes?
– Jason B.
4 hours ago




What software makes the .mode file? Is there a standard file format for vibrational modes?
– Jason B.
4 hours ago










1 Answer
1






active

oldest

votes

















up vote
14
down vote













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



{atoms, coords} = Import[
"https://www.dropbox.com/s/q3rwpedngv5wbqi/ben.xyz?dl=1",
{"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.



Sources:




  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






share|improve this answer























    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "387"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f187054%2fvisualizing-a-normal-mode-vibration-of-a-molecule-in-mathematica%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    14
    down vote













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



    {atoms, coords} = Import[
    "https://www.dropbox.com/s/q3rwpedngv5wbqi/ben.xyz?dl=1",
    {"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.



    Sources:




    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






    share|improve this answer



























      up vote
      14
      down vote













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



      {atoms, coords} = Import[
      "https://www.dropbox.com/s/q3rwpedngv5wbqi/ben.xyz?dl=1",
      {"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.



      Sources:




      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






      share|improve this answer

























        up vote
        14
        down vote










        up vote
        14
        down vote









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



        {atoms, coords} = Import[
        "https://www.dropbox.com/s/q3rwpedngv5wbqi/ben.xyz?dl=1",
        {"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.



        Sources:




        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






        share|improve this answer














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



        {atoms, coords} = Import[
        "https://www.dropbox.com/s/q3rwpedngv5wbqi/ben.xyz?dl=1",
        {"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.



        Sources:




        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







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 4 hours ago

























        answered 6 hours ago









        Jason B.

        47.3k386185




        47.3k386185






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f187054%2fvisualizing-a-normal-mode-vibration-of-a-molecule-in-mathematica%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Understanding the information contained in the Deep Space Network XML data?

            Ross-on-Wye

            Eastern Orthodox Church