GLdouble p0[4];
int i, j, natoms;
const Atom *ap;
- const AtomPar *app;
+ const ElementPar *app;
GLdouble *pp, *p1;
GLdouble max[3], min[3], center[3];
float frame[4], width, height, cot15, rsin15, cot_th, rsin_th, d, trans[3];
int i, natoms, nbonds;
float r, d2, z;
const Atom *ap, *bp;
- const AtomPar *dp;
+ const ElementPar *ep;
const int *ip;
Molecule *mol;
float minDepth;
if (mview->showEllipsoids) {
r = biso2radius(ap->tempFactor) * mview->probabilityScale;
} else {
- dp = &(gDispAtomParameters[ap->atomicNumber]);
- if (dp == NULL)
+ ep = &(gElementParameters[ap->atomicNumber]);
+ if (ep == NULL)
continue;
- r = dp->radius * mview->atomRadius;
+ r = ep->radius * mview->atomRadius;
}
pa1 = pa;
pq1 = pq;
MainView_screenCenterPointOfAtom(MainView *mview, int index, float *outScreenPos)
{
const Atom *ap;
- const AtomPar *dp;
+ const ElementPar *dp;
Vector cv, pv, v;
Double rad, w;
float p[3];
VecScaleSelf(pv, w);
}
} else {
- dp = &(gDispAtomParameters[ap->atomicNumber]);
+ dp = &(gElementParameters[ap->atomicNumber]);
rad = dp->radius * mview->atomRadius;
w = rad / VecLength(pv) * 1.1;
VecScaleSelf(pv, w);
drawAtom(MainView *mview, int i1, int selected, const Vector *dragOffset, const Vector *periodicOffset)
{
const Atom *ap;
- const AtomPar *dp;
+ const ElementPar *dp;
int an1;
int expanded = 0;
Vector r1;
return;
if (ap != NULL && (ap->exflags & kAtomHiddenFlag))
return;
- dp = &(gDispAtomParameters[an1]);
+ dp = &(gElementParameters[an1]);
if (dp == NULL)
return;
if (selected) {
static void
drawBond(MainView *mview, int i1, int i2, int selected, int selected2, int draft, const Vector *dragOffset, const Vector *periodicOffset)
{
- const AtomPar *dp;
+ const ElementPar *dp;
int i, in;
int an[2];
int expanded[2];
TransformVec(&r[1], mview->mol->cell->tr, &r[1]);
} */
- dp = &(gDispAtomParameters[an[0]]);
+ dp = &(gElementParameters[an[0]]);
if (dp == NULL)
return;
if (selected && selected2) {
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, rgba);
drawCylinder(p, p + 3, mview->bondRadius, 6);
}
- dp = &(gDispAtomParameters[an[1]]);
+ dp = &(gElementParameters[an[1]]);
if (dp == NULL)
return;
if (!selected || !selected2) {
LabelRecord rec;
char buf[24], *p;
Atom *ap;
-/* const AtomPar *dp; */
+/* const ElementPar *dp; */
static float foreColor[] = {1, 1, 0, 1};
static float backColor[] = {1, 1, 1, 0};
ap = ATOM_AT_INDEX(mview->mol->atoms, index);
}
i = ElementToInt(ap->element);
if (i >= 0)
- ap->weight = gDispAtomParameters[i].weight;
+ ap->weight = gElementParameters[i].weight;
}
entries++;
} else if (strncmp(buf, "CONECT", 6) == 0 && new_unit) {
Vector r1, r2, dr;
Double a1, a2, alim;
Int newbond[2];
- AtomPar *p = gDispAtomParameters;
+ ElementPar *p = gElementParameters;
nbonds = 0;
bonds = NULL;
for (i = 0; i < mp->natoms; i++) {
ap = ATOM_AT_INDEX(mp->atoms, i);
n1 = ap->atomicNumber;
- if (n1 >= 0 && n1 < gCountDispAtomParameters)
+ if (n1 >= 0 && n1 < gCountElementParameters)
a1 = p[n1].radius;
else a1 = p[6].radius;
r1 = ap->r;
for (j = 0; j < i; j++) {
bp = ATOM_AT_INDEX(mp->atoms, j);
n2 = bp->atomicNumber;
- if (n2 >= 0 && n2 < gCountDispAtomParameters)
+ if (n2 >= 0 && n2 < gCountElementParameters)
a2 = p[n2].radius;
else a2 = p[6].radius;
r2 = bp->r;
Parameter *gBuiltinParameters = NULL;
/* Global parameter */
-AtomPar *gDispAtomParameters = NULL;
-Int gCountDispAtomParameters = 0;
+ElementPar *gElementParameters = NULL;
+Int gCountElementParameters = 0;
static Parameter *sParameterRoot = NULL;
static int sParameterUntitledCount = 0;
npar->nvdwCutoffPars = par->nvdwCutoffPars;
}
/* if (par->atomPars != NULL) {
- npar->atomPars = (AtomPar *)malloc(sizeof(AtomPar) * par->natomPars);
+ npar->atomPars = (ElementPar *)malloc(sizeof(ElementPar) * par->natomPars);
if (npar->atomPars == NULL)
goto release;
- memmove(npar->atomPars, par->atomPars, sizeof(AtomPar) * par->natomPars);
+ memmove(npar->atomPars, par->atomPars, sizeof(ElementPar) * par->natomPars);
npar->natomPars = par->natomPars;
} */
return npar;
if (index >= 0 && index < par->nvdwCutoffPars)
return (UnionPar *)(par->vdwCutoffPars + index);
else return NULL;
- /* case kAtomParType:
+ /* case kElementParType:
if (index >= 0 && index < par->natomPars)
return (UnionPar *)(par->atomPars + index);
else return NULL; */
return par->nvdwpPars;
case kVdwCutoffParType:
return par->nvdwCutoffPars;
- /* case kAtomParType:
+ /* case kElementParType:
return par->natomPars; */
default:
return 0;
return sizeof(VdwPairPar);
case kVdwCutoffParType:
return sizeof(VdwCutoffPar);
- /* case kAtomParType:
+ /* case kElementParType:
return par->natomPars; */
default:
return 0;
ip = &par->nvdwCutoffPars;
size = sizeof(VdwCutoffPar);
break;
- /* case kAtomParType:
+ /* case kElementParType:
p = &par->atomPars;
ip = &par->natomPars;
- size = sizeof(AtomPar);
+ size = sizeof(ElementPar);
break; */
default:
return -1;
ip = &par->nvdwCutoffPars;
size = sizeof(VdwCutoffPar);
break;
- /* case kAtomParType:
+ /* case kElementParType:
p = (char **)&par->atomPars;
ip = &par->natomPars;
- size = sizeof(AtomPar);
+ size = sizeof(ElementPar);
break; */
default:
return -1;
/* if (par->natomPars > 0)
fprintf(fp, "! name atomic_number radius red green blue weight\n");
for (i = 0; i < par->natomPars; i++) {
- AtomPar *app = par->atomPars + i;
+ ElementPar *app = par->atomPars + i;
s_CommentToString(buf, bufsize, app);
- fprintf(fp, "dispatom %.4s %d %f %f %f %f %f%s\n", app->name, app->number, app->radius, app->r, app->g, app->b, app->weight, buf);
+ fprintf(fp, "element %.4s %d %f %f %f %f %f%s\n", app->name, app->number, app->radius, app->r, app->g, app->b, app->weight, buf);
n++;
} */
return n;
*type = kVdwPairParType;
return (UnionPar *)(row >= 0 ? par->vdwpPars + row : NULL);
/* } else if ((row -= par->nvdwpPars + 1) < par->natomPars) {
- *type = kAtomParType;
+ *type = kElementParType;
return (UnionPar *)(row >= 0 ? par->atomPars + row : NULL); */
} else {
*type = kInvalidParType;
}
break;
}
-/* case kAtomParType: {
- AtomPar *ap = (AtomPar *)up;
+/* case kElementParType: {
+ ElementPar *ap = (ElementPar *)up;
if (ap == NULL) {
if (column >= 0 && column < 8)
snprintf(buf, bufsize, "%s", sAtomParTitles[column]);
case kDihedralParType: return (f && column > 0 && column < 5);
case kImproperParType: return (f && column > 0 && column < 5);
case kVdwPairParType: return (f && column > 0 && column < 5);
- /* case kAtomParType: return (f && column > 0 && column < 7); */
+ /* case kElementParType: return (f && column > 0 && column < 7); */
default: return 0;
}
}
#pragma mark ====== Utility Functions ======
int
-AtomParameterInitialize(const char *fname, char **outWarningMessage)
+ElementParameterInitialize(const char *fname, char **outWarningMessage)
{
char buf[1024], name[6], fullname[16];
float val[6];
}
lineNumber = 0;
while (ReadLine(buf, sizeof buf, fp, &lineNumber) > 0) {
- AtomPar *ap;
- if (strncmp(buf, "dispatom ", 9) != 0)
+ ElementPar *ep;
+ if (strncmp(buf, "element ", 8) != 0)
continue; /* Skip non-relevant lines */
fullname[0] = 0;
- if (sscanf(buf + 9, " %4s %f %f %f %f %f %f %15s", name, &val[0], &val[1], &val[2], &val[3], &val[4], &val[5], fullname) < 7) {
- asprintf(&wbuf, "%s:%d: missing parameter in DISPATOM record", fname, lineNumber);
+ if (sscanf(buf + 8, " %4s %f %f %f %f %f %f %15s", name, &val[0], &val[1], &val[2], &val[3], &val[4], &val[5], fullname) < 7) {
+ asprintf(&wbuf, "%s:%d: missing parameter in ELEMENT record", fname, lineNumber);
retval = 1;
goto exit;
}
i = (int)val[0];
if (i < 0 || i >= 200) {
- asprintf(&wbuf, "%s:%d: The atomic number (%d) in DISPATOM record is out of range", fname, lineNumber, i);
+ asprintf(&wbuf, "%s:%d: The atomic number (%d) in ELEMENT record is out of range", fname, lineNumber, i);
retval = 2;
goto exit;
}
- ap = AssignArray(&gDispAtomParameters, &gCountDispAtomParameters, sizeof(AtomPar), i, NULL);
- memmove(ap->name, name, 4);
- ap->number = i;
- ap->radius = val[1];
- ap->r = val[2];
- ap->g = val[3];
- ap->b = val[4];
- ap->weight = val[5];
+ ep = AssignArray(&gElementParameters, &gCountElementParameters, sizeof(ElementPar), i, NULL);
+ memmove(ep->name, name, 4);
+ ep->number = i;
+ ep->radius = val[1];
+ ep->r = val[2];
+ ep->g = val[3];
+ ep->b = val[4];
+ ep->weight = val[5];
fullname[15] = 0;
- memmove(ap->fullname, fullname, 16);
+ memmove(ep->fullname, fullname, 16);
}
exit:
if (fp != NULL)
ElementToInt(const char *s)
{
int i;
- AtomPar *p;
- for (i = 0, p = gDispAtomParameters; i < gCountDispAtomParameters; i++, p++) {
+ ElementPar *p;
+ for (i = 0, p = gElementParameters; i < gCountElementParameters; i++, p++) {
if (p->name[0] == toupper(s[0]) && p->name[1] == tolower(s[1]))
return p->number;
}
char *
ElementToString(Int elem, char *s)
{
- if (elem >= 0 && elem < gCountDispAtomParameters) {
- const char *cs = gDispAtomParameters[elem].name;
+ if (elem >= 0 && elem < gCountElementParameters) {
+ const char *cs = gElementParameters[elem].name;
s[0] = cs[0];
s[1] = cs[1];
s[2] = 0;
GuessAtomicNumber(const char *name, Double weight)
{
int i;
- AtomPar *p;
+ ElementPar *p;
char buf[4];
const char *cp;
- for (i = 0, p = gDispAtomParameters; i < gCountDispAtomParameters; i++, p++) {
+ for (i = 0, p = gElementParameters; i < gCountElementParameters; i++, p++) {
if (p->weight > 0.0 && fabs(weight - p->weight) < 0.1)
return p->number;
}
Double
WeightForAtomicNumber(Int elem)
{
- if (elem >= 1 && elem < gCountDispAtomParameters)
- return gDispAtomParameters[elem].weight;
+ if (elem >= 1 && elem < gCountElementParameters)
+ return gElementParameters[elem].weight;
else return 0.0;
}
Double
RadiusForAtomicNumber(Int elem)
{
- if (elem >= 1 && elem < gCountDispAtomParameters)
- return gDispAtomParameters[elem].radius;
+ if (elem >= 1 && elem < gCountElementParameters)
+ return gElementParameters[elem].radius;
else return 0.0;
}
kVdwParType, kVdwPairParType, kVdwCutoffParType,
kFirstParType = kBondParType,
kLastParType = kVdwCutoffParType,
- kAtomParType = 100 /* Only used in rb_cParameterRef */
+ kElementParType = 100 /* Only used in rb_cParameterRef */
};
/* Parameter Lookup options */
} VdwCutoffPar;
/* Display parameters (defined for elements) */
-typedef struct AtomPar {
+typedef struct ElementPar {
Int com, src; /* Index to the comment array */
Int number; /* Atomic number */
char name[4];
Double r, g, b; /* Color: [0.0, 1.0] for each component */
Double weight;
char fullname[16];
-} AtomPar;
+} ElementPar;
typedef struct Parameter {
Object base;
Int nvdwCutoffPars;
VdwCutoffPar *vdwCutoffPars;
/* Int natomPars;
- AtomPar *atomPars;
+ ElementPar *atomPars;
Int ncomments;
char **comments; */
} Parameter;
VdwPar vdw;
VdwPairPar vdwp;
VdwCutoffPar vdwcutoff;
- AtomPar atom;
+ ElementPar atom;
} UnionPar;
Parameter *ParameterNew(void);
VdwPairPar *ParameterLookupVdwPairPar(Parameter *par, UInt t1, UInt t2, Int options);
VdwCutoffPar *ParameterLookupVdwCutoffPar(Parameter *par, UInt t1, UInt t2, Int options);
-int AtomParameterInitialize(const char *fname, char **outWarningMessage);
+int ElementParameterInitialize(const char *fname, char **outWarningMessage);
UInt AtomTypeEncodeToUInt(const char *s);
char *AtomTypeDecodeToString(UInt type, char *s);
Int ElementToInt(const char *s);
int ParameterTableIsItemEditable(Parameter *par, int column, int row);
extern Parameter *gBuiltinParameters;
-extern AtomPar *gDispAtomParameters;
-extern Int gCountDispAtomParameters;
+extern ElementPar *gElementParameters;
+extern Int gCountElementParameters;
#ifdef __cplusplus
}
Data_Get_Struct(self, ParameterRef, pref);
if (typep != NULL)
*typep = pref->parType;
- if (pref->parType == kAtomParType) {
- up = (UnionPar *)&gDispAtomParameters[pref->idx];
+ if (pref->parType == kElementParType) {
+ up = (UnionPar *)&gElementParameters[pref->idx];
} else {
up = ParameterRefGetPar(pref);
if (checkEditable && up->bond.src != 0 && up->bond.src != -1)
}
static const char *s_ParameterTypeNames[] = {
- "bond", "angle", "dihedral", "improper", "vdw", "vdw_pair", "vdw_cutoff", "atom"
+ "bond", "angle", "dihedral", "improper", "vdw", "vdw_pair", "vdw_cutoff", "element"
};
static ID s_ParameterTypeIDs[8] = {0, 0, 0, 0, 0, 0, 0, 0};
for (i = 0; i < n; i++) {
if (valid == s_ParameterTypeIDs[i]) {
if (i == 7)
- return kAtomParType;
+ return kElementParType;
else return kFirstParType + i;
}
}
static VALUE s_ParameterRef_GetParType(VALUE self) {
Int tp;
s_UnionParFromValue(self, &tp, 0);
- if (tp == kAtomParType)
- return rb_str_new2("atom");
+ if (tp == kElementParType)
+ return rb_str_new2("element");
tp -= kFirstParType;
if (tp >= 0 && tp < sizeof(s_ParameterTypeNames) / sizeof(s_ParameterTypeNames[0]))
return rb_str_new2(s_ParameterTypeNames[tp]);
UnionPar *up;
Int tp;
up = s_UnionParFromValue(self, &tp, 0);
- if (tp == kAtomParType)
+ if (tp == kElementParType)
return rb_float_new(up->atom.radius);
else rb_raise(rb_eMolbyError, "invalid member radius");
}
UnionPar *up;
Int tp;
up = s_UnionParFromValue(self, &tp, 0);
- if (tp == kAtomParType)
+ if (tp == kElementParType)
return rb_ary_new3(3, rb_float_new(up->atom.r), rb_float_new(up->atom.g), rb_float_new(up->atom.b));
else rb_raise(rb_eMolbyError, "invalid member color");
}
* call-seq:
* atomic_number -> Integer
*
- * Get the atomic number for the atom display parameter.
+ * Get the atomic number for the vdw or atom parameter.
*/
static VALUE s_ParameterRef_GetAtomicNumber(VALUE self) {
UnionPar *up;
Int tp;
up = s_UnionParFromValue(self, &tp, 0);
- if (tp == kAtomParType)
+ if (tp == kElementParType)
return INT2NUM(up->atom.number);
+ else if (tp == kVdwParType)
+ return INT2NUM(up->vdw.atomicNumber);
else rb_raise(rb_eMolbyError, "invalid member atomic_number");
}
UnionPar *up;
Int tp;
up = s_UnionParFromValue(self, &tp, 0);
- if (tp == kAtomParType) {
+ if (tp == kElementParType) {
char name[5];
strncpy(name, up->atom.name, 4);
name[4] = 0;
UnionPar *up;
Int tp;
up = s_UnionParFromValue(self, &tp, 0);
- if (tp == kAtomParType)
+ if (tp == kElementParType)
return rb_float_new(up->atom.weight);
else if (tp == kVdwParType)
return rb_float_new(up->vdw.weight);
UnionPar *up;
Int tp;
up = s_UnionParFromValue(self, &tp, 0);
- if (tp == kAtomParType) {
+ if (tp == kElementParType) {
char fullname[16];
strncpy(fullname, up->atom.fullname, 15);
fullname[15] = 0;
oldval = s_ParameterRef_GetRadius(self);
oldsrc = up->bond.src;
val = rb_Float(val);
- if (tp == kAtomParType) {
+ if (tp == kElementParType) {
up->atom.radius = NUM2DBL(val);
} else rb_raise(rb_eMolbyError, "invalid member radius");
s_RegisterUndoForParameterAttrChange(self, s_RadiusSym, val, oldval, oldsrc);
if (RARRAY_LEN(val) != 3)
rb_raise(rb_eMolbyError, "value should be an array of three floats (r, g, b)");
valp = RARRAY_PTR(val);
- if (tp == kAtomParType) {
+ if (tp == kElementParType) {
up->atom.r = NUM2DBL(rb_Float(valp[0]));
up->atom.g = NUM2DBL(rb_Float(valp[1]));
up->atom.b = NUM2DBL(rb_Float(valp[2]));
oldval = s_ParameterRef_GetAtomicNumber(self);
oldsrc = up->bond.src;
val = rb_Integer(val);
- if (tp == kAtomParType)
+ if (tp == kElementParType)
up->atom.number = NUM2INT(val);
- else rb_raise(rb_eMolbyError, "invalid member atomic_number");
+ else if (tp == kVdwParType) {
+ up->vdw.atomicNumber = NUM2INT(val);
+ up->vdw.weight = WeightForAtomicNumber(up->vdw.atomicNumber);
+ } else rb_raise(rb_eMolbyError, "invalid member atomic_number");
s_RegisterUndoForParameterAttrChange(self, s_AtomicNumberSym, val, oldval, oldsrc);
return val;
}
up = s_UnionParFromValue(self, &tp, 1);
oldval = s_ParameterRef_GetName(self);
oldsrc = up->bond.src;
- if (tp == kAtomParType) {
+ if (tp == kElementParType) {
strncpy(up->atom.name, StringValuePtr(val), 4);
} else rb_raise(rb_eMolbyError, "invalid member name");
s_RegisterUndoForParameterAttrChange(self, s_NameSym, val, oldval, oldsrc);
oldval = s_ParameterRef_GetWeight(self);
oldsrc = up->bond.src;
up = s_UnionParFromValue(self, &tp, 1);
- if (tp == kAtomParType)
+ if (tp == kElementParType)
up->atom.weight = NUM2DBL(val);
else if (tp == kVdwParType)
up->vdw.weight = NUM2DBL(val);
up = s_UnionParFromValue(self, &tp, 1);
oldval = s_ParameterRef_GetFullName(self);
oldsrc = up->bond.src;
- if (tp == kAtomParType) {
+ if (tp == kElementParType) {
strncpy(up->atom.fullname, StringValuePtr(val), 15);
up->atom.fullname[15] = 0;
} else rb_raise(rb_eMolbyError, "invalid member fullname");
Data_Get_Struct(self, ParameterRef, pref);
switch (pref->parType) {
case kBondParType:
- return rb_ary_new3(5, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_KSym, s_R0Sym);
+ return rb_ary_new3(7, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_KSym, s_R0Sym, s_CommentSym, s_SourceSym);
case kAngleParType:
- return rb_ary_new3(5, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_KSym, s_A0Sym);
+ return rb_ary_new3(7, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_KSym, s_A0Sym, s_CommentSym, s_SourceSym);
case kDihedralParType:
case kImproperParType:
- return rb_ary_new3(7, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_MultSym, s_KSym, s_PeriodSym, s_Phi0Sym);
+ return rb_ary_new3(9, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_MultSym, s_KSym, s_PeriodSym, s_Phi0Sym, s_CommentSym, s_SourceSym);
case kVdwParType:
- return rb_ary_new3(12, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_AtomicNumberSym, s_ASym, s_BSym, s_ReqSym, s_EpsSym, s_A14Sym, s_B14Sym, s_Req14Sym, s_Eps14Sym);
+ return rb_ary_new3(14, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_AtomicNumberSym, s_ASym, s_BSym, s_ReqSym, s_EpsSym, s_A14Sym, s_B14Sym, s_Req14Sym, s_Eps14Sym, s_CommentSym, s_SourceSym);
case kVdwPairParType:
- return rb_ary_new3(11, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_ASym, s_BSym, s_ReqSym, s_EpsSym, s_A14Sym, s_B14Sym, s_Req14Sym, s_Eps14Sym);
+ return rb_ary_new3(13, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_ASym, s_BSym, s_ReqSym, s_EpsSym, s_A14Sym, s_B14Sym, s_Req14Sym, s_Eps14Sym, s_CommentSym, s_SourceSym);
case kVdwCutoffParType:
- return rb_ary_new3(4, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_CutoffSym);
- case kAtomParType:
- return rb_ary_new3(7, s_IndexSym, s_ParTypeSym, s_AtomicNumberSym, s_NameSym, s_RadiusSym, s_ColorSym, s_WeightSym);
+ return rb_ary_new3(6, s_IndexSym, s_ParTypeSym, s_AtomTypesSym, s_CutoffSym, s_CommentSym, s_SourceSym);
+ case kElementParType:
+ return rb_ary_new3(10, s_IndexSym, s_ParTypeSym, s_AtomicNumberSym, s_NameSym, s_FullNameSym, s_RadiusSym, s_ColorSym, s_WeightSym, s_CommentSym, s_SourceSym);
default:
rb_raise(rb_eMolbyError, "internal error: invalid parameter type");
}
else
snprintf(buf, sizeof buf, "vdwcutoff %d %d %d %d %8.4f", up->vdwcutoff.n1, up->vdwcutoff.n2, up->vdwcutoff.n3, up->vdwcutoff.n4, up->vdwcutoff.cutoff);
break;
- case kAtomParType:
- snprintf(buf, sizeof buf, "dispatom %2.2s %3d %6.3f %6.3f %6.3f %6.3f %8.4f %s", up->atom.name, up->atom.number, up->atom.radius, up->atom.r, up->atom.g, up->atom.b, up->atom.weight, up->atom.fullname);
+ case kElementParType:
+ snprintf(buf, sizeof buf, "element %2.2s %3d %6.3f %6.3f %6.3f %6.3f %8.4f %s", up->atom.name, up->atom.number, up->atom.radius, up->atom.r, up->atom.g, up->atom.b, up->atom.weight, up->atom.fullname);
break;
}
return rb_str_new2(buf);
/*
* call-seq:
- * atom(idx) -> ParameterRef
- * atom(t1) -> ParameterRef
+ * element(idx) -> ParameterRef
+ * element(t1) -> ParameterRef
*
- * In the first form, the index-th atom parameter record is returned. In the second
- * form, the atom parameter for t1 is looked up (the last index first). t1
+ * In the first form, the index-th element parameter record is returned. In the second
+ * form, the element parameter for t1 is looked up (the last index first). t1
* is the element name string (up to 4 characters).
- * Unlike other Parameter methods, this is used only as a singleton method, because
- * the all atom parameters are global.
+ * Unlike other Parameter methods, this is used only for the global parameter.
*/
static VALUE
-s_Parameter_Atom(VALUE self, VALUE ival)
+s_Parameter_Element(VALUE self, VALUE ival)
{
Int idx1;
if (rb_obj_is_kind_of(ival, rb_cNumeric)) {
- int n = gCountDispAtomParameters;
+ int n = gCountElementParameters;
idx1 = NUM2INT(rb_Integer(ival));
if (idx1 < -n || idx1 >= n)
- rb_raise(rb_eMolbyError, "Atom parameter index (%d) out of range", idx1);
+ rb_raise(rb_eMolbyError, "Element parameter index (%d) out of range", idx1);
if (idx1 < 0)
idx1 += n;
- return ValueFromMoleculeWithParameterTypeAndIndex(NULL, kAtomParType, idx1);
+ return ValueFromMoleculeWithParameterTypeAndIndex(NULL, kElementParType, idx1);
} else {
- AtomPar *ap;
+ ElementPar *ep;
char name[6];
int i;
strncpy(name, StringValuePtr(ival), 4);
name[4] = 0;
- for (i = gCountDispAtomParameters - 1, ap = gDispAtomParameters + i; i >= 0; i--) {
- if (strncmp(ap->name, name, 4) == 0)
- return ValueFromMoleculeWithParameterTypeAndIndex(NULL, kAtomParType, i);
+ for (i = gCountElementParameters - 1, ep = gElementParameters + i; i >= 0; i--) {
+ if (strncmp(ep->name, name, 4) == 0)
+ return ValueFromMoleculeWithParameterTypeAndIndex(NULL, kElementParType, i);
}
return Qnil;
}
/*
* call-seq:
- * natoms -> Integer
+ * nelements -> Integer
*
- * Returns the number of atom parameters.
+ * Returns the number of element parameters.
*/
static VALUE
-s_Parameter_Natoms(VALUE self)
+s_Parameter_Nelements(VALUE self)
{
- return INT2NUM(gCountDispAtomParameters);
+ return INT2NUM(gCountElementParameters);
}
/*
/*
* call-seq:
- * atoms -> ParEnumerable
+ * elements -> ParEnumerable
*
- * Returns a ParEnumerable value that (formally) points to the collection of atom parameters.
- * Parameter.atoms[x] is equivalent to Parameter.atom(x). ParEnumerable class is
+ * Returns a ParEnumerable value that (formally) points to the collection of element parameters.
+ * Parameter.elements[x] is equivalent to Parameter.element(x). ParEnumerable class is
* useful when all accessible parameters should be examined by use of 'each' method.
*/
static VALUE
-s_Parameter_Atoms(VALUE self)
+s_Parameter_Elements(VALUE self)
{
Molecule *mol = s_MoleculeFromParameterOrParEnumerableValue(self);
- return s_NewParEnumerableValueFromMoleculeAndType(mol, kAtomParType);
+ return s_NewParEnumerableValueFromMoleculeAndType(mol, kElementParType);
}
static VALUE
/*
* call-seq:
+ * par_type -> String
+ *
+ * Get the parameter type, like "bond", "angle", etc.
+ */
+static VALUE
+s_ParEnumerable_ParType(VALUE self) {
+ ParEnumerable *pen;
+ Int tp;
+ Data_Get_Struct(self, ParEnumerable, pen);
+ tp = pen->parType;
+ if (tp == kElementParType)
+ return rb_str_new2("element");
+ tp -= kFirstParType;
+ if (tp >= 0 && tp < sizeof(s_ParameterTypeNames) / sizeof(s_ParameterTypeNames[0]))
+ return rb_str_new2(s_ParameterTypeNames[tp]);
+ else rb_raise(rb_eMolbyError, "Internal error: parameter type tag is out of range (%d)", tp);
+}
+
+/*
+ * call-seq:
* self[idx] -> ParameterRef
*
* Call the accessor of the Parameter object from which this ParEnumerable object is derived from.
* parent Parameter object of self.
*
* <b>See Also</b>: Parameter#bond, Parameter#angle, Parameter#dihedral, Parameter#improper,
- * Parameter#vdw, Parameter#vdw_pair, Parameter#vdw_cutoff, Parameter#atom.
+ * Parameter#vdw, Parameter#vdw_pair, Parameter#vdw_cutoff, Parameter#element.
*/
static VALUE
s_ParEnumerable_Aref(VALUE self, VALUE ival)
case kVdwParType: return s_Parameter_Vdw(self, ival);
case kVdwPairParType: return s_Parameter_VdwPair(self, ival);
case kVdwCutoffParType: return s_Parameter_VdwCutoff(self, ival);
- case kAtomParType: return s_Parameter_Atom(self, ival);
+ case kElementParType: return s_Parameter_Element(self, ival);
default:
rb_raise(rb_eMolbyError, "internal error: unknown parameter type (%d)", pen->parType);
}
case kVdwParType: return s_Parameter_Nvdws(self);
case kVdwPairParType: return s_Parameter_NvdwPairs(self);
case kVdwCutoffParType: return s_Parameter_NvdwCutoffs(self);
- case kAtomParType: return s_Parameter_Natoms(self);
+ case kElementParType: return s_Parameter_Nelements(self);
default:
rb_raise(rb_eMolbyError, "internal error: unknown parameter type (%d)", pen->parType);
}
ParameterRef *pref;
int i, ofs, n;
Data_Get_Struct(self, ParEnumerable, pen);
- if (pen->parType == kAtomParType)
- n = gCountDispAtomParameters;
+ if (pen->parType == kElementParType)
+ n = gCountElementParameters;
else {
switch (pen->parType) {
case kBondParType: ofs = offsetof(Parameter, nbondPars); break;
ParameterRef *pref;
int i, ofs, n;
Data_Get_Struct(self, ParEnumerable, pen);
- if (pen->parType == kAtomParType)
- n = gCountDispAtomParameters;
+ if (pen->parType == kElementParType)
+ n = gCountElementParameters;
else {
switch (pen->parType) {
case kBondParType: ofs = offsetof(Parameter, nbondPars); break;
rb_define_method(rb_cParameter, "vdw", s_Parameter_Vdw, 1);
rb_define_method(rb_cParameter, "vdw_pair", s_Parameter_VdwPair, 1);
rb_define_method(rb_cParameter, "vdw_cutoff", s_Parameter_VdwCutoff, 1);
- rb_define_method(rb_cParameter, "atom", s_Parameter_Atom, 1);
+ rb_define_method(rb_cParameter, "element", s_Parameter_Element, 1);
rb_define_method(rb_cParameter, "nbonds", s_Parameter_Nbonds, 0);
rb_define_method(rb_cParameter, "nangles", s_Parameter_Nangles, 0);
rb_define_method(rb_cParameter, "ndihedrals", s_Parameter_Ndihedrals, 0);
rb_define_method(rb_cParameter, "nvdws", s_Parameter_Nvdws, 0);
rb_define_method(rb_cParameter, "nvdw_pairs", s_Parameter_NvdwPairs, 0);
rb_define_method(rb_cParameter, "nvdw_cutoffs", s_Parameter_NvdwCutoffs, 0);
- rb_define_method(rb_cParameter, "natoms", s_Parameter_Natoms, 0);
+ rb_define_method(rb_cParameter, "nelements", s_Parameter_Nelements, 0);
rb_define_method(rb_cParameter, "bonds", s_Parameter_Bonds, 0);
rb_define_method(rb_cParameter, "angles", s_Parameter_Angles, 0);
rb_define_method(rb_cParameter, "dihedrals", s_Parameter_Dihedrals, 0);
rb_define_method(rb_cParameter, "vdws", s_Parameter_Vdws, 0);
rb_define_method(rb_cParameter, "vdw_pairs", s_Parameter_VdwPairs, 0);
rb_define_method(rb_cParameter, "vdw_cutoffs", s_Parameter_VdwCutoffs, 0);
- rb_define_method(rb_cParameter, "atoms", s_Parameter_Atoms, 0);
+ rb_define_method(rb_cParameter, "elements", s_Parameter_Elements, 0);
rb_define_method(rb_cParameter, "lookup", s_Parameter_LookUp, -1);
rb_define_const(rb_cParameter, "Builtin", Data_Wrap_Struct(rb_cParameter, 0, NULL, NULL));
/*
/* class ParEnumerable */
rb_cParEnumerable = rb_define_class("ParEnumerable", rb_cObject);
rb_include_module(rb_cParEnumerable, rb_mEnumerable);
+ rb_define_method(rb_cParEnumerable, "par_type", s_ParEnumerable_ParType, 0);
rb_define_method(rb_cParEnumerable, "[]", s_ParEnumerable_Aref, 1);
rb_define_method(rb_cParEnumerable, "length", s_ParEnumerable_Length, 0);
rb_define_method(rb_cParEnumerable, "each", s_ParEnumerable_Each, 0);
+++ /dev/null
-; Atom display parameters
-; symbol, atomic number, radius, color (r,g,b), weight, fullname
-; The atomic radii are taken from http://www.webelements.com/.
-; The 'covalent' radii are taken where available; otherwise,
-; the 'atomic' radii are used.
-
-dispatom Du 0 0.35 0.000 1.000 0.000 0.0000 dummy
-dispatom H 1 0.37 0.564 1.000 0.965 1.0079 hydrogen
-dispatom He 2 0.32 0.500 0.500 0.500 4.0026 helium
-dispatom Li 3 1.34 0.500 0.500 0.500 6.9410 lithium
-dispatom Be 4 0.90 0.500 0.500 0.500 9.0122 beryllium
-dispatom B 5 0.82 0.500 0.500 0.500 10.811 boron
-dispatom C 6 0.77 0.784 0.784 0.784 12.0107 carbon
-dispatom N 7 0.75 0.588 0.706 1.000 14.0067 nitrogen
-dispatom O 8 0.73 1.000 0.569 0.592 15.9994 oxygen
-dispatom F 9 0.71 0.900 1.000 0.850 18.9984 fluorine
-dispatom Ne 10 0.69 0.500 0.500 0.500 20.1797 neon
-dispatom Na 11 1.54 0.900 0.700 0.400 22.9898 sodium
-dispatom Mg 12 1.30 1.000 0.600 0.450 24.3050 magnesium
-dispatom Al 13 1.18 0.600 0.750 0.800 26.9815 aluminum
-dispatom Si 14 1.11 0.150 0.150 0.900 28.0855 silicon
-dispatom P 15 1.06 0.800 0.800 0.300 30.9738 phosphorous
-dispatom S 16 1.02 1.000 1.000 0.200 32.066 sulfur
-dispatom Cl 17 0.99 0.100 1.000 0.000 35.4527 chlorine
-dispatom Ar 18 0.97 0.500 0.500 0.500 39.948 argon
-dispatom K 19 1.96 0.800 0.450 0.800 39.0983 potassium
-dispatom Ca 20 1.74 0.620 0.660 0.800 40.078 calcium
-dispatom Sc 21 1.44 0.580 0.500 0.620 44.9559 scandium
-dispatom Ti 22 1.36 0.700 0.780 0.930 47.867 titanium
-dispatom V 23 1.25 0.950 0.400 0.360 50.9415 vanadium
-dispatom Cr 24 1.27 0.500 0.400 0.500 51.9961 chromium
-dispatom Mn 25 1.39 0.750 0.250 0.710 54.9380 manganese
-dispatom Fe 26 1.25 0.770 0.560 0.240 55.845 iron
-dispatom Co 27 1.26 0.120 0.080 0.670 58.9332 cobalt
-dispatom Ni 28 1.21 0.700 0.700 0.700 58.6934 nickel
-dispatom Cu 29 1.38 0.120 0.140 0.810 63.546 copper
-dispatom Zn 30 1.31 0.600 0.550 0.600 65.39 zinc
-dispatom Ga 31 1.26 0.620 0.930 0.650 69.723 gallium
-dispatom Ge 32 1.22 0.490 0.300 0.400 72.61 germanium
-dispatom As 33 1.19 0.460 0.760 0.500 74.9216 arsenic
-dispatom Se 34 1.16 0.700 0.950 0.440 78.96 selenium
-dispatom Br 35 1.14 0.680 0.460 0.250 79.904 bromine
-dispatom Kr 36 1.10 0.500 0.500 0.500 83.80 krypton
-dispatom Rb 37 2.11 1.000 0.230 0.260 85.4678 rubidium
-dispatom Sr 38 1.92 1.000 0.200 0.950 87.62 strontium
-dispatom Y 39 1.62 0.500 0.500 0.500 88.9059 yttrium
-dispatom Zr 40 1.48 0.500 0.500 0.500 91.224 zirconium
-dispatom Nb 41 1.37 0.500 0.500 0.500 92.9064 niobium
-dispatom Mo 42 1.45 0.500 0.500 0.500 95.94 molybdenum
-dispatom Tc 43 1.56 0.500 0.500 0.500 98 technetium
-dispatom Ru 44 1.26 0.500 0.500 0.500 101.07 ruthenium
-dispatom Rh 45 1.35 0.500 0.500 0.500 102.9055 rhodium
-dispatom Pd 46 1.31 0.500 0.500 0.500 106.42 palladium
-dispatom Ag 47 1.53 0.500 0.500 0.500 107.8682 silver
-dispatom Cd 48 1.48 0.500 0.500 0.500 112.411 cadmium
-dispatom In 49 1.44 0.500 0.500 0.500 114.818 indium
-dispatom Sn 50 1.41 0.500 0.500 0.500 118.710 tin
-dispatom Sb 51 1.38 0.500 0.500 0.500 121.765 antimony
-dispatom Te 52 1.35 0.500 0.500 0.500 127.60 tellurium
-dispatom I 53 1.33 0.500 0.500 0.500 126.9048 iodine
-dispatom Xe 54 1.30 0.500 0.500 0.500 131.29 xenon
-dispatom Cs 55 2.25 0.500 0.500 0.500 132.9055 cesium
-dispatom Ba 56 1.98 0.500 0.500 0.500 137.327 barium
-dispatom La 57 1.69 0.500 0.500 0.500 138.9044 lanthanum
-dispatom Ce 58 1.85 0.500 0.500 0.500 140.116 cerium
-dispatom Pr 59 1.85 0.500 0.500 0.500 140.9077 praseodymium
-dispatom Nd 60 1.85 0.500 0.500 0.500 144.24 neodymium
-dispatom Pm 61 1.85 0.500 0.500 0.500 145 promethium
-dispatom Sm 62 1.85 0.500 0.500 0.500 150.36 samarium
-dispatom Eu 63 1.85 0.500 0.500 0.500 151.964 europium
-dispatom Gd 64 1.80 0.500 0.500 0.500 157.25 gadolinium
-dispatom Tb 65 1.75 0.500 0.500 0.500 158.9253 terbium
-dispatom Dy 66 1.75 0.500 0.500 0.500 162.50 dysprosium
-dispatom Ho 67 1.75 0.500 0.500 0.500 164.9303 holmium
-dispatom Er 68 1.75 0.500 0.500 0.500 167.26 erbium
-dispatom Tm 69 1.75 0.500 0.500 0.500 168.9342 thulium
-dispatom Yb 70 1.75 0.500 0.500 0.500 173.04 ytterbium
-dispatom Lu 71 1.60 0.500 0.500 0.500 174.967 lutetium
-dispatom Hf 72 1.50 0.500 0.500 0.500 178.49 hafnium
-dispatom Ta 73 1.38 0.500 0.500 0.500 180.9479 tantalum
-dispatom W 74 1.46 0.500 0.500 0.500 183.84 tungsten
-dispatom Re 75 1.59 0.500 0.500 0.500 186.207 rhenium
-dispatom Os 76 1.28 0.500 0.500 0.500 190.23 osmium
-dispatom Ir 77 1.37 0.500 0.500 0.500 192.217 iridium
-dispatom Pt 78 1.28 0.500 0.500 0.500 195.078 platinum
-dispatom Au 79 1.44 0.500 0.500 0.500 196.9666 gold
-dispatom Hg 80 1.49 0.500 0.500 0.500 200.59 mercury
-dispatom Tl 81 1.48 0.500 0.500 0.500 204.3833 thallium
-dispatom Pb 82 1.47 0.500 0.500 0.500 207.2 lead
-dispatom Bi 83 1.46 0.500 0.500 0.500 208.9804 bismuth
-dispatom Po 84 1.90 0.500 0.500 0.500 209 polonium
-dispatom At 85 1.80 0.500 0.500 0.500 210 astatine
-dispatom Rn 86 1.45 0.500 0.500 0.500 222 radon
-dispatom Fr 87 1.80 0.500 0.500 0.500 223 francium
-dispatom Ra 88 2.15 0.500 0.500 0.500 226.025 radium
-dispatom Ac 89 1.95 0.500 0.500 0.500 227 actinium
-dispatom Th 90 1.80 0.500 0.500 0.500 232.3081 tholium
-dispatom Pa 91 1.80 0.500 0.500 0.500 231.0359 protactinium
-dispatom U 92 1.75 0.500 0.500 0.500 238.0289 uranium
-dispatom Np 93 1.75 0.500 0.500 0.500 237 neptunium
-dispatom Pu 94 1.75 0.500 0.500 0.500 244 plutonium
-dispatom Am 95 1.75 0.500 0.500 0.500 243 americium
-dispatom Cm 96 1.75 0.500 0.500 0.500 247 curium
-dispatom Bk 97 1.75 0.500 0.500 0.500 247 berkelium
-dispatom Cf 98 1.75 0.500 0.500 0.500 251 californium
-dispatom Es 99 1.75 0.500 0.500 0.500 252 einsteinium
-dispatom Fm 100 1.75 0.500 0.500 0.500 257 fermium
-dispatom Md 101 1.75 0.500 0.500 0.500 258 mendelevium
-dispatom No 102 1.75 0.500 0.500 0.500 259 nobelium
-dispatom Lr 103 1.75 0.500 0.500 0.500 262 lawrencium
-
--- /dev/null
+; Element parameters
+; symbol, atomic number, radius, color (r,g,b), weight, fullname
+; The atomic radii are taken from http://www.webelements.com/.
+; The 'covalent' radii are taken where available; otherwise,
+; the 'atomic' radii are used.
+
+element Du 0 0.35 0.000 1.000 0.000 0.0000 dummy
+element H 1 0.37 0.564 1.000 0.965 1.0079 hydrogen
+element He 2 0.32 0.500 0.500 0.500 4.0026 helium
+element Li 3 1.34 0.500 0.500 0.500 6.9410 lithium
+element Be 4 0.90 0.500 0.500 0.500 9.0122 beryllium
+element B 5 0.82 0.500 0.500 0.500 10.811 boron
+element C 6 0.77 0.784 0.784 0.784 12.0107 carbon
+element N 7 0.75 0.588 0.706 1.000 14.0067 nitrogen
+element O 8 0.73 1.000 0.569 0.592 15.9994 oxygen
+element F 9 0.71 0.900 1.000 0.850 18.9984 fluorine
+element Ne 10 0.69 0.500 0.500 0.500 20.1797 neon
+element Na 11 1.54 0.900 0.700 0.400 22.9898 sodium
+element Mg 12 1.30 1.000 0.600 0.450 24.3050 magnesium
+element Al 13 1.18 0.600 0.750 0.800 26.9815 aluminum
+element Si 14 1.11 0.150 0.150 0.900 28.0855 silicon
+element P 15 1.06 0.800 0.800 0.300 30.9738 phosphorous
+element S 16 1.02 1.000 1.000 0.200 32.066 sulfur
+element Cl 17 0.99 0.100 1.000 0.000 35.4527 chlorine
+element Ar 18 0.97 0.500 0.500 0.500 39.948 argon
+element K 19 1.96 0.800 0.450 0.800 39.0983 potassium
+element Ca 20 1.74 0.620 0.660 0.800 40.078 calcium
+element Sc 21 1.44 0.580 0.500 0.620 44.9559 scandium
+element Ti 22 1.36 0.700 0.780 0.930 47.867 titanium
+element V 23 1.25 0.950 0.400 0.360 50.9415 vanadium
+element Cr 24 1.27 0.500 0.400 0.500 51.9961 chromium
+element Mn 25 1.39 0.750 0.250 0.710 54.9380 manganese
+element Fe 26 1.25 0.770 0.560 0.240 55.845 iron
+element Co 27 1.26 0.120 0.080 0.670 58.9332 cobalt
+element Ni 28 1.21 0.700 0.700 0.700 58.6934 nickel
+element Cu 29 1.38 0.120 0.140 0.810 63.546 copper
+element Zn 30 1.31 0.600 0.550 0.600 65.39 zinc
+element Ga 31 1.26 0.620 0.930 0.650 69.723 gallium
+element Ge 32 1.22 0.490 0.300 0.400 72.61 germanium
+element As 33 1.19 0.460 0.760 0.500 74.9216 arsenic
+element Se 34 1.16 0.700 0.950 0.440 78.96 selenium
+element Br 35 1.14 0.680 0.460 0.250 79.904 bromine
+element Kr 36 1.10 0.500 0.500 0.500 83.80 krypton
+element Rb 37 2.11 1.000 0.230 0.260 85.4678 rubidium
+element Sr 38 1.92 1.000 0.200 0.950 87.62 strontium
+element Y 39 1.62 0.500 0.500 0.500 88.9059 yttrium
+element Zr 40 1.48 0.500 0.500 0.500 91.224 zirconium
+element Nb 41 1.37 0.500 0.500 0.500 92.9064 niobium
+element Mo 42 1.45 0.500 0.500 0.500 95.94 molybdenum
+element Tc 43 1.56 0.500 0.500 0.500 98 technetium
+element Ru 44 1.26 0.500 0.500 0.500 101.07 ruthenium
+element Rh 45 1.35 0.500 0.500 0.500 102.9055 rhodium
+element Pd 46 1.31 0.500 0.500 0.500 106.42 palladium
+element Ag 47 1.53 0.500 0.500 0.500 107.8682 silver
+element Cd 48 1.48 0.500 0.500 0.500 112.411 cadmium
+element In 49 1.44 0.500 0.500 0.500 114.818 indium
+element Sn 50 1.41 0.500 0.500 0.500 118.710 tin
+element Sb 51 1.38 0.500 0.500 0.500 121.765 antimony
+element Te 52 1.35 0.500 0.500 0.500 127.60 tellurium
+element I 53 1.33 0.500 0.500 0.500 126.9048 iodine
+element Xe 54 1.30 0.500 0.500 0.500 131.29 xenon
+element Cs 55 2.25 0.500 0.500 0.500 132.9055 cesium
+element Ba 56 1.98 0.500 0.500 0.500 137.327 barium
+element La 57 1.69 0.500 0.500 0.500 138.9044 lanthanum
+element Ce 58 1.85 0.500 0.500 0.500 140.116 cerium
+element Pr 59 1.85 0.500 0.500 0.500 140.9077 praseodymium
+element Nd 60 1.85 0.500 0.500 0.500 144.24 neodymium
+element Pm 61 1.85 0.500 0.500 0.500 145 promethium
+element Sm 62 1.85 0.500 0.500 0.500 150.36 samarium
+element Eu 63 1.85 0.500 0.500 0.500 151.964 europium
+element Gd 64 1.80 0.500 0.500 0.500 157.25 gadolinium
+element Tb 65 1.75 0.500 0.500 0.500 158.9253 terbium
+element Dy 66 1.75 0.500 0.500 0.500 162.50 dysprosium
+element Ho 67 1.75 0.500 0.500 0.500 164.9303 holmium
+element Er 68 1.75 0.500 0.500 0.500 167.26 erbium
+element Tm 69 1.75 0.500 0.500 0.500 168.9342 thulium
+element Yb 70 1.75 0.500 0.500 0.500 173.04 ytterbium
+element Lu 71 1.60 0.500 0.500 0.500 174.967 lutetium
+element Hf 72 1.50 0.500 0.500 0.500 178.49 hafnium
+element Ta 73 1.38 0.500 0.500 0.500 180.9479 tantalum
+element W 74 1.46 0.500 0.500 0.500 183.84 tungsten
+element Re 75 1.59 0.500 0.500 0.500 186.207 rhenium
+element Os 76 1.28 0.500 0.500 0.500 190.23 osmium
+element Ir 77 1.37 0.500 0.500 0.500 192.217 iridium
+element Pt 78 1.28 0.500 0.500 0.500 195.078 platinum
+element Au 79 1.44 0.500 0.500 0.500 196.9666 gold
+element Hg 80 1.49 0.500 0.500 0.500 200.59 mercury
+element Tl 81 1.48 0.500 0.500 0.500 204.3833 thallium
+element Pb 82 1.47 0.500 0.500 0.500 207.2 lead
+element Bi 83 1.46 0.500 0.500 0.500 208.9804 bismuth
+element Po 84 1.90 0.500 0.500 0.500 209 polonium
+element At 85 1.80 0.500 0.500 0.500 210 astatine
+element Rn 86 1.45 0.500 0.500 0.500 222 radon
+element Fr 87 1.80 0.500 0.500 0.500 223 francium
+element Ra 88 2.15 0.500 0.500 0.500 226.025 radium
+element Ac 89 1.95 0.500 0.500 0.500 227 actinium
+element Th 90 1.80 0.500 0.500 0.500 232.3081 tholium
+element Pa 91 1.80 0.500 0.500 0.500 231.0359 protactinium
+element U 92 1.75 0.500 0.500 0.500 238.0289 uranium
+element Np 93 1.75 0.500 0.500 0.500 237 neptunium
+element Pu 94 1.75 0.500 0.500 0.500 244 plutonium
+element Am 95 1.75 0.500 0.500 0.500 243 americium
+element Cm 96 1.75 0.500 0.500 0.500 247 curium
+element Bk 97 1.75 0.500 0.500 0.500 247 berkelium
+element Cf 98 1.75 0.500 0.500 0.500 251 californium
+element Es 99 1.75 0.500 0.500 0.500 252 einsteinium
+element Fm 100 1.75 0.500 0.500 0.500 257 fermium
+element Md 101 1.75 0.500 0.500 0.500 258 mendelevium
+element No 102 1.75 0.500 0.500 0.500 259 nobelium
+element Lr 103 1.75 0.500 0.500 0.500 262 lawrencium
+
def dock_formula(str, group = selection)
if group.length == 1
# Check if the string is an element name
- Parameter.builtin.atoms.each { |par|
+ Parameter.builtin.elements.each { |par|
if par.atomic_number > 0 && par.name == str
ap = atoms[group[0]]
if ap.atomic_number != par.atomic_number
else
raise "Unknown atom type #{atype}"
end
- aname = Parameter.atom(anum).name
+ aname = Parameter.builtin.element(anum).name
name = atoms[idx].name
name = name.gsub(/\A[A-Za-z]*/, aname)[0..2]
vn.each_with_index { |v, i|
break if s=~ /\$END/
ary = s.split # (PNAME, PTYPE, IZCORE, LMAX+1)
elem = ary[0].match(/\w{1,2}/).to_a[0] # ary[0] should begin with an element name
- ap = Parameter.builtin.atoms.find { |p| p.name.casecmp(elem) == 0 }
+ ap = Parameter.builtin.elements.find { |p| p.name.casecmp(elem) == 0 }
raise MolbyError, "the ECP definition does not begin with an element name: #{s}" if !ap
ecpdef = s
ln = 1
elsif ss =~ /\W/
# Comments or other unrecognizable lines
next
- elsif (ap = Parameter.builtin.atoms.find { |p| p.name.casecmp(ss) == 0 || p.fullname.casecmp(ss) == 0 })
+ elsif (ap = Parameter.builtin.elements.find { |p| p.name.casecmp(ss) == 0 || p.fullname.casecmp(ss) == 0 })
# Valid basis definition
if bas == nil || bas =~ /\W/
bas = basename
else
# Export as an antechamber format
c = count_elements
- formula = c.map { |p| Parameter.atoms[p[0]].name + p[1].to_s }.join(" ")
+ formula = c.map { |p| Parameter.builtin.elements[p[0]].name + p[1].to_s }.join(" ")
open("respgen_in.ac", "w") { |fp|
fp.printf("CHARGE %9.2f ( %d )\n", nc, nc)
fp.printf("Formula: #{formula}\n")
Parameter#bond, ParEnumerable#[] などで、原子タイプからの探索はやめにする。また、ローカルな Parameter の nbonds などがグローバルパラメータを含んだ値を返すのはやめる。
Parameter#bond などをクラスメソッド・インスタンスメソッドとして二重に登録するのはやめた。グローバルパラメータはたとえば Parameter.builtin.atoms または Parameter::Builtin.atoms としてアクセスする。
+2010.2.27.
+ Parameter タイプの atom というのはなんとも紛らわしい。element の方がまだましかも。
wxSetWorkingDirectory(dirname);
/* Read atom display parameters */
- if (AtomParameterInitialize("dispatom.par", &wbuf) != 0) {
+ if (ElementParameterInitialize("element.par", &wbuf) != 0) {
SetConsoleColor(1);
AppendConsoleMessage(wbuf);
SetConsoleColor(0);