CDTK.analyze module
- CDTK.analyze.angle(optionsString, pValue, traj, i, val)[source]
Does perform operations related to angles. If no options given it will not work.
Valid options are as follows:
- -1 <a>, -2 <b>, -3 <b> given: calculate the angle between the the sites. A site can be defined as an
atom by its number or as a center of mass by giving m and a comma separated list of atoms, i.e., -1 m,0,3,4. Optionally, the third argument can also be a space fixed axis given as -3 s,0,0,1 and then the angle between the vector given by the first two sites and that axis is calculated.
- -p <a> given: this option projects it onto a certain range. Valid are below a value (<,A) or above a value
(>,A) or fully bound ranges (A,<,B) - also several ranges can be given as A,<,B,C,<,D, .. . If within the given value the function returns 1.0, else the given pValue or NaN if -v is given.
-v given: Requests NaN values for projection. -n given: Normalization for angle projections required.
Input: optionsString — Input flags given pValue — value used for projections traj — trajectory object to analyze i — time step given as integer val — value from previous operation
Output: values obtained from the position operation combined with old value.
- CDTK.analyze.bootstrap(correl, doHis, func=<function nanmean>, nbootstrap=1000, nozero=False)[source]
This function performs bootstraping to obtain meaningful variances for the calculated quantities. Either a histogram or a certain quantity (i.e. mean, std) given as a function.
Input: correl — an array of values to perform bootstrapping on; NaN values are ignored doHis — either an integer number that defines the number of bins to be used,
0 for integer steps (in both cases upper and lower bounds are chosen as highest and lowest value), or three numbers defining lower bound, upper bound as well as step or a valid command for numpy.histogram
func — function defining the value to be calculated (i.e. mean, std, etc.) nbootstrap — number of bootstrapping steps nzero — if zero values should be omitted for bin calculation
Output: mean — mean values of the quantity requested (i.e. mean or histogram) sigma — standard errors for the quantities (i.e. standard deviations of the mean or bin value) bins — definition of bins if histogramming is used ntraj — number of trajectories used for each value; i.e. number of values not NaN or Inf
- CDTK.analyze.charge(optionsString, pValue, traj, i, val)[source]
Does perform operations related to charges. If no options given it will return the charge of the system.
Valid options are as follows: -t given: give back list of partial charges. -n <a> given: if -t is given, only consider the atoms given here as a list -p <a>: project the calculated (partial) charge rounded to an integer to the given
value. Gives 1.0 for matches to the given value, or pValue if not.
Input: optionsString — Input flags given pValue — value used for projections traj — trajectory object to analyze i — time step given as integer val — value from previous operation
Output: values obtained from the charge operation combined with old value.
- CDTK.analyze.correlation_function(commands, dirs, nbootstrap=1000, step=None, form='time', nozero=False)[source]
Function to calculate a set of correlation functions or expectation values given by the command string and for the trajectories given in the dirs folder. Standard errors of the calculated quantities are calculated using bootstrapping.
Input: commands — dictonary of commands as tuples. They are essentially the input flags
for the main program with the following structure: (opA, opB, projection, red, his, output) opA and opB define the operations for <A(0) B(t)> red defines how to combined A and B, i.e. multiplication, dot product, … his defines if histogram should be produced and number of bins (0=automatic) output defines output file
dirs — list of directories containing the pickled trajectory objects nbootstrap — number of bootstrap resamplings to be performed step — Only give results for one timestep. -1 is last, 0 is first, None is all. form — If given, prints results in an alternative formats. Possible values:
“time”: standard format with one line per time and all values along the columns. “values” one line per value and time along the columns. “single” with values first and empty line and then std errors.
nozero — If true ignore zero values in bin calculation.
Output: The data is written to files with names given in the command. The first column is always time, and then there is a column for each value directly followed by its standard error.
- CDTK.analyze.doParse(filename, directory, parser)[source]
Parse a file of commands. For documentation of commands see documentation for input flags of the whole program. The commands need to be given in the same way. Different commands can be given separated by lines starting with #.
Input: filename — Name of the file to be parsed as string directory — Directory for input/output parser — Set up parser to interpret commands
Output: commands — dictonary of commands
- CDTK.analyze.getBins(doHis, nvalues, correl)[source]
This function creates a set of bins for histogramming the data calculated.
Input: TODO — doHis — either an integer number that defines the number of bins to be used,
0 for integer steps (in both cases upper and lower bounds are chosen as highest and lowest value), or three numbers defining lower bound, upper bound as well as step or a valid command for numpy.histogram
nvalues — number of values calculated correl — correlation function values calculated
Output: bins — array holding the definition of the bins
- CDTK.analyze.getParser()[source]
Function defining the input options parser.
Output: parser — option parser object.
- CDTK.analyze.kinetic(optionsString, pValue, traj, i, val)[source]
Does perform operations related to kinetic energies. If no options given it will return the full kinetic energy of the system.
Valid options are as follows: -n <a> given: Comma separated list of atoms to be taken into account. -s given: if given, the kinetic energy for each atom is calculated separatly and returned as an array -k <a> given: The remaining KER (TODO what is actually done here?) is calculated for each atom
(currently -n is ignored by this option, but should be implemented); implies -s.
Input: optionsString — Input flags given pValue — value used for projections traj — trajectory object to analyze i — time step given as integer val — value from previous operation
Output: values obtained from the kinetic operation combined with old value.
- CDTK.analyze.observable(obsString, projValue, traj, i)[source]
Function that calculates a quantity as defined in the ‘obsString’ from a trajectory at time-step ‘i’.
Input: obsString — String defining the quantity to be calculated. projValue — Value used for any projections traj — Trajectory data i — time-step as integer
- CDTK.analyze.operate(opString, optionsString, projValue, traj, i, val)[source]
Perform an operation to obtain a quantity from a trajectory at time step i. Results are combined with results from previous operations given in ‘val’. The operation is given by the ‘opString’ with options given by the ‘optionsString’.
Input: opString — string defining the operation to be performed.
- Valid: ‘pos’: position related things
‘vel’: velocity related things ‘kin’: kinetic energy related things ‘cha’: charge related things ‘spec’: auger, flouressence or photo-electron related things ‘state’ : state in surface hopping related ‘id’ : idendity
optionsString — string with additional options given to the operation projValue — projection value traj — Trajectory data i — time-step as integer val — value obtained from previous operations
Return: quantity obtained by this operation combined with given older value.
- CDTK.analyze.outputBins(fout, form, bins)[source]
Funtion to write bin definition if histogram was requested
Input: fout — output file handle form — If given, prints results in an alternative formats. Possible values:
“time”: standard format with one line per time and all values along the columns. “values” one line per value and time along the columns. “single” with values first and empty line and then std errors.
bins — Bin edges if histograms were requested.
Output: The bin data is written.
- CDTK.analyze.outputData(m, commands, nbootstrap, step, form, bins, time, mean, sigma, ntraj)[source]
Funtion to write data to files.
Input: m — index of current command. commands — dictonary of commands as tuples. They are essentially the input flags
for the main program with the following structure: (opA, opB, projection, red, his, output) opA and opB define the operations for <A(0) B(t)> red defines how to combined A and B, i.e. multiplication, dot product, … his defines if histogram should be produced and number of bins (0=automatic) output defines output file
nbootstrap — number of bootstrap resamplings to be performed step — Only give results for one timestep. -1 is last, 0 is first, None is all. form — If given, prints results in an alternative formats. Possible values:
“time”: standard format with one line per time and all values along the columns. “values” one line per value and time along the columns. “single” with values first and empty line and then std errors.
bins — Bin edges if histograms were requested. time — array giving the timestamps. mean — Mean value of the requested data as calculated by the bootstrapping. sigma — Standard deviations of the mean of the requested data as calculated by the bootstrapping. ntraj — array giving the number of trajectories.
Output: The data is written to files with names given in the command. The first column is always time, and then there is a column for each value directly followed by its standard error.
- CDTK.analyze.outputNtraj(fout, time, ntraj)[source]
Funtion to write the number of trajectories contributing.
Input: fout — output file handle. time — array giving the timestamps. ntraj — array giving the number of trajectories.
Output: The number of trajectories are written.
- CDTK.analyze.position(optionsString, pValue, traj, i, val)[source]
Does perform operations related to positions. If no options given it will return None.
Valid options are as follows:
- -1 <a>, -2 <b> given: calculate the distance between the two sites. A site can be defined as an
atom by its number or as a center of mass by giving m and a comma separated list of atoms, i.e., -1 m,0,3,4.
- -x <a> given: coordinate value of a given coordinates, e.g., -x 0, gives the x coordinate of the
first atom, or -x 0,3,7 gives the x coordinate of the first and second atom and the y coordinate of the third atom. Alternatively, also the 3D coordinate of a center of mass can be obtained by giving m and a comma separated list of atoms. Single atoms can be obtained as center of mass of that atom, i.e., -x m,1.
- -p <a> given: if a single value is calculated (i.e. a distance or single coordinate) this option
projects it onto a certain range. Valid are fully bound ranges (A,<,B), or below a value (<,A) or above a value (>,A). If within the given value the function returns 1.0, else the given pValue.
- -d <a> given: checks whether a given site is dissociated, i.e., if its distance to all other atoms is
larger than a certain number. The number to compare is given first and then the atom or site to look at is given, e.g., -d 7.0,2 or -d 7.0,m,0,3,4.
Input: optionsString — Input flags given pValue — value used for projections traj — trajectory object to analyze i — time step given as integer val — value from previous operation
Output: values obtained from the position operation combined with old value.
- CDTK.analyze.red(c0, c, redString)[source]
This function calculates the correlation between two values at time 0 and t. The correlation might be calculated for a single value by multiplication, for a set of values in an array as an elemnt-wise multiplication (i.e. [c0[0]*c[0], c0[1]*c[1], …) or for vector-valued quantities by a dot product. Other options might be needed here.
Input: c0 — value or values at time 0 c — value or values at time t redString — definition on how to combine the values.
‘dot’ does a dot-product of both values ‘mult’ does a multiplication; element-wise (i.e. [c0[0]*c[0], c0[1]*c[1], …)
if arrays are given.
Output: The connected value or values.
- CDTK.analyze.spec(optionsString, pValue, traj, i, val)[source]
Does perform operations related to electronic spectra (Auger, Photoionisation, Flouresence, …). TODO check if this really works!!
Valid options are as follows: -a: Auger spectrum -i: Photoionization spectrum -f: Flouresence spectrum
Input: optionsString — Input flags given pValue — value used for projections traj — trajectory object to analyze i — time step given as integer val — value from previous operation
Output: values obtained from the spec operation combined with old value.
- CDTK.analyze.state(optionsString, pValue, traj, i, val)[source]
Does perform operations related to the electronic state in surface hopping.
Valid options are as follows: -p <a>: project results only for given state.
Input: optionsString — Input flags given pValue — value used for projections traj — trajectory object to analyze i — time step given as integer val — value from previous operation
Output: values obtained from the state operation combined with old value.
- CDTK.analyze.velocity(optionsString, pValue, traj, i, val)[source]
Does perform operations related to velocities. If no options given it will return None. Note: adapted from RPMD branch.
Valid options are as follows:
- -x <a> given: velocity value of a given coordinates, e.g., -x 0, gives the x velocity of the
first atom, or -x 0,3,7 gives the x velocity of the first and second atom and the y velocity of the third atom. Alternatively, also the 3D velocity of a center of mass can be obtained by giving m and a comma separated list of atoms. Single atoms can be obtained as center of mass of that atom, i.e., -x m,1.
Input: optionsString — Input flags given pValue — value used for projections traj — trajectory object to analyze i — time step given as integer val — value from previous operation
Output: values obtained from the velocity operation combined with old value.