/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        G E N E R A T I O N   D U   F U L L E R E N E   C 6 0  :                                                                   */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xtc/Fullerene_C60.01$vv$c' :                                                                                   */
/*                                                                                                                                   */
/*                    ChatGPT.5 et Jean-Francois COLONNA (LACTAMME, 20260916104826).                                                 */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#include  "INCLUDES.01.I"
#define   NICO      12
#define   NC60      60
#define   INFINI    1e100
#define   EPSILON1  1e-10
#define   EPSILON2  1e-12
typedef   struct
          {
          double x, y, z;
          } POINT;
static    POINT     p[NICO];
static    POINT     c60[NC60];
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P R O D U I T   S C A L A I R E   E T   D I S T A N C E   A U   C A R R E  :                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
static    double    dist2(POINT a,POINT b)
          {
          double    x = a.x-b.x;
          double    y = a.y-b.y;
          double    z = a.z-b.z;
          return    x*x+y*y+z*z;
          }
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        G E N E R A T I O N   D E S   1 2   S O M M E T S   D E   L ' I C O S A E D R E  :                                         */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
static    void      icosahedron(void)
          {
          double    phi = (1.0+sqrt(5.0))/2.0;
          int       n=0;
          int       s1,s2;
          for       (s1=-1; s1<=1; s1+=2)
                    {
                    for       (s2=-1; s2<=1; s2+=2)
                              {
                              p[n++] = (POINT){0,s1,s2*phi};
                              }
                    }
          for       (s1=-1; s1<=1; s1+=2)
                    {
                    for       (s2=-1; s2<=1; s2+=2)
                              {
                              p[n++] = (POINT){s1,s2*phi,0};
                              }
                    }
          for       (s1=-1; s1<=1; s1+=2)
                    {
                    for       (s2=-1; s2<=1; s2+=2)
                              {
                              p[n++] = (POINT){s2*phi,0,s1};
                              }
                    }
          }
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        C O N S T R U C T I O N   D U   C 6 0  :                                                                                   */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
double    Xmin=+INFINI,Ymin=+INFINI,Zmin=+INFINI;
double    Xmax=-INFINI,Ymax=-INFINI,Zmax=-INFINI;
static    void      make_c60(void)
          {
          double    dmin=+INFINI;
          int       i,j;
          for       (i=0; i<NICO; i++)
                    {
                    for       (j=i+1; j<NICO; j++)
                              {
                              double    d=dist2(p[i],p[j]);
                              if        (d<dmin && d>EPSILON2)
                                        {
                                        dmin=d;
                                        /* Toutes les aretes de l'icosaedre ont la meme longueur.                                    */
                                        }
                              else
                                        {
                                        }
                              }
                    }
          int       n=0;
          for       (i=0; i<NICO; i++)
                    {
                    for       (j=i+1; j<NICO; j++)
                              {
                              if        (fabs(dist2(p[i],p[j])-dmin)<EPSILON1)
                                        {
                                        c60[n++] = (POINT){(2*p[i].x+p[j].x)/3.0,(2*p[i].y+p[j].y)/3.0,(2*p[i].z+p[j].z)/3.0};
                                        c60[n++] = (POINT){(p[i].x+2*p[j].x)/3.0,(p[i].y+2*p[j].y)/3.0,(p[i].z+2*p[j].z)/3.0};
                                        /* Chaque arete donne 2 sommets du polyedre : (2A+B)/3 et (A+2B)/3.                          */
                                        }
                              else
                                        {
                                        }
                              }
                    }
          printf("Nombre de sommets C60 = %d\n",n);
          int       m=0;
          for       (m=0; m<n; m++)
                    {
                    Xmin = MIN2(p[m].x,Xmin);
                    Ymin = MIN2(p[m].x,Ymin);
                    Zmin = MIN2(p[m].x,Zmin);
                    Xmax = MAX2(p[m].x,Xmax);
                    Ymax = MAX2(p[m].x,Ymax);
                    Zmax = MAX2(p[m].x,Zmax);
                    }
          }
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        R E C H E R C H E   D E S   L I A I S O N S   C - C  :                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
static    void      bonds(void)
          {
          double    dmin=+INFINI;
          int       i,j;
          for       (i=0; i<NC60; i++)
                    {
                    for       (j=i+1; j<NC60; j++)
                              {
                              double    d=dist2(c60[i],c60[j]);
                              if        (d<dmin && d>EPSILON2)
                                        {
                                        dmin=d;
                                        /* Distance minimale entre 2 des 60 sommets (ce sont les liaisons C-C).                      */
                                        }
                              else
                                        {
                                        }
                              }
                    }
          printf("Distance C-C^2 = %.15g\n\n",dmin);
          int       nb=0;
          for       (i=0; i<NC60; i++)
                    {
                    for       (j=i+1; j<NC60; j++)
                              {
                              if        (fabs(dist2(c60[i],c60[j])-dmin)<EPSILON1)
                                        {
                                        printf("Arete={%02d,%02d}     ",i,j);
                                        printf("X1=%+.12f Y1=%+.12f Z1=%+.12f",c60[i].x,c60[i].y,c60[i].z);
                                        printf("     ");
                                        printf("X2=%+.12f Y2=%+.12f Z2=%+.12f",c60[j].x,c60[j].y,c60[j].z);
                                        printf("\n");
                                        nb++;
                                        }
                              else
                                        {
                                        }
                              }
                    }
          printf("\nNombre de liaisons = %d\n",nb);
          }
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P R O G R A M M E   P R I N C I P A L  :                                                                                   */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
int       main(void)
          {
          int       i;
          icosahedron();
          make_c60();
          printf("\nCoordonnees des 60 atomes :\n\n");
          for       (i=0; i<NC60; i++)
                    {
                    printf("Atome=%2d     X=%+.12f Y=%+.12f Z=%+.12f\n",i,c60[i].x,c60[i].y,c60[i].z);
                    }
          printf("\n");
          printf("Extrema : ");
          printf("Xmin=%+.12f Ymin=%+.12f Zmin=%+.12f",Xmin,Ymin,Zmin);
          printf("Xmax=%+.12f Ymax=%+.12f Zmax=%+.12f",Xmax,Ymax,Zmax);
          printf("\n");
          printf("\nLiaisons :\n\n");
          bonds();
          return 0;
          }



Copyright © Jean-François Colonna, 2026-2026.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2026-2026.