OSDN Git Service

The order of the anisotropic thermal parameters is changed to 'b11, b22, b33, b12...
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Mon, 4 Jun 2012 14:46:18 +0000 (14:46 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Mon, 4 Jun 2012 14:46:18 +0000 (14:46 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@207 a2be9bc6-48de-4e38-9406-05402d4bc13c

MolLib/Molecule.c
MolLib/Molecule.h
MolLib/Ruby_bind/ruby_bind.c

index 586bb4f..5045f97 100755 (executable)
@@ -4338,7 +4338,7 @@ MoleculeWriteToTepFile(Molecule *mp, const char *fname, char *errbuf, int errbuf
                fprintf(fp, " %4.4s%22s%9.4f%9.4f%9.4f%9d\n", ap->aname, "", ap->v.x, ap->v.y, ap->v.z, 0);
                if (ap->aniso != NULL) {
                        cp = ap->aniso->bij;
-                       fprintf(fp, " %8.5f%9.6f%9.6f%9.6f%9.6f%9.6f%9d\n", cp[0], cp[1], cp[2], cp[3], cp[5], cp[4], 0);
+                       fprintf(fp, " %8.5f%9.6f%9.6f%9.6f%9.6f%9.6f%9d\n", cp[0], cp[1], cp[2], cp[3], cp[4], cp[5], 0);
                } else {
                        Double temp = ap->tempFactor;
                        if (temp <= 0)
@@ -8522,7 +8522,7 @@ MoleculeSetCell(Molecule *mp, Double a, Double b, Double c, Double alpha, Double
 }
 
 void
-MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x23, Double x31, const Double *sigmaptr)
+MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x13, Double x23, const Double *sigmaptr)
 {
        Double d, dx;
        int u = 0;
@@ -8560,8 +8560,8 @@ MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double
        anp->bij[1] = x22 * d;
        anp->bij[2] = x33 * d;
        anp->bij[3] = x12 * dx;
-       anp->bij[4] = x23 * dx;
-       anp->bij[5] = x31 * dx;
+       anp->bij[4] = x13 * dx;
+       anp->bij[5] = x23 * dx;
        if (sigmaptr != NULL) {
                anp->has_bsig = 1;
                anp->bsig[0] = sigmaptr[0] * d;
@@ -8580,15 +8580,15 @@ MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double
                anp->bij[1] *= cp->rcell[1] * cp->rcell[1];
                anp->bij[2] *= cp->rcell[2] * cp->rcell[2];
                anp->bij[3] *= cp->rcell[0] * cp->rcell[1]; /* * cos(cp->rcell[5] * kDeg2Rad); */
-               anp->bij[4] *= cp->rcell[1] * cp->rcell[2]; /* * cos(cp->rcell[3] * kDeg2Rad); */
-               anp->bij[5] *= cp->rcell[2] * cp->rcell[0]; /* * cos(cp->rcell[4] * kDeg2Rad); */
+               anp->bij[4] *= cp->rcell[2] * cp->rcell[0]; /* * cos(cp->rcell[3] * kDeg2Rad); */
+               anp->bij[5] *= cp->rcell[1] * cp->rcell[2]; /* * cos(cp->rcell[4] * kDeg2Rad); */
                if (sigmaptr != NULL) {
                        anp->bsig[0] *= cp->rcell[0] * cp->rcell[0];
                        anp->bsig[1] *= cp->rcell[1] * cp->rcell[1];
                        anp->bsig[2] *= cp->rcell[2] * cp->rcell[2];
                        anp->bsig[3] *= cp->rcell[0] * cp->rcell[1];
-                       anp->bsig[4] *= cp->rcell[1] * cp->rcell[2];
-                       anp->bsig[5] *= cp->rcell[2] * cp->rcell[0];
+                       anp->bsig[4] *= cp->rcell[2] * cp->rcell[0];
+                       anp->bsig[5] *= cp->rcell[1] * cp->rcell[2];
                }
        }
        
@@ -8600,8 +8600,8 @@ MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double
        m1[4] = anp->bij[1] / pi22;
        m1[8] = anp->bij[2] / pi22;
        m1[1] = m1[3] = anp->bij[3] / pi22;
-       m1[5] = m1[7] = anp->bij[4] / pi22;
-       m1[2] = m1[6] = anp->bij[5] / pi22;
+       m1[2] = m1[6] = anp->bij[4] / pi22;
+       m1[5] = m1[7] = anp->bij[5] / pi22;
        MatrixInvert(m1, m1);
        if (cp != NULL) {
                memmove(m2, cp->rtr, sizeof(Mat33));
index 00b0998..eee9c20 100755 (executable)
@@ -40,7 +40,7 @@ extern "C" {
                
 /*  Anisotropic thermal parameter  */
 typedef struct Aniso {
-       Double  bij[6];    /*  b11, b22, b33, b12, b23, b31 (ORTEP type 0) */
+       Double  bij[6];    /*  b11, b22, b33, b12, b13, b23 (ORTEP type 0) */
        char has_bsig;     /*  Has sigma values?  */
        Double  bsig[6];   /*  sigma values  */
        Mat33  pmat;      /*  A 3x3 matrix whose three column vectors are the principal axes of the ellipsoid. Note: If the B matrix is not positive definite, the axis length corresponding to the negative eigenvalue is replaced with 0.001.  */
@@ -351,7 +351,7 @@ AtomRef *AtomRefNew(Molecule *mol, int idx);
 void AtomRefRelease(AtomRef *aref);
 
 void MoleculeSetCell(Molecule *mp, Double a, Double b, Double c, Double alpha, Double beta, Double gamma, int convertCoordinates);
-void MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x23, Double x31, const Double *sigmap);
+void MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x13, Double x23, const Double *sigmap);
 int MoleculeSetPeriodicBox(Molecule *mp, const Vector *ax, const Vector *ay, const Vector *az, const Vector *ao, const char *periodic);
 
 int MoleculeReadCoordinatesFromFile(Molecule *mp, const char *fname, const char *ftype, char *errbuf, int errbufsize);
index dde7c6f..7c2cef9 100644 (file)
@@ -7925,12 +7925,12 @@ s_Molecule_GetViewScale(VALUE self)
 
 /*
  *  call-seq:
- *     get_view_translation -> Vector
+ *     get_view_center -> Vector
  *
- *  Get the current translation factor for the view.
+ *  Get the current center point of the view.
  */
 static VALUE
-s_Molecule_GetViewTranslation(VALUE self)
+s_Molecule_GetViewCenter(VALUE self)
 {
     Molecule *mol;
        float f[4];
@@ -7939,9 +7939,9 @@ s_Molecule_GetViewTranslation(VALUE self)
        if (mol->mview == NULL)
                return Qnil;
        TrackballGetTranslate(mol->mview->track, f);
-       v.x = f[0];
-       v.y = f[1];
-       v.z = f[2];
+       v.x = -f[0] * mol->mview->dimension;
+       v.y = -f[1] * mol->mview->dimension;
+       v.z = -f[2] * mol->mview->dimension;
        return ValueFromVector(&v);
 }
 
@@ -7992,12 +7992,12 @@ s_Molecule_SetViewScale(VALUE self, VALUE aval)
 
 /*
  *  call-seq:
- *     set_view_translation(vec) -> self
+ *     set_view_center(vec) -> self
  *
- *  Set the current translation for the view.
+ *  Set the current center point of the view.
  */
 static VALUE
-s_Molecule_SetViewTranslation(VALUE self, VALUE aval)
+s_Molecule_SetViewCenter(VALUE self, VALUE aval)
 {
     Molecule *mol;
        Vector v;
@@ -8006,9 +8006,9 @@ s_Molecule_SetViewTranslation(VALUE self, VALUE aval)
        if (mol->mview == NULL)
                return Qnil;
        VectorFromValue(aval, &v);
-       f[0] = v.x;
-       f[1] = v.y;
-       f[2] = v.z;
+       f[0] = -v.x / mol->mview->dimension;
+       f[1] = -v.y / mol->mview->dimension;
+       f[2] = -v.z / mol->mview->dimension;
        TrackballSetTranslate(mol->mview->track, f);
        MainViewCallback_setNeedsDisplay(mol->mview, 0);
        return self;
@@ -9037,10 +9037,10 @@ Init_Molby(void)
 #if !defined(__CMDMAC__)
        rb_define_method(rb_cMolecule, "get_view_rotation", s_Molecule_GetViewRotation, 0);
        rb_define_method(rb_cMolecule, "get_view_scale", s_Molecule_GetViewScale, 0);
-       rb_define_method(rb_cMolecule, "get_view_translation", s_Molecule_GetViewTranslation, 0);
+       rb_define_method(rb_cMolecule, "get_view_center", s_Molecule_GetViewCenter, 0);
        rb_define_method(rb_cMolecule, "set_view_rotation", s_Molecule_SetViewRotation, 2);
        rb_define_method(rb_cMolecule, "set_view_scale", s_Molecule_SetViewScale, 1);
-       rb_define_method(rb_cMolecule, "set_view_translation", s_Molecule_SetViewTranslation, 1);
+       rb_define_method(rb_cMolecule, "set_view_center", s_Molecule_SetViewCenter, 1);
        rb_define_method(rb_cMolecule, "set_background_color", s_Molecule_SetBackgroundColor, -1);
        rb_define_method(rb_cMolecule, "create_graphic", s_Molecule_CreateGraphic, -1);
        rb_define_method(rb_cMolecule, "remove_graphic", s_Molecule_RemoveGraphic, 1);