How to get the force component of a group of atoms

Hello,

I'm trying to simulation friction process in Materials Studio, and I want to calculate the force component of a group of atoms labed "TOP". Is it correct to use the script like the one below? Can anyone help me with it? Thank you very much!

my \$atoms = \$doc->UnitCell->Sets("TOP")->Atoms;
my \$force = \$atoms->Force;
print \$force->X;