stko.XTBCREST
- class stko.XTBCREST(crest_path, xtb_path, gfn_version=2, output_dir=None, opt_level='normal', md_len=None, ewin=5, speed_setting=None, keepdir=False, num_cores=4, cross=True, charge=0, electronic_temperature=300, solvent_model='gbsa', solvent=None, num_unpaired_electrons=0, unlimited_memory=False)[source]
Bases:
OptimizerUses GFN-n to run CREST on molecules.
See also
- Parameters:
crest_path (str) – The path to the CREST executable.
xtb_path (str) – The path to the xTB executable. Version >6.3.0 is required.
gfn_version (int) – Parameterization of GFN to use in xTB. For details see https://xtb-docs.readthedocs.io/en/latest/basics.html.
output_dir (str | None) – The name of the directory into which files generated during the optimization are written, if
Nonethenuuid.uuid4()is used.opt_level (str) – Optimization level to use. Can be one of
'crude','sloppy','loose','lax','normal','tight','vtight'or'extreme'. For details see https://xtb-docs.readthedocs.io/en/latest/optimization.html .md_len (float | None) – Set length of the meta-dynamics simulations (MTD) in ps. Default is chosen based on size and flexibility of the system.
ewin (float) – Set the energy threshold in kcal/mol for conformer selection. Double this is used in crude optimization. Defaults ot 5 kcal/mol and is overridden by
speed_setting.speed_setting (None | str) – Conformer search speed setting. Fast methods turn off parts of the calculations and alter MD run times. Defaults to no modification of iMTD-GC algorithm: None. Can be one of
'norotmd','quick','squick'or'mquick'. Overridesewinwith chosen parameters. For details see https://xtb-docs.readthedocs.io/en/latest/crestcmd.html.keepdir (bool) – True to keep subdirectories from MD runs. Defaults to False. For details see https://xtb-docs.readthedocs.io/en/latest/crestcmd.html.
num_cores (int) – The number of cores CREST should use.
charge (int) – Formal molecular charge.
electronic_temperature (float) – Electronic temperature in Kelvin.
solvent_model (str) – Solvent model to use out of older gbsa and newer alpb. gbsa is default for backwards compatability, but alpb is recommended. For details see https://xtb-docs.readthedocs.io/en/latest/gbsa.html.
solvent (str | None) – Solvent to use in GBSA implicit solvation method. For details see https://xtb-docs.readthedocs.io/en/latest/gbsa.html.
num_unpaired_electrons (int) – Number of unpaired electrons.
cross (bool) – Whether or not structure crossing is performed.
unlimited_memory (bool) – If
Trueoptimize()will be run without constraints on the stack size. If memory issues are encountered, this should beTrue, however this may raise issues on clusters.
Notes
Requires version > 6.2 of xtb.
When running
optimize(), this calculator changes the present working directory withos.chdir(). The original working directory will be restored even if an error is raised, so unless multi-threading is being used this implementation detail should not matter.Restrictions to iMTD-GC Algorithm Z-matrix sorting is forced to be off because
stk.Moleculescannot have their atom ordering changed by an external program at this stage.Examples
Note that for
ConstructedMoleculeobjects constructed bystk,XTBCRESTshould usually be used in aOptimizerSequence. This is because xTB only uses xyz coordinates as input and so will not recognize the long bonds created during construction. An optimizer which can minimize these bonds should be used beforeXTBCREST. Further, CREST runs best on an input structure optimized at the same level used throughout the algorithm (i.e.XTB).import stk import stko bb1 = stk.BuildingBlock('NCCNCCN', [stk.PrimaryAminoFactory()]) bb2 = stk.BuildingBlock('O=CCCC=O', [stk.AldehydeFactory()]) polymer = stk.ConstructedMolecule( stk.polymer.Linear( building_blocks=(bb1, bb2), repeating_unit="AB", orientations=[0, 0], num_repeating_units=1 ) ) xtb = stko.OptimizerSequence( stko.UFF(), stko.XTB( xtb_path='/opt/gfnxtb/xtb', unlimited_memory=True, ), # Perform quick conformer search. stko.XTBCREST( crest_path='/opt/crest/crest', xtb_path='/opt/gfnxtb/xtb', opt_level='normal', speed_setting='quick', unlimited_memory=True, ), ) polymer = xtb.optimize(polymer)
While most auxiliary and MD run files will be deleted if
keepdiris False, the files listed below are kept inoutput_dirand could be useful for further analysis!crest_best.xyz: Structure of the lowest energy conformer.This structure is output byoptimize().crest_conformers.xyz: Structure of all conformers.All conformers with RMSD and energy threshold of thelowest energy conformer.crest_rotamers.xyz: Structure of all rotamers.All unique rotamers explored by CREST.crest.energies: Relative conformer energies in a.u..gfn_topo: GFN-FF binary topology file.Defines the molecules force field topology.Methods
Optimize mol.