Source code for schrodinger.application.livedesign.ld_import
# -*- coding: utf-8 -*-
"""
Classes used for LiveDesign import GUIs.
Copyright Schrödinger, LLC. All rights reserved.
"""
from pathlib import Path
from schrodinger import get_maestro
from schrodinger import structure
from schrodinger.utils import fileutils
maestro = get_maestro()
[docs]def import_structures_to_maestro(sts):
"""
Imports structures into maestro all at once by way of a file
:param sts: Structures to import
:type sts: list(structure.Structure)
:return: Name of group that structures were imported to
:rtype: str
"""
pt = maestro.project_table_get()
with fileutils.tempfilename('ld_import_', '.mae') as outfile_path:
# Save outfile path name as this is how we identify the group created
group_name = Path(outfile_path).stem
with structure.StructureWriter(outfile_path) as writer:
writer.extend(sts)
pt.importStructureFile(outfile_path)
return group_name