Work in progress ...
Computation of all reflexive subpolytopes on sublattices

wget http://hep.itp.tuwien.ac.at/~kreuzer/CY/palp/palp-1.02.tar.gz 
tar -xvzf palp-1.02.tar.gz ; cd palp 
vi Global.h ; make class ; grep "max dim of" Global.h


echo "24 3 3 4 4 10" | class.x -f -po zbin
Writing zbin: 798878+1658sl 1181m+14s 9851469b	# POLY_Dmax=6
Writing zbin: 798878+1308sl 1181m+14s 9847010b	# POLY_Dmax=5
Writing zbin: 798878+1280sl 1181m+14s 9846494b	# POLY_Dmax=4
#    ----------    Version 1: with subtractions    ----------
class.x -pi zbin -do zzdb
class.x -b -di zzdb | class.x -f -a -po zbinS1
Writing zbinS1: 1658+0sl
Writing zbinS1: 1308+0sl
Writing zbinS1: 1280+0sl	
class.x -b -pi zbin | class.x -f -sv -pi zbin -po zbinQ1	
class.x -sv -di zzdb -po zbinQ1 	 # equivalent
Writing zbinQ1: 805+0sl
class.x -pi zbinS1 -pa zbinQ1 -po zbinSQ1
Writing zbinSQ1: 2463+0sl
Writing zbinSQ1: 2113+0sl
Writing zbinSQ1: 2083+0sl
class.x -b -pi zbinSQ1 | class.x -f -di zzdb -po zbin1 
Writing zbin1: 4067+0sl
Writing zbin1: 3942+0sl
Writing zbin1: 3462+0sl
class.x -di zzdb -pa zbin1 -do zzdb1 
Writing zzdb1: 802945+0sl
Writing zzdb1: 802820+0sl
Writing zzdb1: 802340+0sl
class.x -sv -di zzdb1 -po zbinQ2	
Writing zbinQ2: 0+0sl

Compute difference files:
Writing zbin.all6d: 802945+0sl
Writing zbin.all5d: 802820+0sl
Writing zbin.all4d: 802340+0sl
Writing zbin.6d-5d: 195+0sl
Writing zbin.5d-4d: 619+0sl
Writing zbin.6d-4d: 716+0sl
Writing zbin.4d-5d: 139+0sl
Writing zbin.5d-6d: 70+0sl
Writing zbin.4d-6d: 111+0sl
class.x -b -pi zbin.4d-5d | poly.x -f | sort| tail -n2
M:22 12 N:39 13 H:34,14 [40]
M:23 11 N:34 11 H:29,15 [28]
class.x -b -pi zbin.6d-5d | poly.x -f | sort| tail -n2
M:22 12 N:39 13 H:34,14 [40]
M:23 11 N:34 11 H:29,15 [28]
...
M:23 11 N:34 11 H:29,15 [28]	# largest difference polytope
4 11  Vertices of P		# [poly.x -m] => unique lattice !!!
    1    0    0   -1   -1    0   -1   -1    0   -2   -2
    0    1    0    0    1    0   -2    0   -1   -2    2
    0    0    1    1    0    0    0   -2   -1    2   -2
    0    0    0    0    0    1    0    0    1   -1   -1
class.x -a -po zbin.diffmax
class.x -pi zbinS1 -ps zbin.diffmax -po zbin.search
Data on zbinS1:  1658+0sl  ...  Writing zbin.search: 1657+0sl
Data on zbinS1:  1308+0sl  ...  Writing zbin.search: 1308+0sl
Data on zbinS1:  1280+0sl  ...  Writing zbin.search: 1279+0sl
#    ----------    Version 2: without subtractions    ----------
class.x -pi zbin -do zzdb
class.x -b -di zzdb | class.x -f -a -po zbinS1
Writing zbinS1: 1658+0sl
Writing zbinS1: 1308+0sl
Writing zbinS1: 1280+0sl	
class.x -b -pi zbin | class.x -f -sv -po zbinQ1	
Writing zbinQ1: 27941+0sl	
class.x -pi zbinQ1 -ds zzdb -po /tmp/zbinQ1sub	# agrees with 805 above
class.x -pi zbinS1 -pa zbinQ1 -po zbinSQ1
Writing zbinSQ1: 29599+0sl
Writing zbinSQ1: 29249+0sl
Writing zbinSQ1: 29219+0sl
class.x -b -pi zbinSQ1 | class.x -f -po zbin1
Writing zbin1: 44576+1sl
Writing zbin1: 44091+1sl
Writing zbin1: 41835+1sl	
class.x -pi zbin1 -ds zzdb -po /tmp/zbin1sub      	# agrees with above
class.x -pi zbin1 -do zzdb1
class.x -b -di zzdb1 | class.x -f -a -po zbinS2
Writing zbinS2: 1+0sl
class.x -pi zbinS2 -pa zbin1 -po zbin21 
Writing zbin21: 44577+0sl
Writing zbin21: 44092+0sl
Writing zbin21: 41836+0sl
class.x -b -pi zbin21 | class.x -f -sv -po zbinQ2
Writing zbinQ2: 27992+0sl
class.x -pi zbin21 -pa zbinQ2 -po zbin22
Writing zbin22: 44577+0sl
Writing zbin22: 44092+0sl
Writing zbin22: 41836+0sl
class.x -b -pi zbin22 | class.x -f -sv -po zbinQ3
Writing zbinQ3: 27992+0sl
cmp zbinQ2 zbinQ3								# zbinQ2=zbinQ3 => finished
class.x -di zzdb -pa zbin1 -do zzdb1
class.x -di zzdb1 -pa zbin22 -do zzdb2				# like above
Writing

