DF: Distribution Function

DF is a base class representing a single Distribution Function (e.g. RDF, bond length distribution, angle distribution, intermolecular potential, angle-bending potential, correction to potential, etc.) The class contains properties and methods, which are common for every function, however, some methods are redefined when necessary to keep function specificity:
Properties:
Name
Name of the DF
FullName
Completely resolved name of the DF, including type and kind of the DF
x,y
numpy arrays storing tabulated values of the argument and the function
Min,Max
Range of distance/angle values where the function is defined
Type
Type of the function: NB, B (pairwise bond), A (angle-bond)
Kind
Kind of the function: RDF, Potential
Npoints
Number of points in a table defining the function
Resol
Resolution of the table defining the function
AtomTypes
(NB only) Names of the atom/bead types involved in the interaction represented by the function
BondNumber
(B/A only) Number of the bond represented by the function.
MolTypeName
(B/A only) Name of the Molecular type the bond function refers to.
AtomGroups
(B/A only) List of atom pairs/triplets involved in the bond

Methods:
Write()
Write the function into a file-stream
Plot()
Plot the function
Save()
Save the function in a tabulated for to a text file.
Average()
Make a new DF which is average of given list of DFs
ExtendRange()
Extend range of the DF
ExtendTail()
Extend the tail range of NB distribution function in to RcutNB
CutTail()
Cut the tail of NB RDF/potential
IsSimilar()
Check if the DF is similar to given one, based on its Type, Kind, AtomTypes, MolecularType and Bond number
ChangeResolution()
Change resolution of the potential. The new points will have an average value between closest neighbors
Distance()
Calculate the distance between this and the given DF
Examples:
import DF - import the class
RDFref=MagicTools.ReadRDF('dmpc.400ns.v2.rdf') - read a set of RDFs, which is and object of the class DFset, containing a number of DF-objects.
rdfNB=RDFref.DFs[0] - Access the first function of the set. It is an object of class DF representing a non-bonded RDF.
rdfNB.g - Access the table of the function
rdfNB.Plot() - Plot the function
rdfNB.AtomTypes - See what bead/atom types are involved in the function.
rdfB=RDFref.DFs_B[0] - Access the first pairwise bond related function of the set (they are indexed from 0)
rdfB.MolTypeName - See the name of the molecular type the bond function belongs to.