Chemistry::File::VRML - Generate VRML models for molecules
use Chemistry::File::PDB; use Chemistry::File::VRML; use Chemistry::Bond::Find 'find_bonds'; my $mol = Chemistry::Mol->read('test.pdb'); find_bonds($mol, orders => 1); $mol->write('test.wrl', format => 'vrml', center => 1, style => 'ballAndWire', color => 'byAtom', );
This module generates a VRML (Virtual Reality Modeling Language) representation of a molecule, which can then be visualized with any VRML viewer. This is a PerlMol file I/O plugin, and registers the 'vrml' format with Chemistry::Mol. Note however that this file plugin is write-only; there's no way of reading a VRML file back into a molecule.
This module is a modification of PDB2VRML by Horst Vollhardt, adapted to the Chemistry::File interface.
The following options may be passed to $mol->write.
If true, shift the molecules center of geometry into the origin of the coordinate system. Note: this only affects the output; it does not affect the coordinates of the atoms in the original Chemistry::Mol object.
Sets the style for the VRML representation of the molecular structure. Default is 'Wireframe'. Currently supported styles are:
Wireframe, BallAndWire, Stick, BallAndStick, CPK
Set the overall color of the molecular structure. If the color is set to 'byAtom', the color the for atoms and bonds is defined by the atom type. Default is 'byAtom'. Currently supported colors are:
byAtom, yellow, blue, red, green, white, brown, grey, purple
Defines the radius in Angstrom for the cylinders in the 'Stick' and 'BallAndStick' style. Default is 0.15 .
Defines the factor which is multiplied with the VDW radius for the spheres in the 'BallAndWire' and 'BallAndStick' style. Default is 0.2 .
Turns on/off compression of the output. If turned on, all leading whitespaces are removed. This produces a less readable but approx. 20% smaller output, the speed is increased by 10% as well.
PDB2VRML Copyright (c) 1998 by Horst Vollhardt. All rights reserved. Chemistry::File::VRML modifications Copyright (c) 2005 by Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
PerlMol project at http://www.perlmol.org/