distance between molecular planes?

Hi,

I'm trying to calculate the distance between two molecule planes from crystal structure.

One way I was looking to achieve this is the following way.

1. select a fragment (molecule).

2. Define plane using CreateBestFitPlane

3. Select another fragment

3. Define another plane

4. Calculates distance between the planes.

The problem is that I don't know how to tell materials studio to apply function only to the atoms selected

There might be an easier way too.

Any help is appreciated