#    ----------    Version 3: iterate first sl, then Q    ----------
class.x -pi zbin -do zzdb
class.x -b -di zzdb | class.x -f -a -po zbinS1
Writing zbinS1: 1658+0sl
Writing zbinS1: 1308+0sl
Writing zbinS1: 1280+0sl	
class.x -b -pi zbinS1 | class.x -f -po zbinS2
Writing zbinS2: 16630+13sl
Writing zbinS2: 16107+13sl
Writing zbinS2: 13704+13sl
class.x -b -pi zbin | class.x -f -sv -po zbinQ1	
Writing zbinQ1: 27941+0sl
class.x -pi zbinS1 -pa zbinQ1 -po zbinSQ1
Writing zbinSQ1: 29599+0sl
Writing zbinSQ1: 29249+0sl
Writing zbinSQ1: 29219+0sl
class.x -pi zbinS2 -pa zbinSQ1 -po zbin21
Writing zbin21: 41352+2sl
Writing zbin21: 40861+2sl
Writing zbin21: 38545+2sl
class.x -pi zbin21 -do zzdb21  
class.x -b -di zzdb21 | class.x -f -a -po zbinS3
Writing zbinS3: 2+0sl
class.x -pi zbin21 -pa zbinS3 -po zbin31 
Writing zbin32: 41354+0sl
Writing zbin32: 40863+0sl
Writing zbin32: 38547+0sl
class.x -b -pi zbin31 | class.x -f -sv -po zbinQ2	
Writing zbinQ2: 27992+0sl
Writing zbinQ2: 27992+0sl
Writing zbinQ2: 27988+0sl
class.x -pi zbin31 -pa zbinQ2 -po zbin33 
Writing zbin33: 41359+0sl
Writing zbin33: 40868+0sl
Writing zbin33: 38552+0sl
class.x -di zzdb -pa zbin32 -do zzdb32
Writing zzdb32: 802940+0sl
Writing zzdb32: 802814+0sl
Writing zzdb32: 802307+0sl
class.x -f -sv -di zzdb32 -po zbinQ3
Writing zbinQ3: 0+0sl						# fewer than above !!!


==========================================================================
interation:

802945-802820=125 -> 100
802820-802340=480 -> 440

class.x -b -pi zbinSQ1 | class.x -f -di zzdb -po zbin1 

Reading data-base zzdb: 802945+4sl 801768nf 9872731b  done (0s)
Writing zbin1: 5+0sl 0m+0s 51b done: 0s

Reading data-base zzdb: 802820+22sl 801661nf 9871540b  done (0s)
Writing zbin1: 30+0sl 0m+0s 312b  u23 done: 0s

Reading data-base zzdb: 802340+64sl 801223nf 9866355b  done (0s)
Writing zbin1: 70+0sl 0m+0s 721b  u31 done: 0s
================================================================
class.x -b -di zzdb1 | time ~/b/class.x -f -oc -po zbinTest2 




Tests of affine NF and subtractions
echo -e "3 1 1 1\n4 1 1 2\n6 1 2 3\n2 1 1 0 0 2 0 0 1 1"|class.x -f -po zzT2
class.x -po zzK3 wK3.r

class.x -b -pi zzT2 | poly.x -fF | poly.x -fA | class.x -f -A -po zzT2.facet
class.x -B -pi zzT2.facet		# 4 edges [0 1] ... [0 4]

class.x -b -pi zzK3 | poly.x -fF | poly.x -fA | class.x -f -A -po zzK3.facet
class.x -B -pi zzK3.facet		# 344 polygons:  3<=v<=7  328 non-ref
class.x -B -pi zzK3.facet|poly.x -fF|poly.x -fA|class.x -f -A -po zzK3.cd2
class.x -B -pi zzK3.cd2			# 11 edges L<=12, L!=11
# class.x -b -pi zzK3 | class.x -A -po zzAk3

N=5 
class.x -b -di zzdb -vf $N -vt $N |poly.x -fF|poly.x -fA|class.x -f -A -po Fv$N
Writing Fv5: 431+0sl 0m+0s 2726b
Writing Fv6: 6136+0sl 0m+0s 44189b