Chemistry Reference
In-Depth Information
tname = ""
else:
tname = name
if coords is not None:
tcoords = eval( (coords.replace('{','[')).replace('}',']') )
molfile = [];
molfile.append(tname)
molfile.append(' gNova FROWNS smiles_to_molfile')
molfile.append(smi)
atoms = mol.atoms
bonds = mol.bonds
molfile.append("%3d%3d%3d%3d%3d%3d%3d%3d%3d%6d V%4d" % (len(atoms),
len(bonds), 0, 0, 0, 0, 0, 0, 0, 999, 2000))
# oddball mapping of charges
#cmap[-3] = 7
#cmap[-2] = 6
#cmap[-1] = 5
#cmap[0] = 0
#cmap[1] = 3
#cmap[2] = 2
#cmap[3] = 1
cmap = [7,6,5,0,3,2,1]
for a in atoms:
if coords is not None:
(x,y,z) = (tcoords[a.index][0], tcoords[a.index][1], tcoords[a.
index][2])
molfile.append(" %9.4f %9.4f %9.4f %-2s%3d%3d%3d%3d%3d%3d%3d%3d%3
d%3d%3d%3d" % (x,y,z, a.symbol, 0,cmap[3+a.
charge],0,0,0,0,0,0,0,0,0,0))
for b in bonds:
molfile.append("%3d%3d%3d%3d%3d%3d%3d" % (b.atoms[0].index+1,
b.atoms[1].index+1, b.bondtype,0,0,0,0))
for a in atoms:
if a.charge:
molfile.append("M CHG%3d %3d %3d" % (1, a.index+1, a.charge))
molfile.append("M END")
molfile.append("$$$$")
return "\n".join(molfile)
$EOPY$ Language plpythonu;
Create Or Replace Function frowns.smiles_to_molfile(smi Text, name
Text) Returns Text As $EOSQL$
Select frowns.smiles_to_molfile($1, $2, null);
$EOSQL$ Language SQL;
Create Or Replace Function frowns.smiles_to_molfile(smi Text)
Returns Text As $EOSQL$
Select frowns.smiles_to_molfile($1, null, null);
$EOSQL$ Language SQL;
Search WWH ::




Custom Search