#include "Object.h"
#include "IntGroup.h"
+#include <stdio.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-/* #define ATOMS_MAX_CONNECTS 12 */
-#define ATOM_CONNECTS_LIMIT 2
#define ATOMS_MAX_SYMMETRY 12
#define ATOMS_MAX_NUMBER 100000000 /* Sufficiently large value */
#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 */
kAtomHiddenFlag = 1
};
+/* Atom connection record */
+/* If nconnects <= ATOM_CONNECT_LIMIT, data[] field is used. Otherwise,
+ memory is allocated by malloc(). */
+#define ATOM_CONNECT_LIMIT 6
+typedef struct AtomConnect {
+ Int count; /* Number of connections */
+ union {
+ Int *ptr;
+ Int data[ATOM_CONNECT_LIMIT];
+ } u;
+} AtomConnect;
+
+typedef struct PiAnchor {
+ AtomConnect connect;
+ Int ncoeffs;
+ Double *coeffs;
+} PiAnchor;
+
/* Atom record */
typedef struct Atom {
Int segSeq;
Double weight;
char element[4];
Int atomicNumber;
- Int nconnects; /* Number of connections (= bonds) */
- union {
- Int *ptr;
- Int data[ATOM_CONNECTS_LIMIT];
- } connects; /* If nconnects >= ATOM_CONNECTS_LIMIT, memory is malloc()'ed; otherwise, data[] is used. */
-/* Int connects[ATOMS_MAX_CONNECTS]; */
+ AtomConnect connect;
Vector r; /* position */
Vector v; /* velocity */
Vector f; /* force */
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;
#define ATOM_PREV(p) ((Atom *)((char *)(p) - gSizeOfAtomRecord))
#define SYMOP_ALIVE(s) ((s.dx || s.dy || s.dz || s.sym) != 0)
#define SYMOP_EQUAL(s1, s2) (s1.dx == s2.dx && s1.dy == s2.dy && s1.dz == s2.dz && s1.sym == s2.sym)
+#define SYMMETRY_AT_INDEX(p, i) (*((i) == 0 ? &gIdentityTransform : &p[i]))
-/* atom.connects is a union entry, including direct data for nconnects < ATOM_CONNECTS_LIMIT
- and malloc()'ed entry for nconnects >= ATOM_CONNECTS_LIMIT. The following functions
+/* atom.connects is a union entry, including direct data for nconnects <= ATOM_CONNECT_LIMIT
+ and malloc()'ed entry for nconnects > ATOM_CONNECT_LIMIT. The following functions
automatically take care of the memory allocation/deallocation. */
-Int *AtomConnects(Atom *ap);
-void AtomResizeConnects(Atom *ap, Int nconnects);
-Int AtomConnectEntryAtIndex(Atom *ap, Int idx);
-void AtomSetConnectEntry(Atom *ap, Int idx, Int connect);
-void AtomInsertConnectEntry(Atom *ap, Int idx, Int connect);
-void AtomDeleteConnectEntry(Atom *ap, Int idx);
+Int *AtomConnectData(AtomConnect *ac);
+void AtomConnectResize(AtomConnect *ac, Int nconnects);
+void AtomConnectInsertEntry(AtomConnect *ac, Int idx, Int connect);
+void AtomConnectDeleteEntry(AtomConnect *ac, Int idx);
+
+#define ATOM_CONNECT_PTR(ac) ((ac)->count > ATOM_CONNECT_LIMIT ? (ac)->u.ptr : (ac)->u.data)
/* Duplicate an atom. If dst is non-NULL, *src is copied to *dst and dst is returned. If dst is NULL, a new atom is allocated by malloc() and that atom is returned. It is the called's responsibility to release the returned memory. */
extern Atom *AtomDuplicate(Atom *dst, const Atom *src);
Double cellsigma[6]; /* For crystallographic data; sigma for the cell parameters */
} XtalCell;
-/* Periodic box parameter */
-#if 0
-typedef struct PeriodicBox {
- Vector axes[3]; /* Unit vectors along the three axis */
- Vector origin; /* Origin of the periodic box */
- char flags[3]; /* 1 for periodic, 0 for non-periodic */
- Transform tr; /* Internal coord -> cartesian */
- Transform rtr; /* Cartesian -> internal coord */
-} PeriodicBox;
-#endif
-
-/* Expanded atoms */
-typedef struct ExAtom {
- Int index; /* Base atom index */
- Vector dr; /* Translational offset */
- Int symop; /* Symmetry operation */
- Int labelid; /* Label ID; 0 for no label */
-} ExAtom;
-
/* 3-Dimensional distribution */
typedef struct Cube {
Int idn; /* Integer identifier (such as MO number) */
kGTOType_P,
kGTOType_D,
kGTOType_D5,
- kGTOtype_F,
+ kGTOType_F,
kGTOType_F7,
+ kGTOType_G,
+ kGTOType_G9,
kGTOType_UU
};
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 */
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;
Int nresidues; /* Number of residues; maximum residue number + 1 (because residue 0 is 'undefined residue') */
char (*residues)[4];
XtalCell *cell;
-/* char is_xtal_coord; *//* True if the coordinates are measured in crystallographic units */
- Int nsyms; /* Symmetry operations; syms are always described in crystallographic units (even when is_xtal_coord is false) */
+ Int nsyms; /* Symmetry operations; syms are always described in crystallographic units (even when the unit cell is not defined) */
Transform *syms;
-/* PeriodicBox *box; *//* Periodic box */
+
IntGroup *selection;
- Int nexatoms;
- ExAtom *exatoms;
- Int nexbonds;
- Int *exbonds; /* The size of array is 2*nbonds; Atom index >= 0 : base atoms, < 0 : expanded atoms at index -exbonds[n]-1 */
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 */
/* 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;
/* 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;
} 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, const Molecule *mp);
+Molecule *MoleculeInitWithMolecule(Molecule *mp2, Molecule *mp);
void MoleculeSetName(Molecule *par, const char *name);
const char *MoleculeGetName(Molecule *mp);
void MoleculeSetPath(Molecule *mol, const char *fname);
Molecule *MoleculeWithName(const char *name);
Molecule *MoleculeRetain(Molecule *mp);
void MoleculeRelease(Molecule *mp);
-extern void MoleculeReleaseExternalHook(Molecule *mol);
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);
void MoleculeSetCell(Molecule *mp, Double a, Double b, Double c, Double alpha, Double beta, Double gamma, int convertCoordinates);
void MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x13, Double x23, const Double *sigmap);
-int MoleculeSetPeriodicBox(Molecule *mp, const Vector *ax, const Vector *ay, const Vector *az, const Vector *ao, const char *periodic);
+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);
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);
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);
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);
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);
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);
int MoleculeGetNumberOfFrames(Molecule *mp);
int MoleculeInsertFrames(Molecule *mp, IntGroup *group, const Vector *inFrame, const Vector *inFrameCell);
int MoleculeRemoveFrames(Molecule *mp, IntGroup *group, Vector *outFrame, Vector *outFrameCell);
-/*int MoleculeInsertFrame(Molecule *mp, int index, const Vector *inFrame);
-int MoleculeRemoveFrame(Molecule *mp, int frame, Vector *outFrame); */
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);
+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);
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);
STUB int MoleculeCallback_writeToPasteboard(const char *type, const void *data, int length);
STUB int MoleculeCallback_readFromPasteboard(const char *type, void **dptr, int *length);
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);