Defines MOPAC optimizers.
-
class
MOPAC(mopac_path, hamiltonian='PM7', method='OPT', minimum_gradient=0.01, eps=80.1, charge=0, fileout='PDBOUT', timeout=172800, use_cache=False)¶ Bases:
stk.calculators.optimization.optimizers.OptimizerUses MOPAC to optimize molcules.
-
mopac_path¶ The full path to the MOPAC suite on the user’s machine. For example, in a default MacOS installation the folder will probably be something like
/opt/mopac/MOPAC2016.exe.- Type
str
-
hamiltonian¶ A series of different methods can be selected:
'PM7','PM6','AM1','CIS''(CISD, CISDT)','MNDO','RM1', etc.'PM7'is the latest version of the reparametrization of NDDO theory, where all the atomic and diatomic parameters were re-optimized / updated from PM6 1.- Type
str, optional
-
method¶ The default calculation consists of a geometry optimization. You can run single point calculations (SCF) or transition search algorithms (TS). Refer to the MOPAC website for specific keywords.
- Type
str, optional
-
minimum_gradient¶ The gradient at which the geometry optimization reaches the convergence criteria (
kcal/mol/Angstrom). For small system and high precision work,0.01is recommended.- Type
float, optional
-
eps¶ Sets the dielectric constant for the solvent. Presence of this keyword will cause the COSMO (Conductor-like Screening Model) method to be used to approximate the effect of a solvent model surrounding the molecule. Solvents with a low dielectric constant are not likely to work well with this model.
0means that the dielectric constant is not included in the calculation.80.1can be used to model a water environment at room temperature.- Type
float, optional
-
charge¶ The charge of the system.
- Type
float, optional
-
fileout¶ Determines the output file type.
- Type
str, optional
-
timeout¶ The amount in seconds the optimization is allowed to run before being terminated. The default value is
2days or172,800seconds.Nonemeans there is no timeout.- Type
float, optional
References
Methods
add_to_cache(self, mol[, value])Add a molecule to the cache.
generate_mop(self, mol, conformer)Creates the
.mopfile for the optimization.get_cached_value(self, mol)Return the value stored in the cache for mol.
is_caching(self)Trueif the calculator has caching turned on.is_in_cache(self, mol)Return
Trueif mol is cached.kill_mopac(self, mol)Kills an in-progress MOPAC run.
mop_header(self)Returns the header of the
.mopfile.optimize(self, mol[, conformer])Optimizes a molecule.
set_cache_use(self, use_cache)Set cache use on or off.
run_mopac
-
__init__(self, mopac_path, hamiltonian='PM7', method='OPT', minimum_gradient=0.01, eps=80.1, charge=0, fileout='PDBOUT', timeout=172800, use_cache=False)¶ Initializes a
MOPACinstance.- Parameters
mopac_path (
str) – The full path to the MOPAC suite on the user’s machine. For example, in a default MacOS installation the folder will probably be something like/opt/mopac/MOPAC2016.exe.hamiltonian (
str, optional) –A series of different methods can be selected:
'PM7','PM6','AM1','CIS''(CISD, CISDT)','MNDO','RM1', etc.'PM7'is the latest version of the reparametrization of NDDO theory, where all the atomic and diatomic parameters were re-optimized / updated from PM6 2.method (
str, optional) – The default calculation consists of a geometry optimization. You can run single point calculations (SCF) or transition search algorithms (TS). Refer to the MOPAC website for specific keywords.minimum_gradient (
float, optional) – The gradient at which the geometry optimization reaches the convergence criteria (kcal/mol/Angstrom). For small system and high precision work,0.01is recommended.eps (
float, optional) – Sets the dielectric constant for the solvent. Presence of this keyword will cause the COSMO (Conductor-like Screening Model) method to be used to approximate the effect of a solvent model surrounding the molecule. Solvents with a low dielectric constant are not likely to work well with this model.0means that the dielectric constant is not included in the calculation.80.1can be used to model a water environment at room temperature.charge (
float, optional) – The charge of the system.fileout (
str, optional) – Determines the output file type.timeout (
float, optional) – The amount in seconds the optimization is allowed to run before being terminated. The default value is2days or172,800seconds.Nonemeans there is no timeout.use_cache (
bool, optional) – IfTrueoptimize()will not run twice on the same molecule and conformer.
References
-
add_to_cache(self, mol, value=None)¶ Add a molecule to the cache.
- Parameters
mol (
Molecule) – The molecule to be added to the cache.value (class:object, optional) – The cached value associated with the molecule.
- Returns
The calculator.
- Return type
- Raises
NotImplementedError – This is a virtual method and needs to be implemented in a subclass.
-
generate_mop(self, mol, conformer)¶ Creates the
.mopfile for the optimization.- Parameters
mol (
Molecule) – The molecule which is to be optimized. Its molecular structure file is converted to a.mopfile.conformer (
int) – The conformer of the molecule to be used.
- Returns
The full path of the newly created
.mopfile.- Return type
str
-
get_cached_value(self, mol)¶ Return the value stored in the cache for mol.
- Parameters
mol (
Molecule) – The molecule whose cached value is to be returned.- Returns
The cached value.
- Return type
object- Raises
NotImplementedError – This is a virtual method and needs to be implemented in a subclass.
-
is_caching(self)¶ Trueif the calculator has caching turned on.- Returns
Trueif the calculator has caching turned on.- Return type
bool- Raises
NotImplementedError – This is a virtual method and needs to be implemented in a subclass.
-
is_in_cache(self, mol)¶ Return
Trueif mol is cached.- Parameters
mol (
Molecule) – The molecule being checked.- Returns
Trueif mol is cached.- Return type
bool- Raises
NotImplementedError – This is a virtual method and needs to be implemented in a subclass.
-
kill_mopac(self, mol)¶ Kills an in-progress MOPAC run.
To kill a MOPAC run, a file with the molecule’s name and a
.endextension is written.- Parameters
mol (
Molecule) – The molecule being optimized.- Returns
None
- Return type
NoneType
-
mop_header(self)¶ Returns the header of the
.mopfile.- Returns
String containing all the MOPAC keywords correctly formatted for the input file.
- Return type
str
-
optimize(self, mol, conformer=-1)¶ Optimizes a molecule.
- Parameters
mol (
Molecule) – The molecule to be optimized.conformer (
int, optional) – The conformer to use.
- Returns
None
- Return type
NoneType
-
run_mopac(self, mol, mopac_path, settings, timeout=7200)¶
-
set_cache_use(self, use_cache)¶ Set cache use on or off.
- Parameters
use_cache (
bool) –Trueif the cache is to be used.- Returns
The calculator.
- Return type
- Raises
NotImplementedError – This is a virtual method and needs to be implemented in a subclass.
-