********> bugfix.16 Author: Bill Ross Date: 5/10/95 Programs: leap Severity: moderate Problem: With addIons command using ions in ions*.lib one sees: ContainerCenterAt(): Skipping atom w/ unknown position Cause: The ions in ions*.lib lack a flag indicating that they have positions. At the moment, there is no obvious way to have the code set this flag when the ions are originally created. The fix causes this flag to be set in addIons when an ion consists of a single atom. The work-around below contains diffs for ions*.lib for inserting the correct flags. Fix: Make the following change to commands.c ------------------------------------------------------------------------- *** OLD commands.c --- NEW commands.c *************** *** 830,836 i++; } ! VP0(( "Loading PDB file\n" )); uUnit = uPdbRead( fPdb, vaUnits ); VarArrayDestroy( &vaUnits ); --- 830,836 ----- i++; } ! VP0(( "Loading PDB file: %s\n", GsBasicsFullName )); uUnit = uPdbRead( fPdb, vaUnits ); VarArrayDestroy( &vaUnits ); *************** *** 4416,4422 STRING sTemp; double dCharge, dPertCharge, dICharge1, dICharge2; double dIonSize1, dIonSize2, dMinSize; ! int iCharge, iTemp, ierr; VECTOR vNewPoint, vMaxPot, vMinPot; RESIDUE rRes; HELP hTemp; --- 4416,4422 ----- STRING sTemp; double dCharge, dPertCharge, dICharge1, dICharge2; double dIonSize1, dIonSize2, dMinSize; ! int iCharge, iUnknown, iTemp, ierr; VECTOR vNewPoint, vMaxPot, vMinPot; RESIDUE rRes; HELP hTemp; *************** *** 4541,4547 } /* ! * Consider ion sizes. */ dIonSize1 = 0.0; lAtoms = lLoop( uIon1, ATOMS ); --- 4540,4546 ----- } /* ! * Consider ion sizes and positions. */ dIonSize1 = 0.0; iUnknown = 0; *************** *** 4544,4549 * Consider ion sizes. */ dIonSize1 = 0.0; lAtoms = lLoop( uIon1, ATOMS ); for(i=0; aAtom = (ATOM)oNext(&lAtoms); i++) { if ( iAtomSetTmpRadius( aAtom ) ) --- 4543,4549 ----- * Consider ion sizes and positions. */ dIonSize1 = 0.0; + iUnknown = 0; lAtoms = lLoop( uIon1, ATOMS ); for(i=0; aAtom = (ATOM)oNext(&lAtoms); i++) { if ( iAtomSetTmpRadius( aAtom ) ) *************** *** 4550,4555 VP0(( "Using default radius %5.2f for ion %s\n", ATOM_DEFAULT_RADIUS, sAssocName( aaArgs[1] ) )); dIonSize1 = MAX( dIonSize1, dAtomTemp( aAtom ) ); } if ( i > 1 ) { VP0(( "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms\n", --- 4550,4557 ----- VP0(( "Using default radius %5.2f for ion %s\n", ATOM_DEFAULT_RADIUS, sAssocName( aaArgs[1] ) )); dIonSize1 = MAX( dIonSize1, dAtomTemp( aAtom ) ); + if ( !bAtomFlagsSet( aAtom, ATOMPOSITIONKNOWN ) ) + iUnknown++; } if ( i > 1 ) { if ( iUnknown ) { *************** *** 4552,4557 dIonSize1 = MAX( dIonSize1, dAtomTemp( aAtom ) ); } if ( i > 1 ) { VP0(( "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms\n", sAssocName( aaArgs[1] ), dIonSize1 )); dIonSize1 *= (double) i; --- 4554,4564 ----- iUnknown++; } if ( i > 1 ) { + if ( iUnknown ) { + VP0(( "Ion %s is polyatomic and has %d atoms w/ no position\n", + sAssocName( aaArgs[1] ), iUnknown )); + RETURN( NULL ); + } VP0(( "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms\n", sAssocName( aaArgs[1] ), dIonSize1 )); dIonSize1 *= (double) i; *************** *** 4555,4560 VP0(( "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms\n", sAssocName( aaArgs[1] ), dIonSize1 )); dIonSize1 *= (double) i; } dMinSize = dIonSize1; if ( uIon2 ) { --- 4562,4575 ----- VP0(( "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms\n", sAssocName( aaArgs[1] ), dIonSize1 )); dIonSize1 *= (double) i; + } else if ( iUnknown ) { + VECTOR vPos; + + VectorDef( &vPos, 0.0, 0.0, 0.0 ); + lAtoms = lLoop( uIon1, ATOMS ); + aAtom = (ATOM)oNext(&lAtoms); + AtomSetPosition( aAtom, vPos ); + AtomSetFlags( aAtom, ATOMPOSITIONKNOWN ); } dMinSize = dIonSize1; if ( uIon2 ) { *************** *** 4559,4564 dMinSize = dIonSize1; if ( uIon2 ) { dIonSize2 = 0.0; lAtoms = lLoop( uIon2, ATOMS ); for(i=0; aAtom = (ATOM)oNext(&lAtoms); i++) { if ( iAtomSetTmpRadius( aAtom ) ) --- 4574,4580 ----- dMinSize = dIonSize1; if ( uIon2 ) { dIonSize2 = 0.0; + iUnknown = 0; lAtoms = lLoop( uIon2, ATOMS ); for(i=0; aAtom = (ATOM)oNext(&lAtoms); i++) { if ( iAtomSetTmpRadius( aAtom ) ) *************** *** 4565,4570 VP0(( "Using default radius %5.2f for ion %s\n", ATOM_DEFAULT_RADIUS, sAssocName( aaArgs[3] ) )); dIonSize2 = MAX( dIonSize2, dAtomTemp( aAtom ) ); } if ( i > 1 ) { VP0(( --- 4581,4588 ----- VP0(( "Using default radius %5.2f for ion %s\n", ATOM_DEFAULT_RADIUS, sAssocName( aaArgs[3] ) )); dIonSize2 = MAX( dIonSize2, dAtomTemp( aAtom ) ); + if ( !bAtomFlagsSet( aAtom, ATOMPOSITIONKNOWN ) ) + iUnknown++; } if ( i > 1 ) { if ( iUnknown ) { *************** *** 4567,4572 dIonSize2 = MAX( dIonSize2, dAtomTemp( aAtom ) ); } if ( i > 1 ) { VP0(( "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms", sAssocName( aaArgs[3] ), dIonSize2 )); --- 4585,4595 ----- iUnknown++; } if ( i > 1 ) { + if ( iUnknown ) { + VP0(( "Ion %s is polyatomic and has %d atoms w/ no position\n", + sAssocName( aaArgs[1] ), iUnknown )); + RETURN( NULL ); + } VP0(( "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms", sAssocName( aaArgs[3] ), dIonSize2 )); *************** *** 4571,4576 "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms", sAssocName( aaArgs[3] ), dIonSize2 )); dIonSize2 *= (double) i; } dMinSize = MIN( dIonSize1, dIonSize2 ); } --- 4594,4607 ----- "Ion %s is polyatomic; multiplying max radius %5.2f by # atoms", sAssocName( aaArgs[3] ), dIonSize2 )); dIonSize2 *= (double) i; + } else if ( iUnknown ) { + VECTOR vPos; + + VectorDef( &vPos, 0.0, 0.0, 0.0 ); + lAtoms = lLoop( uIon1, ATOMS ); + aAtom = (ATOM)oNext(&lAtoms); + AtomSetPosition( aAtom, vPos ); + AtomSetFlags( aAtom, ATOMPOSITIONKNOWN ); } dMinSize = MIN( dIonSize1, dIonSize2 ); } ------------------------------------------------------------------------- Temporary workarounds: make the following mods to ions94.lib: 8c8 < "Cs+" "Cs" 0 1 0 1 55 1.000000 --- > "Cs+" "Cs" 0 1 131072 1 55 1.000000 44c44 < "K+" "K" 0 1 0 1 19 1.000000 --- > "K+" "K" 0 1 131072 1 19 1.000000 80c80 < "Li+" "Li" 0 1 0 1 3 1.000000 --- > "Li+" "Li" 0 1 131072 1 3 1.000000 116c116 < "Na+" "IP" 0 1 0 1 11 1.000000 --- > "Na+" "IP" 0 1 131072 1 11 1.000000 152c152 < "Rb+" "Rb" 0 1 0 1 37 1.000000 --- > "Rb+" "Rb" 0 1 131072 1 37 1.000000 Temporary workarounds: make the following mods to ions91.lib: 9c9 < "Cs+" "QC" 0 1 0 1 55 1.000000 --- > "Cs+" "QC" 0 1 131072 1 55 1.000000 45c45 < "IB" "IB" 0 1 0 1 55 1.000000 --- > "IB" "IB" 0 1 131072 1 55 1.000000 81c81 < "K+" "QK" 0 1 0 1 19 1.000000 --- > "K+" "QK" 0 1 131072 1 19 1.000000 117c117 < "Li+" "QL" 0 1 0 1 3 1.000000 --- > "Li+" "QL" 0 1 131072 1 3 1.000000 153c153 < "Na+" "QN" 0 1 0 1 11 1.000000 --- > "Na+" "QN" 0 1 131072 1 11 1.000000 189c189 < "Rb+" "QR" 0 1 0 1 37 1.000000 --- > "Rb+" "QR" 0 1 131072 1 37 1.000000 -------------------------------------------------------------------------