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
28 use parser_oct_m
32
33 implicit none
34
35 integer :: mode, ierr, ar
36 real(real64) :: w0, vec(1:3)
37 type(spectrum_t) :: spectrum
38 character :: pol
39 logical :: get_maxima
40
41 integer, parameter :: &
42 HS_FROM_MULT = 1, &
43 hs_from_acc = 2, &
44 hs_from_curr = 3
45
46 call getopt_init(ierr)
47 if (ierr /= 0) then
48 call messages_write("Your Fortran compiler doesn't support command-line arguments;")
50 call messages_write("the oct-harmonic-spectrum command is not available.")
51 call messages_fatal()
52 end if
53 ! These are the default values.
54 get_maxima = .true.
55 w0 = m_zero
56 pol = 'x'
57 mode = 1
58 ar = 0
59 vec = (/m_one, m_zero, m_one /)
60 call getopt_harmonic_spectrum(w0, mode, ar, vec(1),vec(2),vec(3),pol)
61 if (w0 <= m_zero) get_maxima = .false.
62 call getopt_end()
63
64
65 ! Initialize stuff
67
68 call parser_init()
69
70 call messages_init()
71
72 call io_init()
76
77 call spectrum_init(spectrum, global_namespace)
78
79 call messages_obsolete_variable(global_namespace, 'HarmonicSpectrumPolarization')
80 call messages_obsolete_variable(global_namespace, 'HarmonicSpectrumMode')
81
82 if ((pol /= 'x') .and. &
83 (pol /= 'y') .and. &
84 (pol /= 'z') .and. &
85 (pol /= '+') .and. &
86 (pol /= '-') .and. &
87 (pol /= 'v')) then
88 message(1) = 'The polarization direction given in the command line is not valid.'
89 call messages_fatal(1)
90 end if
91
92 select case (mode)
93 case (hs_from_mult)
94 if (get_maxima) then
95 call spectrum_hs_from_mult(spectrum, global_namespace, 'hs-mult-maxima', pol, vec, w0)
96 else
97 if (ar == 1) then
98 message(1)= "Calculating angle-resolved hs from multipoles."
99 call messages_info(1)
100 call spectrum_hs_ar_from_mult(spectrum, global_namespace, 'hs-mult', vec)
101 else
102 call spectrum_hs_from_mult(spectrum, global_namespace, 'hs-mult', pol, vec)
103 end if
104 end if
105 case (hs_from_acc)
106 if (get_maxima) then
107 call spectrum_hs_from_acc(spectrum, global_namespace, 'hs-acc-maxima', pol, vec, w0)
108 else
109 if (ar == 1) then
110 message(1)= "Calculating angle-resolved hs from acceleration."
111 call messages_info(1)
112 call spectrum_hs_ar_from_acc(spectrum, global_namespace, 'hs-acc', vec)
113 else
114 call spectrum_hs_from_acc(spectrum, global_namespace, 'hs-acc', pol, vec)
115 end if
116 end if
117 case (hs_from_curr)
118 if (get_maxima) then
119 call spectrum_hs_from_mult(spectrum, global_namespace, 'hs-curr-maxima', pol, vec, w0)
120 else
121 call spectrum_hs_from_current(spectrum, global_namespace, 'hs-curr', pol, vec)
122 end if
123 case default
124 message(1) = 'The harmonic-spectrum mode given in the command line is not valid.'
125 call messages_fatal(1)
126 end select
127
129 call io_end()
130 call messages_end()
131
132 call parser_end()
133
134 call global_end()
135end program harmonic_spectrum
136
137!! Local Variables:
138!! mode: f90
139!! coding: utf-8
140!! 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:118
subroutine, public fft_all_init(namespace)
initialize the table
Definition: fft.F90:277
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
Definition: global.F90:381
real(real64), parameter, public m_zero
Definition: global.F90:187
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:264
subroutine, public init_octopus_globals(comm)
Initialise Octopus-specific global constants and files. This routine performs no initialisation calls...
Definition: global.F90:353
real(real64), parameter, public m_one
Definition: global.F90:188
Definition: io.F90:114
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:166
subroutine, public io_end()
Definition: io.F90:265
subroutine, public messages_end()
Definition: messages.F90:277
subroutine, public messages_init(output_dir)
Definition: messages.F90:224
subroutine, public messages_obsolete_variable(namespace, name, rep)
Definition: messages.F90:1057
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
Definition: messages.F90:624
subroutine, public messages_new_line()
Definition: messages.F90:1146
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:160
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:420
type(namespace_t), public global_namespace
Definition: namespace.F90:132
subroutine, public parser_init()
Initialise the Octopus parser.
Definition: parser.F90:450
subroutine, public parser_end()
End the Octopus parser.
Definition: parser.F90:481
subroutine, public profiling_end(namespace)
Definition: profiling.F90:413
subroutine, public profiling_init(namespace)
Create profiling subdirectory.
Definition: profiling.F90:255
subroutine, public spectrum_hs_ar_from_acc(spectrum, namespace, out_file, vec, w0)
Definition: spectrum.F90:1732
subroutine, public spectrum_init(spectrum, namespace, default_energy_step, default_max_energy)
Definition: spectrum.F90:213
subroutine, public spectrum_hs_from_acc(spectrum, namespace, out_file, pol, vec, w0)
Definition: spectrum.F90:2051
subroutine, public spectrum_hs_from_current(spectrum, namespace, out_file, pol, vec, w0)
Definition: spectrum.F90:2152
subroutine, public spectrum_hs_from_mult(spectrum, namespace, out_file, pol, vec, w0)
Definition: spectrum.F90:1932
subroutine, public spectrum_hs_ar_from_mult(spectrum, namespace, out_file, vec, w0)
Definition: spectrum.F90:1839
This module defines the unit system, used for input and output.
subroutine, public unit_system_init(namespace)
int true(void)