OSDN Git Service

The DISPATOM parameters are renamed to ELEMENT, to avoid confusion. The Ruby commands...
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Sun, 28 Feb 2010 02:43:30 +0000 (02:43 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Sun, 28 Feb 2010 02:43:30 +0000 (02:43 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@18 a2be9bc6-48de-4e38-9406-05402d4bc13c

12 files changed:
MolLib/MainView.c
MolLib/Molecule.c
MolLib/Parameter.c
MolLib/Parameter.h
MolLib/Ruby_bind/ruby_bind.c
Scripts/dispatom.par [deleted file]
Scripts/element.par [new file with mode: 0644]
Scripts/formula.rb
Scripts/gamess.rb
Scripts/md.rb
memo.txt
wxSources/MyApp.cpp

index 654adcd..b5508c4 100755 (executable)
@@ -318,7 +318,7 @@ MainView_resizeToFit(MainView *mview)
        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];
@@ -460,7 +460,7 @@ MainView_findObjectAtPoint(MainView *mview, const float *mousePos, int *outIndex
     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;
@@ -528,10 +528,10 @@ MainView_findObjectAtPoint(MainView *mview, const float *mousePos, int *outIndex
                        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;
@@ -694,7 +694,7 @@ int
 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];
@@ -739,7 +739,7 @@ MainView_screenCenterPointOfAtom(MainView *mview, int index, float *outScreenPos
                        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);
@@ -1090,7 +1090,7 @@ static void
 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;
@@ -1142,7 +1142,7 @@ drawAtom(MainView *mview, int i1, int selected, const Vector *dragOffset, const
                return;
        if (ap != NULL && (ap->exflags & kAtomHiddenFlag))
                return;
-       dp = &(gDispAtomParameters[an1]);
+       dp = &(gElementParameters[an1]);
        if (dp == NULL)
                return;
        if (selected) {
@@ -1220,7 +1220,7 @@ drawAtom(MainView *mview, int i1, int selected, const Vector *dragOffset, const
 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];
@@ -1278,7 +1278,7 @@ drawBond(MainView *mview, int i1, int i2, int selected, int selected2, int draft
                TransformVec(&r[1], mview->mol->cell->tr, &r[1]);
        } */
 
-       dp = &(gDispAtomParameters[an[0]]);
+       dp = &(gElementParameters[an[0]]);
        if (dp == NULL)
                return;
        if (selected && selected2) {
@@ -1311,7 +1311,7 @@ drawBond(MainView *mview, int i1, int i2, int selected, int selected2, int draft
                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) {
@@ -1901,7 +1901,7 @@ MainView_attachLabelToAtom(MainView *mview, int index)
        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);
index 57568ee..6a95bfd 100755 (executable)
@@ -2428,7 +2428,7 @@ MoleculeReadCoordinatesFromPdbFile(Molecule *mp, const char *fname, char *errbuf
                                }
                                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) {
@@ -4168,13 +4168,13 @@ MoleculeGuessBonds(Molecule *mp, Double limit, Int *outNbonds, Int **outBonds)
        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;
@@ -4183,7 +4183,7 @@ MoleculeGuessBonds(Molecule *mp, Double limit, Int *outNbonds, Int **outBonds)
                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;
index 5ea5991..e6ee72c 100755 (executable)
@@ -24,8 +24,8 @@
 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;
@@ -101,10 +101,10 @@ ParameterDuplicate(const Parameter *par)
                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;
@@ -222,7 +222,7 @@ ParameterGetUnionParFromTypeAndIndex(Parameter *par, int type, int index)
                        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; */
@@ -251,7 +251,7 @@ ParameterGetCountForType(Parameter *par, int type)
                        return par->nvdwpPars;
                case kVdwCutoffParType:
                        return par->nvdwCutoffPars;
-       /*      case kAtomParType:
+       /*      case kElementParType:
                        return par->natomPars; */
                default:
                        return 0;
@@ -276,7 +276,7 @@ ParameterGetSizeForType(int type)
                        return sizeof(VdwPairPar);
                case kVdwCutoffParType:
                        return sizeof(VdwCutoffPar);
-                       /*      case kAtomParType:
+                       /*      case kElementParType:
                         return par->natomPars; */
                default:
                        return 0;
@@ -342,10 +342,10 @@ ParameterInsert(Parameter *par, Int type, const UnionPar *up, struct IntGroup *w
                        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;
@@ -402,10 +402,10 @@ sParameterDeleteOrCopy(Parameter *par, Int type, UnionPar *up, struct IntGroup *
                        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;
@@ -1196,9 +1196,9 @@ ParameterAppendToFile(Parameter *par, FILE *fp)
 /*     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;
@@ -1564,7 +1564,7 @@ ParameterTableGetItemPtr(Parameter *par, int row, int *type)
                *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;
@@ -1749,8 +1749,8 @@ ParameterTableGetItemText(Parameter *par, int column, int row, char *buf, int bu
                        }
                        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]);
@@ -1830,7 +1830,7 @@ ParameterTableIsItemEditable(Parameter *par, int column, int row)
                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;
        }
 }
@@ -1838,7 +1838,7 @@ ParameterTableIsItemEditable(Parameter *par, int column, int row)
 #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];
@@ -1853,31 +1853,31 @@ AtomParameterInitialize(const char *fname, char **outWarningMessage)
        }
        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)
@@ -1963,8 +1963,8 @@ Int
 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;
        }
@@ -1974,8 +1974,8 @@ ElementToInt(const char *s)
 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;
@@ -2009,10 +2009,10 @@ Int
 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;
        }
@@ -2035,16 +2035,16 @@ GuessAtomicNumber(const char *name, Double weight)
 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;
 }
 
index 8b1728d..39995f4 100755 (executable)
@@ -47,7 +47,7 @@ enum {
        kVdwParType, kVdwPairParType, kVdwCutoffParType,
        kFirstParType = kBondParType,
        kLastParType = kVdwCutoffParType,
-       kAtomParType = 100  /*  Only used in rb_cParameterRef  */
+       kElementParType = 100  /*  Only used in rb_cParameterRef  */
 };
        
 /*  Parameter Lookup options  */
@@ -122,7 +122,7 @@ typedef struct VdwCutoffPar {
 } 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];
@@ -130,7 +130,7 @@ typedef struct AtomPar {
        Double r, g, b;  /*  Color: [0.0, 1.0] for each component  */
        Double weight;
        char   fullname[16];
-} AtomPar;
+} ElementPar;
        
 typedef struct Parameter {
        Object base;
@@ -149,7 +149,7 @@ typedef struct Parameter {
        Int    nvdwCutoffPars;
        VdwCutoffPar *vdwCutoffPars;
 /*     Int    natomPars;
-       AtomPar *atomPars;
+       ElementPar *atomPars;
        Int    ncomments;
        char **comments;  */
 } Parameter;
@@ -169,7 +169,7 @@ typedef union UnionPar {
        VdwPar vdw;
        VdwPairPar vdwp;
        VdwCutoffPar vdwcutoff;
-       AtomPar atom;
+       ElementPar atom;
 } UnionPar;
 
 Parameter *ParameterNew(void);
@@ -213,7 +213,7 @@ VdwPar *ParameterLookupVdwPar(Parameter *par, UInt t1, Int options);
 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);
@@ -232,8 +232,8 @@ int ParameterTableGetItemSource(Parameter *par, int row);
 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
 }
index a6a340f..43d5c5b 100644 (file)
@@ -629,8 +629,8 @@ s_UnionParFromValue(VALUE self, Int *typep, Int checkEditable)
        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)
@@ -679,7 +679,7 @@ s_AtomTypeIndexFromValue(VALUE val)
 }
 
 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};
 
