NAME

Chemistry::Mol - Molecule object toolkit

SYNOPSIS

use Chemistry::Mol;

$mol = new Chemistry::Mol(id => "mol_id");
$mol->add_atom($atom1, $atom2);
$mol->add_bond($bond);

print $mol->print;

DESCRIPTION

This package, along with Chemistry::Atom and Chemistry::Bond, includes basic objects and methods to describe molecules.

The core methods try not to enforce a particular convention. This means that only a minimal set of attributes is provided by default, and some attributes have very loosely defined meaning. This is because each program and file type has different idea of what each concept (such as bond and atom type) means. Bonds are defined as a list of atoms (typically two) with an arbitrary type. Atoms are defined by a symbol and a Z, and may have 3D coordinates (2D and internal coming soon).

METHODS

See also Chemistry::Obj for generic attributes.

Chemistry::Mol->new(name => value, ...)

Create a new Mol object with the specified attributes.

$mol = Chemistry::Mol->new(id => 'm123', name => 'my mol')

is the same as

Chemistry::Mol->new()
$mol->id('m123')
$mol->name('my mol')
$mol->add_atom($atom, ...)

Add one or more Atom objects to the molecule. Returns the last atom added.

$mol->new_atom(name => value, ...)

Shorthand for $mol->add_atom(Chemistry::Atom->new(name => value, ...)); It has the disadvantage that it doesn't let you create a subclass of Chemistry::Atom.

$mol->add_bond($bond, ...)

Add one or more Bond objects to the molecule. Returns the last bond added.

$mol->new_bond(name => value, ...)

Shorthand for $mol->add_bond(Chemistry::Bond->new(name => value, ...)); It has the disadvantage that it doesn't let you create a subclass of Chemistry::Atom.

$mol->print

Convert the molecule to a string representation.

SEE ALSO

Chemistry::Atom, Chemistry::Bond, Chemistry::File

AUTHOR

Ivan Tubert <itub@cpan.org>

COPYRIGHT

Copyright (c) 2003 Ivan Tubert. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.