Octopus
harmonic_spectrum.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
23 use fft_oct_m
24 use global_oct_m
25 use io_oct_m
26 use iso_c_binding
29 use parser_oct_m
33
34 implicit none
35
36 integer :: mode, ierr, ar
37 real(real64) :: w0, vec(1:3)
38 type(spectrum_t) :: spectrum
39 character :: pol
40 character(kind=c_char) :: cpol(2)
41 logical :: get_maxima
42
43 integer, parameter :: &
44 HS_FROM_MULT = 1, &
45 hs_from_acc = 2, &
46 hs_from_curr = 3
47
48 call getopt_init(ierr)
49 if (ierr /= 0) then
50 call messages_write("Your Fortran compiler doesn't support command-line arguments;")
52 call messages_write("the oct-harmonic-spectrum command is not available.")
53 call messages_fatal()
54 end if
55 ! These are the default values.
56 get_maxima = .true.
57 w0 = m_zero
58 mode = 1
59 ar = 0
60 vec = (/m_one, m_zero, m_one /)
61 cpol = 'x'
62 call getopt_harmonic_spectrum(w0, mode, ar, vec(1),vec(2),vec(3),cpol)
63 pol = cpol(1)
64 if (w0 <= m_zero) get_maxima = .false.
65 call getopt_end()
66
67
68 ! Initialize stuff
70
71 call parser_init()
72
73 call messages_init()
74
75 call io_init()
79
80 call spectrum_init(spectrum, global_namespace)
81
82 call messages_obsolete_variable(global_namespace, 'HarmonicSpectrumPolarization')
83 call messages_obsolete_variable(global_namespace, 'HarmonicSpectrumMode')
84
85 if ((pol /= 'x') .and. &
86 (pol /= 'y') .and. &
87 (pol /= 'z') .and. &
88 (pol /= '+') .and. &
89 (pol /= '-') .and. &
90 (pol /= 'v')) then
91 message(1) = 'The polarization direction given in the command line is not valid.'
92 call messages_fatal(1)
93 end if
94
95 select case (mode)
96 case (hs_from_mult)
97 if (get_maxima) then
98 call spectrum_hs_from_mult(spectrum, global_namespace, 'hs-mult-maxima', pol, vec, w0)
99 else
100 if (ar == 1) then
101 message(1)= "Calculating angle-resolved hs from multipoles."
102 call messages_info(1)
103 call spectrum_hs_ar_from_mult(spectrum, global_namespace, 'hs-mult', vec)
104 else
105 call spectrum_hs_from_mult(spectrum, global_namespace, 'hs-mult', pol, vec)
106 end if
107 end if
108 case (hs_from_acc)
109 if (get_maxima) then
110 call spectrum_hs_from_acc(spectrum, global_namespace, 'hs-acc-maxima', pol, vec, w0)
111 else
112 if (ar == 1) then
113 message(1)= "Calculating angle-resolved hs from acceleration."
114 call messages_info(1)
115 call spectrum_hs_ar_from_acc(spectrum, global_namespace, 'hs-acc', vec)
116 else
117 call spectrum_hs_from_acc(spectrum, global_namespace, 'hs-acc', pol, vec)
118 end if
119 end if
120 case (hs_from_curr)
121 if (get_maxima) then
122 call spectrum_hs_from_mult(spectrum, global_namespace, 'hs-curr-maxima', pol, vec, w0)
123 else
124 call spectrum_hs_from_current(spectrum, global_namespace, 'hs-curr', pol, vec)
125 end if
126 case default
127 message(1) = 'The harmonic-spectrum mode given in the command line is not valid.'
128 call messages_fatal(1)
129 end select
130
132 call io_end()
133 call messages_end()
134
135 call parser_end()
136
137 call global_end()
138end program harmonic_spectrum
139
140!! Local Variables:
141!! mode: f90
142!! coding: utf-8
143!! End:
program harmonic_spectrum
subroutine, public getopt_init(ierr)
Initializes the getopt machinery. Must be called before attempting to parse the options....
subroutine, public getopt_end
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
Definition: fft.F90:120
subroutine, public fft_all_init(namespace)
initialize the table
Definition: fft.F90:280
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
Definition: global.F90:421
real(real64), parameter, public m_zero
Definition: global.F90:191
type(mpi_comm), parameter, public serial_dummy_comm
Alias MPI_COMM_UNDEFINED for the specific use case of initialising Octopus utilities with no MPI supp...
Definition: global.F90:280
subroutine, public init_octopus_globals(comm)
Initialise Octopus-specific global constants and files. This routine performs no initialisation calls...
Definition: global.F90:390
real(real64), parameter, public m_one
Definition: global.F90:192
Definition: io.F90:116
subroutine, public io_init(defaults)
If the argument defaults is present and set to true, then the routine will not try to read anything f...
Definition: io.F90:165
subroutine, public io_end()
Definition: io.F90:270
subroutine, public messages_end()
Definition: messages.F90:273
subroutine, public messages_init(output_dir)
Definition: messages.F90:220
subroutine, public messages_obsolete_variable(namespace, name, rep)
Definition: messages.F90:1023
subroutine, public messages_new_line()
Definition: messages.F90:1112
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:162
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:410
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:594
type(namespace_t), public global_namespace
Definition: namespace.F90:134
subroutine, public parser_init()
Initialise the Octopus parser.
Definition: parser.F90:402
subroutine, public parser_end()
End the Octopus parser.
Definition: parser.F90:434
subroutine, public profiling_end(namespace)
Definition: profiling.F90:415
subroutine, public profiling_init(namespace)
Create profiling subdirectory.
Definition: profiling.F90:257
subroutine, public spectrum_hs_ar_from_acc(spectrum, namespace, out_file, vec, w0)
Definition: spectrum.F90:1734
subroutine, public spectrum_init(spectrum, namespace, default_energy_step, default_max_energy)
Definition: spectrum.F90:215
subroutine, public spectrum_hs_from_acc(spectrum, namespace, out_file, pol, vec, w0)
Definition: spectrum.F90:2050
subroutine, public spectrum_hs_from_current(spectrum, namespace, out_file, pol, vec, w0)
Definition: spectrum.F90:2151
subroutine, public spectrum_hs_from_mult(spectrum, namespace, out_file, pol, vec, w0)
Definition: spectrum.F90:1931
subroutine, public spectrum_hs_ar_from_mult(spectrum, namespace, out_file, vec, w0)
Definition: spectrum.F90:1838
This module defines the unit system, used for input and output.
subroutine, public unit_system_init(namespace)
int true(void)