#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define PI 3.14159265358979323846
int main (int argc, char **argv)
{
double offset, x, y, r, angle;
int order, n;

order = atoi (argv[1]);
r = atof (argv[2]);

offset = (2 * PI) / 36;
printf ("<gml>\n  <molecule>\n");

for (n = 0; n < order; n++)
  {
  angle = (2 * PI) / order;
  x = r * cos (n * angle);
  y = r * sin (n * angle);
  printf ("    <atom element=\"O\" x =\"%f\" y=\"%f\" z=\"%f\"/>\n", x, y, 1.1);

  x = r * cos (n * angle + offset);
  y = r * sin (n * angle + offset);
  printf ("    <atom element=\"O\" x =\"%f\" y=\"%f\" z=\"%f\"/>\n", x, y, 0.9);
  }

printf ("  </molecule>\n</gml>\n");

return 0;
}
