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 $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 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->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->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.
- $atom->distance($obj)
-
Returns the minimum distance to $obj, which can be an atom, a molecule, or a vector.
- $atom->print
-
Convert the atom to a string representation.
SEE ALSO
Chemistry::Mol, Chemistry::Bond, Math::VectorReal, Chemistry::Tutorial
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.