# rmgpy.qm.mopac¶

class rmgpy.qm.mopac.Mopac

A base class for all QM calculations that use MOPAC.

Classes such as MopacMol will inherit from this class.

failureKeys = ['IMAGINARY FREQUENCIES', 'EXCESS NUMBER OF OPTIMIZATION CYCLES', 'NOT ENOUGH TIME FOR ANOTHER CYCLE']

List of phrases that indicate failure NONE of these must be present in a succesful job.

getParser(outputFile)

Returns the appropriate cclib parser.

successKeys = ['DESCRIPTION OF VIBRATIONS', 'MOPAC DONE']

List of phrases to indicate success. ALL of these must be present in a successful job.

usePolar = False

Keywords for the multiplicity

verifyOutputFile()

Check’s that an output file exists and was successful.

Returns a boolean flag that states whether a successful MOPAC simulation already exists for the molecule with the given (augmented) InChI Key.

The definition of finding a successful simulation is based on these criteria: 1) finding an output file with the file name equal to the InChI Key 2) NOT finding any of the keywords that are denote a calculation failure 3) finding all the keywords that denote a calculation success. 4) finding a match between the InChI of the given molecule and the InchI found in the calculation files 5) checking that the optimized geometry, when connected by single bonds, is isomorphic with self.molecule (converted to single bonds)

If any of the above criteria is not matched, False will be returned. If all succeed, then it will return True.

class rmgpy.qm.mopac.MopacMol(molecule, settings)

A base Class for calculations of molecules using MOPAC.

Inherits from both QMMolecule and Mopac.

calculateChiralityCorrection()

Returns the chirality correction to entropy (R*ln(2) if chiral) in J/mol/K.

calculateThermoData()

Calculate the thermodynamic properties.

Stores and returns a ThermoData object as self.thermo. self.qmData and self.pointGroup need to be generated before this method is called.

checkPaths()

Check the paths in the settings are OK. Make folders as necessary.

checkReady()

Check that it’s ready to run calculations.

createGeometry()

Creates self.geometry with RDKit geometries

determinePointGroup()

Determine point group using the SYMMETRY Program

Stores the resulting PointGroup in self.pointGroup

generateQMData()

Calculate the QM data and return a QMData object, or None if it fails.

generateThermoData()

Generate Thermo Data via a QM calc.

Returns None if it fails.

getFilePath(extension, scratch=True)

Returns the path to the file with the given extension.

The provided extension should include the leading dot. If called with scratch=False then it will be in the fileStore directory, else scratch=True is assumed and it will be in the scratchDirectory directory.

getInChiKeyAug()

Returns the augmented InChI from self.molecule

getMolFilePathForCalculation(attempt)

Get the path to the MOL file of the geometry to use for calculation attempt.

If attempt <= self.scriptAttempts then we use the refined coordinates, then we start to use the crude coordinates.

getParser(outputFile)

Returns the appropriate cclib parser.

getThermoFilePath()

Returns the path the thermo data file.

initialize()

inputFileKeywords(attempt)

Return the top, bottom, and polar keywords.

inputFilePath

Get the input file name.

keywords = [{'top': 'precise nosym THREADS=1', 'bottom': 'oldgeo thermo nosym precise THREADS=1 '}, {'top': 'precise nosym gnorm=0.0 nonr THREADS=1', 'bottom': 'oldgeo thermo nosym precise THREADS=1 '}, {'top': 'precise nosym gnorm=0.0 THREADS=1', 'bottom': 'oldgeo thermo nosym precise THREADS=1 '}, {'top': 'precise nosym gnorm=0.0 bfgs THREADS=1', 'bottom': 'oldgeo thermo nosym precise THREADS=1 '}, {'top': 'precise nosym recalc=10 dmax=0.10 nonr cycles=2000 t=2000 THREADS=1', 'bottom': 'oldgeo thermo nosym precise THREADS=1 '}]

Keywords that will be added at the top and bottom of the qm input file

loadThermoData()

maxAttempts

The total number of attempts to try

outputFilePath

Get the output file name.

parse()

Parses the results of the Mopac calculation, and returns a QMData object.

saveThermoData()

Save the generated thermo data.

scriptAttempts

The number of attempts with different script keywords

verifyOutputFile()

Check’s that an output file exists and was successful.

Returns a boolean flag that states whether a successful MOPAC simulation already exists for the molecule with the given (augmented) InChI Key.

