/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2011 by M. Ferrero, O. Parcollet * * TRIQS 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. * * TRIQS 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 * TRIQS. If not, see . * ******************************************************************************/ #include "bravais_lattice_and_brillouin_zone.hpp" #include #include #include namespace triqs { namespace lattice_tools { using namespace tqa; using namespace std; //using triqs::arrays::blas::dot; const double almost_zero(1E-10); bravais_lattice::bravais_lattice( units_type const & units__) : units_(3,3), dim_(units__.len(0)) { units_(range(0,dim_),range()) = units__(); units_(range(dim_,3),range()) = 0; // First complete the basis. Add some tests for safety tqa::vector ux(3),uy(3),uz(3); assert(dim_==2); switch (dim_) { case 1: ux = units_(0,range()); uz() = 0; uz(1) = 1 ; uz = uz - dot(uz,ux)* ux; // no luck, ux was parallel to z, another one must work if (sqrt(dot(uz,uz))