ffparam.script_core package
Submodules
ffparam.script_core.CharmmInputWriter module
ffparam.script_core.CoordinateWriter module
- class ffparam.script_core.CoordinateWriter.CoordinateWriter(coor, filout=None, natom=None, etype=None, e_val=None, resi=None)
Bases:
object
- writecrd()
- writexyz()
- ffparam.script_core.CoordinateWriter.crdformat(coor, topomap)
- ffparam.script_core.CoordinateWriter.crdline(coorobj, dummy=None, resname='RESN', segname='SEGN', resnr=1, returntype='crd')
Takes a list object in the form of [atomnr,atomname,x,y,z] and return a str with crd format. If residue/segment names and the residue number are not specified, the defaults “RESN, SEGN and 1” are written. You can pass a dictionary object with keys {resnam:RESN,segnam:SEGN,resnr:1} or you can pass named arguments: resnam=’RESN’,segnam=’SEGN’,resnr=1
ffparam.script_core.EleInfo module
- ffparam.script_core.EleInfo.eleinfo()
ffparam.script_core.ffpmol module
- class ffparam.script_core.ffpmol.FFPMol(workdir, resilist=[], strfiles=[], nand=[], smileslist=[], toppar=None, coorpath=None, extensions=['mol2'], tag=None, ff='')
Bases:
object
Wrapper class for the topology that allows the user to read/generate topology and coordinates for molecule(s).
Attributes: workdir : Main working directory where a folder with the residue name will be generated if doesn’t exist.
If workdir/residue_name folder exists, the existing coordinates and str files will be read from this directory.
resilist : Residue name(s) strfiles : The file(s) that contains the topology of the molecule(s) toppars : The path to the file containing the parameter files coorpath : Path to a folder where coordinates should be read. If a path is given, a coordinate file is searched within with the pattern ‘residuename’.extensions
The coordinates read from this directory are set as initial coordinates when nothing is found in the workdir+residue_name folder
extensions : List of extensions for coordinate files, default is mol2
- generate_init(exepath=None, sele='all', extra='', rules=None, par=None)
Generates a topology file and/or a coordinate file with the residue name.
if sele is all , then all the molecules in the resilist are checked for the existence of topology and coordinates in the following order: if smiles list is given, both mol2, str and inicoor files are generated. If multiple molecules are given then GenFF call for str is done with all the molecules together and the joint str file is written to the workdir. if smiles list is empty then given strfiles are searched for the topology, if topology not found then it is generated if any coordinate file is found either in the given coorpath or the workdir/residue path.
- readcoor(topos, sele=[], step='init')
- readstr(sele=[])
ffparam.script_core.ffp_cgenff module
ffparam.script_core.GaussInputWriter module
- class ffparam.script_core.GaussInputWriter.GaussInputWriter(resn='resn', rescharge=0, multiplicity=1, qmtop=None)
Bases:
object
- Gaudihcmnt(dihatomnam)
- Gaugeocmnt()
- Gautop(qmtop=None)
- Gauwatbot()
- Gauwatcmnt(tat, ang)
- Gauwatscanbot()
- creatediheinp(filout, coords, dihatomnam, dihatomnum, dihrange)
- creategeominp(filout, coords)
- createwatbsseinp(filout, coords)
- createwatinp(dafile, coords, work_dir=None)
- dectop(nproc, mem, lot, basis, keyword)
ffparam.script_core.GaussParser module
ffparam.script_core.MMWriter module
- class ffparam.script_core.MMWriter.CharmmWriter(atomnrmap, _dummy=None, dihedraldata=None, dipoledata=None, icdata=None, geomdata=None, waterdata=None)
Bases:
object
Functions that would take the data from QM Parser and write the charmm inputs. This class must be initialized with an atom name - number dictionary. If the passed dictionary values are interegers, then it assumes user has provided the correct numbering scheme. If the full atomnrmap is passed then this class assumes the order of the values are like below (also the default format from QMParser) atname1:[original,nolpd,nod]
- accepteddata = ['dihedraldata', 'dipoledata', 'icdata', 'geomdata', 'waterdata']
- writemminputs()
- writequick(icdata)
ffparam.script_core.Psi4InputWriter module
- class ffparam.script_core.Psi4InputWriter.Psi4Writer(topo, qmtop=None, outpath=None, outname=None, resn=None, rescharge=None, multiplicity=1, qmaction=None, cmd=False, **kwargs)
Bases:
object
This class only writes the inputs for Psi4 calculations, does not run them.
- There are two ways to write the files:
During initialization by setting the qmaction list which calls Psi4Writer.run for each QM action within the qmaction list automatically.
After initialization via Psi4Writer.run function that accepts a single QM action.
The following variables are set by default, it they need to be changed the class must be initialized with them. reschrg=Residue charge. Default is 0. multiplicity=Multiplicity of an energy level. Default is 1 (singlets: No unpaired electrons.) resn=Residue name. Default is resn.
cpu=Number of CPUs. Default is 4. mem=Memory. Default is 2 in Gigabytes basis= Main basis set. Default ‘6-31pg_d_’ theory=Level of theory. Default ‘mp2’ bssebasis=Secondary basis set for interaction energy with bsse correction, see below. ‘None’
These options are parsed from the keyword option in qmtop as True/False. For more details see the explanations below in calculation types. OPT , FREQ, DIPOLE , ENERGY , NOSYMM , FIXED, WATER, BSSE
The calculation types to be written are divided into three categories: 1) Single geometry operations: Requires geometry data, not necessarily QM optimized as this type can be used to perform optimization as well. The order of the calculation is the same as the order of the keywords below. Generates a single file.
- Supported keywords:
OPT: adds geometry optimization FREQ: adds frequency calculation DIPIOLE: adds dipole property calculation POLAR: adds polarizability calculation with the finite difference method ENERGY: simply calculates the energy of a given geometry. If none of the above keywords are given, energy calculation is performed by default.
- Data format:
Geometry object: numpy.array, [[]]
- Bonded scan: Requires an optimized geometry, the type of bonded parameter and the atoms involved in the parameter. There are two ways to do scan, frozen and fixed.
Frozen is the default method and should not be changed. The coordinates are pre-generated by Rdkit at a given range and written into a python file that is used as an import. The coordinates are frozen at specific values and the rest is optimized. Generates two files, one coordinate file, another for running the calculation. Fixed is turned on by adding the ‘FIXED’ keyword. The coordinates are generated on-the-fly by Psi4, however this is bound to fail. This is left for future when Psi4 has real scan capacity. Generates one file. Supported keywords:
FIXED: This keyword is left for futurew when Psi4 has real support for bonded parameter scan. Turns on the fixed type of parameter scan. By default bonded scans are done via freezing pre-generated coordinates.
- Data format:
Geometry object: see above. Bonded parameter information:
- Interaction energy: Requires an optimized geometry and the donor-acceptor (da) file. The coordinates are pre-generated from the z-matrix constructed with the help of the da file because Psi4 does not have support for z-matrix optimization.
- Supported keywords:
WATER: The second molecule is set to be a water molecule with predefined charge and multiplicity of 0 and 1. BSSE: Turns on the bsse calculation. With BSSE calculation a second basis set
- Data format:
Geometry object: see above.
Returns are always the file names that are created as a list or a str.
- Attributes:
- User set attributes:
resn: Residue name rescharge: Formal charge of the molecule multiplicity: Multiplcity of the molecule qmtop: Text for CPU, mem, Basis set, theory, and other information. Example for single geometry calculations:
nproc=4 mem=1000MB lot=MP2 basis=6-31G* keyword={OPT FREQ DIPOLE NOSYMM POLAR}
- Attributes set from qmtop:
‘mem’:memory,’cpu’:cpu, ‘theory’:theory (lot),’basis’:basis, ‘multi’:multiple actions (True/False), determined based on todo list. ‘todo’:actions to be done, OPTimization, FREQuency, DIPOle, POLARizability, ENErgy ‘bssebasis’:bssebasis ‘fixed’:Scan type for bonded parameters (True/False) Default is False, do not change. ‘water’:water interaction energy (True/False). False is not supported yet. ‘bsse’: BSSE interaction energy(True/False)
Psi4 Headers and Loops that are predefined: Psi4header: Top part of any Psi4 script, sets the memory and the cpu. Psi4footer: Sets the theory, basis and the options. Psi4moltmpl: Molecule template for Psi4 to set the geometry and the no reorient, no com, etc. Psi4smoltmpl: Molecule template for Psi4 to set the geometry only. No other field is given. Psi4polarloop: Routine for polarizability calculation Psi4fixedloop: Not to be used!!! Routine for doing a bonded parameter scan like Gaussian Psi4frozenloop: Routine for bonded parameter scan where an external coordinate set is used with frozen target value for the bonded parameter Psi4interactionloop: Routine for interaction energy calculations (supports water only for now). This is used for both BSSE and non BSSE calculations.
Functions: run: executes the action given to write the input files. User needs to interact with this only, lower level of functions are called from this. parseqmtop: This parses to qmtop. If QM top changed after initialization, run this function with update=True parsedata: This checks the qmaction and the existence of the required data. Returns the inpdata object for the writeABC functions below. Psi4xyz: Parses a coordinate list of lists and returns a Psi4 excepted coordinate string. writegeom: Writes single geometry calculation inputs writebondedscan: Writes bonded parameter scan inputs scandatatype: Sets the scan type for coordinate generation, bond-angle-dihedral writeinteraction: Writes the interaction energy calculation inputs.
- Psi4fixedloop = '\nstart=float(%s)\nnstep=float(%s)\nincr=float(%s)\nopttheory="%s"\noptbasis="%s"\nscanrange=[start,]\n\nstep=0\nwhile step <= nstep:\n val=start+incr\n scanrange.append(val)\n step+=1\n\nfor i in scanrange:\n val=float(i)\n atoms="%s"\n fixed_type="%s"\n fixed_string=atoms+" "+str(val)\n psi4.set_options({"fixed_"+fixed_type:fixed_string,\'scf_type\': \'df\', \'g_convergence\':\'gau\',\'guess\':\'sad\',\'opt_coordinates\':\'both\',\'freeze_core\':\'true\'})\n psi4.optimize(opttheory+\'/\'+optbasis,molecule=mol)\n'
- Psi4frozenloop = "\ncrdlist=importlib.import_module('.'.join(os.path.basename(__file__).split('.')[:-1])+'_xyz')\nbasename=crdlist.basename\nscanrange=crdlist.scanrange\npsi4.core.print_out('SCAN ATOMS: %s\\n')\nfor i in scanrange:\n psi4.core.print_out('STARTING '+i+'\\n')\n importname=basename+str(i)\n psi4_xyz=getattr(crdlist,importname)\n mol=psi4.geometry(psi4_xyz)\n mol.update_geometry() # This update is required for psi4 to load the molecule\n psi4.set_options(options)\n try:\n psi4.optimize(opttheory+'/'+optbasis,molecule=mol)\n except psi4.OptimizationConvergenceError:\n tmpopt=options\n tmpopt['g_convergence']='gau_loose'\n psi4.set_options(tmpopt)\n try:\n psi4.optimize(opttheory+'/'+optbasis,molecule=mol)\n except psi4.OptimizationConvergenceError:\n psi4.core.print_out('ENDING ERROR '+i+'\\n')\n else:\n E=psi4.energy(opttheory+'/'+optbasis)\n psi4.core.print_out('ENERGY is: '+str(E)+'\\n')\n psi4.core.print_out('ENDING SUCCESS '+i+'\\n')\n else:\n E=psi4.energy(opttheory+'/'+optbasis)\n psi4.core.print_out('ENERGY is: '+str(E)+'\\n')\n psi4.core.print_out('ENDING SUCCESS '+i+'\\n')\n"
- Psi4header = '#!/usr/bin/env python\nimport psi4,os,importlib\nimport numpy as np\nmem="%s"\ncpu=%s\npsi4.set_num_threads(cpu)\npsi4.set_memory(mem)\n\npsi4.core.set_output_file(os.path.dirname(os.path.abspath(__file__))+\'/\'+\'.\'.join(os.path.basename(__file__).split(\'.\')[:-1])+\'.out\', False)\n\n'
- Psi4interactionloop = '\nbsse=%s\nbssebasis="%s"\n\nif bsse:\n psi4.core.print_out(\'INTERACTION ENERGY correction BSSE\\n\')\nelse:\n psi4.core.print_out(\'INTERACTION ENERGY correction None\\n\')\n\ncrdlist=importlib.import_module(\'.\'.join(os.path.basename(__file__).split(\'.\')[:-1])+\'_xyz\')\nbasename=crdlist.basename\nintrange=crdlist.intrange\nbasecoor=getattr(crdlist,\'basecoor\')\nelist={}\nfor i in intrange:\n importname=basename+str(i)\n intecoor=getattr(crdlist,importname)\n mol=psi4.geometry(basecoor+"--"+intecoor)\n mol.update_geometry() # This update is required for psi4 to load the molecule\n E=psi4.energy(opttheory+\'/\'+optbasis)\n key=float(\'.\'.join(i.split(\'_\')))\n elist[key]=E\nmindist=min(elist, key=elist.get)\nmine=elist[mindist]\n\nif bsse and optbasis != bssebasis:\n importname=basename+\'_\'.join(str(mindist).split(\'.\'))\n intecoor=getattr(crdlist,importname)\n mol=psi4.geometry(basecoor+"--"+intecoor)\n mol.update_geometry()\n mine=psi4.energy(opttheory+\'/\'+bssebasis,bsse_type=\'cp\')\n \npsi4.core.print_out(\'INTERACTION DISTANCE and ENERGY are: \'+str(mindist)+\' \'+str(mine)+\'\\n\')\n\npsi4.core.print_out(\'INTERACTION TABLE NOBSSE START\\n\')\nfor d in elist.keys():\n psi4.core.print_out(str(d)+\' \'+str(elist[d])+\'\\n\')\npsi4.core.print_out(\'INTERACTION TABLE NOBSSE END\\n\')\n\n'
- Psi4moltmpl = '\npsi4_xyz="""\n%s\n%s\n"""\nmol=psi4.geometry(psi4_xyz)\nmol.update_geometry() # This update is required for psi4 to load the molecule\n'
- Psi4polarloop = '\ndipotheory="%s"\ndipobasis="%s"\npsi4.prop(dipotheory+"/"+dipobasis, properties=["DIPOLE"])\nzero_ene=psi4.energy(opttheory+"/"+optbasis)\nfield=%f\nfnames={0:\'x\',1:\'y\',2:\'z\'}\npolars={}\nfor i in range(3):\n tmpfield=[0,0,0]\n tmpfield[i]=abs(field)\n psi4.set_options({\'scf_type\': \'df\', \'g_convergence\':\'gau\',\'freeze_core\':\'true\',\'mp2_type\':\'df\',\'perturb_h\':\'true\',\'perturb_with\':\'dipole\',\'perturb_dipole\':tmpfield})\n p_ene=psi4.energy(opttheory+\'/\'+optbasis)\n tmpfield[i]=abs(field)*-1\n psi4.set_options({\'scf_type\': \'df\', \'g_convergence\':\'gau\',\'freeze_core\':\'true\',\'mp2_type\':\'df\',\'perturb_h\':\'true\',\'perturb_with\':\'dipole\',\'perturb_dipole\':tmpfield})\n n_ene=psi4.energy(opttheory+\'/\'+optbasis)\n enes=np.array([zero_ene,p_ene,n_ene,field],dtype=\'float64\') #Lets ensure it floats are always with numpy\n pol_i=abs((enes[1]-(2*enes[0])+enes[2])/(enes[3]**2))\n polars[fnames[i]+fnames[i]]=pol_i\n\ntotal=np.sum(np.array(list(polars.values()),dtype=\'float64\'))/3.0\npsi4.core.print_out(\'Polar RESULTS XX:\'+str(polars[\'xx\'])+\' YY:\'+str(polars[\'yy\'])+\' ZZ:\'+str(polars[\'zz\'])+\' Total:\'+str(total)+\'\\n\')\n'
- Psi4smoltmpl = '\npsi4_xyz="""\n%s\n"""\nmol=psi4.geometry(psi4_xyz)\nmol.update_geometry() # This update is required for psi4 to load the molecule\n'
- Psi4xyz(coor, reschrg, multiplicity, nosymm=None, extraspace=False, notmpl=False)
This function takes up a coordinate dictionary or geometry object and returns an xyz format for Psi4: xyz , this is a simple xyz coordinate file element names as the first character. It also contains charge and multiplicity information If charge is not given it is set to 0. If multiplicity is not given it is set to 1. Most of the time multiplicity is 1. If you need extraspace, which is the case when using coordinates for Psi4 binary set extraspace to True.
- parsedata(kwargs, qmaction)
- parseqmtop(qmtop, update=False)
- run(qmaction, outpath=None, outname=None, **kwargs)
- scandatatype(inpdata, fixed)
This function identifies the bonded parameter types, or parses the file where all the data to be scanned are written. Check the help or the manual for the correct format.
- writebondedscan(inpdata, Psi4header, options=None, fixed=None)
Writes Psi4 Inputs for dihedral scans. Requires external coordinates to be scanned. Support for modifying coordinates within Psi4 is experimental at best.
- writefixedscan(coor, atomnrmap, scannames, scantype, start, end, incr, options=None)
Gaussian like scans, do not use, this is not supported in Psi4.
- writegeom(inpdata, Psi4header, options=None)
- writeinteraction(inpdata, Psi4header, options=None, da_atoms=[])
Writes the interaction energy files, only water true is accepted.
ffparam.script_core.Psi4Parser module
- class ffparam.script_core.Psi4Parser.Psi4Parser(qmdat, datatype=None, outpath=None, topo=None, resname='resn', fixed=False, scantable=False, bsse=False, parent=False)
Bases:
object
This class is used for parsing the Psi4 output files. Requires an output file name as the first object, and the data type requested from this file. There are two ways to interact with this class:
Writing files during initialization, the datatype must be set when the class is first called. The extracted data is assigned to a dictionary as Psi4Parser.results . Especially useful when extracting multiple information such as geometry, dipole, frequency all from one file.
Via psi4Parser.run function where the data type is set within this function and only a single data type is extracted, for example bonded scans or interaction energies. Psi4Parser.results is no longer populated.
Since the names of the atoms could have been changed passing a topology map object is required, however cetain extractions could work without this. For example dihedral parsing requires topology map object, but loggeom could work without this. Extraction of the requested data types are done with predefined keywords in datatypes, with the exception if interaction energy. This class defines the keywords within its function. If these keywords are not found, then the last ever found data of the requested type is parsed and returned, for geometry , dipole, frequency information. Interaction energy parsing is partially supported without keywords, no scan table will be extracted. Bonded parameter scan is not supported without the keywords.
- datatype can be one of the following:
“geom”: Optimized coordinates. Return format, List of sublists where each sublist contains in order atom number, atom name, x, y, z “frequency”: Force matrix for molvib calculations. Return format currently pandas, but this is not supported yet so ignore this data type. “interaction”: Interaction energy parsing, with or without bsse. Return is a list where each line contains the interaction type, energy (kcal/mol) and distance (Angstroms). Additinoal keyword arguments accepted:
scantable:To return the full energy table bsse:For bsse corrected energies, if set to False but calculation is with bsse energies printed within the log file is parsed not FFParam keywords. parent: When bsse is false, monomer energies are required for the final results. When extracting from a monomer file set parent true.
- “bondedscan”: Extracting the energies and the coordinates from bonded parameter calculations. Returns a file name that contains the paths for extracted geometries. It also writes crd formated coordinates, and the energies associated with the coordinates. Additional keyword arguments accepted:
outpath: This is required since bonded scan writes out many files directly from this function. Others returns the data. fixed: This should not be set to True, as it is left for future support when Psi4 can generate coordinates on-the-fly. In the future this could be used to extracted scans where coordinates are generated during run time.
“dipole”: Dipole moment. Returns a list object that has the dipole moment in order; x, y, z, total (no scaling is applied). If polarizability results exist with the keywork Polar RESULTS then they are returned as well. “ic”: Internal coordinates for quick measurements. Returns a list object where each element is a list of [measurement type, [atom numbers ], [atom names ], value]. Additonal keyword arguments are only used internally for bonded scan parsing. See the help in the function for details.
- Other keyword arguments:
topomap: Topology map object, this is required for bonded scan extraction, it is optional for the others, however for consistency of the atom naming strongly recommended to set it. resname: This is used for writing the residue name in the coordinate file, and for the bonded scan file names. Default is ‘resn’
- Attributes:
- User set attributes:
resname: Residue name qmdat: Log file datatype: The data type(s) to be extracted from the log file outpath: Folder to write out the bonded parameter scan results. For the rest the extracted data is returned. fixed: Parameter scan is fixed(True) or frozen (False). Default is False, do not change. scantable: Extract a scantable for interaction energy. bsse: Extract the bsse interaction energy parent: Extract the monomer energy for the interaction energy calculations , use only with the monomer files. topo: Topology object created by FFParam icsym: Required for quality control for the IC table, IC information in the FFParam topology object. Psi4 may contain extra terms that have no corresponding bonded parameter.
returns: Dictionary that stores the extracted results.
- datatypes = {'bondedscan': ['STARTING', 'ENDING'], 'dipole': ['Dipole START', 'Dipole END'], 'frequency': ['Hessian START', 'Hessian END'], 'geom': ['Final (previous) structure:', 'Saving final (previous) structure'], 'ic': ['Internal Coordinate Step in ANG', '**** Optimization is complete! '], 'loggeom': ['Geometry (in Angstrom)', 'Nuclear repulsion']}
- parse_bondedscan(qmdat, topomap, scanoutdir, fixed=False)
- parse_dipole(dipdata)
- parse_frequency(hesdata)
- parse_geom(geomdata)
- parse_ic(icdata, filterscan=None, scantype=None, conv=True)
- parse_interaction(qmdat, scantable=False, bsse=False, parent=False)
- parse_loggeom(loggeomdata)
- parser(spattern, epattern, loggeom=False, fromobj=None)
- run(datatype, outpath=None)
- uni_hesparser(line)
ffparam.script_core.QMResultWriter module
- class ffparam.script_core.QMResultWriter.QMResultWriter(resname=None, outpath=None, filein=None)
Bases:
object
- static hartreetokcal(ene, reverse=False)
- static polau3toang3(pol)
- qmdipoleresult(dipoles, polars=None, dscale=1.0, pscale=1.0)
- qminteraction(intdata, scale=1.0, parentene=[0.0, 0.0], bsse=False, water=True, tag=None, qmeng='gau')
The format of intdata should be: key(name), energy, distance
- qmquickresult(intcodat, topomap=None)
- static qmscaleresult(data, scale=1.0)
ffparam.script_core.ffp_rdkit module
- class ffparam.script_core.ffp_rdkit.MolTransform(m, resname, rescharge, coor, atomnames, atomnrmap, bondnames, changetype, atomlist, targetvalue=None, targetrange=None, returns=None, pathfilebase=None, writepdb=False, writepy=False, multiplicity=1)
Bases:
object
- class ffparam.script_core.ffp_rdkit.RDMol(resi='resn', bonds=[], atomnames=[], smiles=None)
Bases:
object
This class is to create an RDMol object from the topology file. To generate initial coordinates for the molecule, you can run coordinates_fromrdmol , after you initialize the class.
- static atomicnr(atomlist)
- coordinates_fromrdmol(outpath, otype='crd')
- generatemolfromstr(outpath, otype='crd')
- rdmoltomol2(m)
ffparam.script_core.mcsa module
- class ffparam.script_core.mcsa.LoadFromFile(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
Bases:
Action
- ffparam.script_core.mcsa.main()
- class ffparam.script_core.mcsa.mcsa(strfile, resi, crdfile=None, qmdpfile=None, mmdpfile=None, qmintfile=None, mmintfile=None, usecharmm=True, charmmexe='charmm', charmminp='ffparam.inp', charmmcmd=None, ffpfmt=True, chkfile=None, wdp=0.0, wpol=0.0, wint=0.0, temp=1.0, slow_cooling=True, maxmcs=5000, readsele=None, work_dir='.', verbosity=0)
Bases:
object
- chng()
- equivalentgrp(gatlines, seledict)
- error_redistribute(allcharges)
- fctnchrm(tempstr)
- fctnomm(tempstr)
- mcsamain(temp, maxmcs, tempstr, atlines)
- rchrgstr(strfile)
- rdipol(filename)
- restraincharge(plist)
- rintene(filename)
- rmse(mmdpv, mmpolv, mmintv)
- seleprocess(readsele)
- setbounds(seledict)
- tracebackalph(plist)
- tracebackchrg(plist)
- tracebackthol(plist)
- wchrgstr(tempstr, atl, clist, alist=None, tlist=None)
- weighting(mmdpv, mmpolv, mmintv)
- ffparam.script_core.mcsa.str2bool(inp)
ffparam.script_core.mmfileio module
- ffparam.script_core.mmfileio.charmmaddibot(nat, daat, wline, donor=False)
- ffparam.script_core.mmfileio.charmmadditop(nat, wline)
- ffparam.script_core.mmfileio.charmmdrudbot(nat, daat, wline, donor=False)
- ffparam.script_core.mmfileio.charmmdrudtop(nat, wline)
- ffparam.script_core.mmfileio.haccmm(xat, aat, bat, ang1, poav, impr)
- ffparam.script_core.mmfileio.hdonormm(hat, dat, aat, ang1, ang2)
- ffparam.script_core.mmfileio.ndonormm(hat, dat, aat, bat, ang1, ang2)
- ffparam.script_core.mmfileio.o3accmm(xat, aat, bat, ang1, poav, impr)
- ffparam.script_core.mmfileio.oneaccmm(xat, aat, bat, ang1)
ffparam.script_core.mmfileio_scan module
ffparam.script_core.moleculereader module
- class ffparam.script_core.moleculereader.Element(Z, radius, max_bonds, r, g, b)
Bases:
object
- class ffparam.script_core.moleculereader.Molecule(size=0, coorfile=None)
Bases:
object
- static cartzmattocart(coors, zmat, dist=2.1, distvar='roh', zmatcoor=False, returnnr=None, dummy=False, qmnames=True)
Accepts a parent coordinate object, zmatrix lines generated by script_core.qmfileio.daltozmat_w, distance used in zmatrix if not 2.1 and the variable name if not roh. Returns the coordinates generated. zmatcoor returns only the coordinates from the zmatrix lines, excludes the parent coordinates given. returnnr returns, in addition to the coordinates, the numbering of the requested atoms (usually the atoms involed in the distance variable.) qmnames cleans up the atomnames and makes them QM compatible. This is required for Psi4. dummy keeps the dummy atoms used to generate the coordinates.
- Potential issues:
Cleaning the atom names with qmnames could possibly lead to problems if there is CA as the atom name which could be either calcium or Carbon named as CA.
- genbonds()
- mergepos(returns=True)
Returns a merged coordinate object, ordered based on topology order. Molecule.readcoor() must be run first.
- readcoor(filename, center=True)
- static readpdb(atomblock, filename=None)
Parses the lines of a file object, if lines starts with ATOM or HETATM. The names and the coordinates are extracted according to the PDB format. Returns the atomnames as list and the positions as a numpy.array of type float64.
- static readpyxyz(filename)
Parses the python import xyz files. This is the format generated for interaction energies. This file must contain basename that equals to “interaction__” basecoor that is the coordinate string of the parent molecule, monomer 1. intrange that holds the interaction range as strings (dot is replaced by underscore ). basename+range objects that contain the coordinates for monomer 2, for example water.
Returns the atom names and the positions as a list and numpy.array of type float64.
- Known issues:
Currently atom names are read from the file, however these names are cleaned up for Psi4 that they may not match to the names in topology.
ffparam.script_core.openmm_calc module
- class ffparam.script_core.openmm_calc.LoadFromFile(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
Bases:
Action
- class ffparam.script_core.openmm_calc.OmmCalc(resi, ff='addi', topparlist=None, strfile=None, action=None, workdir='.', psffile=None, coorfile=None, m2psffile=None, cpsffile=None, intmol='water', chkfile=None, atomlist=None)
Bases:
object
- dipole(simulation, qcog=False, qcom=False, qxyz=True, dunit=4.803241271, fwrite=False)
- fcog(simulation)
- fcom(simulation)
- getenergy(simulation, fileout=None, fwrite=False)
- initdrlp(psf, positions)
- inte_pre(m1psffile=None, m2psffile=None, cpsffile=None)
- mcsa_dipo(strfile, coorfile)
- mcsa_pre(strfile, coorfile, chkfile)
- minimization(simulation, maxit=None, fileout=None, fwrite=False)
- minimize_onlydrude(simulation, fwrite=False)
- molpol(simulation)
- omm_writecrd(topology, positions, outcrdfile)
- ommtypepos(ffpcoords)
- read_coor(coordfile)
- read_paramfiles(listoftoppar=None, rtfprmstrfile=None)
- read_params(parFiles)
- run_intcoor(simulation, qmdataf)
- run_inte_ene(m1simulation, m2simulation, csimulation, dafile, intmol='water', fwrite=True, verbose=False)
- run_pes(simulation, chkfile, atomlst)
- sdrude(psf, positions)
- set_position(coords, simulation, psfins=None)
- set_simulation(psf, temp=300, dt=0.002, tau=1)
- shake(psf, positions)
- str2bool()
- swm4_coor()
- tip3_coor()
- class ffparam.script_core.openmm_calc.omm_coor(ffp_coords, resnam='RESI', resnum=1, segnam='RESI')
Bases:
object
ffparam.script_core.orphan module
- ffparam.script_core.orphan.angle(v1, v2)
- ffparam.script_core.orphan.changenr(self, listobj, matchfrom, matchto)
This function is for changing the numbering of a list obj. It requires two dictionaries. First dictionary should match the listobj numbering. Second dictionary is the output numbering.
- ffparam.script_core.orphan.dotproduct(v1, v2)
- ffparam.script_core.orphan.frange(alist, rdigit=2, step=False)
This function returns a range of values using the list elements supplied, in the order of [start,end,incr]. The list is inclusive, start and end values are included. step means, the values are [start,number_of_steps,incr].
- ffparam.script_core.orphan.length(v)
- ffparam.script_core.orphan.reverse_readline(filename, buf_size=8192)
A generator that returns the lines of a file in reverse order
- ffparam.script_core.orphan.sepkeepdigit(bastr, sepchar)
Seperates a string, keeps only the digits and returns a list
- ffparam.script_core.orphan.sepkeepletter(bastr, sepchar)
Seperates a string, keeps only the letters and returns a list
ffparam.script_core.qmfileio module
- ffparam.script_core.qmfileio.createda(tpsf, dafile, atomchoice=[], coords=None)
- ffparam.script_core.qmfileio.daltozmat_w(line, atoms=False)
This function parses the da line passed, using the functions defined above in this file and returns a zmatrix for the water.
atoms=True will return the atomnames for water. This is set to true for creating coordinates with one parent atom and different water molecules. Parent atom do not change, thus we do not need that to be returned, atomnames are required.
- ffparam.script_core.qmfileio.haccqm(xat, aat, bat, ang1, poav, impr)
- ffparam.script_core.qmfileio.hdonorqm(hat, dat, aat, ang1, ang2)
- ffparam.script_core.qmfileio.ndonorqm(hat, dat, aat, bat, ang1, ang2)
- ffparam.script_core.qmfileio.o3accqm(xat, aat, bat, ang1, poav, impr)
- ffparam.script_core.qmfileio.oneaccqm(xat, aat, bat, ang1)
ffparam.script_core.rtftopsf module
- ffparam.script_core.rtftopsf.main()
- class ffparam.script_core.rtftopsf.rtftopsf(resilist=[], nand=[], topparlist=[], weight=0.4, outfile=None, psf=False)
Bases:
object
- anisotropy(a11, a22)
- dcharge(alpha)
- findangles(atomlist, listofbonds)
- findbonds(atomlist, listofbonds)
- finddihedrals(atomlist, listofbonds)
- isotropy(qdip)
- readtoppar(resi, topparlist)
Reads a topology and returns the parameters as a dictionary.
- writeformat(fout, datatype, data)
- writepsf()
ffparam.script_core.toppario module
- ffparam.script_core.toppario.canonical_format(iclist, icnumlist)
- ffparam.script_core.toppario.createmap(atomnames)
Creates a map of indices for actual atoms
- ffparam.script_core.toppario.ranking(atnm1, atnm2)
- ffparam.script_core.toppario.readparam(parfiles)