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 */
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;
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 */
/* 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;
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);
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);
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 MoleculeLoadGamessDatFile(Molecule *mol, const char *fname, char **errbuf);
+
int MoleculeReadExtendedInfo(Molecule *mp, const char *fname, char **errbuf);
int MoleculeWriteExtendedInfo(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 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 MoleculeRebuildTablesFromConnects(Molecule *mp);
int MoleculeAreAtomsConnected(Molecule *mol, int idx1, int idx2);
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 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);
int MoleculeSetPiAnchorList(Molecule *mol, Int idx, Int nentries, Int *entries, Double *weights, Int *nUndoActions, struct MolAction ***undoActions);
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 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);