sampledoc

Extras API

Class data structures force-field parameters

class parameters.AngletypesContainer[source]

Container for angletype

findtype(fftype_k, fftype_i, fftype_j)[source]

Find angletypes with a given set of particle types k-i-j

put(atyp)[source]

Append angletype object to this container.

Args:
atyp (angletype) correctly initialized angletype object
class parameters.BondtypesContainer[source]

Container for bondtype

put(btyp)[source]

Append bondtype object to this container.

Args:
btyp (bondtype) correctly initialized bondtype object
class parameters.DihtypesContainer[source]

Container for dihtype

findtype(fftype_k, fftype_i, fftype_j, fftype_l)[source]

Find angletypes with a given set of particle types k-i-j

put(dtyp)[source]

Append dihtype object to this container.

Args:
dtyp (dihtype) correctly initialized dihtype object
class parameters.ImptypesContainer[source]

Container for imptype

findtype(fftype_k, fftype_i, fftype_j, fftype_l)[source]

Find angletypes with a given set of particle types k-i-j

put(Imptyp)[source]

Append Imptyp object to this container.

Args:
Imptyp (imptype) correctly initialized imptype object
class parameters.LJtypesContainer[source]

Container for ljtypes

put(ljtyp)[source]

Append ljtype object to this container.

Args:
ljtyp (ljtype) correctly initialized ljtype object
class parameters.ParameterContainer(ljtypC=None, btypC=None, atypC=None, dtypC=None, imptypC=None)[source]

Container for force-field parameters

get_combmixrule()[source]

Get combmixrule

get_fudgeLJ()[source]

Get fudgeLJ

get_fudgeQQ()[source]

Get fudgeQQ

get_genpairs()[source]

Get genpairs

get_nbfunc()[source]

Get nbfunc

set_combmixrule(combmixrule)[source]

Set combmixrule

set_fudgeLJ(fudgeLJ)[source]

Set fudgeLJ

set_fudgeQQ(fudgeQQ)[source]

Set fudgeQQ

set_genpairs(genpairs)[source]

Set genpairs

set_nbfunc(nbfunc)[source]

Set nbfunc

class parameters.angletype(ptype1='blank', ptype2='blank', ptype3='blank', type='harmonic')[source]

Set of Angle parameters

get_g_indx()[source]

Return bond type index for gromacs

get_kb()[source]

Return kb type

get_lmpindx()[source]

Return bond type index for lammps

get_ptype1()[source]

Return angle ptype1

get_ptype2()[source]

Return angle ptype2

get_ptype3()[source]

Return angle ptype3

get_theta0()[source]

Return theta0 type

get_type()[source]

Return angle type

set_g_indx(g_indx)[source]

Set bond type index for gromacs

set_lmpindx(lmpindx)[source]

Set bond type index for lammps

setharmonic(theta0, kb)[source]

set Harmonic angle parameters

E = kb( theta - theta_0 )^2

Args:
theta0 (float) angle deg kb (float) force constant kcal/mol
class parameters.bondtype(ptype1='blank', ptype2='blank', type='harmonic')[source]

Set of bond parameters

get_g_indx()[source]

Return bond type index for gromacs

get_kb()[source]

Return kb type

get_lmpindx()[source]

Return bond type index for lammps

get_ptype1()[source]

Return bond ptype1

get_ptype2()[source]

Return bond ptype2

get_r0()[source]

Return r0 type

get_type()[source]

Return bond type

set_g_indx(g_indx)[source]

Set bond type index for gromacs

set_lmpindx(lmpindx)[source]

Set bond type index for lammps

setharmonic(r0, kb)[source]

set Harmonic parameters

E = kb( r - r0 )^2

Args:
r0 (float) distance kb (float) force constant
class parameters.dihtype(ptype1='blank', ptype2='blank', ptype3='blank', ptype4='blank', type='harmonic')[source]

Set of Dihedral angle parameters

get_g_indx()[source]

Return bond type index for gromacs

get_kb()[source]

Return dih kb

get_lmpindx()[source]

