-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
637f9ae
commit c8b93f4
Showing
1 changed file
with
357 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,357 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "24f6e8d5-6eb7-4d85-9a3e-da8239324338", | ||
"metadata": {}, | ||
"source": [ | ||
"This notebook shows a simple method to identify Kollar divisors using CYTools.\n", | ||
"\n", | ||
"Recall, Kollar divisors are those, $D\\in K(X)\\cap\\mathbb{Z}^{h^{1,1}}$, for which $\\kappa_{ijk} D^i D^j D^k = 0$ but $\\kappa_{ijk} D^i D^j \\neq 0$." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ed933502-59e5-4419-b910-5c7372e4dd5d", | ||
"metadata": {}, | ||
"source": [ | ||
"# Setup" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "862a107c-8be9-415d-9753-08754c16816d", | ||
"metadata": {}, | ||
"source": [ | ||
"## Imports" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "d32db58d-55a3-4dc4-a167-4e089e3eba6a", | ||
"metadata": {}, | ||
"source": [ | ||
"Here, we import some useful packages..." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c38f449f-9217-4abe-af85-6722a26795f7", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# generic Python imports\n", | ||
"import itertools\n", | ||
"import numpy as np\n", | ||
"\n", | ||
"# CYTools imports\n", | ||
"from cytools import Cone, fetch_polytopes, Polytope\n", | ||
"\n", | ||
"# custom impotys\n", | ||
"import sys; sys.path.append('../cytools_utilities/')\n", | ||
"from ntfe_frsts import ntfe_frsts\n", | ||
"from gvs import gvs" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c4c62bfe-fd1b-4a0d-8e69-5723d3f58ea3", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"Filter warnings" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5bb4c741-2431-4cde-b4b1-581f002af713", | ||
"metadata": { | ||
"jupyter": { | ||
"source_hidden": true | ||
}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import warnings\n", | ||
"warnings.filterwarnings(\"ignore\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "31588402-adc8-46d8-be2e-303da691bc4d", | ||
"metadata": {}, | ||
"source": [ | ||
"## Custom functions" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4794d7f6-a749-41c7-aec6-6863431137be", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"Here, we define some useful functions..." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d5b03c78-a738-49b6-800a-cd45fa3f8704", | ||
"metadata": { | ||
"jupyter": { | ||
"source_hidden": true | ||
}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"def read_wati_polys(inds, fname=\"fiber-free.txt\"):\n", | ||
" \"\"\"\n", | ||
" Read polytopes from Wati's list.\n", | ||
" \n", | ||
" From http://ctp.lns.mit.edu/wati/data.html\n", | ||
" \"\"\"\n", | ||
" all_polys = []\n", | ||
"\n", | ||
" # load the points\n", | ||
" with open(fname, \"r\") as f:\n", | ||
" for i_poly in range(max(poly_inds)+1):\n", | ||
" # read the points\n", | ||
" pts = []\n", | ||
"\n", | ||
" f.readline()\n", | ||
" for i_coords in range(4):\n", | ||
" pts.append([int(x) for x in f.readline().split()])\n", | ||
" pts = np.array(pts).T\n", | ||
"\n", | ||
" # this is a polytope of interest\n", | ||
" if i_poly in poly_inds:\n", | ||
" all_polys.append(Polytope(pts))\n", | ||
" \n", | ||
" return all_polys" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3410489c-70bd-44e4-bba3-66a7b9e04bd8", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"def intersection_form(kappa, x, order=3):\n", | ||
" # get the indices to contract\n", | ||
" inds = 'abc,' + ','.join([chr(ord('a')+i) for i in range(order)])\n", | ||
" \n", | ||
" # contract them!\n", | ||
" return np.einsum(inds, kappa, *(order*[x]))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ae6d9963-1834-45c2-b6d6-9fd769039cc6", | ||
"metadata": {}, | ||
"source": [ | ||
"# The scan!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f9763dda-6e53-4aec-890a-c4f26f3ae96a", | ||
"metadata": {}, | ||
"source": [ | ||
"Select polytopes to scan over" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "7550e056-742a-465e-a745-cd43e0675ba6", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"scan_over_wati = False" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5c15955a-251d-41d5-afc2-f5fcea37cc36", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"if scan_over_wati:\n", | ||
" # indices of the polytopes to scan over http://ctp.lns.mit.edu/wati/data.html\n", | ||
" poly_inds = list(range(20,600))\n", | ||
" \n", | ||
" # read them from the file\n", | ||
" polys = read_wati_polys(poly_inds)\n", | ||
"else:\n", | ||
" # read from KS\n", | ||
" polys = fetch_polytopes(h11=6,lattice=\"N\",limit=50,as_list=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "428039b4-7bb8-48b3-a3b4-9504ea37ab54", | ||
"metadata": {}, | ||
"source": [ | ||
"Do the scan!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c444b39b-f363-4542-8a61-aaa1765e7679", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"verbosity = 0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ece519b0-8155-45bc-9015-db116d810e70", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"kollar_divisors = []\n", | ||
"found_divisors = 0\n", | ||
"\n", | ||
"for i,p in enumerate(polys):\n", | ||
" # get the Hodge numbers, dualize to have h11<h21\n", | ||
" h11 = p.h11(lattice=\"N\")\n", | ||
" h21 = p.h21(lattice=\"N\")\n", | ||
" if h11>h21:\n", | ||
" p = p.dual()\n", | ||
" \n", | ||
" # reject non-favorables\n", | ||
" if not p.is_favorable(lattice=\"N\"):\n", | ||
" continue\n", | ||
"\n", | ||
" print(f\"poly #{i}, (h11,h21)={(p.h11(lattice='N'),p.h21(lattice='N'))}, total found (with duplicates)={found_divisors}\",end='\\r')\n", | ||
"\n", | ||
" kollar_divisors.append([])\n", | ||
" \n", | ||
" # iterate over NTFEs\n", | ||
" # ------------------\n", | ||
" ts = p.ntfe_frsts()\n", | ||
" if verbosity>0:\n", | ||
" print(f\"There are {len(ts)} NTFEs\")\n", | ||
"\n", | ||
" for t in ts:\n", | ||
" kollar_divisors[-1].append([])\n", | ||
"\n", | ||
" # construct the TV, CY\n", | ||
" # --------------------\n", | ||
" cy = t.cy()\n", | ||
" tv = cy.ambient_variety()\n", | ||
" if verbosity>1:\n", | ||
" print('Constructing CY, TV...')\n", | ||
"\n", | ||
" # get the intersection numbers\n", | ||
" # ----------------------------\n", | ||
" if verbosity>1:\n", | ||
" print('Constructing kappa...')\n", | ||
" kappa = cy.intersection_numbers(format='dense',in_basis=True)\n", | ||
"\n", | ||
" # get the Kahler cone\n", | ||
" # -------------------\n", | ||
" if verbosity>1:\n", | ||
" print('Constructing Kähler cones...')\n", | ||
" if False:\n", | ||
" # get the CY kahler cone\n", | ||
" print('with GVs...')\n", | ||
" max_deg = 10\n", | ||
" \n", | ||
" while True:\n", | ||
" try:\n", | ||
" gvs = cy.compute_gvs(max_deg=max_deg)\n", | ||
" break\n", | ||
" except:\n", | ||
" max_deg += 2\n", | ||
" \n", | ||
" mori = Cone(rays=list(gvs.keys()))\n", | ||
" kahler = mori.dual()\n", | ||
" kahler = Cone(rays=kahler.extremal_rays())\n", | ||
" else:\n", | ||
" # get the toric kahler cone\n", | ||
" kahler = cy.toric_kahler_cone()\n", | ||
"\n", | ||
" # find the possible Kollar divisors\n", | ||
" # ---------------------------------\n", | ||
" # (lattice points in the Kahler cone...)\n", | ||
" min_points = 200\n", | ||
" if verbosity>1:\n", | ||
" print(f\"Finding >={min_points} points...\")\n", | ||
" possible_pts = kahler.find_lattice_points(min_points=min_points, verbose=False)\n", | ||
" if verbosity>1:\n", | ||
" print(f\"Found {len(possible_pts)} points...\")\n", | ||
" \n", | ||
" # check them!\n", | ||
" # -----------\n", | ||
" for kollar_plz in possible_pts:\n", | ||
" # skip the origin... trivial divisor\n", | ||
" if sum(np.abs(kollar_plz))==0:\n", | ||
" continue\n", | ||
"\n", | ||
" # check if cubic is 0\n", | ||
" if intersection_form(kappa, kollar_plz, order=3) == 0:\n", | ||
" # get the quadratic\n", | ||
" quadratic = intersection_form(kappa, kollar_plz, order=2)\n", | ||
"\n", | ||
" # check if the quadratic is nonzero\n", | ||
" if any(quadratic!=0) and all(quadratic>=0):\n", | ||
" kollar_divisors[-1][-1].append(kollar_plz)\n", | ||
" found_divisors += 1\n", | ||
" \n", | ||
" # extra printing\n", | ||
" if verbosity>0:\n", | ||
" print(100*\":)\")\n", | ||
" print(f\"x={kollar_plz}\")\n", | ||
" print()\n", | ||
"\n", | ||
" # extra printing\n", | ||
" if verbosity>1:\n", | ||
" print('all done!')\n", | ||
" print()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |