From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon Dec 18 2017 - 09:49:23 CST

Peter,
  Indeed, I think that the code as-written might coincidentally work
sometimes when inputs are already upper-cased (most PDB files), but as
you point out, the parentheses are clearly misplaced and thus toupper()
is being misused there. I will take care of correcting this. Thanks!

Best,
  John Stone
  vmd_at_ks.uiuc.edu

On Mon, Dec 18, 2017 at 09:35:44AM +0000, Peter Jensen Husen wrote:
> In the method
> float BaseMolecule::default_mass(const char *nm)
>
> there are three lines:
>
> if (toupper(nm[0] == 'C') && toupper(nm[1] == 'L')) val = 35.453f;
>
> else if (toupper(nm[0] == 'N') && toupper(nm[1] == 'A')) val = 22.989770f;
>
> else if (toupper(nm[0] == 'M') && toupper(nm[1] == 'G')) val = 24.3050f;
>
> which seem to have the wrong parenthesization. I suppose it should be,
> e.g:
>
> toupper(nm[0]) == 'C'
>
> I think this means the method will work as if the toupper wasn't there,
> since it maps 0->0 and 1->1, so it works, if "CL", "NA" and "MG" are
> already uppercase, but not otherwise.
> Best,
> Peter Husen
> Dept. of Physics, Chemistry and Pharmacy
> University of Southern Denmark

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/