From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Sat Jun 27 2015 - 19:42:45 CDT

Ahh, I'm too used to python syntax. You need to escape any character
that has special meaning in Tcl. Which includes the open and close
square bracket:

set sel [atomselect top "noh or withinbonds 1 of name \"\[O,N\].*\""]

-Josh

On 6/27/15 1:46 AM, Francesco Pietra wrote:
> Notice, if relevant, that the system contained TIP3 water in a
> periodic box.
>
> ---------- Forwarded message ----------
> From: *Francesco Pietra* <chiendarret_at_gmail.com
> <mailto:chiendarret_at_gmail.com>>
> Date: Sat, Jun 27, 2015 at 8:32 AM
> Subject: Re: vmd-l: Removing all non polar hydrogens
> To: Josh Vermaas <vermaas2_at_illinois.edu <mailto:vermaas2_at_illinois.edu>>
> Cc: VMD Mailing List <vmd-l_at_ks.uiuc.edu <mailto:vmd-l_at_ks.uiuc.edu>>
>
>
> I tried your suggestion on the tk console after loading psf/pdb
>
> loading history file ... 22 events added
> Main console display active (Tcl8.5.6 / Tk8.5.6)
> (tmp) 23 % set sel [atomselect top "noh or withinbonds 1 of name
> \"[O,N].*\""]
> invalid command name "O,N"
> >Main< (tmp) 24 %
>
>
>
> On Fri, Jun 26, 2015 at 9:55 PM, Josh Vermaas <vermaas2_at_illinois.edu
> <mailto:vermaas2_at_illinois.edu>> wrote:
>
> How about "noh or withinbonds 1 of name \"[O,N].*\""? First part
> gets you all the heavy atoms, second part saves hydrogens that are
> bonded to oxygens or nitrogens. It will require you to load your
> psf or equivalent topology-bearing file so the bond definitions
> are correct, but that ought to be trivial anywhere (mol new
> blah.psf; mol addfile blah.pdb;)
>
> -Josh Vermaas
>
>
> On 6/26/15 12:57 PM, Francesco Pietra wrote:
>> hello:
>>
>> is there an alternative to
>>
>> set sel [atomselect top "not hydrogen"]
>> $sel writepdb ...
>>
>>
>> in order to remove all non polar hydrogens only? Possibly without
>> loading the psf file, that would be difficult in the context
>> where i am now working.
>>
>> For example, with CHIMERA the command "delete HC" exists.
>>
>> thanks
>>
>> francesco pietra
>
>
>