OSDN Git Service

Start implementing 'additional exponent' for JANPA output
[molby/Molby.git] / MolLib / Molecule.c
index 526edbf..4672586 100755 (executable)
@@ -1757,7 +1757,7 @@ MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char **errbuf)
                                        s_append_asprintf(errbuf, "line %d: the atom index (%d) is out of range", lineNumber, ibuf[1]);
                                        goto err_exit;
                                }
-                               MoleculeAddGaussianOrbitalShell(mp, ibuf[1], ibuf[2], ibuf[0]);
+                               MoleculeAddGaussianOrbitalShell(mp, ibuf[1], ibuf[2], ibuf[0], 0);
                                i = ibuf[0];
                                while (ReadLine(buf, sizeof buf, fp, &lineNumber) > 0) {
                                        if (buf[0] == '!')
@@ -2710,7 +2710,7 @@ MoleculeLoadShelxFile(Molecule *mp, const char *fname, char **errbuf)
 
 /*  Add one gaussian orbital shell information (not undoable)  */
 int
-MoleculeAddGaussianOrbitalShell(Molecule *mol, Int a_idx, Int sym, Int nprims)
+MoleculeAddGaussianOrbitalShell(Molecule *mol, Int a_idx, Int sym, Int nprims, Int add_exp)
 {
        BasisSet *bset;
        ShellInfo *shellp;
@@ -2747,6 +2747,7 @@ MoleculeAddGaussianOrbitalShell(Molecule *mol, Int a_idx, Int sym, Int nprims)
                shellp->m_idx = 0;
                shellp->p_idx = 0;
        }
+    shellp->add_exp = add_exp;
        /*  Update the number of components (if not yet determined)  */
        if (bset->ncomps < shellp->m_idx + shellp->ncomp)
                bset->ncomps = shellp->m_idx + shellp->ncomp;
@@ -6203,7 +6204,7 @@ MoleculeSearchImpropersAcrossAtomGroup(Molecule *mp, IntGroup *atomgroup)
        return sMoleculeSearchAcrossAtomGroup(mp->nimpropers, mp->impropers, 4, atomgroup, "impropers");
 }
 
-/*  Subroutine for MoleculeGuessBonds. It can be also used independently, but make sure that *outNbonds/*outBonds 
+/*  Subroutine for MoleculeGuessBonds. It can be also used independently, but make sure that *outNbonds / *outBonds
     _correctly_ represents an array of two integers (as in mp->nbonds/mp->bonds).  */
 /*  Find atoms within the given "distance" from the given position.  */
 /*  If limit is negative, its absolute value denotes the threshold distance in angstrom; otherwise,
@@ -9387,12 +9388,12 @@ MoleculeChangeResidueNumberWithArray(Molecule *mp, IntGroup *group, Int *resSeqs
        Atom *ap;
        
        /*  If LSB of resSeqs is 1, then a constant value is used for all specified atoms  */
-       if (((int)resSeqs & 1) == 0) {
+       if (((uintptr_t)resSeqs & 1) == 0) {
                withArray = 1;
                resSeq = 0;
        } else {
                withArray = 0;
-               resSeq = ((int)resSeqs - 1) / 2;
+               resSeq = ((uintptr_t)resSeqs - 1) / 2;
        }
        
        IntGroupIteratorInit(group, &iter);
@@ -9433,7 +9434,7 @@ MoleculeChangeResidueNumberWithArray(Molecule *mp, IntGroup *group, Int *resSeqs
 int
 MoleculeChangeResidueNumber(Molecule *mp, IntGroup *group, int resSeq)
 {
-       return MoleculeChangeResidueNumberWithArray(mp, group, (Int *)(resSeq * 2 + 1));
+       return MoleculeChangeResidueNumberWithArray(mp, group, (Int *)(intptr_t)(resSeq * 2 + 1));
 }
 
 /*  Offset the residue numbers by a certain amount. The argument nresidues, if non-negative,
@@ -10284,6 +10285,7 @@ MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double
        }
        MatrixSymDiagonalize(m1, val, axis);
        for (u = 0; u < 3; u++) {
+        anp->eigval[u] = val[u];
                if (val[u] < 0) {
                        fprintf(stderr, "Non-positive definite thermal parameters for atom %.4s\n", mp->atoms[n1].aname);
                        val[u] = 0.001;