Hi,

I wanted to know if it was possible to do the same thing as in the cookbook (1) but for conformer optimization : optimize each conformer generated but in parallel.

I want to optimize conformer generation for one molecule, because it will be a one molecule job script on a webserver.

I tried with that (part of ) code :

|def optimize(mol, id):||
||    AllChem.UFFOptimizeMolecule(mol, confId=id)||
||
||def main ():||
||
||    global options, args||
||
||    max_workers=4||
||
||    input_file = args.input||
||    sdf_output_file = args.output||
||
||    n = args.nbconf||
||
||    writer = Chem.SDWriter(sdf_output_file)||
||
||    suppl = Chem.SDMolSupplier(input_file)||
||
||    for mol in suppl:||
||        try:||
||            mol = Chem.AddHs(mol)||
||            ids = AllChem.EmbedMultipleConfs(mol, numConfs=n)||
||            ids = list(ids)||
||            # for id in ids:||
||            #     AllChem.UFFOptimizeMolecule(mol, confId=id)||
||        except:||
||            raise||
||
||        try:||
|| with futures.ProcessPoolExecutor(max_workers=max_workers) as executor:||
||                # Submit a set of asynchronous jobs||
||                jobs = []||
||                try:||
||                    for id in ids:||
||                        job = executor.submit(optimize, mol, id)||
||                        jobs.append(job)||
||                except:||
||                    raise||
||
||                for job in futures.as_completed(jobs):||
||                    for id in ids:||
||                        writer.write(mol, confId=id)||
||            writer.close()||
||        except:||
||            raise|

But with nbconf = 10, it generate 100 conformers. So i suspect something wrong with the optimization function and the job management.


(1) http://www.rdkit.org/docs/Cookbook.html#parallel-conformation-generation

Thank you.
------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to