Thanks! It seems that I need to write the sub Normalize by myself. I thought Normalize is a function in perl....
| [reply] |
"Normalize" means different things in different contexts.
The one you seek could very well have already been written and available inside a free CPAN module .. You need to set the context, and search.
If you have trouble finding a pre-written one on CPAN, post back here with an explanation of what you expect "Normalize" to do, and what kind of parameters you are passing in .. Monks are eager to help.
It appears you are dealing with Molecular Chemistry - if so perlmol may be of interest.
All power corrupts, but we need electricity.
| [reply] |
# get dipole moment
my $dipoleMoment = $setMolecule->DipoleMoment;
# get the unit vector of dipole moment
my $direction=Normalize($dipoleMoment);
unit vector=±a/|a|. For example, if I want to have the unit vector of (2,-3,6), the calculation process is unit vector=±(2,-3,6)/√4+9+36=±(2/7,-3/7,6/7).
$dipoleMoment is a vector with (X, Y, Z), I am trying to have the unit vector of $dipoleMoment, would you please write sub Normalize to fulfill this calculation?
| [reply] [d/l] |
| [reply] |