File: volume.f90

package info (click to toggle)
espresso 6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 311,040 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,502; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (38 lines) | stat: -rw-r--r-- 1,219 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
!
! Copyright (C) 2017 Quantum ESPRESSO Foundation
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
!
!---------------------------------------------------------------------
SUBROUTINE volume (alat, a1, a2, a3, omega)
  !---------------------------------------------------------------------
  !
  !     Compute the volume of the unit cell defined by 3 vectors
  !     a1, a2, a3, given in units of "alat" (alat may be 1):
  !        omega = alat^3 * [ a1 . (a2 x a3) ]
  !     ( . = scalar product, x = vector product )
  !
  USE kinds, ONLY: dp
  IMPLICIT NONE
  !
  REAL(dp), INTENT(IN) :: alat, a1(3), a2(3), a3(3)
  REAL(dp), INTENT(OUT) :: omega
  !
  omega = a1(1) * ( a2(2)*a3(3)-a2(3)*a3(2) ) - &
          a1(2) * ( a2(1)*a3(3)-a2(3)*a3(1) ) + &
          a1(3) * ( a2(1)*a3(2)-a2(2)*a3(1) )
  !
  IF ( omega < 0.0_dp) THEN
     call infomsg('volume','axis vectors are left-handed')
     omega = ABS (omega)
  END IF
  !
  IF ( alat < 1.0_dp) call infomsg('volume','strange lattice parameter')
  omega = omega * alat**3
  !
  RETURN
  !
END SUBROUTINE volume