File : polymers.adb


with Ada.Text_IO, Messages, Ints, Reps, Lin, Lin.IO, Lin.IO.Vinci;
use Ada.Text_IO, Messages, Ints, Reps, Lin, Lin.IO, Lin.IO.Vinci;
with Lattice, Lattice.Ops, Lattice.IO, Lattice.IO.VRML;
use Lattice, Lattice.Ops, Lattice.IO, Lattice.IO.VRML;

procedure Polymers is   -- generate polymers and write .pol files
                        -- uncomment WriteVRML(...) line below to get .wrl files
                        -- uncomment WriteVinci(...) line below to get .ine files

  LP: constant Positive :=  2;  -- layer period: set 2 for AB, 3 for ABC
  NP: constant Positive :=  5;  -- size of polymers

  N1: constant Positive := 12;  -- lattice patch depth:  -N1 .. N1
  N2: constant Positive := 12;  -- lattice patch width:  -N2 .. N1
  N3: constant Positive :=  8;  -- lattice patch height: -N3 .. N3

  OK: Boolean;
  P: PolysPtr;
  A: RMatPtr;
  Mov: Blob(8);

begin
  Verbose := 1;
  InitPatch(N1,N2,N3,LP);

  P := FindConnClass(NP);

  Show(P,P'Last,NP);

  for K in P'Range loop
    null;
--    WriteVRML(MyImg(P(K)) & ".wrl",P(K));
  end loop;

  CheckMovable(NP,P);
  RemoveNbors(P);

  for K in P'Range loop
    Write(MyImg(P(K)) & ".pol",P(K));
    SetMovable(P(K),Mov,OK);
    A := Constraints(Mov);
    ClearMovable(Mov);
--    WriteVinci(MyImg(P(K)) & ".ine","Multiplicity" & P(K).M'Img,A);
    Free(A);
  end loop;

  FreeAll(P);

end Polymers;