Skip to content

Commit 3602553

Browse files
committed
placeholder
1 parent 0b358b2 commit 3602553

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/PlaneWaveBasis.jl

+16-6
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,13 @@ struct PlaneWaveBasis{T,
106106
## Symmetry operations that leave the discretized model (k and r grids) invariant.
107107
# Subset of model.symmetries.
108108
symmetries::Vector{SymOp{VT}}
109-
# Whether the symmetry operations leave the rgrid invariant
109+
# Whether the symmetry operations leave the rgrid invariant.
110110
# If this is true, the symmetries are a property of the complete discretized model.
111111
# Therefore, all quantities should be symmetric to machine precision
112112
symmetries_respect_rgrid::Bool
113+
# Whether the symmetry operations leave the basis invariant. Otherwise the symmetry
114+
# operations will leave the lattice invariant.
115+
symmetries_respect_basis::Bool
113116
# Whether symmetry is used to reduce the number of explicit k-points to the
114117
# irreducible BZMesh. This is a debug option, useful when a part in the code does
115118
# not yet implement symmetry. See `unfold_bz` as a convenient way to use this.
@@ -175,6 +178,7 @@ end
175178
function PlaneWaveBasis(model::Model{T}, Ecut::Real, fft_size::Tuple{Int, Int, Int},
176179
variational::Bool, kgrid::AbstractKgrid,
177180
symmetries_respect_rgrid::Bool,
181+
symmetries_respect_basis::Bool,
178182
use_symmetries_for_kpoint_reduction::Bool,
179183
comm_kpts, architecture::Arch
180184
) where {T <: Real, Arch <: AbstractArchitecture}
@@ -209,7 +213,11 @@ function PlaneWaveBasis(model::Model{T}, Ecut::Real, fft_size::Tuple{Int, Int, I
209213
if symmetries_respect_rgrid
210214
symmetries = symmetries_preserving_rgrid(symmetries, fft_size)
211215
end
212-
symmetries = symmetries_preserving_kgrid(symmetries, kgrid)
216+
# If false, symmetries will respect the model (leave the lattice invariant), as is the
217+
# default behaviour for Abinit (nsym 0).
218+
if symmetries_respect_basis
219+
symmetries = symmetries_preserving_kgrid(symmetries, kgrid)
220+
end
213221

214222
# Build the irreducible k-point coordinates
215223
if use_symmetries_for_kpoint_reduction
@@ -317,7 +325,7 @@ function PlaneWaveBasis(model::Model{T}, Ecut::Real, fft_size::Tuple{Int, Int, I
317325
kpoints, kweights, kgrid,
318326
kcoords_global, kweights_global,
319327
comm_kpts, krange_thisproc, krange_allprocs, krange_thisproc_allspin,
320-
architecture, symmetries, symmetries_respect_rgrid,
328+
architecture, symmetries, symmetries_respect_rgrid, symmetries_respect_basis,
321329
use_symmetries_for_kpoint_reduction, terms)
322330

323331
# Instantiate the terms with the basis
@@ -342,6 +350,7 @@ with a maximal spacing of `2π * 0.022` per Bohr.
342350
kshift=[0, 0, 0],
343351
variational=true, fft_size=nothing,
344352
symmetries_respect_rgrid=isnothing(fft_size),
353+
symmetries_respect_basis=true,
345354
use_symmetries_for_kpoint_reduction=true,
346355
comm_kpts=MPI.COMM_WORLD, architecture=CPU()) where {T <: Real}
347356
if isnothing(fft_size)
@@ -372,8 +381,8 @@ with a maximal spacing of `2π * 0.022` per Bohr.
372381
end
373382

374383
PlaneWaveBasis(model, austrip(Ecut), fft_size, variational, kgrid_inner,
375-
symmetries_respect_rgrid, use_symmetries_for_kpoint_reduction,
376-
comm_kpts, architecture)
384+
symmetries_respect_rgrid, symmetries_respect_basis,
385+
use_symmetries_for_kpoint_reduction, comm_kpts, architecture)
377386
end
378387

379388
"""
@@ -383,7 +392,7 @@ e.g. an [`MonkhorstPack`](@ref) or a [`ExplicitKpoints`](@ref) grid.
383392
@timing function PlaneWaveBasis(basis::PlaneWaveBasis, kgrid::AbstractKgrid)
384393
PlaneWaveBasis(basis.model, basis.Ecut,
385394
basis.fft_size, basis.variational,
386-
kgrid, basis.symmetries_respect_rgrid,
395+
kgrid, basis.symmetries_respect_rgrid, basis.symmetries_respect_basis,
387396
basis.use_symmetries_for_kpoint_reduction,
388397
basis.comm_kpts, basis.architecture)
389398
end
@@ -544,6 +553,7 @@ function gather_kpts(basis::PlaneWaveBasis)
544553
basis.variational,
545554
basis.kgrid,
546555
basis.symmetries_respect_rgrid,
556+
basis.symmetries_respect_basis,
547557
basis.use_symmetries_for_kpoint_reduction,
548558
MPI.COMM_SELF,
549559
basis.architecture)

0 commit comments

Comments
 (0)