The definition of finding a successful simulation is based on these criteria: 1) finding an output file with the file name equal to the InChI Key 2) NOT finding any of the keywords that are denote a calculation failure 3) finding all the keywords that denote a calculation success. 4) finding a match between the InChI of the given molecule and the InchI found in the calculation files 5) checking that the optimized geometry, when connected by single bonds, is isomorphic with self.molecule (converted to single bonds)

If any of the above criteria is not matched, False will be returned. If all succeed, then it will return True.

writeInputFile(attempt)

Using the Geometry object, write the input file for the attempt.

class rmgpy.qm.mopac.MopacMolPM3(molecule, settings)

Mopac PM3 calculations for molecules

This is a class of its own in case you wish to do anything differently, but for now it’s the same as all the MOPAC PMn calculations, only pm3

calculateChiralityCorrection()

Returns the chirality correction to entropy (R*ln(2) if chiral) in J/mol/K.

calculateThermoData()

Calculate the thermodynamic properties.

Stores and returns a ThermoData object as self.thermo. self.qmData and self.pointGroup need to be generated before this method is called.

checkPaths()

Check the paths in the settings are OK. Make folders as necessary.

checkReady()

Check that it’s ready to run calculations.

createGeometry()

Creates self.geometry with RDKit geometries

determinePointGroup()

Determine point group using the SYMMETRY Program

Stores the resulting PointGroup in self.pointGroup

generateQMData()

Calculate the QM data and return a QMData object, or None if it fails.

generateThermoData()

Generate Thermo Data via a QM calc.

Returns None if it fails.

getFilePath(extension, scratch=True)

Returns the path to the file with the given extension.

The provided extension should include the leading dot. If called with scratch=False then it will be in the fileStore directory, else scratch=True is assumed and it will be in the scratchDirectory directory.

getInChiKeyAug()

Returns the augmented InChI from self.molecule

getMolFilePathForCalculation(attempt)

Get the path to the MOL file of the geometry to use for calculation attempt.

If attempt <= self.scriptAttempts then we use the refined coordinates, then we start to use the crude coordinates.

getParser(outputFile)

Returns the appropriate cclib parser.

getThermoFilePath()

Returns the path the thermo data file.

initialize()

inputFileKeywords(attempt)

Return the top, bottom, and polar keywords for attempt number attempt.

NB. attempt begins at 1, not 0.

inputFilePath

Get the input file name.

loadThermoData()

maxAttempts

The total number of attempts to try

outputFilePath

Get the output file name.

parse()

Parses the results of the Mopac calculation, and returns a QMData object.

saveThermoData()

Save the generated thermo data.

scriptAttempts

The number of attempts with different script keywords

verifyOutputFile()

Check’s that an output file exists and was successful.

Returns a boolean flag that states whether a successful MOPAC simulation already exists for the molecule with the given (augmented) InChI Key.

The definition of finding a successful simulation is based on these criteria: 1) finding an output file with the file name equal to the InChI Key 2) NOT finding any of the keywords that are denote a calculation failure 3) finding all the keywords that denote a calculation success. 4) finding a match between the InChI of the given molecule and the InchI found in the calculation files 5) checking that the optimized geometry, when connected by single bonds, is isomorphic with self.molecule (converted to single bonds)

If any of the above criteria is not matched, False will be returned. If all succeed, then it will return True.

writeInputFile(attempt)

Using the Geometry object, write the input file for the attempt.

class rmgpy.qm.mopac.MopacMolPM6(molecule, settings)

Mopac PM6 calculations for molecules

This is a class of its own in case you wish to do anything differently, but for now it’s the same as all the MOPAC PMn calculations, only pm6

calculateChiralityCorrection()

Returns the chirality correction to entropy (R*ln(2) if chiral) in J/mol/K.

calculateThermoData()

Calculate the thermodynamic properties.

Stores and returns a ThermoData object as self.thermo. self.qmData and self.pointGroup need to be generated before this method is called.

checkPaths()

Check the paths in the settings are OK. Make folders as necessary.

checkReady()

Check that it’s ready to run calculations.

createGeometry()

Creates self.geometry with RDKit geometries

determinePointGroup()

Determine point group using the SYMMETRY Program

Stores the resulting PointGroup in self.pointGroup

generateQMData()

Calculate the QM data and return a QMData object, or None if it fails.

generateThermoData()

Generate Thermo Data via a QM calc.

Returns None if it fails.

getFilePath(extension, scratch=True)

Returns the path to the file with the given extension.

The provided extension should include the leading dot. If called with scratch=False then it will be in the fileStore directory, else scratch=True is assumed and it will be in the scratchDirectory directory.

