Update generate.py

This commit is contained in:
Saoge123
2023-12-04 09:14:13 +08:00
committed by GitHub
parent b70b9979c2
commit b983006478

View File

@@ -357,14 +357,12 @@ class Generate(object):
data_clone = data.clone().detach() data_clone = data.clone().detach()
out = self.run(data_clone) out = self.run(data_clone)
if out: if out:
mol, mol_NoModify = out mol, _ = out
del data_clone del data_clone
if mol is not None: if mol is not None:
#print(len(mol.GetAtoms())) #print(len(mol.GetAtoms()))
mol.SetProp('_Name', 'No_%s-%s'%(valid_conuter, out_dir)) mol.SetProp('_Name', 'No_%s-%s'%(valid_conuter, out_dir))
mol_NoModify.SetProp('_Name', 'No_%s-%s' %(valid_conuter, out_dir))
smi = Chem.MolToSmiles(mol) smi = Chem.MolToSmiles(mol)
smi_NoModify = Chem.MolToSmiles(mol_NoModify)
if with_print: if with_print:
print(smi) print(smi)
with open(out_dir+'generated.sdf', 'a') as sdf_writer: with open(out_dir+'generated.sdf', 'a') as sdf_writer: