ABINIT/irreducible_set_pert [ Functions ]

Determines a set of perturbations that form a basis
in that, using symmetry, they can be used to generate
all other perturbations that are asked to be calculated (target).

INPUTS

indsym(4,nsym,natom)=indirect indexing array described above: for each
isym,iatom, fourth element is label of atom into which iatom is sent by
INVERSE of symmetry operation isym; first three elements are the primitive
translations which must be subtracted after the transformation to get back
to the original unit cell.
mpert =maximum number of iper
natom= number of atoms
nsym=number of space group symmetries
rfdir(3)=direction for the perturbations
rfpert(mpert)=information on the perturbations
symrec(3,3,nsym)=3x3 matrices of the group symmetries (reciprocal space)
symrel(3,3,nsym)=3x3 matrices of the group symmetries (real space)
symq(4,2,nsym)= (integer) three first numbers define the G vector;
fourth number is 0 if the q-vector is not preserved, is 1 otherwise
second index is one without time-reversal symmetry, two with time-reversal symmetry

OUTPUT

pertsy(3,mpert)= the target perturbation is described by the two last indices (idir, and ipert),
the value is 0, 1 or -1, see notes.

NOTES

Output will be in the pertsy array,
0 for non-target perturbations
1 for basis perturbations
-1 for perturbations that can be found from basis perturbations

ABINIT/m_geometry [ Modules ]

This module contains basic tools to operate on vectors expressed in reduced coordinates.

COPYRIGHT

Copyright (C) 2008-2018 ABINIT group (MG, MT, FJ, TRangel, DCA, XG, AHR, DJA, DRH)
This file is distributed under the terms of the
GNU General Public License, see ~abinit/COPYING
or http://www.gnu.org/copyleft/gpl.txt .

m_geometry/chkdilatmx [ Functions ]

Check whether the new rprimd does not give a too large number
of plane waves, compared to the one booked for rprimd, taking
into account the maximal dilatation dilatmx. Actually check whether
the new Fermi sphere is inside the old one, dilated.

INPUTS

chkdilatmx_ = if 1, will prevent to have any vector outside the Fermi sphere, possibly
by rescaling (three times at most), and then stopping the execution
if 0, simply send a warning, but continues execution
dilatmx = maximal dilatation factor (usually the input variable)
rprimd = new primitive vectors
rprimd_orig = original primitive vectors (usually the input variable)

OUTPUT

