OSDN Git Service

Pi anchor implementation is done.
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Mon, 29 Oct 2012 14:57:47 +0000 (14:57 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Mon, 29 Oct 2012 14:57:47 +0000 (14:57 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@311 a2be9bc6-48de-4e38-9406-05402d4bc13c

MolLib/Molecule.c
MolLib/Molecule.h
MolLib/Parameter.c
MolLib/Ruby_bind/ruby_bind.c
Scripts/default.par
Scripts/molby.par [new file with mode: 0644]
msw-build/molby.iss

index 4ba1bc6..118991d 100755 (executable)
@@ -6069,6 +6069,17 @@ MoleculeRebuildTablesFromConnects(Molecule *mp)
        return retval;
 }
 
+int
+MoleculeAreAtomsConnected(Molecule *mol, int idx1, int idx2)
+{
+       Atom *ap1 = ATOM_AT_INDEX(mol->atoms, idx1);
+       if (AtomConnectHasEntry(&ap1->connect, idx2))
+               return 1;
+       else if (ap1->anchor != NULL && AtomConnectHasEntry(&(ap1->anchor->connect), idx2))
+               return 2;
+       else return 0;
+}
+
 #pragma mark ====== Atom names ======
 
 /*  Look for the n1-th atom in resno-th residue (n1 is 0-based)  */
@@ -6182,23 +6193,6 @@ MoleculeAtomIndexFromString(Molecule *mp, const char *s)
        return -1;  /*  Not found  */
 }
 
-/*
-int
-MoleculeAreAtomsConnected(Molecule *mp, int n1, int n2)
-{
-       Atom *ap;
-       Int i, *cp;
-       if (mp == NULL || n1 < 0 || n1 >= mp->natoms || n2 < 0 || n2 >= mp->natoms)
-               return 0;
-       ap = ATOM_AT_INDEX(mp->atoms, n1);
-       cp = AtomConnectData(&ap->connect);
-       for (i = 0; i < ap->connect.count; i++)
-               if (cp[i] == n2)
-                       return 1;
-       return 0;
-}
-*/
-
 void
 MoleculeGetAtomName(Molecule *mp, int index, char *buf, int bufsize)
 {
@@ -7135,17 +7129,6 @@ s_fprintf(FILE *fp, const char *fmt, ...)
 }
 
 int
-MoleculeAreAtomsConnected(Molecule *mol, int idx1, int idx2)
-{
-       Atom *ap1 = ATOM_AT_INDEX(mol->atoms, idx1);
-       if (AtomConnectHasEntry(&ap1->connect, idx2))
-               return 1;
-       else if (ap1->anchor != NULL && AtomConnectHasEntry(&(ap1->anchor->connect), idx2))
-               return 2;
-       else return 0;
-}
-
-int
 MoleculeCheckSanity(Molecule *mol)
 {
        const char *fail = "Sanity check failure";
index f85fbbf..34de218 100755 (executable)
@@ -423,8 +423,6 @@ int MoleculeChangeResidueNames(Molecule *mp, int argc, Int *resSeqs, char *names
 int MoleculeMaximumResidueNumber(Molecule *mp, IntGroup *group);
 int MoleculeMinimumResidueNumber(Molecule *mp, IntGroup *group);
 
-int MoleculeAreAtomsConnected(Molecule *mol, int idx1, int idx2);
-
 struct MolAction;
 #if defined(DEBUG)
        int MoleculeCheckSanity(Molecule *mp);
@@ -480,9 +478,9 @@ int MoleculeAtomIndexFromString(Molecule *mp, const char *s);
 
 int MoleculeFindCloseAtoms(Molecule *mp, Int index, Double limit, Int *outNbonds, Int **outBonds, Int triangle);
 int MoleculeGuessBonds(Molecule *mp, Double limit, Int *outNbonds, Int **outBonds);
-int MoleculeAreAtomsConnected(Molecule *mp, int n1, int n2);
 int MoleculeRebuildTablesFromConnects(Molecule *mp);
-
+int MoleculeAreAtomsConnected(Molecule *mol, int idx1, int idx2);
+       
 void MoleculeGetAtomName(Molecule *mp, int index, char *buf, int bufsize);
 
 void MoleculeSetSelection(Molecule *mp, IntGroup *select);
index 2dbbb00..8849a62 100755 (executable)
@@ -1970,8 +1970,15 @@ AtomTypeEncodeToUInt(const char *s)
                        break;
                }
                n = (*s - 0x20) % 96;  /*  Map to 1..95  */
-               if (i == 0 && n < 32)
-                       n = 32;
+               if (i == 0) {
+                       if (n < 16) {
+                       /*  The first character: map !#$%&* to [\]{|}; other characters less than 32 -> _  */
+                               static char sTab[] = "_[_\\]{|___}_____";
+                               n = sTab[n] - 32;
+                       } else if (n < 32) {
+                               n = '_' - 32;
+                       }
+               }
                t += n * s_coeff[i];
        }
        return t;
