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.
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: system coordinates as a list of decimal numbers
- Coordinate array is the most important line in an NMD file. All mode array lengths must match the length of the coordinate array. Also, number of atoms in the system is deduced from the length of the coordinate array.
coordinates 27.552 4.354 23.629 24.179 4.807 21.907 ...
- mode: normal mode array as a list of decimal numbers
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.
- atomnames: list of atom names
- If not provided, all atom names are set to “CA”.
- resnames: list of residue names
- If not provided, all residue names are set to “GLY”.
- chainids: list of chain identifiers
- If not provided, all chain identifiers are set to “A”.
- resids: list of residue numbers
- If not provided, residue numbers are started from 1 and incremented by one for each atom.
- bfactors: list of experimental beta-factors
- If not provided, all beta-factors are set to zero. Beta-factors can be used to color the protein representation.
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 (
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.
writeNMD(filename, modes, atoms)¶
Returns filename that contains modes and atoms data in NMD format described in NMD Format.
.nmdextension is appended to filename, if it does not have an extension.
- This function skips modes with zero eigenvalues.
- If a
Vectorinstance is given, it will be normalized before it is written. It’s length before normalization will be written as the scaling factor of the vector.
Returns VMD path, or set it to be a user specified path.
Start VMD in the current Python session and load NMD data.