[ase-users] [EXTERNAL] Potential Pubchem API Integration
Hermes, Eric
ehermes at sandia.gov
Fri Aug 9 23:19:24 CEST 2019
I really like this idea. Please consider creating a MR on gitlab.
I would think this functionality should go in ase.data. It looks like ase.data.isotopes does something similar with physics.nist.gov to get isotope information, so ASE connecting to NIST isn't completely unheard of.
The function should probably also return a list of Atoms objects, since pubchem will provide multiple conformers. We may also want to improve the "sdf" parser so that it stores PUBCHEM_MMFF94_PARTIAL_CHARGES in arrays['initial_charges'].
It also looks like the URL needs to have "?record_type=3d" at the end, otherwise everything gets squashed into the xy-plane.
--
Eric Hermes
Postdoctoral Researcher
Sandia National Laboratories
On 8/9/19, 13:01, "ase-users-bounces at listserv.fysik.dtu.dk on behalf of Ben Comer via ase-users" <ase-users-bounces at listserv.fysik.dtu.dk on behalf of ase-users at listserv.fysik.dtu.dk> wrote:
Hello all,
I've noticed that ASE has a very limited number of molecules that can be
easily made into an atoms object. An easy fix for this could be to
integrate a restful API to a chemical database to query and pull in
structures from the internet. Pubchem
(https://pubchem.ncbi.nlm.nih.gov/) might make sense for this, since it
does not require an API key to access. We could just use the requests
library to access molecules by name (or anything else, like cid fro
example.) Some code to access the API would be a fairly short putt, we
might make something like this:
from io import StringIO
from ase.io import read
import requests
def pubchem(name):
r =
requests.get("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/{}/sdf".format(name))
f_like = StringIO(r.text)
atoms = read(f_like, format = 'sdf')
return atoms
atoms = pubchem('ammonia')
print(atoms)
Just an idea, what do you guys think?
Thanks,
Ben Comer
_______________________________________________
ase-users mailing list
ase-users at listserv.fysik.dtu.dk
https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
More information about the ase-users
mailing list