Source code for promod3
# load compounds library
# That way we do not need to call our scripts with the OST starter and are more
# flexible.
import os
import ost
from ost import conop
from ost import io
[docs]def SetCompoundsChemlib(path_to_chemlib="/import/bc2/apps/OpenStructure/1.4.0-goolf-1.4.10_20150306/share/openstructure/compounds.chemlib"):
"""SetCompoundsChemlib(path_to_chemlib)
Load a compounds library. Does not return anything, the library is just
enabled globally.
:param path_to_chemlib: Points to the file to be loaded.
:type path_to_chemlib: :class:`str`
"""
compound_lib_path = path_to_chemlib
compound_lib = conop.CompoundLib.Load(compound_lib_path)
conop.SetDefaultLib(compound_lib)
io.profiles['DEFAULT'].processor = conop.RuleBasedProcessor(compound_lib)
# check if we already have an OST PrefixPath
try:
ost.GetSharedDataPath()
except RuntimeError, rt_err:
ost.SetPrefixPath("/import/bc2/apps/OpenStructure/1.4.0-goolf-1.4.10_20150306")
except:
raise
# check if we do have a compounds library
if not conop.GetDefaultLib():
SetCompoundsChemlib()
__all__ = ('SetCompoundsChemlib',)
# LocalWords: OST os ost conop io SetCompoundsChemlib CHEMLIB param chemlib
# LocalWords: str SetDefaultLib RuleBasedProcessor PrefixPath RuntimeError
# LocalWords: GetSharedDataPath SetPrefixPath GetDefaultLib