#!/usr/bin/perl -w

use System;

my $a=sqrt(3);
my $c=(5.616/3.577)*$a;
my $m=2.7387318e-25;

$cell=[
  $a*sqrt(3)/2,-$a/2,0,
  0,$a,0,
  0,0,$c,
];

my $atoms=[
  [ "A", $m ],
  [ "B", $m ],
];

my $sites=[
  [ 0,0,0,             0 ],
  [ $a/sqrt(3),0,$c/2, 1 ],
];

my $bonds=[
  [ 0,1, $a/sqrt(3),0,$c/2,       7.054, 0.000, 6.766,
                                  0.000, 1.055, 0.000,
                                  6.766, 0.000,11.517 ],
  [ 1,0,-$a/sqrt(3),0,-$c/2,      7.054, 0.000, 6.766,
                                  0.000, 1.055, 0.000,
                                  6.766, 0.000,11.517 ],

  [ 0,0, 0,$a,0,                  1.084, 2.259, 0.000,
                                 -2.259,12.716, 0.000,
                                  0.000, 0.000,-0.927 ],
  [ 1,1, 0,$a,0,                  1.084,-2.259, 0.000,
                                  2.259,12.716, 0.000,
                                  0.000, 0.000,-0.927 ],

  [ 0,1, -2*$a/sqrt(3),0,$c/2,   -1.496, 0.000, 0.965,
                                  0.000,-0.937, 0.000,
                                  0.965, 0.000,-1.066 ],
  [ 1,0, 2*$a/sqrt(3),0,-$c/2,   -1.496, 0.000, 0.965,
                                  0.000,-0.937, 0.000,
                                  0.965, 0.000,-1.066 ],

  [ 0,0, 0,0,$c,                  0.080, 0.000, 0.000,
                                  0.000, 0.080, 0.000,
                                  0.000, 0.000,-3.897 ],
  [ 1,1, 0,0,$c,                  0.080, 0.000, 0.000,
                                  0.000, 0.080, 0.000,
                                  0.000, 0.000,-3.897 ],

  [ 0,1, System::axial([5*$a/(2*sqrt(3)),$a/2,$c/2],     0.488,-0.011) ],
  [ 1,0, System::axial([-5*$a/(2*sqrt(3)),-$a/2,-$c/2],  0.488,-0.011) ],

  [ 0,0, System::axial([ $a*sqrt(3),0,0],                1.213, 0.318) ],
  [ 1,1, System::axial([ $a*sqrt(3),0,0],                1.213, 0.318) ],
  [ 0,0, System::axial([-$a*sqrt(3),0,0],                1.213, 0.318) ],
  [ 1,1, System::axial([-$a*sqrt(3),0,0],                1.213, 0.318) ],

  [ 0,0, System::axial([0,$a,$c],                        1.048,-0.133) ],
  [ 1,1, System::axial([0,$a,$c],                        1.048,-0.133) ],

  [ 0,0, System::axial([0,2*$a,0],                      -0.344, 0.040) ],
  [ 1,1, System::axial([0,2*$a,0],                      -0.344, 0.040) ],
];

System::write($cell,$atoms,$sites,$bonds,"hcp");
