Antonio S. Torralba
Universidad Complutense  

Chemistry

BBM1

Biophysics

 

FUNDER - Documentation


Feria Only in Spanish. Sorry!

Funder

Main

Theory

Documents

Example

Download

Contact


 

C++ classes

Prev/Up

Signal - Public methods

Next



Susceptibility - PUBLIC METHODS


Susceptibility();

Default constructor. It is not allowed and will terminate the program.


Susceptibility

(int order, int size, double scale, System *name, char flag);

Allocates memory for order susceptibilities and their errors and calculates functional derivatives of the response of the system. The response must be defined internally in the system. The FD_VERBOSE flag causes the object to display information while calculating the susceptibilities, including the order of the susceptibility being calculated, the number of perturbations used at any given time, the perturbation times and any inaccuracies of the calculation. An asterisk (*) indicates the latter, which is followed by the derivative orders, the time point at which the error occurred and the accuracy achieved.

Parameters

order

Order of the approximation

size

Number of discrete-time points

scale

Time increment between discrete-time points

name

Name of the system to be used for derivative calculations

flag

FD_VERBOSE

Give extra information while calculating

FD_NO_VERBOSE

Do not give extra information


Susceptibility(char *name);

Allocates memory for the number of susceptibilities specified in the binary file name and reads the data from the file. It also allocates memory for the errors, but does not read them. Susceptibilities need not be calculated if this constructor is used. If the file is not found, cannot be opened or its format is incorrect, an error is prompted and the program is terminated.

Parameters

name

Name of the binary file to be read


~Susceptibility();

Deallocates the susceptibilities and their errors. It need not be called explicitly.


void WriteToBinaryFile(char *name, char flag);

Writes a binary file with the susceptibilities of all orders. It also stores information on their size and scale, and on the order of the approximation. Only one flag is accepted. If ambiguous, the errors will be written.

Parameters

name

Name of the binary file to be written

flag

FD_SUSCEPTIBILITY

Write susceptibilities

FD_ERRORS

Write errors


void ReadBinaryErrors(char *name);

Reads a binary file and sets the errors of the susceptibilities. The latter must have been read from another file by using Susceptibility(char *name). If the file is not found, or if its format is not correct, an error is prompted and the program terminates.

Parameters

name

Name of the binary file to be read


void RawToTextFile(char *name, char flag);

Writes the susceptibilities to a text file exactly in the same order as they are stored in the computer memory. The structure of the file is:


Column no.

Meaning

Show if flag

1

Susceptibility order

-

2

Susceptibility value

-

3

Error value

FD_WITH_ERRORS

4

o/*

FD_WITH_ERRORS


This file should be used primarily to check the correctness of the calculations. If this method is called with the flag FD_WITH_ERRORS, the last two columns are written, with the errors and the accuracy, "o" (accurate) or "*" (inaccurate). If the file cannot be created, the program terminates.

Parameters

name

Name of the text file to be written

flag

FD_WITH_ERRORS

Include the errors in the text file

FD_WITHOUT_ERRORS

Do not include the errors


void FirstToTextFile(char *name, char flag);

Writes the first susceptibility to a text file.


Column no.

Meaning

Show if flag

1

Real time

-

2

Susceptibility value

-

3

Error value

FD_WITH_ERRORS

4

o/*

FD_WITH_ERRORS


The last two columns are written only if the method is called with the flag FD_WITH_ERRORS. The last column is "o", if the specified accuracy was achieved, or "*", if not. If the file cannot be created, the program terminates.

Parameters

name

Name of the text file to be written

flag

FD_WITH_ERRORS

Include the errors in the text file

FD_WITHOUT_ERRORS

Do not include the errors


void SecondToTextFile(char *name, int 2nd_time, char flags);

Writes the second susceptibility (if any) to a text file.


Column no.

Meaning

Show if flag

1

Real time

-

2

2nd Perturbation time

-

3

Susceptibility value

-

4

Error value

FD_WITH_ERRORS

5

o/*

FD_WITH_ERRORS


The last two columns are written only if the method is called with the flag FD_WITH_ERRORS. The last column is "o", if the specified accuracy was achieved, or "*", if not. If the flag FD_GNUPLOT is on, a carriage return is written between real time blocks. This is required for plotting with the GNU application gnuplot. The plotting mode must be parametric. For example:


             set parametric
             splot 'file.dat' u 1:2:3

If the file cannot be created or there is no second susceptibility, the program terminates.

Parameters

name

Name of the text file to be written

flags

FD_WITH_ERRORS

Include the errors in the text file

FD_WITHOUT_ERRORS

Do not include the errors

FD_GNUPLOT

Use gnuplot format


void ThirdToTextFile(char *name, int 2nd_time, char flags);

Writes a section of the third susceptibility (if any) to a text file.


Column no.

Meaning

Show if flag

1

2nd Perturbation time

FD_SECOND_TIME

2/1

Real time

-

3/2

3rd Perturbation time

-

4/3

Susceptibility value

-

5/4

Error value

FD_WITH_ERRORS

6/5

o/*

FD_WITH_ERRORS


The first column is the fixed second perturbation time only if the flag FD_SECOND_TIME is on. The last two columns are written only if the method is called with the flag FD_WITH_ERRORS. The last column is "o", if the specified accuracy was achieved, or "*", if not. If the flag FD_GNUPLOT is on, a carriage return is written between real time blocks. This is required for plotting in parametric mode with the GNU application gnuplot. For example:


             set parametric
             splot 'file.dat' u 1:2:3

or

             splot 'file.dat' u 2:3:4

(if FD_SECOND_TIME is on). If the file cannot be created or there is no third susceptibility, the program terminates.

Parameters

name

Name of the text file to be written

2nd_time

Fixed time of the second perturbation

flags

FD_WITH_ERRORS

Include the errors in the text file

FD_WITHOUT_ERRORS

Do not include the errors

FD_GNUPLOT

Use gnuplot format

FD_SECOND_TIME

Write the second perturbation time


void TestSums(char *name);

Calculates the integrals of the susceptibilities and writes them to stdout and to the specified text file.

Parameters

name

A file name for writing the integrals of the susceptibilities


Response operator*(Signal &);

Calculates multiple convolutions of a signal (the input flux variation) with the susceptibilities of a system. The result is returned as a Response object, which contains all the orders of the response and their total sum. This sum is the approximation to the (variation of the) response of the system. The operation itself is commutative, but the method is written so that the signal must be left-multiplied. This method overloads "*". It needs not be called explicitly. For example:


             int tau=50;
             double dt=0.1;

                    // Create a step function 
                    //  of 50 points and time
                    //  increment of 0.1
             Signal sig(tau, dt);

                    // Read the suscetibilities 
                    //  of a system from a file
             Susceptibility sus("suscept.dat");

                    // Create a response object
             Response res;

                    // Calculate the response
                    //  The method 
                    //   Susceptibility::operator* 
                    //  is implicitly called
             res = sus*sig;       // NOTE: sig*sus is not defined

If the signal and the susceptibilities are not in the same scale or the number of discrete-time points is different, this method prompts an error and the program terminates.


int GetOrder();

Retrieves the order of the approximation, i.e. the number of susceptibilities in the object.


int GetSize();

Retrieves the number of discrete-time points of the approximation.


double GetTimeInc();

Retrieves the time increment used for discretizing the signals.



Prev/Up

Next

C++ classes

Signal
- Public methods

 

Valid HTML 4.01!

Copyright © 2003-2013 Antonio Sánchez Torralba
Last modified:
Monday, 04-Mar-2013 11:58:25 CET

© 2013 Antonio Sánchez Torralba