cctk.MOL2File¶
- class cctk.MOL2File(name=None)[source]¶
Bases:
File
Class representing SYBYL
.mol2
files.- name¶
name of file
- Type:
str
Methods
__init__
([name])append_to_file
(filename, text)Appends output text to a file.
get_molecule
([num])Returns the last molecule from the ensemble.
read_file
(filename[, name])Reads
.mol2
file and generates aMOL2File
instance.write_ensemble_to_file
(filename, ensemble)Write each structure in the specified ensemble to a single mol2 file.
write_file
(filename[, molecule])Write a
.mol2
file, using object attributes.write_molecule_to_file
(filename, molecule[, ...])Write a
.gjf
file using the given molecule.- static append_to_file(filename, text)¶
Appends output text to a file.
- Parameters:
filename (str) – path to file, including name (e.g.
path/to/input.gjf
)text (str) – desired contents of file
- Returns:
True
if write succeeded,False
otherwise
- get_molecule(num=None)[source]¶
Returns the last molecule from the ensemble.
If
num
is specified, returnsself.ensemble.molecules[num]
- classmethod read_file(filename, name=None, **kwargs)[source]¶
Reads
.mol2
file and generates aMOL2File
instance.- Parameters:
filename (str) – path to file
name (str) – name of the file
- Returns:
MOL2File object
- classmethod write_ensemble_to_file(filename, ensemble)[source]¶
Write each structure in the specified ensemble to a single mol2 file.
- Parameters:
filename (str) – where to write the file
ensemble (Ensemble) –
Ensemble
object to write
- write_file(filename, molecule=-1, **kwargs)[source]¶
Write a
.mol2
file, using object attributes.- Parameters:
filename (str) – path to the new file
molecule (int) – which molecule to use – passed to
self.get_molecule()
. Default is -1 (e.g. the last molecule), but positive integers will select from self.ensemble.molecules (0-indexed). AMolecule
object can also be passed, in which case that molecule will be written to the file.
- classmethod write_molecule_to_file(filename, molecule, title=None, append=False)[source]¶
Write a
.gjf
file using the given molecule.- Parameters:
filename (str) – path to the new file
molecule (Molecule) – which molecule to use – a``Molecule`` object.
title (str) – title of the file
append (Bool) – whether to write to file normally or append