NAME

Chemistry::Atom

SYNOPSIS

    use Chemistry::Atom;

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

    print $atom->print;

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 $atom->method without any parameters. To set the value, use $atom->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 the atomic number (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->mass($new_mass)

Sets and returns the atomic mass in atomic mass units. By default, relative atomic masses from the 1995 IUPAC recommendation are used. (Table stolen from the Chemistry::MolecularMass module by Maksim A. Khrapov).

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

Sets the atom's coordinates, and returns a Math::VectorReal object. It can take as a parameter a Math::VectorReal object, a reference to an array, or the list of coordinates.

$atom->add_bond($bond)

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

$atom->delete

Calls $mol->delete_atom($atom) on the atom's parent molecule. Note that an atom should belong to only one molecule or strange things may happen.

$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.

($distance, $closest_atom) = $atom->distance($obj)

Returns the minimum distance to $obj, which can be an atom, a molecule, or a vector. In scalar context it returns only the distance; in list context it also returns the closest atom found.

$atom->angle($atom2, $atom3)

Returns the angle in radians between the atoms involved. $atom2 is the atom in the middle. Can also be called as Chemistry::Atom::angle($atom1, $atom2, $atom3);

$atom->angle_deg($atom2, $atom3)

Same as angle(), but returns the value in degrees.

$atom->dihedral($atom2, $atom3, $atom4)

Returns the dihedral angle in radians between the atoms involved. Can also be called as Chemistry::Atom::dihedral($atom1, $atom2, $atom3, $atom4);

$atom->dihedral_deg($atom2, $atom3, $atom4)

Same as dihedral(), but returns the value in degrees.

$atom->print

Convert the atom to a string representation.

VERSION

0.21

SEE ALSO

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

The PerlMol website http://www.perlmol.org/

AUTHOR

Ivan Tubert <itub@cpan.org>

COPYRIGHT

Copyright (c) 2004 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.