DESCRIPTION

The HackaMol AtomGroupRole class provides core methods and attributes for consuming classes that use groups of atoms. The original implementation of this role relied heavily on attributes, builders, and clearers. Such an approach naturally gives fast lookup tables, but the ability to change atoms and coordinates made the role to difficult. Such an approach may be pursued again (without changing the API) in the future after the API has matured. The AtomGroupRole calculates all values for atoms using their own t attributes.

METHODS

do_for_all

pass method and arguments down to atoms in group

$group->do_for_all('t',1); #sets t to 1 for all atoms

gt

integer argument. wraps do_for_all for setting time within group

$group->gt(1);

dipole

no arguments. return dipole calculated from charges and coordinates as Math::Vector::Real object

COM

no arguments. return center of mass calculated from masses and coordinates as Math::Vector::Real object

COM

no arguments. return center of nuclear charge calculated from Zs and coordinates as Math::Vector::Real object

total_charge

no arguments. return sum of atom charges.

total_mass

no arguments. return sum of atom masses.

total_Z

no arguments. return sum of Zs.

dipole_moment

no arguments. returns the norm of the dipole in debye (assuming charges in electrons, AKMA)

bin_atoms

no arguments. returns two hash references. The histogram of atom symbols, and a map from symbol-> Z for the same keys. The second hash reference was added, to be able to sort by Z in the absence of Atom objects.

count_unique_atoms

no arguments. returns the number of keys in each hash returned by bin_atoms

bin_atoms_name

no arguments. returns a string summary of the atoms in the group. Take the bin_atoms hashes, sorts by Z and generates something like OH2 for water or O2H2 for peroxide.

tmax

return (count_coords-1) if > 0; return 0 otherwise; croaks if not all atoms share the same tmax.

rotate

Rotates all atoms in the group around the MVR vector. Pass tf to the translate method to store new coordinates in tf rather than atom->t.

print_xyz

optional argument: filename or filehandle. with no argument, prints xyz formatted output to STDOUT. pass a filename and an xyz file with that name will be written or overwritten (with warning). pass filehandle for continuous writing to an open filehandle.

print_xyz_ts

argument: array_ref containing the values of t to be used for printing. optional argument: filename or filehandle for writing out to file. For example,

$mol->print_xyz_ts([0 .. 3, 8, 4], 'fun.xyz');

will write the coordinates for all group atoms at t=0,1,2,3,8,4 to a file, in that order.