{"id":19650487,"url":"https://github.com/jerrychen97/lattices","last_synced_at":"2025-08-19T23:08:02.722Z","repository":{"id":185924283,"uuid":"238995995","full_name":"JerryChen97/Lattices","owner":"JerryChen97","description":"Homework 1 for Computational Physics","archived":false,"fork":false,"pushed_at":"2020-04-10T20:55:27.000Z","size":47,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-27T01:18:59.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JerryChen97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-02-07T18:22:53.000Z","updated_at":"2020-02-07T21:42:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"467bb0a0-2114-4d10-aac1-1bc560ff0669","html_url":"https://github.com/JerryChen97/Lattices","commit_stats":null,"previous_names":["jerrychen97/lattices"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JerryChen97/Lattices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryChen97%2FLattices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryChen97%2FLattices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryChen97%2FLattices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryChen97%2FLattices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JerryChen97","download_url":"https://codeload.github.com/JerryChen97/Lattices/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerryChen97%2FLattices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271236280,"owners_count":24723978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T14:58:50.997Z","updated_at":"2025-08-19T23:08:02.690Z","avatar_url":"https://github.com/JerryChen97.png","language":"Julia","readme":"# Lattices\nHomework 1 for Computational Physics\n\n## Introduction\nIn this repo I want to implement a program for simulating parts of the lattices used commonly in Physics.\nIn principle, such a generic purpose should not be implemented too much specifically.\nHowever, considering the fact that there are only hours till the deadline of this homework, I decided to start from such a concrete and simple model.\n\n## Square Lattice\n\n### Square Lattice with Periodic Boundary Conditions\n\n#### mutable structure: SquareLattice\nThis is the first structure we defined for the Lattice package.\nIt has three different elements:\n\n    `L` : the length of the square lattice. This element defines the shape of the square lattice. For example, if the lattice is of the size 2 by 2, then `L` should be 2.\n\n    `point_list` : the list of the value on each vertices of the lattice. We require this to be a `L` by `L` array.\n\n    `coordinates_next` : the adjacency list for x axis or y axis of the square lattice. Since the square lattice with periodic boundary conditions has equal size on either dimension and shows identical behavior on the boudnary condition, we can use only one 1D array to represent the adjacency list.\n\n#### basic usages\nCurrently we only offer a limited number of methods to make use of the SquareLattice structure.\n\n    `SquareLattice(L::Int)` : create a square lattice of size `L` by `L`. The `point_list` will be undefined.  \n    \n    `SquareLattice(list::Array)` : create a square lattice with an input 2D array. The length `L` will be automatcally defined according to the input array `list`.\n    \n    `print_lat(lat::SquareLattice)` : print and show the square lattice.\n    \n    `flip!(lat::SquareLattice, position::Tuple{Int, Int})` : flip the specific spin at `position`.\n    \n    `get_spins(lat::SquareLattice, position_list::Array{Tuple{Int, Int}, 1})` : get the spins value at specific positions in `position_list`.\n\n## Examples\nHere is an easy example showing how to use this package\n```Julia\nusing Lattices\n\n# create the spin matrix to serve as the input to SquareLattice\na = rand([1, -1], 2, 2)\n# create the SquareLattice\nlat_a = SquareLattice(a)\nprint_lat(lat_a)\n\n# flip some specific spin\nflip_pos = (1,1)\nflip!(lat_a2, (flip_pos))\nprint_lat(lat_a)\nprintln(\"Is it correctly flipped? \",lat_a.point_list[flip_pos...]+lat_a2.point_list[flip_pos...]==0)\n\n# extract the spins at specific positions\nposition_list = [(1,1), (1,2), (2,2), (2,1)]\nspins_list = get_spins(lat_a, position_list)\nprintln(spins_list)\n\n```\n\n\n## Outlook\nIn the future, we will consider offer a more abstract and specific structure for a generic lattice.\n\nWhat's more, the statistics and arbitrary manipulation on spins is on the way.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerrychen97%2Flattices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerrychen97%2Flattices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerrychen97%2Flattices/lists"}