Re: atomselect option for extracting protein-ligand complex

From: Axel Kohlmeyer (
Date: Mon Feb 17 2014 - 16:22:38 CST

On Mon, Feb 17, 2014 at 5:16 PM, KK R <> wrote:
> Hi,
> I am trying to select a set comprising 'protein', 'ligand' and 'water
> residue within 10 angstroms of the ligand LIG' in the VMD console to write

two suggestions:

a) try the VMD mailing list, not the NAMD mailing list. your chances
to get a useful answer are a lot higher
b) search the mailing list archives. your kind of question has come up
several times before.

> them into PDB file from dcd trajectory. I tried to do it using the following
> atomselect command:
> set sel [atomselect top "{protein} and {resname LIG} and {water within 10 of
> (resname LIG)}"]
> My ultimate purpose is to extract "complex of protein-ligand and waters
> residing within 10A of ligand" from DCD trajectory. The whole script, I am
> using, is given below:
> --------------------------------------------------------------------------------------------------------------------------------
> set sel [atomselect top "{protein} and {resname LIG} and {water within 10 of
> (resname LIG)}"]
> set n [molinfo top get numframes]
> set outname "protligwater_"
> for { set i 0 } { $i < $n } { incr i } {
> $sel frame $i
> $sel update
> set name [format "%s%.9d.pdb" $outname $i]
> $sel writepdb $name
> }
> ---------------------------------------------------------------------------------------------------------------------------------
> It successfully writes pdb files, but all are empty as nothing was selected
> from the atomselect command.

they *have* to be empty, because the "and" in the atom selection
syntax is a "logical and" not an "additive and", i.e. only atoms that
satisfy *all* conditions will be selected. so you need to throw in a
strategic "or" or two somewhere. for details please refer to the VMD
user's guide and pay special attention to this additional piece of


> Any suggestion on it will be highly appreciable.
> Best regards,
> Roy

Dr. Axel Kohlmeyer
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:22:08 CST