Difference between revisions of "File formats/Export"

From Jmol
Jump to navigation Jump to search
(update for write, write() and write coords)
Line 1: Line 1:
 
== Exporting or saving molecular model files from Jmol ==
 
== Exporting or saving molecular model files from Jmol ==
Although Jmol is basically a viewer, it has some limited capabilities to save files for the displayed molecular model (or a subset of it).
+
Although Jmol was designed as a viewer, it has now capabilities to save files for the displayed molecular model (or a subset of it).
  
* <code>write</code> command
+
=== <code>write</code> command ===
* Pop-up menu
+
Jmol can export ''the currently selected set of atoms'' to a file in
* <code>save isosurface</code> command
+
* XYZ format
 
+
* PDB format
=== <code>write</code> command: MDL formats ===
 
Jmol can export the currently selected set of atoms to a file in
 
 
* MOL v2000 format (single model)
 
* MOL v2000 format (single model)
 
* MOL v3000 format (single model)
 
* MOL v3000 format (single model)
 
* SDF v2000 format (single or multiple models)
 
* SDF v2000 format (single or multiple models)
according to the [http://www.symyx.com/downloads/public/ctfile/ctfile.pdf official format specification from MDL-Symyx-Accelrys].
+
The last 3 are according to the [http://accelrys.com/products/informatics/cheminformatics/ctfile-formats/no-fee.php official format specification from MDL-Accelrys-Symyx].
 
 
''(Jmol version 12.1.26 has this full set of options; former versions export only MOL v2000 and match the specification only partially.)''
 
  
 
The syntax (see  
 
The syntax (see  
 
[{{ScriptingDoc}}#writemodel reference documentation]) is
 
[{{ScriptingDoc}}#writemodel reference documentation]) is
 +
write myFile.xyz #exports to XYZ
 +
write myFile.pdb #exports to PDB
 
  write myFile.mol #exports to MOL v2000
 
  write myFile.mol #exports to MOL v2000
write v3000 myFile.mol #exports to MOL v3000
 
 
  write myFile.sdf #exports to SDF v2000
 
  write myFile.sdf #exports to SDF v2000
  
 +
write xyz myFile.myExt #exports to XYZ
 +
write pdb myFile.myExt #exports to PDb
 
  write mol myFile.myExt #exports to MOL v2000
 
  write mol myFile.myExt #exports to MOL v2000
 
  write v2000 myFile.myExt #exports to MOL v2000
 
  write v2000 myFile.myExt #exports to MOL v2000
 
  write v3000 myFile.myExt #exports to MOL v3000
 
  write v3000 myFile.myExt #exports to MOL v3000
 
  write sdf myFile.myExt #exports to SDF v2000
 
  write sdf myFile.myExt #exports to SDF v2000
 +
 +
write myFile.myExt as xyz
 +
write myFile.myExt as pdb
 +
write myFile.myExt as mol
 +
write myFile.myExt as v2000
 +
write myFile.myExt as v3000
 +
write myFile.myExt as sdf
 +
 +
All those 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:
 +
write coord myFile.mol #exports to MOL v2000
 +
write coord mol myFile.myExt #exports to MOL v2000
 +
write coord v3000 myFile.myExt #exports to MOL v3000
 +
 +
=== <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.
 +
 +
First parameter in the function is the format, second if needed is some qualifier, both matching what would be used in the command.
 +
 +
Examples:
 +
a = write("xyz") #incorrect, not implemented, does not work
 +
a = write("pdb") #incorrect, not implemented, does not work
 +
a = write("mol") #exports to MOL v2000, original untransformed coordinates
 +
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
 +
a = write("coord","v3000") #exports to MOL v3000, transformed coordinates
 +
 +
=== 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, in compressed form, 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 [{{ScriptingDoc}}#writeobject <code>write isosurface</code>] command.

Revision as of 09:38, 1 July 2014

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

write myFile.xyz #exports to XYZ
write myFile.pdb #exports to PDB
write myFile.mol #exports to MOL v2000
write myFile.sdf #exports to SDF v2000
write xyz myFile.myExt #exports to XYZ
write pdb myFile.myExt #exports to PDb
write mol myFile.myExt #exports to MOL v2000
write v2000 myFile.myExt #exports to MOL v2000
write v3000 myFile.myExt #exports to MOL v3000
write sdf myFile.myExt #exports to SDF v2000
write myFile.myExt as xyz
write myFile.myExt as pdb
write myFile.myExt as mol
write myFile.myExt as v2000
write myFile.myExt as v3000
write myFile.myExt as sdf

All those 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:

write coord myFile.mol #exports to MOL v2000
write coord mol myFile.myExt #exports to MOL v2000
write coord v3000 myFile.myExt #exports to MOL v3000

write() function

This function in the Jmol Scripting Language allows to put in a variable data equivalent to what the write command would save to a file.

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

Examples:

a = write("xyz") #incorrect, not implemented, does not work
a = write("pdb") #incorrect, not implemented, does not work
a = write("mol") #exports to MOL v2000, original untransformed coordinates
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
a = write("coord","v3000") #exports to MOL v3000, transformed coordinates

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, in compressed form, 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