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.
- center
- 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.
- style
- Sets the style for the VRML representation of the molecular structure.
Default is 'Wireframe'. Currently supported styles are:
Wireframe, BallAndWire,
Stick, BallAndStick,
CPK
- color
- 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
- stick_radius
- Defines the radius in Angstrom for the cylinders in the 'Stick' and
'BallAndStick' style. Default is 0.15 .
- ball_radius
- Defines the factor which is multiplied with the VDW radius for the spheres
in the 'BallAndWire' and 'BallAndStick' style. Default is 0.2 .
- compression
- 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 originally by Horst Vollhardt, horstv@yahoo.com, 1998. Modified and
adapted as Chemistry::File::VRML by Ivan Tubert-Brohman, itub@cpan.org, 2005.
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.
PDB2VRML found at
http://www.realitydiluted.com/mirrors/reality.sgi.com/horstv_basel/pdb2vrml/
PerlMol project at http://www.perlmol.org/