CHARMM Development Project
Posted By: rossi A selection problem - 12/31/20 03:04 PM
Hello Everyone.

I have a molecule with four (4) residues, and I want to select the number of molecules interacting within a certain distance of another molecule

Here is a snippet of the code for selecting the number of molecules near cor2. Either selection seems to work the same way ... incorrectly

define nearby sele .byresidue. ( resn MACR .and. ( prop Z .le. +10.0 ) .and. ( segid cor2 .around. 53.0 ) ) end
define nearby sele .byresidue. ( ( segid MACR .and resid 1:4 ) .and. ( prop Z .le. +10.0 ) .and. ( segid cor2 .around. 53.0 ) ) end

calc ntest = ?nsel / 53

There are definitely 53 atoms in the molecule with 4 residues. Since I am using .byresidue. it should give me the number of residues divided by 53 as a whole number. (If the moleculesurrounding COR2 has one (1) residue, it works just fine.)

The problem is that, for the 4 residue molecule, ntest is NOT a whole number. HELP! All different attempts at selection do not work (e.g. without using .byresidue.).

If you view the final results with vmd, then some of the molecules near COR2 have the correct number of residues (i.e. 4) but there are others with only one (1) residue. That's why I am getting a
selection value (ntest) that is not a whole number.

Can you please help me with a selection command that will always provide a selection with four (4) residues?

Thanks so much for your help with this.

Kind regards and Happy New Year (2021)!

Posted By: rmv Re: A selection problem - 12/31/20 05:25 PM
How big is the box? Is the COR2 segment centered in the middle of the box? Is each MACR residue a whole molecule? Or is each molecule in the MACR segment composed of multiple (e.g. 4) residues?

The value 53.0 is a fairly large cutoff distance for the .around. operator, esp. to characterize interactions.

The .byres. operator will not select a whole molecule if some of the residues in the molecule are outside the other criteria (.around. and prop Z), so you may need additional selections that utilize the .bonded. operator to get the whole molecules.

Ideally, whole molecules are either residues or segments; a segment with many multiple residue molecules poses distinct challenges fro atom selection.
Posted By: rossi Re: A selection problem - 12/31/20 05:59 PM
Dear Rick,

Thanks for helping me.

COR2 is a graphene molecule and flat.

Before the selection, I issue the command coor orient select resname COR2 end which ensures that it is in the xy-plane. It has a large radius so that a large .around. value allows molecules
interacting with it to be selected. Also, using prop Z is a way to select molecules above the xy-plane of the graphene.

The box size is x by y by z is 50 x 50 x 115 and has a complicated mix of molecules

How about this after the above selection:


calc ntest = ?nsel / 4


Now I have the number of molecules.

Can I somehow use .subset. to get the molecules I want? I am not sure.

I will try the following

set newnearby select nearby .subset 1:@ntest end


© CHARMM forums