This module defines input and output functions for NMD format.
NMD files (extension .nmd) are plain text files that contain at least normal mode and system coordinate data.
NMD files can be visualized using Normal Mode Wizard. ProDy functions writeNMD() and parseNMD() can be used to read and write NMD files.
Data fields in bold face are required. All data arrays and lists must be in a single line and items must be separated by one or more space characters.
coordinates 27.552 4.354 23.629 24.179 4.807 21.907 ...
Optionally, mode index and a scaling factor may be provided in the same line as a mode array. Both of these must precede the mode array. Providing a scaling factor enables relative scaling of the mode arrows and the amplitude of the fluctuations in animations. For NMA, scaling factors may be chosen to be the square-root of the inverse-eigenvalue associated with the mode. Analogously, for PCA data, scaling factor would be the square-root of the eigenvalue.
If a mode line contains numbers preceding the mode array, they are evaluated based on their type. If an integer is encountered, it is considered the mode index. If a decimal number is encountered, it is considered the scaling factor. Scaling factor may be the square-root of the inverse eigenvalue if data is from an elastic network model, or the square-root of the eigenvalue if data is from an essential dynamics (or principal component) analysis.
For example, all of the following lines are valid. The first line contains mode index and scaling factor. Second and third lines contain mode index or scaling factor. Last line contains only the mode array.
mode 1 2.37 0.039 0.009 0.058 0.038 -0.011 0.052 ...
mode 1 0.039 0.009 0.058 0.038 -0.011 0.052 ...
mode 2.37 0.039 0.009 0.058 0.038 -0.011 0.052 ...
mode 0.039 0.009 0.058 0.038 -0.011 0.052 0.043 ...
name: name of the model
The length of all following data fields must be equal to the number of atoms in the system. NMWiz uses such data when writing a temporary PDB files for loading coordinate data into VMD.
NMD files may contain additional lines. Only lines that start with one of the above field names are evaluated by NMWiz.
By adding a special line in an NMD file, file content can be automatically loaded into VMD at startup. The first line calls a NMWiz function to load the file itself (xyzeros.nmd).
nmwiz_load xyzeros.nmd
coordinates 0 0 0 0 0 0 ...
mode 0.039 0.009 0.058 0.038 -0.011 0.052 ...
mode -0.045 -0.096 -0.009 -0.040 -0.076 -0.010 ...
mode 0.007 -0.044 0.080 0.015 -0.037 0.062 ...
In this case, VMD must be started from the command line by typing vmd -e xyzeros.nmd.
Return NMA and AtomGroup instances storing data parsed from filename in .nmd format. Type of NMA instance, e.g. PCA, ANM, or GNM will be determined based on mode data.
Return filename that contains modes and atoms data in NMD format described in NMD Format. .nmd extension is appended to filename, if it does not have an extension.
Note