/* Magma functions to access the database of smooth toric Fano varieties. Just copy and paste these lines into a Magma session. The function: ``FanoP(n)'' returns the anticanonical polytope of the n-th smooth toric Fano variety from the database. The command ``FanoX(n)'' returns the n-th smooth toric Fano variety from the same database, while ``FanoDualX(n)'' returns the toric variety with dual anticanonical polytope. */ FanoP := function(ID) block := ID div 250; num := (ID mod 250); L := GetLibraryRoot(); file := L cat "/data/polytopes/smoothfano/block" cat IntegerToString( block ); fh := Open( file, "r" ); base := Gets( fh ); while num gt 0 do line := Gets( fh ); num -:= 1; end while; base := StringToInteger( base ); line := StringToInteger( line ); coeffs := IntegerToSequence( line, base ); dim := coeffs[1]; shift := coeffs[2]; coeffs := [ coeffs[i] - shift : i in [3..#coeffs] ]; vertices := [ [ coeffs[dim * i + j] : j in [1..dim] ] : i in [0..#coeffs div dim - 1]]; P := Polytope(vertices); return P; end function; FanoX := function(ID) P := FanoP(ID); F := SpanningFan(P); X := ToricVariety(Rationals(),F); return X; end function; FanoDualX := function(ID) P := FanoP(ID); F := DualFan(P); X := ToricVariety(Rationals(),F); return X; end function;