Difference between revisions of "File formats/Export"

From Jmol
Jump to navigation Jump to search
(better display)
(expanding on the write command and functon)
Line 45: Line 45:
 
write myFile.myExt as sdf</pre>
 
write myFile.myExt as sdf</pre>
 
| {{file|sdf-v2000}}  format
 
| {{file|sdf-v2000}}  format
 +
|-
 +
| <pre>write myFile.jmol
 +
write jmol myFile.myExt
 +
write myFile.myExt as jmol</pre>
 +
| writes a single file that packs the original model file, the state as a Jmol script, and a snapshot ({{file|png}} image) of the current display; this file may be loaded back into Jmol and will reproduce the state
 +
|-
 +
| <pre>write image pngj myFile.png
 +
write myFile.png as pngj</pre>
 +
| functionally equivalent to the previous one, but produces a {{file|png}} file that is displayed as a regular image in any software; when loaded into Jmol it will read the model and its state
 
|}
 
|}
 
   
 
   
 
All of the above commands will save the original cooordinates of each atom as they were in the input file.  
 
All of the above commands will save the original cooordinates of each atom as they were in the input file.  
  
There is also the choice (only in MOL format) of saving the '''modified coordinates''' as in the current state of the model:
+
There is also the choice (only in MOL format) of saving the '''transformed coordinates''' as they are in the current state of the model:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! commands (synonymous)
 
! commands (synonymous)
 
! export the currently selected set of atoms,  
 
! export the currently selected set of atoms,  
with modified coordinates, using this format:
+
with transformed coordinates, using this format:
 
|-
 
|-
 
| <pre>write coord myFile.mol
 
| <pre>write coord myFile.mol
Line 65: Line 74:
  
 
=== <code>write()</code> function ===
 
=== <code>write()</code> function ===
This function in the Jmol Scripting Language allows to put in a variable data equivalent to what the <code>write</code> command would save to a file.
+
This function in the Jmol Scripting Language allows to place the output of the write command into a variable, rather than saving to a file. The data can later be loaded using <code>load var a</code>
  
 
First parameter in the function is the format, second if needed is some qualifier, both matching what would be used in the command.
 
First parameter in the function is the format, second if needed is some qualifier, both matching what would be used in the command.
  
Examples:
+
Common examples:
a = write("xyz") #incorrect, not implemented, does not work
+
{| class="wikitable"
a = write("pdb") #incorrect, not implemented, does not work
+
|-
a = write("mol") #exports to MOL v2000, original untransformed coordinates
+
! commands
a = write("v3000") #exports to MOL v3000, original untransformed coordinates
+
!
a = write("coord") #exports to XYZ, original untransformed coordinates
+
|-
a = write("coord","mol") #exports to MOL v2000, transformed coordinates
+
| <pre>a = write("xyz")
a = write("coord","v3000") #exports to MOL v3000, transformed coordinates
+
a = write("pdb")</pre>
 +
| incorrect, not implemented, do not work
 +
|-
 +
| <pre>a = write("mol")
 +
a = write("v3000")</pre>
 +
| exports to {{file|mol-v2000}} or {{file|mol-v3000}} format, respectively
 +
|-
 +
| <pre>a = write("coord")</pre>
 +
| exports to {{file|xyz}} format, original untransformed coordinates
 +
|-
 +
| <pre>a = write("coord","mol")</pre>
 +
| exports transformed coordinates to {{file|mol-v2000}} or {{file|mol-v3000}} format, respectively
 +
|-
 +
| <pre>a = write("jmol")</pre>
 +
| exports a packed file that contains the model and the state (but not the snapshot)
 +
''(only available since Jmol 14.27)''
 +
|}
 +
 
  
 
=== Pop-up menu ===
 
=== Pop-up menu ===
Line 89: Line 115:
 
  File > Export > Export PNG+JMOL image
 
  File > Export > Export PNG+JMOL image
  