@@ -1998,9 +2005,15 @@ AtomTypeDecodeToString(UInt type, char *s)
                return s;
        }
        for (i = 0; i < 4; i++) {
-               s[i] = (type / s_coeff[i]) % 96;
-               if (s[i] != 0)
-                       s[i] += 0x20;
+               n = (type / s_coeff[i]) % 96;
+               if (n != 0) {
+                       n += 32;
+                       if (n >= '[' && n <= ']')
+                               n = "!#$"[n - '['];
+                       else if (n >= '{' && n <= '}')
+                               n = "%&*"[n - '{'];
+               }
+               s[i] = n;
        }
        s[4] = 0;
        n = strlen(s);
index 71a9eaa..dccf384 100644 (file)
@@ -9579,7 +9579,7 @@ s_Molecule_CreatePiAnchor(int argc, VALUE *argv, VALUE self)
        strncpy(a.aname, StringValuePtr(nval), 4);
        if (a.aname[0] == '_')
                rb_raise(rb_eMolbyError, "please avoid a name beginning with '_' for a pi anchor, because it causes some internal confusion.");
-       a.type = AtomTypeEncodeToUInt("an");  /*  Default atom type  */
+       a.type = AtomTypeEncodeToUInt("##");  /*  Default atom type for pi_anchor  */
        for (i = 0; (n = IntGroupGetNthPoint(ig, i)) >= 0; i++) {
                if (n >= mol->natoms) {
                        AtomConnectResize(&an.connect, 0);
index 8e607a1..ea5dcf8 100644 (file)
@@ -1,2 +1,3 @@
 include "gaff.par"
 include "parm99.par"
+include "molby.par"
diff --git a/Scripts/molby.par b/Scripts/molby.par
new file mode 100644 (file)
index 0000000..cd6e712
--- /dev/null
@@ -0,0 +1,2 @@
+vdw  ##   0.0000  0.0000  0.0000  0.0000  0  0.0000 ! Dummy atom for pi-metal bonds
+bond ##   ##      0.0000  0.0000                    ! Dummy bond
index 8f1f8cb..24a1c84 100755 (executable)
@@ -9,7 +9,6 @@ OutputBaseFileName = SetupMolby
 [Files]
 Source: "build\Molby\Molby.exe"; DestDir: {app}
 Source: "build\Molby\mingwm10.dll"; DestDir: {app}
-Source: "build\Molby\buildInfo.txt"; DestDir: {app}
 Source: "build\Molby\amber11\bin\*"; DestDir: {app}\amber11\bin
 Source: "build\Molby\amber11\dat\antechamber\*"; DestDir: {app}\amber11\dat\antechamber
 Source: "build\Molby\amber11\dat\leap\parm\*"; DestDir: {app}\amber11\dat\leap\parm