Return bond type index for lammps

get_mult()[source]

Return dih mult

get_oplsklist()[source]

Return list of rb constants 0-5 type

get_ptype1()[source]

Return dih ptype1

get_ptype2()[source]

Return dih ptype2

get_ptype3()[source]

Return dih ptype3

get_ptype4()[source]

Return dih ptype4

get_rbClist()[source]

Return list of rb constants 0-5 type

get_theat_s()[source]

Return dih theat_s

get_type()[source]

Return dih type

normforceconstants(dihen_norm)[source]

Divide all force constants by a value

set_g_indx(g_indx)[source]

Set bond type index for gromacs

set_lmpindx(lmpindx)[source]

Set bond type index for lammps

setharmonic(mult, kb, theat_s)[source]

set MultiHarmonic parameters dihedral_style charmm

E = kb[ 1 - cos( mult theta - theat_s ) ] gromacs E = kb[ 1 - cos( n theta - d ) ] lammps

Args:
mult (float) kb (float) force constant kcal/mol theat_s (float) angle degrees
setopls(k1, k2, k3, k4)[source]

set opls parameters

E = 1/2 k1[1+cos(theta)]+1/2 k2[1-cos(2 theta)]+1/2 k3[1+cos(3 theta)]+1/2 k4[1-cos(4 theta)]

Args:
k1 (float) force constant kcal/mol k2 (float) force constant kcal/mol k3 (float) force constant kcal/mol k4 (float) force constant kcal/mol
setrb(C0, C1, C2, C3, C4, C5)[source]

set Ryckaert-Bellemans parameters

V_{rb}(theta) = sum_n=0^5 C_n [ cos(theata - 180 )^n ]

Args:
C0 (float) force constant kcal/mol C1 (float) force constant kcal/mol C2 (float) force constant kcal/mol C3 (float) force constant kcal/mol C4 (float) force constant kcal/mol C5 (float) force constant kcal/mol
class parameters.imptype(ptype1='blank', ptype2='blank', ptype3='blank', ptype4='blank', type='harmonic')[source]

Set of improper dihedral angle parameters

get_g_indx()[source]

Return bond type index for gromacs

get_lmpindx()[source]

Return bond type index for lammps

get_pn()[source]

get Periodic Harmonic parameter pn

Return:
pn (int)
get_ptype1()[source]

Return dih ptype1

get_ptype2()[source]

Return dih ptype2

get_ptype3()[source]

Return dih ptype3

get_ptype4()[source]

Return dih ptype4

get_type()[source]

Return dih type

getimp()[source]

Get Improper parameters

Return:
e0 (float) kb (float) force constant kcal/mol
set_g_indx(g_indx)[source]

Set bond type index for gromacs

set_lmpindx(lmpindx)[source]

Set bond type index for lammps

set_pn(pn)[source]

set Periodic Harmonic parameter pn

Args:
pn (int)
setimp(e0, ke)[source]

set Harmonic parameters

E = kb ( e_{lijk} - e0 )^2

Args:
e0 (float) kb (float) force constant kcal/mol
class parameters.ljtype(ptype1='blank')[source]

Set of LJ particle parameters

get_epsilon(en_units='kcal')[source]

Return epsilon of LJ particle

get_mass()[source]

Return mass of LJ particle

get_ptype1()[source]

Return ptype1 of LJ particle

get_sigma()[source]

Return sigma of LJ particle

setmass(mass)[source]

set mass of LJ particle

Args:
mass (float) mass AMU
setparam(epsilon, sigma)[source]

set Harmonic parameters

E = 4 epsilon [ (sigma/r_ij)^12 - (sigma/r_ij)^6]

Args:
epsilon (float) energy kcal/mol sigma (float) distance
setpid(pid)[source]

set particle ID

Args:
pid (int) element number for atomic types

Class of elements with associated atomic properties

class periodictable.element(symbol, number, mass, cov_radii, vdw_radii)[source]

Gives the basic properties of the elements in the periodic table

class periodictable.periodictable[source]

Elements of the periodic table

