OSDN Git Service

Start implementing 'additional exponent' for JANPA output
[molby/Molby.git] / MolLib / Molecule.h
index 7f49250..5bc8364 100755 (executable)
@@ -21,6 +21,8 @@
 #include "Object.h"
 #include "IntGroup.h"
 
+#include <stdio.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -36,13 +38,15 @@ extern "C" {
        
 #define BOLTZMANN (8.31441e-3*J2INTERNAL)
 #define PI 3.14159265358979
-               
+#define PI2R 0.564189583547756    /*  1.0/sqrt(PI)  */
+       
 /*  Anisotropic thermal parameter  */
 typedef struct Aniso {
        Double  bij[6];    /*  b11, b22, b33, b12, b13, b23 (ORTEP type 0) */
        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  */
@@ -73,6 +77,12 @@ typedef struct AtomConnect {
        } u;
 } AtomConnect;
 
+typedef struct PiAnchor {
+       AtomConnect connect;
+       Int ncoeffs;
+       Double *coeffs;
+} PiAnchor;
+
 /*  Atom record  */
 typedef struct Atom {
        Int    segSeq;
@@ -100,12 +110,14 @@ typedef struct Atom {
        Vector *frames;
        Symop  symop;    /*  For symmetry-expanded atom  */
        Int    symbase;  /*  The index of original atom for symmetry-expansion  */
+       PiAnchor *anchor;  /*  Non-NULL if this atom is a pi-anchor  */
        Int    labelid;  /*  The label ID; 0 for no label  */
        short  wrap_dx, wrap_dy, wrap_dz; /*  Calculated by md_wrap_coordinates; used only in wrapped output.  */
        Double fix_force; /*  0: no fix, >0: fix at fix_pos with harmonic potential, <0: fix at fix_pos without force  */
        Vector fix_pos;
        Byte   mm_exclude;        /*  If nonzero, then this atom is excluded from MM/MD calculations  */
        Byte   periodic_exclude;  /*  If nonzero, then this atom is excluded from periodic calculations  */
+       char   uff_type[6]; /*  UFF type string  */
 } Atom;
 
 extern Int gSizeOfAtomRecord;
@@ -172,16 +184,6 @@ typedef struct XtalCell {
        Double  cellsigma[6];  /*  For crystallographic data; sigma for the cell parameters  */
 } XtalCell;
 
-
-/*  Dummy atoms to represent metal-pi bonds  */
-typedef struct PiAtom {
-       char aname[4];
-       UInt type;
-       AtomConnect connect;
-       Int  ncoeffs;
-       Double *coeffs;  /*  The piatom position is given by sum(i, atoms[connect.data[i]] * coeffs[i]) */
-} PiAtom;
-
 /*  3-Dimensional distribution  */
 typedef struct Cube {
        Int idn;             /*  Integer identifier (such as MO number)  */
@@ -198,8 +200,10 @@ enum {
        kGTOType_P,
        kGTOType_D,
        kGTOType_D5,
-       kGTOtype_F,
+       kGTOType_F,
        kGTOType_F7,
+       kGTOType_G,
+       kGTOType_G9,
        kGTOType_UU
 };
 
@@ -215,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 */
@@ -229,26 +234,67 @@ 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 */
-       Vector *pos;         /*  Positions of atoms; the unit is bohr, not angstrom  */
+       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  */
        Cube **cubes;        /*  Calculated MOs (an array of pointers to Cubes)  */
 } BasisSet;
 
+/*  Marching Cube (for drawing isosurface)  */
+typedef struct MCubePoint {
+       Int key;       /*  key = ((ix*ny+iy)*nz+iz)*3+ii, ii=0/1/2 for x/y/z direction, respectively */
+       float d;       /*  offset toward the direction; 0 <= d < 1  */
+       float pos[3];  /*  cartesian coordinate of the point  */
+       float grad[3]; /*  gradient vector  */
+} 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;
+               Int ntriangles;
+               Int *triangles;  /*  Triangles; indices to cubepoints[]  */
+               float rgba[4];   /*  Surface color  */
+       } c[2];
+} MCube;
+
 /*  Electrostatic potential  */
 typedef struct Elpot {
        Vector pos;
        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;
@@ -267,23 +313,12 @@ typedef struct Molecule {
        XtalCell   *cell;
        Int    nsyms;        /*  Symmetry operations; syms are always described in crystallographic units (even when the unit cell is not defined)  */
        Transform *syms;
-       Int    npiatoms;     /*  Number of "dummy" atoms to represent pi-metal bonds  */
-       PiAtom *piatoms;
-       Int    npibonds;
-       Int    *pibonds;     /*  Array to represent bond/angle/dihedral including piatoms. */
-                         /* [n1, n2, -1, -1]: bonds,
-                                                       [n1, n2, n3, -1]: angle,
-                                                   [n1, n2, n3, n4]: dihedral,
-                                                   where n# is atom index if it is <ATOMS_MAX_NUMBER and
-                                                   is piatom index + ATOMS_MAX_NUMBER otherwise.
-                                                   The size of array is 4*npibonds.  */
-       
+
        IntGroup *selection;
        Int    nframes;      /*  The number of frames (>= 1). This is a cached value, and should be
                                                         recalculated from the atoms if it is -1  */
        Int    cframe;       /*  The current frame number  */
 
-/*     Byte   useFlexibleCell;  *//*  Obsolete (since 0.6.5; unit cell is frame dependent in all cases)  */
        Int    nframe_cells;
        Vector *frame_cells; /*  The cell vectors for frames; (nframe_cells*4) array of Vectors  */
 
@@ -305,13 +340,24 @@ typedef struct Molecule {
        /*  Information for basis sets and MOs  */
        BasisSet *bset;
        
+       /*  Marching cube  */
+       MCube *mcube;
+
        /*  Electrostatic potential  */
        Int    nelpots;
        Elpot  *elpots;
 
+       /*  Properties  */
+       Int    nmolprops;
+       MolProp *molprops;
+
        /*  Parameters specific for this molecule  */
        struct Parameter *par;
        
+       /*  Bond order (not to be used in MM/MD, but may be necessary to hold this info)  */
+       Int    nbondOrders;
+       Double *bondOrders;
+
        /*  Flag to request rebuilding MD internal information  */
        Byte   needsMDRebuild;
        
@@ -333,6 +379,9 @@ typedef struct Molecule {
        /*  Mutex object. If non-NULL, it should be locked before modifying molecule  */
        void *mutex;
        
+       /*  Flag to prohibit modification from user interface  */
+       Byte   dontModifyFromGUI;
+
        /*  Ruby pointer (see ruby_bind.c)  */
        void *exmolobj;
        Byte exmolobjProtected;
@@ -341,13 +390,15 @@ 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 errbufsize);
-int MoleculeLoadPsfFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeLoadTepFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeLoadShelxFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeLoadGaussianFchkFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
+int MoleculeLoadFile(Molecule *mp, const char *fname, const char *ftype, char **errbuf);
+int MoleculeLoadPsfFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeLoadTepFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeLoadShelxFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeLoadGaussianFchkFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char **errbuf);
 Molecule *MoleculeNewWithName(const char *name);
 Molecule *MoleculeInitWithAtoms(Molecule *mp, const Atom *atoms, int natoms);
 Molecule *MoleculeInitWithMolecule(Molecule *mp2, Molecule *mp);
@@ -360,10 +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 MoleculeAllocateBasisSetRecord(Molecule *mol, Int rflag, Int ne_alpha, Int ne_beta);
+int MoleculeGetMOCoefficients(Molecule *mol, Int idx, Double *energy, Int *ncoeffs, Double **coeffs);
+int MoleculeSetMOInfo(Molecule *mol, Int rflag, Int ne_alpha, Int ne_beta);
 
 void MoleculeIncrementModifyCount(Molecule *mp);
 void MoleculeClearModifyCount(Molecule *mp);
@@ -377,19 +430,23 @@ void MoleculeSetCell(Molecule *mp, Double a, Double b, Double c, Double alpha, D
 void MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x13, Double x23, const Double *sigmap);
 void MoleculeSetAnisoBySymop(Molecule *mp, int idx);
 int MoleculeSetPeriodicBox(Molecule *mp, const Vector *ax, const Vector *ay, const Vector *az, const Vector *ao, const char *periodic, int convertCoordinates);
+int MoleculeCalculateCellFromAxes(XtalCell *cp, int calc_abc);
+
+int MoleculeReadCoordinatesFromFile(Molecule *mp, const char *fname, const char *ftype, char **errbuf);
+int MoleculeReadCoordinatesFromPdbFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeReadCoordinatesFromDcdFile(Molecule *mp, const char *fname, char **errbuf);
 
-int MoleculeReadCoordinatesFromFile(Molecule *mp, const char *fname, const char *ftype, char *errbuf, int errbufsize);
-int MoleculeReadCoordinatesFromPdbFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeReadCoordinatesFromDcdFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
+int MoleculeLoadGamessDatFile(Molecule *mol, const char *fname, char **errbuf);
 
-int MoleculeReadExtendedInfo(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeWriteExtendedInfo(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
+int MoleculeReadExtendedInfo(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeWriteExtendedInfo(Molecule *mp, const char *fname, char **errbuf);
 
-int MoleculeWriteToFile(Molecule *mp, const char *fname, const char *ftype, char *errbuf, int errbufsize);
-int MoleculeWriteToPsfFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeWriteToPdbFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeWriteToDcdFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
-int MoleculeWriteToTepFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
+int MoleculeWriteToFile(Molecule *mp, const char *fname, const char *ftype, char **errbuf);
+int MoleculeWriteToPsfFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeWriteToPdbFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeWriteToDcdFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeWriteToTepFile(Molecule *mp, const char *fname, char **errbuf);
+int MoleculeWriteToMbsfFile(Molecule *mp, const char *fname, char **errbuf);
 void MoleculeDump(Molecule *mol);
 
 int MoleculePrepareMDArena(Molecule *mol, int check_only, char **retmsg);
@@ -406,12 +463,21 @@ int MoleculeChangeResidueNames(Molecule *mp, int argc, Int *resSeqs, char *names
 int MoleculeMaximumResidueNumber(Molecule *mp, IntGroup *group);
 int MoleculeMinimumResidueNumber(Molecule *mp, IntGroup *group);
 
+struct MolAction;
+#if defined(DEBUG)
+       int MoleculeCheckSanity(Molecule *mp);
+#else
+#define MoleculeCheckSanity(mp)
+#endif
+
 int MoleculeCreateAnAtom(Molecule *mp, const Atom *ap, int pos);
-int MoleculeMerge(Molecule *dst, Molecule *src, IntGroup *where, int resSeqOffset);
-int MoleculeUnmerge(Molecule *src, Molecule **dstp, IntGroup *where, int resSeqOffset);
+int MoleculeMerge(Molecule *dst, Molecule *src, IntGroup *where, int resSeqOffset, Int *nactions, struct MolAction ***actions, Int forUndo);
+int MoleculeUnmerge(Molecule *src, Molecule **dstp, IntGroup *where, int resSeqOffset, Int *nactions, struct MolAction ***actions, Int forUndo);
 int MoleculeExtract(Molecule *src, Molecule **dstp, IntGroup *where, int dummyFlag);
-int MoleculeAddBonds(Molecule *mp, Int nbonds, const Int *bonds);
-int MoleculeDeleteBonds(Molecule *mp, Int nbonds, const Int *bonds);
+int MoleculeAddBonds(Molecule *mp, Int nbonds, const Int *bonds, IntGroup *where, Int autoGenerate);
+int MoleculeDeleteBonds(Molecule *mp, Int *bonds, IntGroup *where, Int **outRemoved, IntGroup **outRemovedPos);
+int MoleculeAssignBondOrders(Molecule *mp, const Double *orders, IntGroup *where);
+int MoleculeGetBondOrders(Molecule *mp, Double *outOrders, IntGroup *where);
 int MoleculeAddAngles(Molecule *mp, const Int *angles, IntGroup *where);
 int MoleculeDeleteAngles(Molecule *mp, Int *angles, IntGroup *where);
 int MoleculeAddDihedrals(Molecule *mp, const Int *dihedrals, IntGroup *where);
@@ -423,16 +489,6 @@ int MoleculeLookupAngle(Molecule *mp, Int n1, Int n2, Int n3);
 int MoleculeLookupDihedral(Molecule *mp, Int n1, Int n2, Int n3, Int n4);
 int MoleculeLookupImproper(Molecule *mp, Int n1, Int n2, Int n3, Int n4);
 
-/*
-Int    MoleculeReplaceAllAngles(Molecule *mol, Int nangles, const Int *angles, Int **outAngles);
-Int MoleculeReplaceAllDihedrals(Molecule *mol, Int ndihedrals, const Int *dihedrals, Int **outDihedrals);
-Int MoleculeReplaceAllImpropers(Molecule *mol, Int nimpropers, const Int *impropers, Int **outImpropers);
-
-Int MoleculeFindAllAngles(Molecule *mol, Int **outAngles);
-Int MoleculeFindAllDihedrals(Molecule *mol, Int **outDihedrals);
-Int MoleculeFindAllImpropers(Molecule *mol, Int **outImpropers);
-*/
-
 Int MoleculeFindMissingAngles(Molecule *mol, Int **outAngles);
 Int MoleculeFindMissingDihedrals(Molecule *mol, Int **outDihedrals);
 Int MoleculeFindMissingImpropers(Molecule *mol, Int **outImpropers);
@@ -452,11 +508,11 @@ int MoleculeLookupAtomInResidue(Molecule *mp, int n1, int resno);
 int MoleculeAnalyzeAtomName(const char *s, char *resName, int *resSeq, char *atomName);
 int MoleculeAtomIndexFromString(Molecule *mp, const char *s);
 
-int MoleculeFindCloseAtoms(Molecule *mp, Int index, Double limit, Int *outNbonds, Int **outBonds, Int triangle);
+int MoleculeFindCloseAtoms(Molecule *mp, const Vector *vp, Double radius, 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);
@@ -472,7 +528,7 @@ int MoleculeGetTransformForSymop(Molecule *mp, Symop symop, Transform *tf, int i
 int MoleculeGetSymopForTransform(Molecule *mp, const Transform tf, Symop *symop, int is_cartesian);
 
 int MoleculeTransformBySymop(Molecule *mp, const Vector *vpin, Vector *vpout, Symop symop);
-int MoleculeAddExpandedAtoms(Molecule *mp, Symop symop, IntGroup *group, Int *indices);
+int MoleculeAddExpandedAtoms(Molecule *mp, Symop symop, IntGroup *group, Int *indices, Int allowOverlap);
 int MoleculeAmendBySymmetry(Molecule *mp, IntGroup *group, IntGroup **groupout, Vector **vpout);
 
 int MoleculeShowAllAtoms(Molecule *mp);
@@ -482,7 +538,6 @@ int MoleculeHideAtoms(Molecule *mp, IntGroup *ig);
 int MoleculeRenumberAtoms(Molecule *mp, const Int *new2old, Int *old2new_out, Int isize);
 
 void MoleculeTransform(Molecule *mp, Transform tr, IntGroup *group);
-/*void MoleculeMove(Molecule *mp, Transform tr, IntGroup *group);*/
 void MoleculeTranslate(Molecule *mp, const Vector *vp, IntGroup *group);
 void MoleculeRotate(Molecule *mp, const Vector *axis, Double angle, const Vector *center, IntGroup *group);
 int MoleculeCenterOfMass(Molecule *mp, Vector *center, IntGroup *group);
@@ -512,9 +567,18 @@ 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 MoleculeCalculatePiAtomPosition(Molecule *mol, int idx, Vector *vp);
+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);
+int MoleculeSetPiAnchorList(Molecule *mol, Int idx, Int nentries, Int *entries, Double *weights, Int *nUndoActions, struct MolAction ***undoActions);
+       
 int MoleculeCalcMO(Molecule *mp, Int mono, const Vector *op, const Vector *dxp, const Vector *dyp, const Vector *dzp, Int nx, Int ny, Int nz, int (*callback)(double progress, void *ref), void *ref);
 int MoleculeGetDefaultMOGrid(Molecule *mp, Int npoints, Vector *op, Vector *xp, Vector *yp, Vector *zp, Int *nx, Int *ny, Int *nz);
 const Cube *MoleculeGetCubeAtIndex(Molecule *mp, Int index);
@@ -522,11 +586,14 @@ int MoleculeLookUpCubeWithMONumber(Molecule *mp, Int mono);
 int MoleculeClearCubeAtIndex(Molecule *mp, Int index);
 int MoleculeOutputCube(Molecule *mp, Int index, const char *fname, const char *comment);
 
-/*#define kMoleculePasteboardType "Molecule"
-#define kParameterPasteboardType "Parameter" */
+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;
-
+extern char *gLoadSaveErrorMessage;
+       
 STUB void MoleculeRetainExternalObj(Molecule *mol);
 STUB void MoleculeReleaseExternalObj(Molecule *mol);
 
@@ -545,8 +612,13 @@ STUB int MoleculeCallback_setDisplayName(Molecule *mol, const char *name);
 
 STUB void MoleculeCallback_lockMutex(void *mutex);
 STUB void MoleculeCallback_unlockMutex(void *mutex);
+STUB void MoleculeCallback_disableModificationFromGUI(Molecule *mol);
+STUB void MoleculeCallback_enableModificationFromGUI(Molecule *mol);
+       
 STUB void MoleculeCallback_cannotModifyMoleculeDuringMDError(Molecule *mol);
 
+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);