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
84 type(unit_t),
public :: unit_GPa
93 type(namespace_t),
intent(in) :: namespace
95 integer :: cc, cinp, cout, xyz_units
163 call messages_write(
"The 'Units' variable is obsolete. Now Octopus always works in atomic", new_line = .
true.)
164 call messages_write(
"units. For different units you can use values like 'angstrom', 'eV' ", new_line = .
true.)
180 unit_one%factor =
m_one
181 unit_one%abbrev =
'1'
182 unit_one%name =
'one'
184 unit_angstrom%factor =
p_ang
185 unit_angstrom%abbrev =
"A"
186 unit_angstrom%name =
"Angstrom"
188 unit_ppm%factor = 1e-6_real64
189 unit_ppm%abbrev =
'ppm a.u.'
190 unit_ppm%name =
'parts per million'
192 unit_susc_ppm_cgs%factor = 1e-6_real64/8.9238878e-2_real64
193 unit_susc_ppm_cgs%abbrev =
'ppm cgs/mol'
194 unit_susc_ppm_cgs%name =
'magnetic susceptibility parts per million cgs'
196 unit_debye%factor =
m_one/2.5417462_real64
197 unit_debye%abbrev =
'Debye'
198 unit_debye%name =
'Debye'
201 unit_invcm%factor =
m_one/219474.63_real64
202 unit_invcm%abbrev =
'cm^-1'
203 unit_invcm%name =
'h times c over centimeters'
205 unit_kelvin%factor =
p_kb
206 unit_kelvin%abbrev =
'K'
207 unit_kelvin%name =
'degrees Kelvin'
210 unit_amu%factor =
m_one/5.485799110e-4_real64
211 unit_amu%abbrev =
'u'
212 unit_amu%name =
'1/12 of the mass of C^12'
214 unit_femtosecond%factor = 1.0_real64/0.024188843_real64
215 unit_femtosecond%abbrev =
'fs'
216 unit_femtosecond%name =
'femtoseconds'
218 unit_kilobytes%factor = 2.0_real64**10
219 unit_kilobytes%abbrev =
'KiB'
220 unit_kilobytes%name =
'kibibytes'
222 unit_megabytes%factor = 2.0_real64**20
223 unit_megabytes%abbrev =
'MiB'
224 unit_megabytes%name =
'mebibytes'
226 unit_gigabytes%factor = 2.0_real64**30
227 unit_gigabytes%abbrev =
'GiB'
228 unit_gigabytes%name =
'gibibytes'
230 unit_ev%abbrev =
"eV"
231 unit_ev%name =
"electronvolt"
234 unit_gpa%abbrev =
"GPa"
235 unit_gpa%name =
"gigapascal"
236 unit_gpa%factor = 0.339892967545026635270e-4_real64
257 call parse_variable(namespace,
'UnitsXYZFiles', option__unitsxyzfiles__angstrom_units, xyz_units)
263 select case (xyz_units)
265 case (option__unitsxyzfiles__bohr_units)
267 units_inp%length_xyz_file = units_inp%length
268 units_out%length_xyz_file = units_inp%length
270 case (option__unitsxyzfiles__angstrom_units)
271 units_inp%length_xyz_file = unit_angstrom
272 units_out%length_xyz_file = unit_angstrom
285 integer,
intent(in) :: cc
295 message(1) =
"Unknown units in unit_system_get"
312 uu%length%abbrev =
"b"
313 uu%length%name =
"Bohr"
314 uu%length%factor =
m_one
316 uu%energy%abbrev =
"H"
317 uu%energy%name =
"Hartree"
318 uu%energy%factor =
m_one
320 uu%time%abbrev =
"hbar/H"
321 uu%time%name =
"hbar/Hartree"
322 uu%time%factor =
m_one/uu%energy%factor
324 uu%velocity%abbrev =
"bH(2pi/h)"
325 uu%velocity%name =
"Bohr times Hartree over hbar"
326 uu%velocity%factor =
m_one
328 uu%mass%abbrev =
"me"
329 uu%mass%name =
"electron mass"
330 uu%mass%factor =
m_one
332 uu%force%abbrev =
"H/b"
333 uu%force%name =
"Hartree/Bohr"
334 uu%force%factor =
m_one
336 uu%acceleration%abbrev =
"bH(2pi/h)^2"
337 uu%acceleration%name =
"Bohr times (Hartree over h bar) squared"
338 uu%acceleration%factor =
m_one
340 uu%polarizability%abbrev =
"b^3"
341 uu%polarizability%name =
"Bohr^3"
342 uu%polarizability%factor =
m_one
347 uu%hyperpolarizability%abbrev =
"b^5"
348 uu%hyperpolarizability%name =
"Bohr^5"
349 uu%hyperpolarizability%factor =
m_one
361 uu%length%abbrev =
"A"
362 uu%length%name =
"Angstrom"
363 uu%length%factor =
p_ang
365 uu%energy%abbrev =
"eV"
366 uu%energy%name =
"electronvolt"
369 uu%time%abbrev =
"hbar/eV"
370 uu%time%name =
"hbar/electronvolt"
371 uu%time%factor =
m_one/uu%energy%factor
373 uu%velocity%abbrev =
"A eV/hbar"
374 uu%velocity%name =
"Angstrom times electronvolts over hbar"
375 uu%velocity%factor = uu%length%factor*uu%energy%factor
377 uu%mass%abbrev =
"hbar^2/(eV A^2)"
378 uu%mass%name =
"hbar^2/(electronvolt * Angstrom^2)"
379 uu%mass%factor =
m_one/(uu%energy%factor * uu%length%factor**2)
381 uu%force%abbrev =
"eV/A"
382 uu%force%name =
"electronvolt/Angstrom"
383 uu%force%factor = uu%energy%factor/uu%length%factor
385 uu%acceleration%abbrev =
"A (eV/hbar)^2"
386 uu%acceleration%name =
"Angstrom times (electronvolt over hbar) squared"
387 uu%acceleration%factor = uu%length%factor/uu%time%factor**2
389 uu%polarizability = uu%length**3
390 uu%hyperpolarizability = uu%length**5
405 character(len=*),
intent(in) :: fname
407 integer,
intent(inout) :: ierr
409 integer :: iunit, ios
410 character(len=256) :: line
414 iunit =
io_open(trim(fname), namespace, action=
'read', status=
'old', die=.false.)
415 if (iunit == -1)
then
423 read(iunit,
'(a)', iostat = ios) line
425 if (index(line,
'[A]') /= 0 .or. index(line,
'eV') /= 0)
then
429 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,...