Set covalent radi from: http://www.ccdc.cam.ac.uk/products/csd/radii/table.php4 Van der Waals radi from: http://www.ccdc.cam.ac.uk/products/csd/radii/table.php4

getelementWithMass(mass_i)[source]

Find element based on mass

getelementWithNumber(atomic_number_i)[source]

Find element based on atomic number

getelementWithSymbol(symbol_i)[source]

Find element based on atomic mass

Unit conversions

File will be read in and all units will be converted to the default units

distance - Angstroms mass - AMU energy - kcal/mol charge - electron density - AMU Angstroms^-3

Upon output default units will be converted to the appropriate units, which will be displayed in the header of the output file or given for a certian type of input file

Conversions are taken from the

CRC Handbook of Chemistry and Physics 95th see CRC_HCP_energy.pdf in doc director

units.convert_AMUA3_gcm3(den_AMUA3)[source]

Convert density from AMU Angstroms^-3 to g/cm^3

units.convert_H_eV(en_H)[source]

convert Hartree to kcalmol

units.convert_H_kJmol(en_H)[source]

convert Hartree to kJmol

units.convert_H_kcalmol(en_H)[source]

convert Hartree to kcalmol

units.convert_ang_bohr(dist_ang)[source]

Convert angstroms to bohr

units.convert_angstroms_nm(d_angstroms)[source]

convert angstroms to nm

units.convert_bohr_ang(dist_bohr)[source]

Convert bohr to angstroms

units.convert_eV_H(en_eV)[source]

convert eV to Hartree

units.convert_eV_kJmol(en_eV)[source]

convert eV to kJmol

units.convert_eV_kcalmol(en_eV)[source]

convert eV to kcalmol

units.convert_g_angle_kb(g_ka)[source]
convert gromacs harmonic angle parameter in
1/2.0 K kJ/mol/radina^2
to general angle parameter defined by lammps
kcal/mol /radina^2
units.convert_g_bond_kb(g_kb)[source]
convert gromacs harmonic bond parameter in
2.0 kJ/mol /nm /nm
to general bond parameter defined by lammps
kcal/mol /angstrom/angstrom
units.convert_gcm3_AMUA3(den_gmc3)[source]

Convert density from g/cm^3 to AMU Angstroms^-3

units.convert_kJmol_H(en_kJmol)[source]

convert kJmol to Hartree

units.convert_kJmol_eV(en_kJmol)[source]

convert kJmol to eV

units.convert_kJmol_kcalmol(en_kJmol)[source]

convert kJmol to kcalmol

units.convert_kb_g_angle(g_ka)[source]
convert to gromacs harmonic angle parameter in
1/2.0 K kJ/mol/radina^2
from general angle parameter defined by lammps
kcal/mol /radina^2
units.convert_kb_g_bond(g_kb)[source]
convert to gromacs harmonic bond parameter in
2.0 kJ/mol /nm /nm
from general bond parameter defined by lammps
kcal/mol /angstrom/angstrom
units.convert_kcalmol_H(en_kcalmol)[source]

convert kcalmol to Hartree

units.convert_kcalmol_eV(en_kcalmol)[source]

convert kcalmol to eV

units.convert_kcalmol_kJmol(en_kcalmol)[source]

convert kcalmol to kJmol

units.convert_nm_angstroms(d_nm)[source]

convert nm to angstroms

A collection of classes for useful functions. Used throughout STREAMM

class runjobs.EditFileLines(inputfile, debugFlag=False)[source]

Creates an object that can edit a file by manipulating lines Close in spirit to bash utilities like ‘sed’ and ‘awk’.

deleteLinesBetween(start, end)[source]

Remove file lines in-between specified line strings.

Args:
start (str): String in file to begin section end (str): String in file to end section
Returns:
Return list of strings (not including start and end string)
fileLines()[source]

Count lines in the input file

getLinesAfter(startnum)[source]

Return file lines after a line number. First line in file is ‘1’

Args:
startnum (int) Line number of file to start returning lines after
Returns:
Return list of strings
getLinesBetween(start, end)[source]

