			idum1 = DelAmino(xyzp->iresid[*incp-1]);
			InsertAmino = xyzp->iresid[*incp-1];
			ir = xyzp->iresid[*incp-1];
			   if (xyzp->iresid[i] == ir) xyzp->iaton[i] = 2;
				xyzp->iresid[i] = SelRes;
	  if (xyzp->iresid[l] < -3) {
	   m = ABS(xyzp->iresid[l]);
	  if (xyzp->iresid[l] < -3) {
	   m = ABS(xyzp->iresid[l]);
		   if (xyzp->iresid[i] > 0) {
			AminoAcids[calfptr->iamino[xyzp->iresid[i]-1]-1]);
		   } else if (xyzp->iresid[i] < -3) {
			hetptr.HetAtm[ABS(xyzp->iresid[i])]);
	irtt = xyzp->iresid[Asel];
	xyzp->iresid[iptr1] = irt;
    xyzp->iresid[iptr1] = irt;
	xyzp->iresid[j+2] = 1;
	   xyzp->iresid[j+offhlp+1] = i+1;
	xyzp->iresid[0] = calfptr->ncalf;
	xyzp->iresid[row] = calfptr->ncalf;
    SetPDBArray(xyzp->iresid,frglen-1,calfptr->ncalf,nz);
		if ((izz(j,k) == iprot[l]) && xyzp->iresid[j] <= 0) prot = 1;
	if (xyzp->iresid[j] >= ires) {
	   xyzp->iresid[j+nlines] = xyzp->iresid[j] + seq_len;
	   xyzp->iresid[j+nlines] = xyzp->iresid[j];
		if ((ab == iprot[l]) && xyzp->iresid[j] <= 0) prot = 1;
	    if (xyzp->iresid[i] != ires-1) {
	xyzp->iresid[in-1] = ires+seq_len;
	    if (xyzp->iresid[i] != ires) {
	if (xyzp->iresid[i] <= 0) ktyp = 1;
	if ((xyzp->iresid[i] == ires) && (xyzp->ianz[i] == 1) &&
	if (prothet[l][4] == 2) xyzp->iresid[i+nefflin] = ires;
	fprintf(stderr,"atm iresid %d ipdbt %d ityp %d iaton %d \n",xyzp->iresid[i],xyzp->ipdbt[i],xyzp->ityp[i],xyzp->iaton[i]);
	   xyzp->iresid[iptr1] = irt;
	    xyzp->iresid[iptr1] = irt;
				   ires = xyzp->iresid[i] - 1;
	   CurAmino = xyzp->iresid[iat] - 1;
		if ((izz(j+1,k) == iprot[l]) && xyzp->iresid[j+1] <= 0) prot = 1;
		if ((izz(j+nlines,k) == iprot[l]) && xyzp->iresid[j+nlines] <= 0) prot = 1;
	xyzp->iresid[j]  = xyzp->iresid[j+nlines];
		if ((ab == iprot[l]) && xyzp->iresid[j+nlines] <= 0) prot = 1;
		if (xyzp->iresid[i] != ires) {
	xyzp->iresid[in-1] = xyzp->iresid[in-1] - 1;
	if (xyzp->iresid[i] > ires) 
	   xyzp->iresid[i] = xyzp->iresid[i] - 1;
        if (xyzp->iresid[i] != ires) {
   ires = xyzp->iresid[isel];
        if (xyzp->iresid[i] != ires) {
		if (xyzp->iresid[i] == ires) {
			xyzp->coo,xyzp->qat,xyzp->iresid,xyzp->iatclr,
			   if (xyzp->iresid[i] == ires) {
					    xyzp->iresid[nprev+1+j] = xyzp->iresid[i+j];
   maparr(NULL,NULL,xyzp->iresid,NULL,2);
	if (xyzp->iresid[isel] > 0) update_res = xyzp->iresid[isel];
	sprintf(qboxes[QRSD].str,"%d",xyzp->iresid[ATMsel]);
	qboxes[QRSD].iflt = &xyzp->iresid[ATMsel];
	ir = abs(xyzp->iresid[0]);
			rearr(iarr,xyzp->iresid);
		xyzp->iresid[i] = 0;
		xyzp->iresid[i] = TMPxyz.iresid[i];
	    watres[istruct][n] = xyzp->iresid[i];
	xyzp->iresid[ia+i] = watres[istruct][i];
		if (xyzp->iresid[i] == resrot[0].idrs[j]) xyzp->iatclr[i] = 1;
		if (xyzp->iresid[i] == resrot[0].idrs[l]) {
	if (xyzp->iresid[i] == CHGopt) 
			if (xyzp->iresid[k] == j+1) {xyzp->isurf[k] = 1;}
			if (xyzp->iresid[k] == -j) {xyzp->isurf[k] = 1;}
		           if (Ca>=0) parse_labelp(xyzp->iresid[Ca]-1,Ca,
		   	   if (Ca>=0) parse_labelp(xyzp->iresid[Ca]-1,Ca,
    if (xyzp->iaton[iatom] >= 1  && !(xyzp->iresid[iatom] <= 0 
	&& xyzp->iresid[iatom] >= -3 && xyzp->ianz[iatom] == 100)) {
	   if (*ipdbon && xyzp->iresid[iatom] == -(calfptr->ishoh) && it) issolv = 1;
	   ir = xyzp->iresid[iatom];
	    jr = xyzp->iresid[j];
       if (xyzp->iresid[i] < -3) {
	   !(xyzp->iresid[i] <= 0 && xyzp->iresid[i] >= -3 && xyzp->ianz[i] == 100)) {
	   !(xyzp->iresid[i] <= 0 && xyzp->iresid[i] >= -3 && xyzp->ianz[i] == 100) && xyzp->iconn[i*(MXCON+1)] == 0 && ! *fancy) {
	   !(xyzp->iresid[i] <= 0 && xyzp->iresid[i] >= -3 && xyzp->ianz[i] == 100)) {
	 if (!dsurf && xyzp->iresid[i] < 0) { 
	   !(xyzp->iresid[i] <= 0 && xyzp->iresid[i] >= -3 && 
	   !(xyzp->iresid[i] <= 0 && xyzp->iresid[i] >= -3 && xyzp->ianz[i] == 100)) {
	if (xyzp->iresid[i] > 0) {
	   if (calfptr->lab[xyzp->iresid[i]-1] > 0) {
		ilptr = calfptr->lab[xyzp->iresid[i]-1];
	   if (clfstrptr->labhet[ABS(xyzp->iresid[i])] > 0) {
		ilptr = clfstrptr->labhet[ABS(xyzp->iresid[i])];
		&xyzp->qat[i],&zero,&ilptr,&xyzp->iresid[i],&zero);
	if (xyzp->iresid[j] == het) {
	tmpres = xyzp->iresid[j+ndel];
	xyzp->iresid[j] = tmpres;
   ir = xyzp->iresid[iatom];
		   if (xyzp->iresid[i] == -j) 
		ir = xyzp->iresid[iat];
			       if (xyzp->iresid[i] == ir) {
	xyzp->iresid[j+nlines] = xyzp->iresid[j];
	xyzpn->iresid[j] = xyzp1->iresid[j];
	xyzpn->iresid[j+nlines] = xyzp1->iresid[j];
	xyzpn->iresid[j+nlines] = xyzp2->iresid[j];
	ires = xyzp2->iresid[j];
		xyzpn->iresid[j+nlines] = nres1 + xyzp2->iresid[j];
		xyzpn->iresid[j+nlines] = xyzp2->iresid[j] - (nhet1);
		xyzpn->iresid[j+nlines] = xyzp2->iresid[j];
		xyzpn->iresid[j+nlines] = -COO[str1]->hetatm.NHetAtm;
		xyzpn->iresid[j+nlines] = -4;
	 xyzp->ianz,xyzp->iaton,xyzp->iatclr,xyzp->iconn,xyzp->iresid,
	if (xyzp->iresid[j] == ihet) {
	if (xyzp->iresid[j] == ihet) {
		if (i > 0) if (xyzp->iresid[i] != ihet) iac++;
	if (xyzp->iresid[j] == ihet) {
    ir = xyzp->iresid[iat];
	if (xyzp->iresid[j] == ihet) {
	if (xyzp->iresid[j] == ihet) {
	  ir = xyzp->iresid[j];
	  	   lr = xyzp->iresid[la-1];
						   angles3[k], xyzp->iresid[j]);
						   angles2[k], xyzp->iresid[j]);
						xyzp->iresid[j]);
							   xyzp->iresid[j]);
						xyzp->iresid[j]);
						xyzp->iresid[j]);
					angles3a[k],xyzp->iresid[j]);
					180.0,xyzp->iresid[j]);
					is*120.0,xyzp->iresid[j]);
	   if (xyzp->iresid[j] == ihet) {
	if (xyzp->iresid[j] == ihet) {
	xyzp->iresid);
	if (xyzpo->iresid[j] == het) {
	xyzp->iresid[j] = -4;
	   ir = xyzpo->iresid[i-1];
	   if (xyzp->iresid[i] > 0) {
		if (calfptr->reson[xyzp->iresid[i]-1] == 1) doit = 1;
	   } else if (xyzp->iresid[i] < -3) {
	   if (xyzp->iresid[i] > 0) {
		if (calfptr->reson[xyzp->iresid[i]-1] == 1) doit = 1;
	   } else if (xyzp->iresid[i] < -3) {
   fprintf(stderr,"%d iresid[7027] %d \n",iop,xyzp->iresid[7027]);
	if (xyzp->iresid[k] > 0) {
   pppires = xyzp->iresid;
   xyzp->iresid = MOLxyz.iresid;
   xyzp->iresid = pppires;
		xyzp->iresid[itel] = -3;