The 2nd and 4th are equivalent and contain, in compressed form, a snapshot PNG image, the coordinates file and the state script file.
+
The 2nd and 4th are equivalent and contain, packed in a single file, a snapshot PNG image, the coordinates file and the state script file.
  
 
=== Save isosurface ===
 
=== Save isosurface ===
 
The pop-up menu entry will svae the last isosurface selected or generated. More flexibility is allowed by using the [{{ScriptingDoc}}#writeobject <code>write isosurface</code>] command.
 
The pop-up menu entry will svae the last isosurface selected or generated. More flexibility is allowed by using the [{{ScriptingDoc}}#writeobject <code>write isosurface</code>] command.

Revision as of 11:46, 11 December 2017

Exporting or saving molecular model files from Jmol

Although Jmol was designed as a viewer, it has now capabilities to save files for the displayed molecular model (or a subset of it).

write command

Jmol can export the currently selected set of atoms to a file in

  • XYZ format
  • PDB format
  • MOL v2000 format (single model)
  • MOL v3000 format (single model)
  • SDF v2000 format (single or multiple models)

The last 3 are according to the official format specification from MDL-Accelrys-Symyx.

The syntax (see reference documentation) is like this:

commands (synonymous) export the currently selected set of atoms,

with original coordinates, using this format:

write myFile.xyz
write xyz myFile.myExt
write myFile.myExt as xyz
File icon.gifxyz format
write myFile.pdb
write pdb myFile.myExt
write myFile.myExt as pdb
File icon.gifpdb format
write myFile.mol
write mol myFile.myExt
write v2000 myFile.myExt
write myFile.myExt as mol
write myFile.myExt as v2000
File icon.gifmol-v2000 format
write v3000 myFile.myExt
write myFile.myExt as v3000
File icon.gifmol-v3000 format
write myFile.sdf
write sdf myFile.myExt
write myFile.myExt as sdf
File icon.gifsdf-v2000 format
write myFile.jmol
write jmol myFile.myExt
write myFile.myExt as jmol
writes a single file that packs the original model file, the state as a Jmol script, and a snapshot (File icon.gifpng image) of the current display; this file may be loaded back into Jmol and will reproduce the state
write image pngj myFile.png
write myFile.png as pngj
functionally equivalent to the previous one, but produces a File icon.gifpng file that is displayed as a regular image in any software; when loaded into Jmol it will read the model and its state

All of the above commands will save the original cooordinates of each atom as they were in the input file.

There is also the choice (only in MOL format) of saving the transformed coordinates as they are in the current state of the model:

commands (synonymous) export the currently selected set of atoms,

with transformed coordinates, using this format:

write coord myFile.mol
write coord mol myFile.myExt
File icon.gifmol-v2000 format
write coord v3000 myFile.myExt
File icon.gifmol-v3000 format

write() function

This function in the Jmol Scripting Language allows to place the output of the write command into a variable, rather than saving to a file. The data can later be loaded using load var a

First parameter in the function is the format, second if needed is some qualifier, both matching what would be used in the command.

Common examples:

commands
a = write("xyz")
a = write("pdb")
incorrect, not implemented, do not work
a = write("mol")
a = write("v3000")
exports to File icon.gifmol-v2000 or File icon.gifmol-v3000 format, respectively
a = write("coord")
exports to File icon.gifxyz format, original untransformed coordinates
a = write("coord","mol")
exports transformed coordinates to File icon.gifmol-v2000 or File icon.gifmol-v3000 format, respectively
a = write("jmol")
exports a packed file that contains the model and the state (but not the snapshot)

(only available since Jmol 14.27)


Pop-up menu

These are available:

File > Save > Save a copy of file
File > Save > Save as PNG/JMOL (image+zip)
File > Save > Save JVXL isosurface
File > Export > Export PNG+JMOL image

The 2nd and 4th are equivalent and contain, packed in a single file, a snapshot PNG image, the coordinates file and the state script file.

Save isosurface

The pop-up menu entry will svae the last isosurface selected or generated. More flexibility is allowed by using the write isosurface command.

Contributors

AngelHerraez