Get file lines in-between specified line strings.

Args:
start (str): String in file to begin section end (str): String in file to end section
Returns:
Return list of strings (not including start and end string)
insertLinesAfter(linesList, start)[source]

Insert lines after the search string

Args:
linesList (list): List of strings to insert start (str): Search string marker to insert after
Returns:
Edits the internal file object
class runjobs.FileEditorWithTags(tagValDictTpl)[source]

Creates objects capable of editing files by replacing string tags with values. The correspondence between these tags and values are specified by the dictionary objects:

‘tagValDict’ –> actual dictionary used to do string replacements ‘tagValDictTpl’ –> dictionary template used by class method to automatically

Create new file edit objects with one parameter ‘sweeping’ over a series of specified values

editFile(inFile)[source]

Take each line in file and replace tagged strings with values to be set. tagValDict is a dictionary eg

tagValDict[‘EDIT_x1’ ] = 0.232 tagValDict[‘EDIT_x2’] = 134 tagValDict[‘EDIT_x3’] = 0.456 ....

fileLines(fname)[source]

Count lines in file

getParamSweeps(tag, params)[source]

This is a factory which creates copies of this object Return a list of copied file edit objects generated by sweeping over ‘param’ values for ‘tag’ in the dictionary template.

setDict(tagValDict)[source]

Setter for new dictionary

setDictTpl(tagValDictTpl)[source]

Setter for new dictionary template

setDictTplValue(str)[source]

Setter for TEMPLATE dictionary values from assignment string eg obj.setDictTplValue(‘EDIT_x=0.30’)

NOTE: when one wants a sweep over a different parameter

setDictValue(str)[source]

Setter for dictionary values from assignment string eg obj.setDictValue(‘EDIT_x=0.30’)

show()[source]

Print the current dictionary to be used to edit a file

class runjobs.Geometry(debugFlag=False)[source]

Collection of geometric/math methods

rdist(pt1, pt2)[source]

Cartestian dist between pt1-pt2 (in list [] format)

Args:
pt1 : python list [x,y,z] pt2 : python list [x,y,z]
rdistInBounds(pt1, pt2, rcutoff)[source]

Only checks x-coord with cutoff to determine bound for Cartesian distance.

rdistInBoundsPBC(pt1, pt2, rcutoff, bsize)[source]

Only checks idir-coord with cutoff to determine bound for Cartesian distance. NOTE: TEsting

rdistPBCbox(pt1, pt2, bsize)[source]

Cartestian dist between pt1-pt2 (in list [] format) Finds minimun distance assuming points are located inside a rectangular box with sizes in bsize = [Lx, Ly, Lz]

Args:
pt1 : python list [x,y,z] pt2 : python list [x,y,z] bsize : python list [Lx, Ly, Lz]
Returns:
float value for cartestian distance in periodic box
rdistPBCboxSqr(pt1, pt2, bsize)[source]

Squrared Cartestian dist between pt1-pt2 (in list [] format) Finds minimun distance assuming points are located inside a rectangular box with sizes in bsize = [Lx, Ly, Lz]

Args:
pt1 : python list [x,y,z] pt2 : python list [x,y,z] bsize : python list [Lx, Ly, Lz]
Returns:
float value for cartestian distance squared periodic box
rdistSqr(pt1, pt2)[source]

Squared Cartestian dist between pt1-pt2 (in list [] format)

Args:
pt1 : python list [x,y,z] pt2 : python list [x,y,z]
Returns:
float value for cartestian distance
class runjobs.Histogram1D(xmin, xmax, numbins, debugFlag=False)[source]

Collection of binning/histogram methods in 1D

getBinSize()[source]

Return calculated binsize

getHistogram(data)[source]

Returns tuple with bin positions and raw binned histogram (raw counts) for all values in ‘data’, this is a driver for getBinning().

Args:
data (list) positions that will be binned given params used to construct this object
Returns:
tuple with (bin-values, raw histogram)
getHistogramNorm(data)[source]

