CHARMM Development Project
Posted By: shane yue Selection within a cylinder - 09/06/16 06:53 PM
Hi CHARMMers,

I am curious of making selections within a cylindrical region.

For example, if I want to find number of water molecules between -20 Angstrom and -15 Angstrom along the z-axis, it is easy to define z-range using "(prop Z .gt. -20) .and. (prop Z .lt. -15)", but how can I define the region on xy-plane?

Thanks in advance.

Best

Shane
Posted By: lennart Re: Selection within a cylinder - 09/06/16 07:44 PM
For a cylinder of radius Rc the following should work

scalar x store 1
scalar y store 2
scalar sca1 pow 2.0
scalar sca2 pow 2.0
scalar sca1 +store 2
scalar sca2 sqrt

define inxysel sele prop sca2 .le. "rc" end

define cylinder sele inxysel .and. ( your-z-selection) .and. type oh2 end
echo Number of water molecules in cylinder: @cylinder
Posted By: shane yue Re: Selection within a cylinder - 09/06/16 08:43 PM
Hi Lennart,

Thanks for your instruction. It worked.

Best

Shane
© CHARMM forums