NAME

Chemistry::Atom

SYNOPSIS

    use Chemistry::Atom;

    my $atom = new Chemistry::Atom(
	id => 'a1',
	coords => [$x, $y, $z],
	symbol => 'Br'
    );

    $atom->add_bond($b);

    print $atom;

DESCRIPTION

This module includes objects to describe chemical atoms. An atom is defined by its symbol and its coordinates. Atomic coordinates are described by a Math::VectorReal object, so that they can be easily used in vector operations.

Atom Attributes

In addition to common attributes such as id, name, and type, atoms have the following attributes, which are accessed or modified through methods defined below: bonds, coords, Z, symbol.

In general, to get the value of a property use $mol->method without any parameters. To set the value, use $mol->method($new_value).

METHODS

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

Create a new Atom object with the specified attributes. Sensible defaults are used when possible.

$atom->Z($new_Z)

Sets and returns Z. If the symbol of the atom doesn't correspond to a known element, Z = undef.

$atom->symbol($new_symbol)

Sets and returns the atomic symbol.

$atom->coords([$x, $y, $z])

Sets the atom's coordinates, and returns a Math::VectorReal object.

$atom->add_bond($bond)

Adds a new bond to the atom, as defined by the Bond object $bond.

$atom->neighbors([$from])

Return a list of neighbors. If an atom object $from is specified, it will be excluded from the list.

$atom->bonds([$from])

Return a list of bonds. If an atom object $from is specified, it will be excluded from the list.

$mol->print

Convert the atom to a string representation.

SEE ALSO

Chemistry::Mol, Chemistry::Bond, Math::VectorReal

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.