dilatmx_errmsg=Emptry string if calculation can continue.
If the calculation cannot continue, dilatmx_errmsg will contain
the message that should be reported in the output file.
Client code should handle a possible problem with the following test:
if (LEN_TRIM(dilatmx_errmsg) then
dump dilatmx_errmsg to the main output file.
handle_error
end if

m_geometry/fixsym [ Functions ]

Using input indsym which tells which atoms are related by symmetry,
check that iatfix consistently fixes (freezes) all atoms which are
related by symmetry, i.e. that iatfix does not break symmetry.

INPUTS

iatfix(3,natom)=integer array with 1 in every position for which
the atom is to be kept fixed
NOTE that this is not the input data structure for iatfix but it is
the internal data structure used through most of the subroutines
indsym(4,nsym,natom)=indirect indexing array for symmetrically related
atoms; 4th element is label of symmetrically related atom
natom=number of atoms
nsym=number of symmetries (should be > 1 when this is called)

m_geometry/fred2fcart [ Functions ]

fred(3,natom)=symmetrized grtn = d(etotal)/d(xred)
natom=Number of atoms in the unitary cell
Favgz_null=TRUE if the average cartesian force has to be set to zero
FALSE if it is set to zero only in x,y directions (not z)
gprimd(3,3)=dimensional primitive translations for reciprocal space(bohr^-1)

Only the proper part of the symmetry operation is taken into account:
pure rotations, while the inversion part is taken away, if present.
The whole collection of symmetry matrices is call symrel(3,3,nsym)
symrel1 contains just one of those matrices symrel1(3,3)

m_geometry/littlegroup_pert [ Functions ]

If syuse==0 and abs(rfmeth)==2, determines the set of symmetries that leaves a perturbation invariant.
(Actually, all symmetries that leaves a q-wavevector invariant should be used to reduce the number
of k-points for all perturbations. Unfortunately, one has to take into account the sign reversal of the
perturbation under the symmetry operations, which makes GS routines not usable for the respfn code.
The intermediate choice was to select only those that keep also the perturbation invariant.
Note that the wavevector of the perturbation must also be invariant,
a translation vector in real space is NOT allowed ).

INPUTS

gprimd(3,3)=dimensional primitive translations for reciprocal space (bohr**-1)
idir=direction of the perturbation
indsym(4,nsym,natom)=indirect indexing of atom labels--see subroutine symatm for definition (if nsym>1)
iout=if non-zero, output on unit iout
ipert=characteristics of the perturbation
natom= number of atoms
nsym=number of space group symmetries
rfmeth =
1 or -1 if non-stationary block
2 or -2 if stationary block
3 or -3 if third order derivatives
positive if symmetries are used to set elements to zero whenever possible, negative to prevent this to happen.
symq(4,2,nsym)= Table computed by littlegroup_q.
three first numbers define the G vector;
fourth number is zero if the q-vector is not preserved, is 1 otherwise
second index is one without time-reversal symmetry, two with time-reversal symmetry
symafm(nsym)=(anti)ferromagnetic part of the symmetry operations
symrec(3,3,nsym)=3x3 matrices of the group symmetries (reciprocal space)
symrel(3,3,nsym)=3x3 matrices of the group symmetries (real space)
syuse= flag to use the symmetries or not. If 0 usei it, if 1 do not use it.
tnons(3,nsym)=nonsymmorphic translations of space group in terms
of real space primitive translations (may be 0)
[unit]=By default the routine writes to std_out and this is very annoying if we are inside a big loop.
Use unit=dev_null or a negative integer to disable writing.

OUTPUT

nsym1 =number of space group symmetries that leaves the perturbation invariant
symaf1(nsym1)=(anti)ferromagnetic part of the corresponding symmetry operations
symrl1(3,3,nsym1)=corresponding 3x3 matrices of the group symmetries (real space)
tnons1(3,nsym1)=corresponding nonsymmorphic translations of space group in terms
of real space primitive translations (may be 0)!!

m_geometry/normv_int_vector [ Functions ]

Returns the norm of an integer 3D vector expressed in reduced coordinates.
either in real or reciprocal space. In the later case the factor 2pi has
to be included, due to the conventions used in abinit to define the reciprocal lattice.

m_geometry/normv_int_vector_array [ Functions ]

Returns the norm of an array of integer 3D vectors expressed in reduced coordinates.
either in real or reciprocal space. In the later case the factor 2pi has
to be included, due to the conventions used in abinit to define the reciprocal lattice.

m_geometry/normv_rdp_vector [ Functions ]

Compute the norm of a vector expressed in reduced coordinates using the metric met.
The result is multiplied by 2pi in case of a vector in reciprocal space
to take into account the correct normalisation of the reciprocal lattice vectors

INPUTS

xv(3)=Vector in reduced coordinates
met(3,3)=Metric tensor
space=Character defining whether we are working in real (r|R) or reciprocal space (g|G)

OUTPUT

normv_rdp_vector=norm of xv

NOTES

The routine is able to deal both with a single vector as well as arrays of vectors.
Versions for integer and real vectors are provided.

m_geometry/normv_rdp_vector_array [ Functions ]

Returns the norm of an array of real 3D vectors expressed in reduced coordinates.
either in real or reciprocal space. In the later case the factor 2pi has
to be included, due to the conventions used in abinit to define the reciprocal lattice.

m_geometry/randomcellpos [ Functions ]

This subroutine creates a unit cell with random atomic positions. It is
assumed that the cell parameters are given and fixed. Several methods are
used to generate the cell.

INPUTS

natom=number of atoms
npsp=number of pseudopotentials (needed for the dimension of znucl)
ntypat=number of type of atoms
random_atpos=input variable
0 no generation of random atomic potision
1 completely random atomic potisions
2 random atomic positions, avoiding too close atoms
(prevent coming closer than a fraction of the sum of covalent radii)
3 same than 2 but also generates the rprim and acell randomly
within some given ranges (angles between 50 and 130)
ratsph(1:ntypat)=radius of the atomic sphere
rprimd(3,3)=dimensional primitive translations in real space (bohr)
typat(1:natom)= input variable giving the type of each atom
znucl(1:npsp)=nuclear number of atom as specified in psp file

m_geometry/remove_inversion [ Functions ]

Remove the inversion symmetry from a symmetry set as well
all the improper rotations (if present)

INPUTS

nsym=initial number of symmetries
symrel(3,3,nsym)=Initial set of symmetry operarations in real space
tnons(3,nsym)=Initial fractional translations

OUTPUT

nsym_out=Number of symmetries in the set without improper rotation
symrel_out(:,:) [pointer] = output symmetries without improper rotations
tnons_out(:) [pointer] = fractional translations associated to symrel_out
pinv=-1 if the inversion has been removed, 1 otherwise

NOTES

Note the use of pointers, memory is allocated inside the procedure and passed back
to the caller. Thus memory deallocation is relegated to the caller. To be on the safe side
the pointers should be nullified before entering.

m_geometry/rotmat [ Functions ]

inversion_flag = flag that indicates that an inversion operation
on the coordinate system should be done
umat(3,3)= matrix that rotates the x=(1 0 0) and z=(0 0 1) to the new
values defined in xaxis and zaxis

NOTES

Here I set that the axe x is originally at the 1 0 0 direction and z is originally 0 0 1.
So calling rotmat(x',z') will find the rotation
matrix for the case in which we rotate the x and z
axes from their default values to x' and z'.

m_geometry/shellstruct [ Functions ]

natom=number of atoms in unit cell
xred=reduced coordinates of atoms
rprimd=unit cell vectors
magv = magnetic ordering of atoms given as 1 and -1, if not given fm is assumed
atp = atom on which the perturbation was done

OUTPUT

sdisv(nat)= distance of each shell to central atom (only the first nsh entries are relevant)
nsh= number of shells
mult(nat) = number of atoms on shell (only the first nsh entries are relevant)

m_geometry/stresssym [ Functions ]

For given order of point group, symmetrizes the stress tensor,
in symmetrized storage mode and cartesian coordinates, using input
3x3 symmetry operators in reduced coordinates.
symmetrized tensor replaces input tensor.

When aprim=rprimd and bprim=gprimd, the routine operates in real space (on a real space symmetry)
When aprim=gprimd and bprim=rprimd, the routine operates in reciprocal space (on a real space symmetry)

m_geometry/vdotw_rc_vector [ Functions ]

Compute the scalar product between two vectors expressed in reduced coordinates
First vector is real, the second one is complex.
The result is multiplied by (2pi)**2 in case of vectors in reciprocal space
to take into account the correct normalisation of the reciprocal lattice vectors

INPUTS

xv(3),xw(3)=Vectors in reduced coordinates
met(3,3)=Metric tensor
space=Character defining whether we are working in real (r) or reciprocal space (g)

m_geometry/vdotw_rr_vector [ Functions ]

Compute the scalar product between two vectors expressed in reduced coordinates
The result is multiplied by (2pi)**2 in case of vectors in reciprocal space
to take into account the correct normalisation of the reciprocal lattice vectors

INPUTS

xv(3),xw(3)=Vectors in reduced coordinates
met(3,3)=Metric tensor
space=Character defining whether we are working in real (r) or reciprocal space (g)

m_geometry/wigner_seitz [ Functions ]

Calculates a grid of points that falls inside of (and eventually on the surface of)
the Wigner-Seitz supercell centered on the origin of the B lattice with primitive
translations nmonkh(1)*a_1+nmonkh(2)*a_2+nmonkh(3)*a_3.
Subroutine taken from the Wannier90 code. Modified by MG to fulfil abinit coding rules.
API slightly changed wrt the wannier90 version.

COPYRIGHT

Copyright (C) 2007 Jonathan Yates, Arash Mostofi,
Young-Su Lee, Nicola Marzari, Ivo Souza, David Vanderbilt.
This file is distributed under the terms of the
GNU General Public License, see ~abinit/COPYING
or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

center(3)=The Wigner-Seitz cell is centered on this point in reduced coordinates.
rmet(3,3)=Real spacemetric ($\textrm{bohr}^{2}$).
kptrlatt(3)=Values defining the supercell.
prtvol=If different from 0 print out the points falling inside the W-S cell and the correponding weights.
lmax(3)=see Notes below.

OUTPUT

npts=number of points falling inside the Wigner-Seitz cell
irvec(3,npts)=Reduced coordinated of the points inside the W-S cell
ndegen(npts)=Weigths associated to each point.

SIDE EFFECTS

irvec and ndegen are are allocated with the correct
size inside the routine and returned to the caller.

NOTES

The Wannier functions live in a supercell of the real space unit cell.
This supercell is mp_grid unit cells long in each direction
The algorithm loops over grid points r on a unit cell that is 8 times larger than this
primitive supercell.
One of these points is in the W-S cell if it is closer to center(:)
than any of the other points R where R are the translation vectors of the supercell.
In the end npts contains the total number of grid points that have been found in the Wigner-Seitz cell
The number of lattice vectors R along each direction of the supercell is defined by lmax.

m_geometry/xcart2xred [ Functions ]

Convert from cartesian coordinates xcart(3,natom) in bohr to
dimensionless reduced coordinates xred(3,natom) by using
xred(mu,ia)=gprimd(1,mu)*xcart(1,ia)
+gprimd(2,mu)*xcart(2,ia)
+gprimd(3,mu)*xcart(3,ia)
where gprimd is the inverse of rprimd
Note that the reverse operation is deon by xred2xcart

m_geometry/xred2xcart [ Functions ]

Convert from dimensionless reduced coordinates xred(3,natom)
to cartesian coordinates xcart(3,natom) in bohr by using
xcart(mu,ia)=rprimd(mu,1)*xred(1,ia)
+rprimd(mu,2)*xred(2,ia)
+rprimd(mu,3)*xred(3,ia)
Note that the reverse operation is done by xcart2xred.F90