@@ -697,7 +697,7 @@ s_ParTypeFromValue(VALUE val)
        for (i = 0; i < n; i++) {
                if (valid == s_ParameterTypeIDs[i]) {
                        if (i == 7)
-                               return kAtomParType;
+                               return kElementParType;
                        else return kFirstParType + i;
                }
        }
@@ -725,8 +725,8 @@ static VALUE s_ParameterRef_GetIndex(VALUE self) {
 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]);
@@ -1126,7 +1126,7 @@ static VALUE s_ParameterRef_GetRadius(VALUE self) {
        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");
 }
@@ -1141,7 +1141,7 @@ static VALUE s_ParameterRef_GetColor(VALUE self) {
        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");
 }
@@ -1150,14 +1150,16 @@ static VALUE s_ParameterRef_GetColor(VALUE self) {
  *  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");
 }
 
@@ -1171,7 +1173,7 @@ static VALUE s_ParameterRef_GetName(VALUE self) {
        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;
@@ -1189,7 +1191,7 @@ static VALUE s_ParameterRef_GetWeight(VALUE self) {
        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);
@@ -1206,7 +1208,7 @@ static VALUE s_ParameterRef_GetFullName(VALUE self) {
        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;
@@ -1712,7 +1714,7 @@ static VALUE s_ParameterRef_SetRadius(VALUE self, VALUE val) {
        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);   
@@ -1730,7 +1732,7 @@ static VALUE s_ParameterRef_SetColor(VALUE self, VALUE val) {
        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]));
