viewSq, a Visual Molecular Dynamics (VMD) module for calculating, analyzing, and visualizing X-ray and neutron structure factors from atomistic simulations

T Mackoy and B Kale and ME Papka and RA Wheeler, COMPUTER PHYSICS COMMUNICATIONS, 264, 107881 (2021).

DOI: 10.1016/j.cpc.2021.107881

viewSq is a Visual Molecular Dynamics (VMD) module for calculating structure factors (S(q)) and partial structure factors for any user- selected atomic selections (S-sel1,S-sel2(q)) derived from computer simulation trajectories, as well as quantifying, analyzing, and visualizing atomic contributions to them. viewSq offers radial distribution functions (g(r)), S(q) and S-sel1,S-sel2(q) with and without X-ray atomic form factors or neutron scattering lengths, partial radial distribution functions (g(sel1,sel2)(r)), as well as decompositions of S(q) and S-sel1,S-sel2(q) into various positive and negative components (each of which indicates periodic atomic ordering). Additionally, viewSq plots as a function of distance r the Fourier transform summands used to transform g(r) to S(q), allowing understanding of the atom-specific distances around atomic centers that contribute to S(q), S-sel1,S-sel2(q), and their various positive and negative components. viewSq will also rank atoms by their contributions to S(q), S-sel1,S-sel2(q), and the positive and negative components, and uses VMD to visualize those atoms interactively. Another feature performs the same rankings for atoms within a cutoff distance of a user- selected central atom, allowing the fundamental contributions atoms make with each other to be quantified and interactively visualized. Analysis may be done for any user-selected range of wavenumber (q) for a single structure or a small ensemble of structures. viewSq's features are illustrated by using a single frame from an MD simulation of a box of water. Program summary Program Title: viewSq CPC Library link to program files: https://doi.org/10.17632/w5bxkfsj4d.1 Developer's repository link: https://github.com/tmackoy/viewSq Licensing provisions: MIT Programming language: Tcl, Python Nature of problem: Total scattering, the measurement of a complete diffraction pattern including Bragg and diffuse scattering of radiation, is a powerful family of techniques for investigating the structures of liquids and soft matter 1, 2, 3, 4, 5, 6. Data are typically derived from X-ray or neutron scattering and reported as a plot of intensity or structure factor (S(q)), as a function of wavenumber (q). So S(q) summarizes in a one-dimensional plot the positions in three-dimensional space of all atomic species, each of which scatters X-rays and neutrons differently. Thus, an experimental S(q) can be difficult to interpret 7, 8, 9, 10, 11, 12, 13, although recent advances have been made 14, 15, 16. Computer simulations (e.g. molecular dynamics (MD) or Monte Carlo simulations) complement experiment by allowing calculated S(q) to be calculated from a structural model 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 and decomposed into partial structure factors (S-sel1,S-sel2(q)), each associated with user-defined atomic selections 29, 30, 31, 32. While S-sel1,S-sel2(q) are informative, they are also difficult to analyze for determining the structural ordering underlying S(q). Not only are S-sel1,S-sel2(q) difficult to conceptualize, but each S-sel1,S-sel2(q) is the sum of positive and negative components, which each indicate periodic atomic ordering. Moreover, these components partially or nearly completely cancel and are often large in magnitude compared with S(q) and S-sel1,S-sel2(q). Numerous computer programs exist to calculate S(q) (e.g. by performing the Fourier transform of the radial distribution function (g(r))) derived from molecular simulations 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28. Publicly available computer programs focus on accurately reproducing the experimental S(q) and/or incorporating the simulated S(q) into a structure refinement algorithm. viewSq not only calculates S(q) and S-sel1,S-sel2(q), but it is unique because it also emphasizes interpreting and visualizing atomic contributions to S(q) and S-sel1,S-sel2(q). Solution method: While several tools exist for calculating S(q) and S-sel1,S-sel2(q) from atomistic simulations 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, viewSq is to our knowledge the first program that also provides positive and negative components of S(q) and S-sel1,S-sel2(q), and allows ready visualization of atomic contributions to S(q), S-sel1,S-sel2(q), and the positive and negative components of S(q) and S-sel1,S-sel2(q). Options contained in this release of viewSq include: 1. Select a single structure or an ensemble of structures to analyze. 2. Select one q or a range of q to analyze. 3. Calculate g(r) and S(q) using any number of trajectory snapshots. 4. Select chemically relevant atom subsets for calculation of partial radial distribution functions (g(sel1,sel2)(r)) and S-sel1,S-sel2(q). 5. Separately sum positive and negative Fourier transform summands constituting S(q) and Ssel1,sel2(q), to determine positive and negative components of S(q) and S-sel1,S-sel2(q). 6. Display summands composing S(q) or S-sel1,S-sel2(q) as a function of distance from atomic centers (or a user selection of atomic centers). 7. Quantify compositions of g(r), g(sel1,sel2)(r), or summands for any combination of r. 8. Rank atoms by their contributions to S(q) and S-sel1,S-sel2(q). 9. Display atoms making the largest contributions to S(q) or S-sel1,S-sel2(q) at selected values of q. This can be done for the entire simulation box or with respect to one central atom. 10. Calculations and analysis can be accomplished using X-ray scattering atomic form factors, neutron scattering lengths, or neither. Features 5-9 are currently unique to viewSq and provide a suite of tools for analyzing and visualizing S(q) and S-sel1,S-sel2(q) from atomistic simulations. Thus, viewSq is a Visual Molecular Dynamics 33 (VMD) module that provides a uniquely powerful interactive experience to interpret peaks in S(q) calculated for X-ray scattering, neutron scattering, or independent of atomic interactions with radiation. viewSq was designed as a Visual Molecular Dynamics (VMD) module because VMD can readily load, analyze, and visualize the types and sizes of trajectories often used for S(q) studies. Additional comments including restrictions and unusual features: Because viewSq pre-calculates a variety of quantities in order to provide a unique analysis and interactive visualization experience, the memory, time, and disk usage are higher than other programs for simple S(q) and S-sel1,S-sel2(q) calculations. Additionally, the memory requirements grow with number of atoms and might be restrictive even on machines with 64+ GB RAM for simulations with over 25,000 atoms. Advantages to viewSq include its unique features and visualizations that are not available in programs which solely calculate S(q) and S-sel1,S-sel2(q). viewSq is only compatible with rectangular simulation boxes. (c) 2021 Published by Elsevier B.V.

Return to Publications page