It took too long to find a proper solution on the web when searching for “pymol remove hydrogens” or “pymol remove water“. Therefore this short post.
For removing hydrogens, best use a selection:
There also is a special selection name available:
For removing water we can use a selection based on the residue name:
remove resn hoh
However, I most often use a more intelligent command for removing solvent in general: