enh: changed default of LatticeConstant for Parameters/Vectors

This means that when using LatticeParameters/Vectors the default
lattice constant value is 1 Ang.

All utilities use of LatticeConstant has also changed to the
new default.

Signed-off-by: Nick Papior <nickpapior@gmail.com>
This commit is contained in:
Nick Papior 2023-02-10 15:17:03 +01:00
parent 6e9a3c88a9
commit a0762f5690
8 changed files with 39 additions and 31 deletions

View File

@ -3312,7 +3312,7 @@ Firstly, the size of the cell itself should be specified, using some
combination of the options \fdf{LatticeConstant},
\fdf{LatticeParameters}, and \fdf{LatticeVectors}, and
\fdf{SuperCell}. If nothing is specified, \siesta\ will construct a
cubic cell in which the atoms will reside as a cluster.
cubic cell in which the atoms will reside as a cluster (a molecule).
Secondly, the positions of the atoms within the cells must be
specified, using either the traditional \siesta\ input format (a
@ -3320,21 +3320,19 @@ modified xyz format) which must be described within a
\fdf{AtomicCoordinatesAndAtomicSpecies} block.
\begin{fdfentry}{LatticeConstant}[length]
\fdfdepend{LatticeParameters,LatticeVectors}
Lattice constant. This is just to define the scale of the lattice
vectors.
\textit{Default value:} Minimum size to include the system (assumed
to be a molecule) without intercell interactions, plus 10\%.
\note A LatticeConstant value, even if redundant, might be needed
for other options, such as the units of the $k$-points used for
band-structure calculations. This mis-feature will be corrected in
future versions.
\note This defaults to $1\,\mathrm{Ang}$ when used in combination
with \fdf{LatticeParameters} or \fdf{LatticeVectors}. Otherwise it
is not used.
\end{fdfentry}
\begin{fdfentry}{LatticeParameters}[block]
\fdfdepend{LatticeConstant}
Crystallographic way of specifying the lattice vectors, by giving
six real numbers: the three vector modules, $a$, $b$, and $c$, and
@ -3342,7 +3340,7 @@ modified xyz format) which must be described within a
$\beta$, and $\gamma$. The three modules are in units of
\fdf{LatticeConstant}, the three angles are in degrees.
This defaults to a square cell with side-lengths equal to \fdf{LatticeConstant}.
For example a square cell with side-lengths equal to \fdf{LatticeConstant}.
\begin{fdfexample}
1.0 1.0 1.0 90. 90. 90.
\end{fdfexample}
@ -3350,22 +3348,20 @@ modified xyz format) which must be described within a
\end{fdfentry}
\begin{fdfentry}{LatticeVectors}[block]
\fdfdepend{LatticeConstant}
The cell vectors are read in units of the lattice constant defined
above. They are read as a matrix \texttt{CELL(ixyz,ivector)}, each
vector being one line.
The cell vectors are read in units of the lattice constant,
\fdf{LatticeConstant} which defaults to $1\,\mathrm{Ang}$.
This defaults to a square cell with side-lengths equal to \fdf{LatticeConstant}.
They are read as a matrix with each vector being one line.
For example a square cell with side-lengths equal to \fdf{LatticeConstant}.
\begin{fdfexample}
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
\end{fdfexample}
\noindent
If the \fdf{LatticeConstant} default is used, the default of
\fdf{LatticeVectors} is still diagonal but not necessarily cubic.
\end{fdfentry}
\begin{fdfentry}{SuperCell}[block]

View File

@ -11,7 +11,7 @@ CONTAINS
use fdf, only: leqi, fdf_get
use parallel, only: IOnode
use siesta_geom, only: ucell
use units, only: Pi
use units, only: Pi, Ang
implicit none
@ -31,7 +31,7 @@ CONTAINS
if (leqi(scale,'pi/a')) then
alat = fdf_get( 'LatticeConstant', 0.0_dp, 'Bohr' )
alat = fdf_get( 'LatticeConstant', Ang, 'Bohr' )
if (alat .eq. 0.0_dp) then
if (IOnode ) then
write(6,'(a)') 'ERROR: Lattice constant required for ' // &

View File

@ -71,7 +71,7 @@ c Coord. option Ang => Multiply by 0.529177 (Bohr --> Ang)
c Coord. option Scaled => Divide by lattice constant
c Coord. option Fractional => Multiply by inverse of lattice vectors
alat = fdf_physical('LatticeConstant',0._dp,'Bohr')
alat = fdf_physical('LatticeConstant',Ang,'Bohr')
if (alat.eq.0._dp .and. leqi(acfout,'ScaledCartesian')) then
write(6,"(/,2a)") 'outcoor: WARNING: Explicit lattice ',
. 'constant is needed for ScaledCartesian output.'

View File

@ -24,6 +24,7 @@ C
use precision, only : dp
use parallel, only : Node
use sys, only : die
use units, only : Ang
use fdf
implicit none
@ -38,8 +39,6 @@ C Internal variables
type(block_fdf) :: bfdf
type(parsed_line), pointer :: pline
C Lattice constant
alat = fdf_physical('LatticeConstant',0.0_dp,'Bohr')
C Lattice vectors
@ -50,8 +49,13 @@ C Lattice vectors
endif
if ( fdf_block('LatticeParameters',bfdf) ) then
C Lattice constant
alat = fdf_physical('LatticeConstant',Ang,'Bohr')
if (.not. fdf_bline(bfdf, pline))
. call die('redcel: ERROR in LatticeParameters block')
. call die('redcel: ERROR in LatticeParameters block')
alp = fdf_bvalues(pline,1)
blp = fdf_bvalues(pline,2)
clp = fdf_bvalues(pline,3)
@ -81,6 +85,8 @@ C Lattice vectors
where (abs(cell) < 1.0e-14) cell = 0.0_dp
elseif ( fdf_block('LatticeVectors',bfdf) ) then
C Lattice constant (vectors are in Ang)
alat = fdf_physical('LatticeConstant',Ang,'Bohr')
do i = 1,3
if (.not. fdf_bline(bfdf, pline))
@ -89,7 +95,11 @@ C Lattice vectors
cell(2,i) = fdf_bvalues(pline,2)
cell(3,i) = fdf_bvalues(pline,3)
enddo
else
C Lattice constant (default 0 == molecule setting)
alat = fdf_physical('LatticeConstant',0._dp,'Bohr')
do i = 1,3
do j = 1,3
cell(i,j) = 0.0_dp

View File

@ -15,6 +15,7 @@ program unfold
! S.G.Mayo and J.M.Soler, Oct.2018
! P. Ordejón, Jan 2021 - Parallelization over orbitals implemented
use units, only: Ang
use alloc, only: de_alloc, re_alloc
use memory_log, only: memory_report
use atmfuncs, only: lofio, mofio, nofis, rcut, rphiatm, zetafio
@ -306,7 +307,7 @@ program unfold
! Find unit cell and initialize atomic coords
if (myNode==0) print'(a,/,(3f12.6))','unfold: reading system geometry'
alat = fdf_get('LatticeConstant',1._dp,'bohr')
alat = fdf_get('LatticeConstant',Ang,'bohr')
call coor(na,ucell) ! atomic coordinates xa stored in module siesta_geom
vol = volcel(ucell) ! unit cell volume
call reclat(ucell,rcell,1) ! rcell = reciprocal cell vectors

View File

@ -24,7 +24,7 @@ c
c **********************************************************************
use fdf
use units, only: Pi
use units, only: Pi, Ang
use precision, only: dp
implicit none
@ -90,7 +90,7 @@ c Read Number of Atoms in Unit cell ...
c ...
c Lattice constant of unit cell...
alat = fdf_get('LatticeConstant',0.d0,'Bohr')
alat = fdf_get('LatticeConstant',Ang,'Bohr')
if (alat .eq. 0.d0) then
write(6,'(a)')
. 'ERROR: No valid lattice constant specified.'

View File

@ -77,6 +77,7 @@ C If only given points (not lines) are desired, simply specify 1 as
C the number of points along the line.
C *********************************************************************
use fdf
use units, only: Pi, Ang
implicit none
@ -99,7 +100,7 @@ C Internal variables
double precision
. alat,
. pi, rcell(3,3), reals(4),
. rcell(3,3), reals(4),
. ucell(3,3), values(4)
character
@ -126,7 +127,7 @@ C Find if there are band-lines data
C Find lattice constant
alat = fdf_physical( 'LatticeConstant', 0.d0, 'Bohr' )
alat = fdf_physical( 'LatticeConstant', Ang, 'Bohr' )
if (alat .eq. 0.d0) then
call die('klines: ERROR: Lattice constant required')
endif
@ -134,7 +135,7 @@ C Find lattice constant
C Find scale used in k point data
scale = fdf_string( 'BandLinesScale', 'pi/a' )
if (scale .eq. 'pi/a') then
pi = 4.d0 * atan(1.d0)
! do nothing
elseif (scale .eq. 'ReciprocalLatticeVectors') then
if ( fdf_block('LatticeVectors',bfdf) ) then
do i = 1,3

View File

@ -23,7 +23,7 @@ c
c **********************************************************************
use fdf
use units, only: Pi
use units, only: Pi, Ang
use precision, only: dp
implicit none
@ -154,7 +154,7 @@ c ...
ndof = natoms * 3
c Lattice constant of unit cell...
alat = fdf_get('LatticeConstant',0.d0,'Bohr')
alat = fdf_get('LatticeConstant',Ang,'Bohr')
if (alat .eq. 0.d0) then
write(6,'(a)')
. 'ERROR: No valid lattice constant specified.'