[MMTK] Determine atom position given restraints
Antoine Logean
al at biolinux.ch
Mon Dec 15 23:24:35 CET 2003
Rocco Moretti wrote:
>Hello all,
>
>I'm looking to build up atom positions within a molecule atomwise, given
>the relationships between the atoms. That is, I have a growing
>molecule/chain, and I'd like to add on another atom to it, given
>distance, angle and dihedral from three already positioned atoms. Is
>there a function in MMTK to do such a thing? Is there perhaps code in
>the hydrogen addition algorithm which I could hijack for that purpose?
>
>Thanks,
>-Rocco
>
>
>
>
>
yes
the code is in the findPositions method of the ConfigIO module.
The cartesian coordinate of the fourth atom are given by the
intersection of a sphere a cone and a plane.
by the way here a java code I wrote to calculate the thing :
public static Point3D putDihedral(Atom c, Atom b, Atom a, float bond,
float angle, float dihedral) {
float rad1 = angle * 3.1415926f / 180.0f;
float rad2 = dihedral * 3.1415926f / 180.0f;
float sin1 = (float) Math.sin(rad1);
float cos1 = (float) Math.cos(rad1);
float sin2 = (float) Math.sin(rad2);
float cos2 = (float) Math.cos(rad2);
float xab = a.x - b.x;
float yab = a.y - b.y;
float zab = a.z - b.z;
float rab = (float) Math.sqrt(xab*xab + yab*yab + zab*zab);
xab = xab / rab;
yab = yab / rab;
zab = zab / rab;
float xbc = b.x - c.x;
float ybc = b.y - c.y;
float zbc = b.z - c.z;
float rbc = (float) Math.sqrt(xbc*xbc + ybc*ybc + zbc*zbc);
xbc = xbc / rbc;
ybc = ybc / rbc;
zbc = zbc / rbc;
float xt = zab*ybc - yab*zbc;
float yt = xab*zbc - zab*xbc;
float zt = yab*xbc - xab*ybc;
float cosine = xab*xbc + yab*ybc + zab*zbc;
float sine = (float) Math.sqrt(1.0f-cosine*cosine);
xt = xt / sine;
yt = yt / sine;
zt = zt / sine;
float xu = yt*zab - zt*yab;
float yu = zt*xab - xt*zab;
float zu = xt*yab - yt*xab;
Point3D point = new Point3D();
point.x = a.x + bond * (xu*sin1*cos2 + xt*sin1*sin2 - xab*cos1);
point.y = a.y + bond * (yu*sin1*cos2 + yt*sin1*sin2 - yab*cos1);
point.z = a.z + bond * (zu*sin1*cos2 + zt*sin1*sin2 - zab*cos1);
return point;
}
--
-----------------------------------------------------------------------------
Antoine Logean, PhD
Computational Biochemistry and Material Science group
IBM Research Division - Zurich Research Laboratory
Saumerstrasse 4
8003 Rueschlikon - Switzerland
e-mail: alo at zurich.ibm.com
www: www.biolinux.ch
Tel: +41-1-7248969
-----------------------------------------------------------------------------
More information about the mmtk
mailing list