Returns tuple with bin positions and normalized histogram for all values in ‘data’, this is a driver for getBinning().

NOTE: !!!!!!! —– The exact meaning of this norm factor needs clarification

Args:
data (list) positions that will be binned given params used to construct this object
Returns:
tuple with (bin-values, histogram)
getHistogramWeighted(data)[source]

Returns tuple with bin positions and raw binned histogram (raw counts) for all values in ‘data’, this is a driver for getBinning().

Args:
data (list) positions that will be binned given params used to construct this object
Returns:
tuple with (bin-values, raw histogram)
getHistogramWeightedAvePerBin(data)[source]

Returns tuple with bin positions and binned histogram for all values in ‘data’, this is a driver for getBinning() using the total weight per bin / (number of counts) for each bin

Args:
data (list) positions that will be binned given params used to construct this object
Returns:
tuple with (bin-values, raw histogram)
setWeights(wts)[source]

‘weights’ is the factor that bin counting is weighted by. If no weights are given then the default for all data is –> ‘1’. If weights are given is should be a list with length equal to len(data)

class runjobs.IO(fileName, debugFlag=False)[source]

Class for managing output to files/screen

floatToStr(x, num=5)[source]

Convert/format a float value to a string

Args:
x (float): value num (int): Size of format field
Returns:
string type value
flush()[source]

Flush the print buffer to the file object

prt(prtString)[source]

Write to screen and file

prtFile(prtString)[source]

Only print to file

prtdb(prtString)[source]

Print debug info if set

class runjobs.Job(repopath, exe, inputfile, script, auxFileList=[], verbose=False)[source]

Job class representing data/members needed to represent an instance of a code that will run with a single set of input parameters

changeInputFile()[source]

Use imported edit methods to change input file for run The imported method must implement an ‘editfile(file)’ method

changeScriptFile()[source]

Use imported edit methods to change script file for run The imported method must implement an ‘editfile(file)’ method

createJobRun()[source]

Create run directory and populate with appropriate files

info()[source]

Dump state of object

setInputEditor(editor)[source]

Expects an editor object that implements the appropriate ‘editFile(..)’ method

setScriptEditor(editor)[source]

Expects an editor object that implements the appropriate ‘editFile(..)’ method

class runjobs.JobStatus(verbose=False)[source]

Class containing members needed to inquire about job status once already created and populated by necessary files/scripts

isJobDone(jobdir, jobscript)[source]

Finds ‘code specific’ finish condition for a particular run. Assumes that call is made from correct run directory

This method can be redefined for other ‘finish’ criteria It must be defined as

def isJobDone(jobdir, jobscript): ... ... return isDone (True/False)

Note: This call is defaulting to a job NOT being finished if a specific isJobDone is not defined for a given applic.

isJobInQueue(jobdir, jobscript)[source]

This method will be inherited by derived classes as all jobs are assumed to be in queueing system and running jobs will have same signature

NOTE: method logic assumes that .pbs file name is the job name to look for

class runjobs.Misc(debugFlag=False)[source]

Collection of useful methods that do not clearly fit into other classes

getList(x0, dx, xmax)[source]

Generate list from x0, x0+dx,..... xmax

getTagForSorting(num)[source]

Return a string with leading 0’s so file systems etc sort is a normal way

partitionList(data, partLen)[source]

Partition list into chunks w the last chunk is the remainder of elements:

data –> eg [1.2, 3.3, 55.6, 0.34.......3.1,38.2] (odd) partLen –> eg 2 chunks = [ [1.2, 3.3], [55.6, 0.34].... [38.2] ]

recursive_glob(treeroot, pattern)[source]

Recursive glob using the os.walk command to traverse directory structure. Starting from ‘treeroot’ directory, return list of full path names for files containing ‘pattern’

Args:
treeroot (str): Directory name to start top of search pattern (str): String pattern (can use * wildcard) for search
Returns:
List of path name string
tupleOfLists2List(tup)[source]

Take a tuple of lists and convert to single list eg ([a,b],[c,d],[e,f],...) –> [a,b,c,d,e,f]