From d1ba15c4a7c5fb03ff37554e0004c665508d99df Mon Sep 17 00:00:00 2001 From: Yuman Hordijk Date: Mon, 18 Mar 2024 11:34:48 +0100 Subject: [PATCH] Now checking if the molecule has a comment attribute or not --- src/tcutility/molecule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tcutility/molecule.py b/src/tcutility/molecule.py index 4095f28d..0c073cb3 100644 --- a/src/tcutility/molecule.py +++ b/src/tcutility/molecule.py @@ -39,7 +39,7 @@ def save(mol: plams.Molecule, path: str, comment: str = None): """Save a molecule in a custom xyz file format. Molecule and atom flags can be provided as the "flags" parameter of the object (mol.flags and atom.flags). """ - comment = comment or mol.comment + comment = comment or mol.comment if hasattr(mol, 'comment') else '' with open(path, "w+") as f: f.write(f"{len(mol.atoms)}\n{comment}\n") for atom in mol.atoms: