<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_ctf_8cpp">
<title>/Users/bernard/b20/bsoft/src/util/ctf.cpp File Reference</title>
<indexterm><primary>/Users/bernard/b20/bsoft/src/util/ctf.cpp</primary></indexterm>
<para>

<para>Functions to manage CTF (contrast transfer function) parameters. </para>
 
</para>
<programlisting>#include &quot;ctf.h&quot;
#include &quot;utilities.h&quot;
</programlisting><simplesect>
    <title>Functions    </title>
        <itemizedlist>
            <listitem><para>double <link linkend="_ctf_8cpp_1ada4dde849c16659751225aa1938a6a16">electron_wavelength</link> (double volt)</para>

<para>Calculates the wavelength in angstrom from the acceleration voltage. </para>
</listitem>
            <listitem><para>double <link linkend="_ctf_8cpp_1a6b00977a694b50a8ae29dff20d10c135">beta2</link> (double volt)</para>

<para>Calculates the square of the relative electron velocity. </para>
</listitem>
            <listitem><para>double <link linkend="_ctf_8cpp_1a58af9b95ad67fce3014a21a4248db61b">beta</link> (double volt)</para>

<para>Calculates the relative electron velocity. </para>
</listitem>
            <listitem><para>vector&lt; double &gt; <link linkend="_ctf_8cpp_1a94c9256d5dfed8a70aa07455f849298f">C_curve</link> (long n, double freq_step)</para>

<para>Calculates the carbon scattering curve. </para>
</listitem>
        </itemizedlist>
</simplesect>
<simplesect>
    <title>Variables    </title>
        <itemizedlist>
            <listitem><para>int <link linkend="_ctf_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453">verbose</link></para>
</listitem>
        </itemizedlist>
</simplesect>
<section>
<title>Detailed Description</title>

<para>Functions to manage CTF (contrast transfer function) parameters. </para>

<para><formalpara><title>Author: </title>

<para>Bernard Heymann </para>
</formalpara>
<formalpara><title>Date: </title>

<para>Created: 20000426 </para>

<para>Modified: 20190703 </para>
</formalpara>
</para>
</section>
<section>
<title>Function Documentation</title>
<anchor xml:id="_ctf_8cpp_1a58af9b95ad67fce3014a21a4248db61b"/>    <section>
    <title>beta()</title>
<indexterm><primary>beta</primary><secondary>ctf.cpp</secondary></indexterm>
<indexterm><primary>ctf.cpp</primary><secondary>beta</secondary></indexterm>
<para><computeroutput>double beta (double volt)</computeroutput></para><para>

<para>Calculates the relative electron velocity. </para>
</para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>volt</entry>
                                <entry>
<para>acceleration voltage. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>double relative electron velocity. <literallayout><computeroutput>                          1
beta = sqrt(1 - ---------------------)
                (1+e*volt/(me*c^2))^2
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 447 of file ctf.cpp.</para>
    </section><anchor xml:id="_ctf_8cpp_1a6b00977a694b50a8ae29dff20d10c135"/>    <section>
    <title>beta2()</title>
<indexterm><primary>beta2</primary><secondary>ctf.cpp</secondary></indexterm>
<indexterm><primary>ctf.cpp</primary><secondary>beta2</secondary></indexterm>
<para><computeroutput>double beta2 (double volt)</computeroutput></para><para>

<para>Calculates the square of the relative electron velocity. </para>
</para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>volt</entry>
                                <entry>
<para>acceleration voltage. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>double square of the relative electron velocity. <literallayout><computeroutput>                     1
beta2 = 1 - ---------------------
            (1+e*volt/(me*c^2))^2
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 426 of file ctf.cpp.</para>
    </section><anchor xml:id="_ctf_8cpp_1a94c9256d5dfed8a70aa07455f849298f"/>    <section>
    <title>C_curve()</title>
<indexterm><primary>C_curve</primary><secondary>ctf.cpp</secondary></indexterm>
<indexterm><primary>ctf.cpp</primary><secondary>C_curve</secondary></indexterm>
<para><computeroutput>vector&lt;double&gt; C_curve (long n, double freq_step)</computeroutput></para><para>

<para>Calculates the carbon scattering curve. </para>
</para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>n</entry>
                                <entry>
<para>length of curve. </para>
</entry>
                            </row>
                            <row>
                                <entry>freq_step</entry>
                                <entry>
<para>frequency step size. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>vector&lt;double&gt; array with C-curve. <literallayout><computeroutput>The curve is based on the sum of five Gaussians.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 462 of file ctf.cpp.</para>
    </section><anchor xml:id="_ctf_8cpp_1ada4dde849c16659751225aa1938a6a16"/>    <section>
    <title>electron_wavelength()</title>
<indexterm><primary>electron_wavelength</primary><secondary>ctf.cpp</secondary></indexterm>
<indexterm><primary>ctf.cpp</primary><secondary>electron_wavelength</secondary></indexterm>
<para><computeroutput>double electron_wavelength (double volt)</computeroutput></para><para>

<para>Calculates the wavelength in angstrom from the acceleration voltage. </para>
</para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>volt</entry>
                                <entry>
<para>acceleration voltage. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>double wavelength in angstrom, &lt;0 on error. <literallayout><computeroutput>                   12.26
lambda = ----------------------------
         sqrt(volt*(1+volt*0.9788e-6)
                       1e10 * h
lambda = ---------------------------------------
         sqrt(2*me*e*volt*(1+e*volt/(2*me*c^2)))
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 403 of file ctf.cpp.</para>
</section>
</section>
<section>
<title>Variable Documentation</title>
<anchor xml:id="_ctf_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453"/>    <section>
    <title>verbose</title>
<indexterm><primary>verbose</primary><secondary>ctf.cpp</secondary></indexterm>
<indexterm><primary>ctf.cpp</primary><secondary>verbose</secondary></indexterm>
<para><computeroutput>int verbose</computeroutput></para></section>
</section>
</section>
