That's cool, buddy! I am trying to obtain the unit vector of the dipole moment (a vector) using sub Normalize.
# 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?
In reply to Re^4: The problem of getting the unit vector "Undefined subroutine &main::Normalize"
by windcrazy86
in thread The problem of getting the unit vector "Undefined subroutine &main::Normalize"
by windcrazy86
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |