OSDN Git Service

Start implementing 'additional exponent' for JANPA output
[molby/Molby.git] / MolLib / Molecule.h
index f15533c..5bc8364 100755 (executable)
@@ -46,6 +46,7 @@ typedef struct Aniso {
        char has_bsig;     /*  Has sigma values?  */
        Double  bsig[6];   /*  sigma values  */
        Mat33  pmat;      /*  A 3x3 matrix whose three column vectors are the principal axes of the ellipsoid. Note: If the B matrix is not positive definite, the axis length corresponding to the negative eigenvalue is replaced with 0.001.  */
+    Double eigval[3]; /*  Eigenvalues of the B matrix; this should be all non-negative */
 } Aniso;
 
 /*  Symmetry operation  */
@@ -218,6 +219,7 @@ typedef struct ShellInfo {
        signed char sym;     /*  Symmetry of the basis; S, P, ... */
        signed char ncomp;   /*  Number of components (S: 1, P: 3, SP: 4, etc.)  */
        signed char nprim;   /*  Number of primitives for this shell  */
+    signed char add_exp; /*  Additional exponent (for JANPA-Molden only)  */
        Int p_idx;           /*  Index to the PrimInfo (exponent/coefficient) table  */
        Int cn_idx;          /*  Index to the normalized (cached) contraction coefficient table  */
        Int a_idx;           /*  Index to the atom which this primitive belongs to */
@@ -232,13 +234,14 @@ typedef struct BasisSet {
        PrimInfo *priminfos; /*  Primitive information table  */
        Int ncns;            /*  Number of normalized (cached) contraction coefficient values  */
        Double *cns;         /*  Normalized (cached) contraction coefficients; (up to 10 values for each primitive)  */
-       Int natoms;          /*  Number of atoms; separately cached here because MO info should be invariant during editing */
+       Int natoms_bs;       /*  Number of atoms; separately cached here because MO info should be invariant during editing */
        Double *nuccharges;  /*  Nuclear charges (for ECP atoms)  */
        Int ne_alpha, ne_beta;  /*  Number of alpha/beta electrons  */
        Int rflag;           /*  0: UHF, 1: RHF, 2:ROHF  */
        Int ncomps;          /*  Number of AO components; equal to sum of shells[i].ncomp  */
        Int nmos;            /*  Number of MOs; equal to ncomps if close shell, ncomps*2 if open shell */
        Double *mo;          /*  MO matrix (mo[i][j] represents the j-th AO coefficient for the i-th MO)  */
+                                                /*  Memory are allocated for (2*nmos+1) entries; the last entry is for displaying arbitrary vector  */
        Double *moenergies;  /*  MO energies  */
        Double *scfdensities; /*  SCF densities; lower triangle of a symmetric matrix (size nmos*(nmos+1)/2)  */
        Int ncubes;          /*  Number of calculated MOs  */
@@ -254,13 +257,23 @@ typedef struct MCubePoint {
 } MCubePoint;
        
 typedef struct MCube {
+       char hidden;         /*  If non-zero, then this MCube is not drawn  */
        Int idn;             /*  MO number  */
        Vector origin;       /*  Cube origin */
        Double dx, dy, dz;   /*  Cube steps */
        Int nx, ny, nz;      /*  Cube dimension (must be multiples of 8)  */
        Double thres;        /*  Threshold value  */
        Double *dp;          /*  Value for point (ix, iy, iz) is in dp[(ix*ny+iy)*nz+iz]  */
+       Int nradii;
+       Double *radii;       /*  Estimated radius (with margin) for each atom  */
+       Double expand;       /*  Expand the estimated radius by this value (default: 1.0)  */
        struct {
+               /*  Flags for cube (ix, iy, iz)-(ix+1, iy+1, iz+1). It is an 8-bit */
+               /*  integer representing whether the values at the 8 corners are */
+               /*  larger than the threshold value or not. As special cases,  */
+               /*  the values 0 and 255 (all corners are below or above the threshold) */
+               /*  are represented as 255, and the value 0 is used to indicate "yet undefined". */
+               unsigned char *fp;
                /*  Cube points and triangles: for positive and negative surfaces  */
                Int ncubepoints;
                MCubePoint *cubepoints;
@@ -276,6 +289,12 @@ typedef struct Elpot {
        Double esp;
 } Elpot;
 
+/*  Properties (total energy etc.; specific for each frame)  */
+typedef struct MolProp {
+       char *propname;
+       Double *propvals;
+} MolProp;
+       
 /*  Molecule record  */
 typedef struct Molecule {
        Object base;
@@ -328,6 +347,10 @@ typedef struct Molecule {
        Int    nelpots;
        Elpot  *elpots;
 
+       /*  Properties  */
+       Int    nmolprops;
+       MolProp *molprops;
+
        /*  Parameters specific for this molecule  */
        struct Parameter *par;
        
@@ -367,6 +390,8 @@ typedef struct Molecule {
 
 int strlen_limit(const char *s, int limit);
 
+void BasisSetRelease(BasisSet *bset);
+
 Molecule *MoleculeNew(void);
 int MoleculeLoadFile(Molecule *mp, const char *fname, const char *ftype, char **errbuf);
 int MoleculeLoadPsfFile(Molecule *mp, const char *fname, char **errbuf);
@@ -386,11 +411,12 @@ Molecule *MoleculeRetain(Molecule *mp);
 void MoleculeRelease(Molecule *mp);
 void MoleculeExchange(Molecule *mp1, Molecule *mp2);
 
-int MoleculeAddGaussianOrbitalShell(Molecule *mol, Int sym, Int nprims, Int a_idx);
+int MoleculeAddGaussianOrbitalShell(Molecule *mol, Int a_idx, Int sym, Int nprims, Int add_exp);
 int MoleculeAddGaussianPrimitiveCoefficients(Molecule *mol, Double exponent, Double contraction, Double contraction_sp);
+int MoleculeGetGaussianComponentInfo(Molecule *mol, Int comp_idx, Int *outAtomIdx, char *outLabel, Int *outShellIdx);
 int MoleculeSetMOCoefficients(Molecule *mol, Int idx, Double energy, Int ncomps, Double *coeffs);
 int MoleculeGetMOCoefficients(Molecule *mol, Int idx, Double *energy, Int *ncoeffs, Double **coeffs);
-int MoleculeAllocateBasisSetRecord(Molecule *mol, Int rflag, Int ne_alpha, Int ne_beta);
+int MoleculeSetMOInfo(Molecule *mol, Int rflag, Int ne_alpha, Int ne_beta);
 
 void MoleculeIncrementModifyCount(Molecule *mp);
 void MoleculeClearModifyCount(Molecule *mp);
@@ -541,6 +567,13 @@ int MoleculeInsertFrames(Molecule *mp, IntGroup *group, const Vector *inFrame, c
 int MoleculeRemoveFrames(Molecule *mp, IntGroup *group, Vector *outFrame, Vector *outFrameCell);
 int MoleculeSelectFrame(Molecule *mp, int frame, int copyback);
 int MoleculeFlushFrames(Molecule *mp);
+int MoleculeReorderFrames(Molecule *mp, const Int *old_idx);
+
+int MoleculeCreateProperty(Molecule *mp, const char *name);
+int MoleculeLookUpProperty(Molecule *mp, const char *name);
+int MoleculeDeletePropertyAtIndex(Molecule *mp, int idx);
+int MoleculeSetProperty(Molecule *mp, int idx, IntGroup *ig, const Double *values);
+int MoleculeGetProperty(Molecule *mp, int idx, IntGroup *ig, Double *outValues);
 
 void MoleculeUpdatePiAnchorPositions(Molecule *mol);
 void MoleculeCalculatePiAnchorPosition(Molecule *mol, int idx);
@@ -555,6 +588,7 @@ int MoleculeOutputCube(Molecule *mp, Int index, const char *fname, const char *c
 
 MCube *MoleculeClearMCube(Molecule *mol, Int nx, Int ny, Int nz, const Vector *origin, Double dx, Double dy, Double dz);
 int MoleculeUpdateMCube(Molecule *mol, int idn);
+void MoleculeDeallocateMCube(MCube *mcube);
 
 extern char *gMoleculePasteboardType;
 extern char *gParameterPasteboardType;
@@ -583,7 +617,7 @@ STUB void MoleculeCallback_enableModificationFromGUI(Molecule *mol);
        
 STUB void MoleculeCallback_cannotModifyMoleculeDuringMDError(Molecule *mol);
 
-STUB int MoleculeCallback_callSubProcessAsync(Molecule *mol, const char *cmd, int (*callback)(Molecule *, int), int (*timerCallback)(Molecule *, int), FILE *output, FILE *errout);
+STUB int MoleculeCallback_callSubProcessAsync(Molecule *mol, const char **argv, int (*callback)(Molecule *, int), int (*timerCallback)(Molecule *, int), FILE *output, FILE *errout);
 
 /*  This is also defined in Molby_extern.h, but it may be called from functions in Molecule.c  */
 STUB int MyAppCallback_checkInterrupt(void);