@@ -1747,9 +1749,12 @@ static VALUE s_ParameterRef_SetAtomicNumber(VALUE self, VALUE val) {
        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;
 }
@@ -1761,7 +1766,7 @@ static VALUE s_ParameterRef_SetName(VALUE self, VALUE 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);     
@@ -1776,7 +1781,7 @@ static VALUE s_ParameterRef_SetWeight(VALUE self, VALUE val) {
        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);
@@ -1792,7 +1797,7 @@ static VALUE s_ParameterRef_SetFullName(VALUE self, VALUE 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");
@@ -1894,20 +1899,20 @@ s_ParameterRef_Keys(VALUE self)
        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");
        }
@@ -1977,8 +1982,8 @@ s_ParameterRef_ToString(VALUE self)
                        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);
@@ -2228,36 +2233,35 @@ s_Parameter_VdwCutoff(VALUE self, VALUE ival)
 
 /*
  *  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;
        }
@@ -2398,14 +2402,14 @@ s_Parameter_NvdwCutoffs(VALUE self)
 
 /*
  *  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);
 }
 
 /*
@@ -2515,17 +2519,17 @@ s_Parameter_VdwCutoffs(VALUE self)
 
 /*
  *  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
@@ -2764,6 +2768,26 @@ s_NewParEnumerableValueFromMoleculeAndType(Molecule *mol, Int parType)
 
 /*
  *  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.
@@ -2771,7 +2795,7 @@ s_NewParEnumerableValueFromMoleculeAndType(Molecule *mol, Int parType)
  *  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)
@@ -2787,7 +2811,7 @@ 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);
        }
@@ -2814,7 +2838,7 @@ s_ParEnumerable_Length(VALUE self)
                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);
        }
@@ -2835,8 +2859,8 @@ s_ParEnumerable_Each(VALUE self)
        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;
@@ -2878,8 +2902,8 @@ s_ParEnumerable_ReverseEach(VALUE self)
        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;
@@ -7565,7 +7589,7 @@ Init_Molby(void)
        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);
@@ -7573,7 +7597,7 @@ Init_Molby(void)
        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);
@@ -7581,7 +7605,7 @@ Init_Molby(void)
        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));
 /*
@@ -7614,6 +7638,7 @@ Init_Molby(void)
        /*  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);
diff --git a/Scripts/dispatom.par b/Scripts/dispatom.par
deleted file mode 100644 (file)
index 34c425f..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-;  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
-
diff --git a/Scripts/element.par b/Scripts/element.par
new file mode 100644 (file)
index 0000000..aa0909f
--- /dev/null
@@ -0,0 +1,111 @@
+;  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
+
index 3bddb96..fa6010a 100755 (executable)
@@ -383,7 +383,7 @@ class Molecule
   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
@@ -686,7 +686,7 @@ class Molecule
        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|
index 9402184..f472d55 100755 (executable)
@@ -36,7 +36,7 @@ class Molecule
                    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
@@ -58,7 +58,7 @@ class Molecule
                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
index a573895..cf7eb49 100755 (executable)
@@ -695,7 +695,7 @@ class Molecule
        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")
index 00f5266..0e2d569 100755 (executable)
--- a/memo.txt
+++ b/memo.txt
@@ -18,3 +18,5 @@ OS 10.4 用のユニバーサルバイナリは、export ISYSROOT='-isysroot /De
   Parameter#bond, ParEnumerable#[] などで、原子タイプからの探索はやめにする。また、ローカルな Parameter の nbonds などがグローバルパラメータを含んだ値を返すのはやめる。
   Parameter#bond などをクラスメソッド・インスタンスメソッドとして二重に登録するのはやめた。グローバルパラメータはたとえば Parameter.builtin.atoms または Parameter::Builtin.atoms としてアクセスする。
 
+2010.2.27.
+  Parameter タイプの atom というのはなんとも紛らわしい。element の方がまだましかも。
index a2542aa..e23c41f 100755 (executable)
@@ -236,7 +236,7 @@ bool MyApp::OnInit(void)
                wxSetWorkingDirectory(dirname);
 
                /*  Read atom display parameters  */
-               if (AtomParameterInitialize("dispatom.par", &wbuf) != 0) {
+               if (ElementParameterInitialize("element.par", &wbuf) != 0) {
                        SetConsoleColor(1);
                        AppendConsoleMessage(wbuf);
                        SetConsoleColor(0);