Skip to content
Snippets Groups Projects
Commit fc685f60 authored by Jonas Greitemann's avatar Jonas Greitemann
Browse files

Add honeycomb lattice

parent a52868f3
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,12 @@ target_compile_definitions(heisenberg-triangular PUBLIC -DHEISENBERG -DTRIANGULA
add_executable(ising-triangular main.cpp)
target_compile_definitions(ising-triangular PUBLIC -DISING -DTRIANGULAR)
add_executable(heisenberg-honeycomb main.cpp)
target_compile_definitions(heisenberg-honeycomb PUBLIC -DHEISENBERG -DHONEYCOMB)
add_executable(ising-honeycomb main.cpp)
target_compile_definitions(ising-honeycomb PUBLIC -DISING -DHONEYCOMB)
# Use ALPSCore_LIBRARIES variable to link to ALPSCore
target_link_libraries(heisenberg-chain ${ALPSCore_LIBRARIES} stdc++fs)
target_link_libraries(ising-chain ${ALPSCore_LIBRARIES} stdc++fs)
......@@ -49,6 +55,8 @@ target_link_libraries(heisenberg-cubic ${ALPSCore_LIBRARIES} stdc++fs)
target_link_libraries(ising-cubic ${ALPSCore_LIBRARIES} stdc++fs)
target_link_libraries(heisenberg-triangular ${ALPSCore_LIBRARIES} stdc++fs)
target_link_libraries(ising-triangular ${ALPSCore_LIBRARIES} stdc++fs)
target_link_libraries(heisenberg-honeycomb ${ALPSCore_LIBRARIES} stdc++fs)
target_link_libraries(ising-honeycomb ${ALPSCore_LIBRARIES} stdc++fs)
enable_testing()
add_subdirectory(test)
// SVM Order Parameters for Hidden Spin Order
// Copyright (C) 2018 Jonas Greitemann, Ke Liu, and Lode Pollet
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "lattice/bravais.hpp"
#include <utility>
namespace lattice {
template <typename Site>
struct honeycomb : bravais<Site, 2ul, 2ul> {
using Base = bravais<Site, 2ul, 2ul>;
using iterator = typename Base::iterator;
using const_iterator = typename Base::const_iterator;
static const size_t coordination = 3;
using Base::bravais;
auto nearest_neighbors(iterator const& it)
-> std::array<iterator, coordination>
{
if (it.basis_index() == 0)
return {
iterator{it.cell_it(), 1},
iterator{it.cell_it().down(0), 1},
iterator{it.cell_it().down(1), 1},
};
else
return {
iterator{it.cell_it(), 0},
iterator{it.cell_it().up(0), 0},
iterator{it.cell_it().up(1), 0},
};
}
auto nearest_neighbors(const_iterator const& it) const
-> std::array<const_iterator, coordination>
{
if (it.basis_index() == 0)
return {
const_iterator{it.cell_it(), 1},
const_iterator{it.cell_it().down(0), 1},
const_iterator{it.cell_it().down(1), 1},
};
else
return {
const_iterator{it.cell_it(), 0},
const_iterator{it.cell_it().up(0), 0},
const_iterator{it.cell_it().up(1), 0},
};
}
};
}
......@@ -27,6 +27,7 @@
#include "lattice/chain.hpp"
#include "lattice/ortho.hpp"
#include "lattice/triangular.hpp"
#include "lattice/honeycomb.hpp"
#include "update/single_flip.hpp"
#if defined HEISENBERG
......@@ -47,6 +48,8 @@ using hamiltonian_t = hamiltonian_t_t<lattice::square>;
using hamiltonian_t = hamiltonian_t_t<lattice::cubic>;
#elif defined TRIANGULAR
using hamiltonian_t = hamiltonian_t_t<lattice::triangular>;
#elif defined HONEYCOMB
using hamiltonian_t = hamiltonian_t_t<lattice::honeycomb>;
#else
#error Unknown lattice
#endif
......
......@@ -20,6 +20,7 @@
#include <lattice/chain.hpp>
#include <lattice/ortho.hpp>
#include <lattice/triangular.hpp>
#include <lattice/honeycomb.hpp>
#include <algorithm>
#include <iostream>
......@@ -188,3 +189,27 @@ TEST_CASE("nn-triangular-5") {
};
test_nn(lattice::triangular<int_site>(5, true, increment_gen()), nn_ind);
}
TEST_CASE("nn-honeycomb-3") {
int nn_ind[][3] = {
{ 1, 5, 13},
{ 0, 2, 6},
{ 1, 3, 15},
{ 2, 4, 8},
{ 3, 5, 17},
{ 0, 4, 10},
{ 1, 7, 11},
{ 6, 8, 12},
{ 3, 7, 9},
{ 8, 10, 14},
{ 5, 9, 11},
{ 6, 10, 16},
{ 7, 13, 17},
{ 0, 12, 14},
{ 9, 13, 15},
{ 2, 14, 16},
{11, 15, 17},
{ 4, 12, 16},
};
test_nn(lattice::honeycomb<int_site>(3, true, increment_gen()), nn_ind);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment