ForceBalance API
1.1
Automated optimization of force fields and empirical potentials
|
Classes | |
class | Pickler_LP |
A subclass of the python Pickler that implements pickling of _ElementTree types. More... | |
class | Unpickler_LP |
A subclass of the python Unpickler that implements unpickling of _ElementTree types. More... | |
Functions | |
def | pvec1d |
Printout of a 1-D vector. More... | |
def | pmat2d |
Printout of a 2-D matrix. More... | |
def | encode |
def | segments |
def | commadash |
def | uncommadash |
def | printcool |
Cool-looking printout for slick formatting of output. More... | |
def | printcool_dictionary |
See documentation for printcool; this is a nice way to print out keys/values in a dictionary. More... | |
def | isint |
ONLY matches integers! If you have a decimal point? None shall pass! More... | |
def | isfloat |
Matches ANY number; it can be a decimal, scientific notation, what have you CAUTION - this will also match an integer. More... | |
def | isdecimal |
Matches things with a decimal only; see isint and isfloat. More... | |
def | floatornan |
Returns a big number if we encounter NaN. More... | |
def | col |
Given any list, array, or matrix, return a 1-column matrix. More... | |
def | row |
Given any list, array, or matrix, return a 1-row matrix. More... | |
def | flat |
Given any list, array, or matrix, return a single-index array. More... | |
def | orthogonalize |
Given two vectors vec1 and vec2, project out the component of vec1 that is along the vec2-direction. More... | |
def | invert_svd |
Invert a matrix using singular value decomposition. More... | |
def | get_least_squares |
def | statisticalInefficiency |
Compute the (cross) statistical inefficiency of (two) timeseries. More... | |
def | lp_dump |
Use this instead of pickle.dump for pickling anything that contains _ElementTree types. More... | |
def | lp_load |
Use this instead of pickle.load for unpickling anything that contains _ElementTree types. More... | |
def | getWorkQueue |
def | getWQIds |
def | createWorkQueue |
def | destroyWorkQueue |
def | queue_up |
Submit a job to the Work Queue. More... | |
def | queue_up_src_dest |
Submit a job to the Work Queue. More... | |
def | wq_wait1 |
This function waits ten seconds to see if a task in the Work Queue has finished. More... | |
def | wq_wait |
This function waits until the work queue is completely empty. More... | |
def | GoInto |
def | allsplit |
def | Leave |
def | MissingFileInspection |
def | LinkFile |
def | CopyFile |
def | link_dir_contents |
def | remove_if_exists |
Remove the file if it exists (doesn't return an error). More... | |
def | which |
def | warn_press_key |
def | warn_once |
Prints a warning but will only do so once in a given run. More... | |
def | concurrent_map |
Similar to the bultin function map(). More... | |
def | multiopen |
This function be given any of several variable types (single file name, file object, or list of lines, or a list of the above) and give a list of files: More... | |
Variables | |
tuple | logger = getLogger(__name__) |
float | kb = 0.0083144100163 |
Boltzmann constant. More... | |
float | eqcgmx = 2625.5002 |
Q-Chem to GMX unit conversion for energy. More... | |
float | fqcgmx = -49621.9 |
Q-Chem to GMX unit conversion for force. More... | |
float | bohrang = 0.529177249 |
One bohr equals this many angstroms. More... | |
string | XMLFILE = 'x' |
Pickle uses 'flags' to pickle and unpickle different variable types. More... | |
WORK_QUEUE = None | |
tuple | WQIDS = defaultdict(list) |
list | specific_lst |
tuple | specific_dct = dict(list(itertools.chain(*[[(j,i[1]) for j in i[0]] for i in specific_lst]))) |
def nifty.allsplit | ( | Dir | ) |
def nifty.col | ( | vec | ) |
def nifty.commadash | ( | l | ) |
def nifty.concurrent_map | ( | func, | |
data | |||
) |
def nifty.CopyFile | ( | src, | |
dest | |||
) |
def nifty.destroyWorkQueue | ( | ) |
def nifty.encode | ( | l | ) |
def nifty.flat | ( | vec | ) |
def nifty.floatornan | ( | word | ) |
def nifty.get_least_squares | ( | x, | |
y, | |||
w = None , |
|||
thresh = 1e-12 |
|||
) |
[in] | X | (2-D array) An array of X-values (see above) |
[in] | Y | (array) An array of Y-values (only used in getting the least squares coefficients) |
[in] | w | (array) An array of weights, hopefully normalized to one. |
[out] | Beta | The least-squares coefficients |
[out] | Hat | The hat matrix that takes linear combinations of data y-values to give fitted y-values (weights) |
[out] | yfit | The fitted y-values |
[out] | MPPI | The Moore-Penrose pseudoinverse (multiply by Y to get least-squares coefficients, multiply by dY/dk to get derivatives of least-squares coefficients) |
Definition at line 358 of file nifty.py.
def nifty.getWQIds | ( | ) |
def nifty.invert_svd | ( | X, | |
thresh = 1e-12 |
|||
) |
def nifty.isdecimal | ( | word | ) |
Matches things with a decimal only; see isint and isfloat.
[in] | word | String (for instance, '123', '153.0', '2.', '-354') |
Definition at line 243 of file nifty.py.
def nifty.isfloat | ( | word | ) |
Matches ANY number; it can be a decimal, scientific notation, what have you CAUTION - this will also match an integer.
[in] | word | String (for instance, '123', '153.0', '2.', '-354') |
Definition at line 233 of file nifty.py.
def nifty.isint | ( | word | ) |
ONLY matches integers! If you have a decimal point? None shall pass!
[in] | word | String (for instance, '123', '153.0', '2.', '-354') |
Definition at line 222 of file nifty.py.
def nifty.LinkFile | ( | src, | |
dest | |||
) |
def nifty.lp_dump | ( | obj, | |
file, | |||
protocol = None |
|||
) |
def nifty.lp_load | ( | file | ) |
def nifty.MissingFileInspection | ( | fnm | ) |
def nifty.multiopen | ( | arg | ) |
This function be given any of several variable types (single file name, file object, or list of lines, or a list of the above) and give a list of files:
[file1, file2, file3 ... ]
each of which can then be iterated over:
[[file1_line1, file1_line2 ... ], [file2_line1, file2_line2 ... ]]
def nifty.orthogonalize | ( | vec1, | |
vec2 | |||
) |
Given two vectors vec1 and vec2, project out the component of vec1 that is along the vec2-direction.
[in] | vec1 | The projectee (i.e. output is some modified version of vec1) |
[in] | vec2 | The projector (component subtracted out from vec1 is parallel to this) |
def nifty.pmat2d | ( | mat2d, | |
precision = 1 , |
|||
loglevel = INFO |
|||
) |
def nifty.printcool | ( | text, | |
sym = "#" , |
|||
bold = False , |
|||
color = 2 , |
|||
ansi = None , |
|||
bottom = '-' , |
|||
minwidth = 50 , |
|||
center = True |
|||
) |
Cool-looking printout for slick formatting of output.
[in] | text | The string that the printout is based upon. This function will print out the string, ANSI-colored and enclosed in the symbol for example: ################# ### I am cool ### ################# |
[in] | sym | The surrounding symbol |
[in] | bold | Whether to use bold print |
[in] | color | The ANSI color: 1 red 2 green 3 yellow 4 blue 5 magenta 6 cyan 7 white |
[in] | bottom | The symbol for the bottom bar |
[in] | minwidth | The minimum width for the box, if the text is very short then we insert the appropriate number of padding spaces |
Definition at line 155 of file nifty.py.
def nifty.printcool_dictionary | ( | Dict, | |
title = "General options" , |
|||
bold = False , |
|||
color = 2 , |
|||
keywidth = 25 , |
|||
topwidth = 50 , |
|||
center = True , |
|||
leftpad = 0 |
|||
) |
See documentation for printcool; this is a nice way to print out keys/values in a dictionary.
The keys in the dictionary are sorted before printing out.
[in] | dict | The dictionary to be printed |
[in] | title | The title of the printout |
Definition at line 198 of file nifty.py.
def nifty.pvec1d | ( | vec1d, | |
precision = 1 , |
|||
loglevel = INFO |
|||
) |
def nifty.queue_up | ( | wq, | |
command, | |||
input_files, | |||
output_files, | |||
tgt = None , |
|||
verbose = True |
|||
) |
Submit a job to the Work Queue.
[in] | wq | (Work Queue Object) |
[in] | command | (string) The command to run on the remote worker. |
[in] | input_files | (list of files) A list of locations of the input files. |
[in] | output_files | (list of files) A list of locations of the output files. |
Definition at line 605 of file nifty.py.
def nifty.queue_up_src_dest | ( | wq, | |
command, | |||
input_files, | |||
output_files, | |||
tgt = None , |
|||
verbose = True |
|||
) |
Submit a job to the Work Queue.
This function is a bit fancier in that we can explicitly specify where the input files come from, and where the output files go to.
[in] | wq | (Work Queue Object) |
[in] | command | (string) The command to run on the remote worker. |
[in] | input_files | (list of 2-tuples) A list of local and remote locations of the input files. |
[in] | output_files | (list of 2-tuples) A list of local and remote locations of the output files. |
def nifty.remove_if_exists | ( | fnm | ) |
def nifty.row | ( | vec | ) |
def nifty.segments | ( | e | ) |
def nifty.statisticalInefficiency | ( | A_n, | |
B_n = None , |
|||
fast = False , |
|||
mintime = 3 , |
|||
warn = True |
|||
) |
Compute the (cross) statistical inefficiency of (two) timeseries.
Notes The same timeseries can be used for both A_n and B_n to get the autocorrelation statistical inefficiency. The fast method described in Ref [1] is used to compute g.
References [1] J. D. Chodera, W. C. Swope, J. W. Pitera, C. Seok, and K. A. Dill. Use of the weighted histogram analysis method for the analysis of simulated and parallel tempering simulations. JCTC 3(1):26-41, 2007.
Examples
Compute statistical inefficiency of timeseries data with known correlation time.
import timeseries A_n = timeseries.generateCorrelatedTimeseries(N=100000, tau=5.0) g = statisticalInefficiency(A_n, fast=True)
@param[in] A_n (required, numpy array) - A_n[n] is nth value of timeseries A. Length is deduced from vector. @param[in] B_n (optional, numpy array) - B_n[n] is nth value of timeseries B. Length is deduced from vector. If supplied, the cross-correlation of timeseries A and B will be estimated instead of the autocorrelation of timeseries A. @param[in] fast (optional, boolean) - if True, will use faster (but less accurate) method to estimate correlation time, described in Ref. [1] (default: False) @param[in] mintime (optional, int) - minimum amount of correlation function to compute (default: 3) The algorithm terminates after computing the correlation time out to mintime when the correlation function furst goes negative. Note that this time may need to be increased if there is a strong initial negative peak in the correlation function. @return g The estimated statistical inefficiency (equal to 1 + 2 tau, where tau is the correlation time). We enforce g >= 1.0.
def nifty.uncommadash | ( | s | ) |
def nifty.warn_once | ( | warning, | |
warnhash = None |
|||
) |
def nifty.warn_press_key | ( | warning, | |
timeout = 10 |
|||
) |
def nifty.which | ( | fnm | ) |
def nifty.wq_wait | ( | wq, | |
wait_time = 10 , |
|||
wait_intvl = 10 , |
|||
print_time = 60 , |
|||
verbose = False |
|||
) |
def nifty.wq_wait1 | ( | wq, | |
wait_time = 10 , |
|||
wait_intvl = 1 , |
|||
print_time = 60 , |
|||
verbose = False |
|||
) |
float nifty.bohrang = 0.529177249 |
float nifty.eqcgmx = 2625.5002 |
float nifty.fqcgmx = -49621.9 |
tuple nifty.specific_dct = dict(list(itertools.chain(*[[(j,i[1]) for j in i[0]] for i in specific_lst]))) |
list nifty.specific_lst |