stko.XTBFF
- class stko.XTBFF(xtb_path, output_dir=None, opt_level='normal', num_cores=1, charge=0, unlimited_memory=False)[source]
Bases:
OptimizerUses GFN-FF to optimize molecules.
See also
- Parameters:
xtb_path (str) – The path to the xTB executable.
output_dir (Path | 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 .num_cores (int) – The number of cores xTB should use.
charge (int) – Formal molecular charge.
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
GFN-FF requires >= version 6.3 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.Currently, we only provide inputs that work with GFN-FF, specifically the charge of the system. Other electronic properties of the molecule are not relavent to a forcefield optimisation.
Examples
Note that for
ConstructedMoleculeobjects constructed bystk,XTBFFshould 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 beforeXTBFF.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.XTBFF( xtb_path='/opt/gfnxtb/xtb', unlimited_memory=True, ), ) polymer = xtb.optimize(polymer)
Methods
Optimize mol.