37 use,
intrinsic :: iso_fortran_env
55 type(unit_t) :: length
56 type(unit_t) :: length_xyz_file
57 type(unit_t) :: energy
59 type(unit_t) :: velocity
62 type(unit_t) :: acceleration
63 type(unit_t) :: polarizability
64 type(unit_t) :: hyperpolarizability
68 type(unit_system_t),
public :: units_inp, units_out
71 type(unit_t),
public :: unit_one
72 type(unit_t),
public :: unit_angstrom
73 type(unit_t),
public :: unit_ppm
74 type(unit_t),
public :: unit_debye
75 type(unit_t),
public :: unit_invcm
76 type(unit_t),
public :: unit_susc_ppm_cgs
77 type(unit_t),
public :: unit_kelvin
78 type(unit_t),
public :: unit_femtosecond
79 type(unit_t),
public :: unit_amu
80 type(unit_t),
public :: unit_kilobytes
81 type(unit_t),
public :: unit_megabytes
82 type(unit_t),
public :: unit_gigabytes
83 type(unit_t),
public :: unit_eV
92 type(namespace_t),
intent(in) :: namespace
94 integer :: cc, cinp, cout, xyz_units
161 call messages_write(
"The 'Units' variable is obsolete. Now Octopus always works in atomic", new_line = .
true.)
162 call messages_write(
"units. For different units you can use values like 'angstrom', 'eV' ", new_line = .
true.)
179 unit_one%abbrev =
'1'
180 unit_one%name =
'one'
182 unit_angstrom%factor =
p_ang
183 unit_angstrom%abbrev =
"A"
184 unit_angstrom%name =
"Angstrom"
186 unit_ppm%factor = 1e-6_real64
187 unit_ppm%abbrev =
'ppm a.u.'
188 unit_ppm%name =
'parts per million'
190 unit_susc_ppm_cgs%factor = 1e-6_real64/8.9238878e-2_real64
191 unit_susc_ppm_cgs%abbrev =
'ppm cgs/mol'
192 unit_susc_ppm_cgs%name =
'magnetic susceptibility parts per million cgs'
194 unit_debye%factor =
m_one/2.5417462_real64
195 unit_debye%abbrev =
'Debye'
196 unit_debye%name =
'Debye'
199 unit_invcm%factor =
m_one/219474.63_real64
200 unit_invcm%abbrev =
'cm^-1'
201 unit_invcm%name =
'h times c over centimeters'
203 unit_kelvin%factor =
p_kb
204 unit_kelvin%abbrev =
'K'
205 unit_kelvin%name =
'degrees Kelvin'
208 unit_amu%factor =
m_one/5.485799110e-4_real64
209 unit_amu%abbrev =
'u'
210 unit_amu%name =
'1/12 of the mass of C^12'
212 unit_femtosecond%factor = 1.0_real64/0.024188843_real64
213 unit_femtosecond%abbrev =
'fs'
214 unit_femtosecond%name =
'femtoseconds'
216 unit_kilobytes%factor = 2.0_real64**10
217 unit_kilobytes%abbrev =
'KiB'
218 unit_kilobytes%name =
'kibibytes'
220 unit_megabytes%factor = 2.0_real64**20
221 unit_megabytes%abbrev =
'MiB'
222 unit_megabytes%name =
'mebibytes'
224 unit_gigabytes%factor = 2.0_real64**30
225 unit_gigabytes%abbrev =
'GiB'
226 unit_gigabytes%name =
'gibibytes'
228 unit_ev%abbrev =
"eV"
229 unit_ev%name =
"electronvolt"
251 call parse_variable(namespace,
'UnitsXYZFiles', option__unitsxyzfiles__angstrom_units, xyz_units)
257 select case (xyz_units)
259 case (option__unitsxyzfiles__bohr_units)
261 units_inp%length_xyz_file = units_inp%length
262 units_out%length_xyz_file = units_inp%length
264 case (option__unitsxyzfiles__angstrom_units)
265 units_inp%length_xyz_file = unit_angstrom
266 units_out%length_xyz_file = unit_angstrom
279 integer,
intent(in) :: cc
289 message(1) =
"Unknown units in unit_system_get"
306 uu%length%abbrev =
"b"
307 uu%length%name =
"Bohr"
308 uu%length%factor =
m_one
310 uu%energy%abbrev =
"H"
311 uu%energy%name =
"Hartree"
312 uu%energy%factor =
m_one
314 uu%time%abbrev =
"hbar/H"
315 uu%time%name =
"hbar/Hartree"
316 uu%time%factor =
m_one/uu%energy%factor
318 uu%velocity%abbrev =
"bH(2pi/h)"
319 uu%velocity%name =
"Bohr times Hartree over hbar"
320 uu%velocity%factor =
m_one
322 uu%mass%abbrev =
"me"
323 uu%mass%name =
"electron mass"
324 uu%mass%factor =
m_one
326 uu%force%abbrev =
"H/b"
327 uu%force%name =
"Hartree/Bohr"
328 uu%force%factor =
m_one
330 uu%acceleration%abbrev =
"bH(2pi/h)^2"
331 uu%acceleration%name =
"Bohr times (Hartree over h bar) squared"
332 uu%acceleration%factor =
m_one
334 uu%polarizability%abbrev =
"b^3"
335 uu%polarizability%name =
"Bohr^3"
336 uu%polarizability%factor =
m_one
341 uu%hyperpolarizability%abbrev =
"b^5"
342 uu%hyperpolarizability%name =
"Bohr^5"
343 uu%hyperpolarizability%factor =
m_one
355 uu%length%abbrev =
"A"
356 uu%length%name =
"Angstrom"
357 uu%length%factor =
p_ang
359 uu%energy%abbrev =
"eV"
360 uu%energy%name =
"electronvolt"
363 uu%time%abbrev =
"hbar/eV"
364 uu%time%name =
"hbar/electronvolt"
365 uu%time%factor =
m_one/uu%energy%factor
367 uu%velocity%abbrev =
"A eV/hbar"
368 uu%velocity%name =
"Angstrom times electronvolts over hbar"
369 uu%velocity%factor = uu%length%factor*uu%energy%factor
371 uu%mass%abbrev =
"hbar^2/(eV A^2)"
372 uu%mass%name =
"hbar^2/(electronvolt * Angstrom^2)"
373 uu%mass%factor =
m_one/(uu%energy%factor * uu%length%factor**2)
375 uu%force%abbrev =
"eV/A"
376 uu%force%name =
"electronvolt/Angstrom"
377 uu%force%factor = uu%energy%factor/uu%length%factor
379 uu%acceleration%abbrev =
"A (eV/hbar)^2"
380 uu%acceleration%name =
"Angstrom times (electronvolt over hbar) squared"
381 uu%acceleration%factor = uu%length%factor/uu%time%factor**2
383 uu%polarizability = uu%length**3
384 uu%hyperpolarizability = uu%length**5
399 character(len=*),
intent(in) :: fname
401 integer,
intent(inout) :: ierr
403 integer :: iunit, ios
404 character(len=256) :: line
408 iunit =
io_open(trim(fname), namespace, action=
'read', status=
'old', die=.false.)
417 read(iunit,
'(a)', iostat = ios) line
419 if (index(line,
'[A]') /= 0 .or. index(line,
'eV') /= 0)
then
423 else if (index(line,
'[b]') /= 0)
then
real(real64), parameter, public m_two
real(real64), parameter, public p_ry
real(real64), parameter, public p_ang
real(real64), parameter, public p_kb
Boltzmann constant in Ha/K.
real(real64), parameter, public m_one
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
subroutine, public messages_obsolete_variable(namespace, name, rep)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
logical function, public parse_is_defined(namespace, name)
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
subroutine, public unit_system_from_file(uu, fname, namespace, ierr)
This is a very primitive procedure that attempts to find out which units were used to write an octopu...
integer, parameter, public units_fs
subroutine, public unit_system_get(uu, cc)
subroutine, public unit_system_init(namespace)
subroutine unit_system_init_ev_ang(uu)
integer, parameter, public units_eva
subroutine unit_system_init_atomic(uu)
These routines output the unit-conversion factors, defined by [a.u.] = input*u.unit,...