getInChiKeyAug()

Returns the augmented InChI from self.molecule

getMolFilePathForCalculation(attempt)

Get the path to the MOL file of the geometry to use for calculation attempt.

If attempt <= self.scriptAttempts then we use the refined coordinates, then we start to use the crude coordinates.

getParser(outputFile)

Returns the appropriate cclib parser.

getThermoFilePath()

Returns the path the thermo data file.

initialize()

inputFileKeywords(attempt)

Return the top, bottom, and polar keywords for attempt number attempt.

NB. attempt begins at 1, not 0.

inputFilePath

Get the input file name.

loadThermoData()

maxAttempts

The total number of attempts to try

outputFilePath

Get the output file name.

parse()

Parses the results of the Mopac calculation, and returns a QMData object.

saveThermoData()

Save the generated thermo data.

scriptAttempts

The number of attempts with different script keywords

verifyOutputFile()

Check’s that an output file exists and was successful.

Returns a boolean flag that states whether a successful MOPAC simulation already exists for the molecule with the given (augmented) InChI Key.

The definition of finding a successful simulation is based on these criteria: 1) finding an output file with the file name equal to the InChI Key 2) NOT finding any of the keywords that are denote a calculation failure 3) finding all the keywords that denote a calculation success. 4) finding a match between the InChI of the given molecule and the InchI found in the calculation files 5) checking that the optimized geometry, when connected by single bonds, is isomorphic with self.molecule (converted to single bonds)

If any of the above criteria is not matched, False will be returned. If all succeed, then it will return True.

writeInputFile(attempt)

Using the Geometry object, write the input file for the attempt.

class rmgpy.qm.mopac.MopacMolPM7(molecule, settings)

Mopac PM7 calculations for molecules

This is a class of its own in case you wish to do anything differently, but for now it’s the same as all the MOPAC PMn calculations, only pm7

calculateChiralityCorrection()

Returns the chirality correction to entropy (R*ln(2) if chiral) in J/mol/K.

calculateThermoData()

Calculate the thermodynamic properties.

Stores and returns a ThermoData object as self.thermo. self.qmData and self.pointGroup need to be generated before this method is called.

checkPaths()

Check the paths in the settings are OK. Make folders as necessary.

checkReady()

Check that it’s ready to run calculations.

createGeometry()

Creates self.geometry with RDKit geometries

determinePointGroup()

Determine point group using the SYMMETRY Program

Stores the resulting PointGroup in self.pointGroup

generateQMData()

Calculate the QM data and return a QMData object, or None if it fails.

generateThermoData()

Generate Thermo Data via a QM calc.

Returns None if it fails.

getFilePath(extension, scratch=True)

Returns the path to the file with the given extension.

The provided extension should include the leading dot. If called with scratch=False then it will be in the fileStore directory, else scratch=True is assumed and it will be in the scratchDirectory directory.

getInChiKeyAug()

Returns the augmented InChI from self.molecule

getMolFilePathForCalculation(attempt)

Get the path to the MOL file of the geometry to use for calculation attempt.

If attempt <= self.scriptAttempts then we use the refined coordinates, then we start to use the crude coordinates.

getParser(outputFile)

Returns the appropriate cclib parser.

getThermoFilePath()

Returns the path the thermo data file.

initialize()

inputFileKeywords(attempt)

Return the top, bottom, and polar keywords for attempt number attempt.

NB. attempt begins at 1, not 0.

inputFilePath

Get the input file name.

loadThermoData()

maxAttempts

The total number of attempts to try

outputFilePath

Get the output file name.

parse()

Parses the results of the Mopac calculation, and returns a QMData object.

saveThermoData()

Save the generated thermo data.

scriptAttempts

The number of attempts with different script keywords

verifyOutputFile()

Check’s that an output file exists and was successful.

Returns a boolean flag that states whether a successful MOPAC simulation already exists for the molecule with the given (augmented) InChI Key.

The definition of finding a successful simulation is based on these criteria: 1) finding an output file with the file name equal to the InChI Key 2) NOT finding any of the keywords that are denote a calculation failure 3) finding all the keywords that denote a calculation success. 4) finding a match between the InChI of the given molecule and the InchI found in the calculation files 5) checking that the optimized geometry, when connected by single bonds, is isomorphic with self.molecule (converted to single bonds)

If any of the above criteria is not matched, False will be returned. If all succeed, then it will return True.

writeInputFile(attempt)

Using the Geometry object, write the input file for the attempt.