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)
}
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;
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;
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];
}
}
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));
/* 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. */
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);
/*
* 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];
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);
}
/*
* 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;
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;
#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);