diff --git a/lib/Grid_cartesian_base.h b/lib/cartesian/Grid_cartesian_base.h similarity index 100% rename from lib/Grid_cartesian_base.h rename to lib/cartesian/Grid_cartesian_base.h diff --git a/lib/Grid_cartesian_full.h b/lib/cartesian/Grid_cartesian_full.h similarity index 100% rename from lib/Grid_cartesian_full.h rename to lib/cartesian/Grid_cartesian_full.h diff --git a/lib/Grid_cartesian_red_black.h b/lib/cartesian/Grid_cartesian_red_black.h similarity index 100% rename from lib/Grid_cartesian_red_black.h rename to lib/cartesian/Grid_cartesian_red_black.h diff --git a/lib/Grid_communicator_fake.cc b/lib/communicator/Grid_communicator_fake.cc similarity index 100% rename from lib/Grid_communicator_fake.cc rename to lib/communicator/Grid_communicator_fake.cc diff --git a/lib/Grid_communicator_mpi.cc b/lib/communicator/Grid_communicator_mpi.cc similarity index 100% rename from lib/Grid_communicator_mpi.cc rename to lib/communicator/Grid_communicator_mpi.cc diff --git a/lib/Grid_cshift_common.h b/lib/cshift/Grid_cshift_common.h similarity index 100% rename from lib/Grid_cshift_common.h rename to lib/cshift/Grid_cshift_common.h diff --git a/lib/Grid_cshift_mpi.h b/lib/cshift/Grid_cshift_mpi.h similarity index 100% rename from lib/Grid_cshift_mpi.h rename to lib/cshift/Grid_cshift_mpi.h diff --git a/lib/Grid_cshift_none.h b/lib/cshift/Grid_cshift_none.h similarity index 100% rename from lib/Grid_cshift_none.h rename to lib/cshift/Grid_cshift_none.h diff --git a/lib/Grid_lattice_arith.h b/lib/lattice/Grid_lattice_arith.h similarity index 100% rename from lib/Grid_lattice_arith.h rename to lib/lattice/Grid_lattice_arith.h diff --git a/lib/Grid_lattice_conformable.h b/lib/lattice/Grid_lattice_conformable.h similarity index 100% rename from lib/Grid_lattice_conformable.h rename to lib/lattice/Grid_lattice_conformable.h diff --git a/lib/Grid_lattice_coordinate.h b/lib/lattice/Grid_lattice_coordinate.h similarity index 100% rename from lib/Grid_lattice_coordinate.h rename to lib/lattice/Grid_lattice_coordinate.h diff --git a/lib/Grid_lattice_local.h b/lib/lattice/Grid_lattice_local.h similarity index 100% rename from lib/Grid_lattice_local.h rename to lib/lattice/Grid_lattice_local.h diff --git a/lib/Grid_lattice_peekpoke.h b/lib/lattice/Grid_lattice_peekpoke.h similarity index 100% rename from lib/Grid_lattice_peekpoke.h rename to lib/lattice/Grid_lattice_peekpoke.h diff --git a/lib/Grid_lattice_reality.h b/lib/lattice/Grid_lattice_reality.h similarity index 100% rename from lib/Grid_lattice_reality.h rename to lib/lattice/Grid_lattice_reality.h diff --git a/lib/Grid_lattice_reduction.h b/lib/lattice/Grid_lattice_reduction.h similarity index 100% rename from lib/Grid_lattice_reduction.h rename to lib/lattice/Grid_lattice_reduction.h diff --git a/lib/Grid_lattice_rng.h b/lib/lattice/Grid_lattice_rng.h similarity index 100% rename from lib/Grid_lattice_rng.h rename to lib/lattice/Grid_lattice_rng.h diff --git a/lib/Grid_lattice_trace.h b/lib/lattice/Grid_lattice_trace.h similarity index 100% rename from lib/Grid_lattice_trace.h rename to lib/lattice/Grid_lattice_trace.h diff --git a/lib/Grid_lattice_transfer.h b/lib/lattice/Grid_lattice_transfer.h similarity index 100% rename from lib/Grid_lattice_transfer.h rename to lib/lattice/Grid_lattice_transfer.h diff --git a/lib/Grid_lattice_transpose.h b/lib/lattice/Grid_lattice_transpose.h similarity index 100% rename from lib/Grid_lattice_transpose.h rename to lib/lattice/Grid_lattice_transpose.h diff --git a/lib/Grid_math_arith.h b/lib/math/Grid_math_arith.h similarity index 100% rename from lib/Grid_math_arith.h rename to lib/math/Grid_math_arith.h diff --git a/lib/Grid_math_arith_add.h b/lib/math/Grid_math_arith_add.h similarity index 100% rename from lib/Grid_math_arith_add.h rename to lib/math/Grid_math_arith_add.h diff --git a/lib/Grid_math_arith_mac.h b/lib/math/Grid_math_arith_mac.h similarity index 100% rename from lib/Grid_math_arith_mac.h rename to lib/math/Grid_math_arith_mac.h diff --git a/lib/Grid_math_arith_mul.h b/lib/math/Grid_math_arith_mul.h similarity index 100% rename from lib/Grid_math_arith_mul.h rename to lib/math/Grid_math_arith_mul.h diff --git a/lib/Grid_math_arith_scalar.h b/lib/math/Grid_math_arith_scalar.h similarity index 100% rename from lib/Grid_math_arith_scalar.h rename to lib/math/Grid_math_arith_scalar.h diff --git a/lib/Grid_math_arith_sub.h b/lib/math/Grid_math_arith_sub.h similarity index 100% rename from lib/Grid_math_arith_sub.h rename to lib/math/Grid_math_arith_sub.h diff --git a/lib/Grid_math_inner.h b/lib/math/Grid_math_inner.h similarity index 100% rename from lib/Grid_math_inner.h rename to lib/math/Grid_math_inner.h diff --git a/lib/Grid_math_outer.h b/lib/math/Grid_math_outer.h similarity index 100% rename from lib/Grid_math_outer.h rename to lib/math/Grid_math_outer.h diff --git a/lib/Grid_math_peek.h b/lib/math/Grid_math_peek.h similarity index 100% rename from lib/Grid_math_peek.h rename to lib/math/Grid_math_peek.h diff --git a/lib/Grid_math_poke.h b/lib/math/Grid_math_poke.h similarity index 100% rename from lib/Grid_math_poke.h rename to lib/math/Grid_math_poke.h diff --git a/lib/Grid_math_reality.h b/lib/math/Grid_math_reality.h similarity index 100% rename from lib/Grid_math_reality.h rename to lib/math/Grid_math_reality.h diff --git a/lib/Grid_math_tensors.h b/lib/math/Grid_math_tensors.h similarity index 100% rename from lib/Grid_math_tensors.h rename to lib/math/Grid_math_tensors.h diff --git a/lib/Grid_math_trace.h b/lib/math/Grid_math_trace.h similarity index 100% rename from lib/Grid_math_trace.h rename to lib/math/Grid_math_trace.h diff --git a/lib/Grid_math_traits.h b/lib/math/Grid_math_traits.h similarity index 100% rename from lib/Grid_math_traits.h rename to lib/math/Grid_math_traits.h diff --git a/lib/Grid_math_transpose.h b/lib/math/Grid_math_transpose.h similarity index 100% rename from lib/Grid_math_transpose.h rename to lib/math/Grid_math_transpose.h diff --git a/lib/Grid_QCD.h b/lib/qcd/Grid_QCD.h similarity index 100% rename from lib/Grid_QCD.h rename to lib/qcd/Grid_QCD.h diff --git a/lib/Grid_vComplexD.h b/lib/simd/Grid_vComplexD.h similarity index 100% rename from lib/Grid_vComplexD.h rename to lib/simd/Grid_vComplexD.h diff --git a/lib/Grid_vComplexF.h b/lib/simd/Grid_vComplexF.h similarity index 100% rename from lib/Grid_vComplexF.h rename to lib/simd/Grid_vComplexF.h diff --git a/lib/Grid_vInteger.h b/lib/simd/Grid_vInteger.h similarity index 100% rename from lib/Grid_vInteger.h rename to lib/simd/Grid_vInteger.h diff --git a/lib/Grid_vRealD.h b/lib/simd/Grid_vRealD.h similarity index 100% rename from lib/Grid_vRealD.h rename to lib/simd/Grid_vRealD.h diff --git a/lib/Grid_vRealF.h b/lib/simd/Grid_vRealF.h similarity index 100% rename from lib/Grid_vRealF.h rename to lib/simd/Grid_vRealF.h diff --git a/lib/Grid_stencil_common.cc b/lib/stencil/Grid_stencil_common.cc similarity index 100% rename from lib/Grid_stencil_common.cc rename to lib/stencil/Grid_stencil_common.cc