Chemistry Reference
In-Depth Information
Begin
For i In 1 .. natoms Loop
centrum[1] = centrum[1] + amol[i][1];
centrum[2] = centrum[2] + amol[i][2];
centrum[3] = centrum[3] + amol[i][3];
End Loop;
centrum[1] = centrum[1] / natoms;
centrum[2] = centrum[2] / natoms;
centrum[3] = centrum[3] / natoms;
Return centrum;
End;
$$ Language plpgsql Immutable;
Create Or Replace Function difference(float[3], float[3]) Returns
float[3] As $$
Select ARRAY[$2[1] - $1[1],
$2[2] - $1[2],
$2[3] - $1[3]];
$$ Language SQL Immutable;
The align function might be used as follows, to align all structures in a
table to a reference structure selected by name.
Select ref.name as ref, others.name, align(ref.coords, others.coords) from
(Select name, coords from vla4.structure where name = 'BMCL-805-1') ref,
(Select name, coords from vla4.structure) others;
The align function can be expanded in many ways. For example, instead
of simply finding the center of each molecule, a substructure could be
used. This might be defined as a SMARTS match that is expected in each
of the molecules to be aligned. This would be a natural outcome of a sub-
structure search. In order to create an array of coordinates for a subset of
a molecule, the following function could be used.
Select ref.name as ref, others.name, align(ref.coords, others.coords) from
(Select name, subset(cansmiles,'CSC', coords) as coords
from vla4.structure where name = 'BMCL-805-1') ref,
(Select name, subset(cansmiles, 'CSC', coords) as coords
from vla4.structure Where matches(cansmiles, 'CSC')) others
This SQL statement is similar to the previous SQL statement, except that
the subset function is used to select only those elements of the coords
array for atoms that match the target of interest, here the substructure
CSC. The subset function is defined as follows.
Create Or Replace Function subset(smiles text, smarts text, coords
float[][3]) Returns float[][3] As $$
Declare
scoords Float[][3];
Search WWH ::




Custom Search