void CreateNPos(c1,c2,c3,c4)
double c1[3],c2[3],c3[3],c4[3];
{
  double v3[3],v4[3],vect[3];
  double c5[3],c6[3];
  double v21[3],v31[3];
  double cosa,sina;
  double angrad,fact,tot;
  int i;

// c1 == (C)=O	CD
// c2 == C=(O)	OE2
// c3 == NE2	NE2

  vsubd(c2,c1,v21);
  vsubd(c3,c1,v31);

  normalize(v21);
  normalize(v31);

// v3 perpendicular to C=O (v21) and N-C (v31)

  crossprd(v21,v31,v3);

// v4 perpendicular to C=O (v21) and v3

  crossprd(v21,v3,v4);

  angrad = (114.5 * PI) / 180.0;

  sina = sin(angrad);
  cosa = cos(angrad);

  fact = 2.763/toangs;

  for (i=0; i < 3; i++) {
	v4[i] = -v4[i];
  }

  normalize(v4);

  for (i=0; i < 3; i++) {
	vect[i] = -cosa*v21[i] + sina*v4[i];
  }

  normalize(vect);

  for (i=0; i < 3; i++) {
	vect[i] = fact*vect[i];
  }

// vect has the wrong direction

  for (i=0; i < 3; i++) {
	c4[i] = (c2[i] + vect[i])*toangs;
  }

  fprintf(stderr,"coordinates %7.3f %7.3f %7.3f\n",c4[0],c4[1],c4[2]);
// c4 is the projected N coordinate
}

void CreateCPos(c1,c2,c3,c4)
double c1[3],c2[3],c3[3],c4[3];
{
  double v3[3],v4[3],vect[3];
  double c5[3],c6[3];
  double v21[3],v31[3];
  double cosa,sina;
  double angrad,fact,tot;
  int i;

// c1 = NE2
// c2 = HE2
// c3 = (C)=O CD

  vsubd(c2,c1,v21);
  vsubd(c3,c1,v31);

  normalize(v21);
  normalize(v31);

// v3 perpendicular to N-H (v21) and C-N (v31)

  crossprd(v21,v31,v3);

// v4 perpendicular to N-H (v21) and v3

  crossprd(v21,v3,v4);

  angrad = (157.86 * PI) / 180.0;

  sina = sin(angrad);
  cosa = cos(angrad);

  fact = 2.7203/toangs;

  for (i=0; i < 3; i++) {
	v4[i] = -v4[i];
  }

  normalize(v4);

  for (i=0; i < 3; i++) {
	vect[i] = -cosa*v21[i] + sina*v4[i];
  }

  normalize(vect);

  for (i=0; i < 3; i++) {
	vect[i] = fact*vect[i];
  }

// vect has the wrong direction

  for (i=0; i < 3; i++) {
	c4[i] = (c2[i] + vect[i])*toangs;
  }

  fprintf(stderr,"coordinates %7.3f %7.3f %7.3f\n",c4[0],c4[1],c4[2]);
// c4 is the projected C(=O) coordinate
}
