4 * Created by Toshi Nagata on 06/03/11.
5 * Copyright 2006-2008 Toshi Nagata. All rights reserved.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation version 2 of the License.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
17 #ifndef __Molecule_h__
18 #define __Molecule_h__
30 #define ATOMS_MAX_SYMMETRY 12
31 #define ATOMS_MAX_NUMBER 100000000 /* Sufficiently large value */
33 /* Conversion between kcal/mol and internal energy unit (am*ang^2/fs^2, am = atomic mass) */
34 #define KCAL2INTERNAL (4.184e-4)
35 #define INTERNAL2KCAL (1.0/KCAL2INTERNAL)
36 #define J2INTERNAL (1e-4)
37 #define INTERNAL2J (1.0/J2INTERNAL)
39 #define BOLTZMANN (8.31441e-3*J2INTERNAL)
40 #define PI 3.14159265358979
41 #define PI2R 0.564189583547756 /* 1.0/sqrt(PI) */
43 /* Anisotropic thermal parameter */
44 typedef struct Aniso {
45 Double bij[6]; /* b11, b22, b33, b12, b13, b23 (ORTEP type 0) */
46 char has_bsig; /* Has sigma values? */
47 Double bsig[6]; /* sigma values */
48 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. */
51 /* Symmetry operation */
52 /* If periodic box is defined, dx/dy/dz denote multiples of the axes of the periodic box.
53 Otherwise, dx/dy/dz denote offset to the x/y/z coordinates of the atoms. */
54 typedef struct Symop {
59 unsigned int alive: 1;
67 /* Atom connection record */
68 /* If nconnects <= ATOM_CONNECT_LIMIT, data[] field is used. Otherwise,
69 memory is allocated by malloc(). */
70 #define ATOM_CONNECT_LIMIT 6
71 typedef struct AtomConnect {
72 Int count; /* Number of connections */
75 Int data[ATOM_CONNECT_LIMIT];
79 typedef struct PiAnchor {
98 Vector r; /* position */
99 Vector v; /* velocity */
100 Vector f; /* force */
101 Vector sigma; /* For crystallographic data only; sigma for each crystallographic coordinates */
102 /* (Unlike r, these are not converted to the cartesian system) */
108 Int nframes; /* Multiple frames */
110 Symop symop; /* For symmetry-expanded atom */
111 Int symbase; /* The index of original atom for symmetry-expansion */
112 PiAnchor *anchor; /* Non-NULL if this atom is a pi-anchor */
113 Int labelid; /* The label ID; 0 for no label */
114 short wrap_dx, wrap_dy, wrap_dz; /* Calculated by md_wrap_coordinates; used only in wrapped output. */
115 Double fix_force; /* 0: no fix, >0: fix at fix_pos with harmonic potential, <0: fix at fix_pos without force */
117 Byte mm_exclude; /* If nonzero, then this atom is excluded from MM/MD calculations */
118 Byte periodic_exclude; /* If nonzero, then this atom is excluded from periodic calculations */
121 extern Int gSizeOfAtomRecord;
123 #define ATOM_AT_INDEX(p, i) ((Atom *)((char *)(p) + (i) * gSizeOfAtomRecord))
124 #define ATOM_NEXT(p) ((Atom *)((char *)(p) + gSizeOfAtomRecord))
125 #define ATOM_PREV(p) ((Atom *)((char *)(p) - gSizeOfAtomRecord))
126 #define SYMOP_ALIVE(s) ((s.dx || s.dy || s.dz || s.sym) != 0)
127 #define SYMOP_EQUAL(s1, s2) (s1.dx == s2.dx && s1.dy == s2.dy && s1.dz == s2.dz && s1.sym == s2.sym)
128 #define SYMMETRY_AT_INDEX(p, i) (*((i) == 0 ? &gIdentityTransform : &p[i]))
130 /* atom.connects is a union entry, including direct data for nconnects <= ATOM_CONNECT_LIMIT
131 and malloc()'ed entry for nconnects > ATOM_CONNECT_LIMIT. The following functions
132 automatically take care of the memory allocation/deallocation. */
133 Int *AtomConnectData(AtomConnect *ac);
134 void AtomConnectResize(AtomConnect *ac, Int nconnects);
135 void AtomConnectInsertEntry(AtomConnect *ac, Int idx, Int connect);
136 void AtomConnectDeleteEntry(AtomConnect *ac, Int idx);
138 #define ATOM_CONNECT_PTR(ac) ((ac)->count > ATOM_CONNECT_LIMIT ? (ac)->u.ptr : (ac)->u.data)
140 /* 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. */
141 extern Atom *AtomDuplicate(Atom *dst, const Atom *src);
143 /* Duplicate an atom, except for the frame entry */
144 extern Atom *AtomDuplicateNoFrame(Atom *dst, const Atom *src);
146 /* Clean the content of an atom record */
147 extern void AtomClean(Atom *ap);
149 /* MolEnumerable type code */
160 /* Enumerable class to access to atoms, bonds, etc. */
161 typedef struct MolEnumerable {
162 struct Molecule *mol;
167 typedef struct AtomRef {
168 struct Molecule *mol;
172 /* Crystallographic cell parameter (also used as periodic box in MD) */
173 typedef struct XtalCell {
174 Double cell[6]; /* a, b, c, alpha, beta, gamma (in degree) */
175 Double rcell[6]; /* Reciprocal cell */
176 Vector axes[3]; /* Cartesian unit vectors along the three axis */
177 Vector origin; /* Cartesian origin of the periodic box */
178 char flags[3]; /* 1 for periodic, 0 for non-periodic */
179 char has_sigma; /* Has sigma? */
180 Transform tr; /* Crystal coord -> cartesian */
181 Transform rtr; /* Cartesian -> crystal coord */
182 Double cellsigma[6]; /* For crystallographic data; sigma for the cell parameters */
185 /* 3-Dimensional distribution */
186 typedef struct Cube {
187 Int idn; /* Integer identifier (such as MO number) */
191 Double *dp; /* Value for point (ix, iy, iz) is in dp[(ix*ny+iy)*nz+iz] */
194 /* Gaussian orbital symmetry types */
208 /* Exponent/coefficient info for a single gaussian primitive */
209 typedef struct PrimInfo {
210 Double A; /* Exponent */
211 Double C; /* Contraction coefficient */
212 Double Csp; /* P(S=P) contraction coefficient */
215 /* Gaussian orbital shell information */
216 typedef struct ShellInfo {
217 signed char sym; /* Symmetry of the basis; S, P, ... */
218 signed char ncomp; /* Number of components (S: 1, P: 3, SP: 4, etc.) */
219 signed char nprim; /* Number of primitives for this shell */
220 Int p_idx; /* Index to the PrimInfo (exponent/coefficient) table */
221 Int cn_idx; /* Index to the normalized (cached) contraction coefficient table */
222 Int a_idx; /* Index to the atom which this primitive belongs to */
223 Int m_idx; /* Index to the MO matrix */
226 /* Basis set and MO information */
227 typedef struct BasisSet {
228 Int nshells; /* Number of gaussian orbital shells */
229 ShellInfo *shells; /* Gaussian orbital shells */
230 Int npriminfos; /* Size of primitive information table */
231 PrimInfo *priminfos; /* Primitive information table */
232 Int ncns; /* Number of normalized (cached) contraction coefficient values */
233 Double *cns; /* Normalized (cached) contraction coefficients; (up to 10 values for each primitive) */
234 Int natoms; /* Number of atoms; separately cached here because MO info should be invariant during editing */
235 Vector *pos; /* Positions of atoms; the unit is bohr, not angstrom */
236 Double *nuccharges; /* Nuclear charges (for ECP atoms) */
237 Int ne_alpha, ne_beta; /* Number of alpha/beta electrons */
238 Int rflag; /* 0: UHF, 1: RHF, 2:ROHF */
239 Int ncomps; /* Number of AO components; equal to sum of shells[i].ncomp */
240 Int nmos; /* Number of MOs; equal to ncomps if close shell, ncomps*2 if open shell */
241 Double *mo; /* MO matrix (mo[i][j] represents the j-th AO coefficient for the i-th MO) */
242 Double *moenergies; /* MO energies */
243 Double *scfdensities; /* SCF densities; lower triangle of a symmetric matrix (size nmos*(nmos+1)/2) */
244 Int ncubes; /* Number of calculated MOs */
245 Cube **cubes; /* Calculated MOs (an array of pointers to Cubes) */
248 /* Electrostatic potential */
249 typedef struct Elpot {
254 /* Molecule record */
255 typedef struct Molecule {
260 Int *bonds; /* The size of array is 2*nbonds */
262 Int *angles; /* The size of array is 3*nangles */
264 Int *dihedrals; /* The size of array is 4*ndihedrals */
266 Int *impropers; /* The size of array is 4*nimpropers */
267 Int nresidues; /* Number of residues; maximum residue number + 1 (because residue 0 is 'undefined residue') */
270 Int nsyms; /* Symmetry operations; syms are always described in crystallographic units (even when the unit cell is not defined) */
274 Int nframes; /* The number of frames (>= 1). This is a cached value, and should be
275 recalculated from the atoms if it is -1 */
276 Int cframe; /* The current frame number */
278 /* Byte useFlexibleCell; *//* Obsolete (since 0.6.5; unit cell is frame dependent in all cases) */
280 Vector *frame_cells; /* The cell vectors for frames; (nframe_cells*4) array of Vectors */
282 struct MainView *mview; /* Reference to the MainView object if present (no retain) */
283 Int modifyCount; /* Internal counter for modification. This value is not to be modified
284 manually; instead, call MoleculeIncrementModifyCount() whenever
285 modification is done, which also takes care necessary notification
286 to the other part of the application (system dependent) */
288 struct MDArena *arena; /* Reference to the MDArena record during MM/MD run (no retain) */
290 const char *path; /* The full path of the molecule, when this molecule is last saved to/loaded from file. Only used in the command-line version. (In GUI version, the path is obtained by the Document mechanism) */
292 /* Information from the dcd files */
293 Int startStep; /* the timestep for frame 0 */
294 Int stepsPerFrame; /* the number of timesteps between neighboring frames */
295 Double psPerStep; /* picosecond per step */
297 /* Information for basis sets and MOs */
300 /* Electrostatic potential */
304 /* Parameters specific for this molecule */
305 struct Parameter *par;
307 /* Flag to request rebuilding MD internal information */
310 /* Flag to clear selection of the parameter table */
311 Byte parameterTableSelectionNeedsClear;
313 /* Flag to request copying coordinates to MD arena */
314 Byte needsMDCopyCoordinates;
316 /* Prohibit modification of the topology (to avoid interfering MD) */
317 Byte noModifyTopology;
319 /* Flag to request aborting a subthread */
320 Byte requestAbortThread;
322 /* Flag to signal that a subthread is terminated */
323 Byte threadTerminated;
325 /* Mutex object. If non-NULL, it should be locked before modifying molecule */
328 /* Flag to prohibit modification from user interface */
329 Byte dontModifyFromGUI;
331 /* Ruby pointer (see ruby_bind.c) */
333 Byte exmolobjProtected;
337 int strlen_limit(const char *s, int limit);
339 Molecule *MoleculeNew(void);
340 int MoleculeLoadFile(Molecule *mp, const char *fname, const char *ftype, char **errbuf);
341 int MoleculeLoadPsfFile(Molecule *mp, const char *fname, char **errbuf);
342 int MoleculeLoadTepFile(Molecule *mp, const char *fname, char **errbuf);
343 int MoleculeLoadShelxFile(Molecule *mp, const char *fname, char **errbuf);
344 int MoleculeLoadGaussianFchkFile(Molecule *mp, const char *fname, char **errbuf);
345 int MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char **errbuf);
346 Molecule *MoleculeNewWithName(const char *name);
347 Molecule *MoleculeInitWithAtoms(Molecule *mp, const Atom *atoms, int natoms);
348 Molecule *MoleculeInitWithMolecule(Molecule *mp2, Molecule *mp);
349 void MoleculeSetName(Molecule *par, const char *name);
350 const char *MoleculeGetName(Molecule *mp);
351 void MoleculeSetPath(Molecule *mol, const char *fname);
352 const char *MoleculeGetPath(Molecule *mol);
353 Molecule *MoleculeWithName(const char *name);
354 Molecule *MoleculeRetain(Molecule *mp);
355 void MoleculeRelease(Molecule *mp);
356 void MoleculeExchange(Molecule *mp1, Molecule *mp2);
358 int MoleculeAddGaussianOrbitalShell(Molecule *mol, Int sym, Int nprims, Int a_idx);
359 int MoleculeAddGaussianPrimitiveCoefficients(Molecule *mol, Double exponent, Double contraction, Double contraction_sp);
360 int MoleculeSetMOCoefficients(Molecule *mol, Int idx, Double energy, Int ncomps, Double *coeffs);
361 int MoleculeAllocateBasisSetRecord(Molecule *mol, Int rflag, Int ne_alpha, Int ne_beta);
363 void MoleculeIncrementModifyCount(Molecule *mp);
364 void MoleculeClearModifyCount(Molecule *mp);
366 MolEnumerable *MolEnumerableNew(Molecule *mol, int kind);
367 void MolEnumerableRelease(MolEnumerable *mseq);
368 AtomRef *AtomRefNew(Molecule *mol, int idx);
369 void AtomRefRelease(AtomRef *aref);
371 void MoleculeSetCell(Molecule *mp, Double a, Double b, Double c, Double alpha, Double beta, Double gamma, int convertCoordinates);
372 void MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x13, Double x23, const Double *sigmap);
373 void MoleculeSetAnisoBySymop(Molecule *mp, int idx);
374 int MoleculeSetPeriodicBox(Molecule *mp, const Vector *ax, const Vector *ay, const Vector *az, const Vector *ao, const char *periodic, int convertCoordinates);
376 int MoleculeReadCoordinatesFromFile(Molecule *mp, const char *fname, const char *ftype, char **errbuf);
377 int MoleculeReadCoordinatesFromPdbFile(Molecule *mp, const char *fname, char **errbuf);
378 int MoleculeReadCoordinatesFromDcdFile(Molecule *mp, const char *fname, char **errbuf);
380 int MoleculeReadExtendedInfo(Molecule *mp, const char *fname, char **errbuf);
381 int MoleculeWriteExtendedInfo(Molecule *mp, const char *fname, char **errbuf);
383 int MoleculeWriteToFile(Molecule *mp, const char *fname, const char *ftype, char **errbuf);
384 int MoleculeWriteToPsfFile(Molecule *mp, const char *fname, char **errbuf);
385 int MoleculeWriteToPdbFile(Molecule *mp, const char *fname, char **errbuf);
386 int MoleculeWriteToDcdFile(Molecule *mp, const char *fname, char **errbuf);
387 int MoleculeWriteToTepFile(Molecule *mp, const char *fname, char **errbuf);
388 void MoleculeDump(Molecule *mol);
390 int MoleculePrepareMDArena(Molecule *mol, int check_only, char **retmsg);
392 char *MoleculeSerialize(Molecule *mp, Int *outLength, Int *timep);
393 Molecule *MoleculeDeserialize(const char *data, Int length, Int *timep);
395 void MoleculeCleanUpResidueTable(Molecule *mp);
396 int MoleculeChangeNumberOfResidues(Molecule *mp, int nresidues);
397 int MoleculeChangeResidueNumberWithArray(Molecule *mp, IntGroup *group, Int *resSeqs);
398 int MoleculeChangeResidueNumber(Molecule *mp, IntGroup *group, int resSeq);
399 int MoleculeOffsetResidueNumbers(Molecule *mp, IntGroup *group, int offset, int nresidues);
400 int MoleculeChangeResidueNames(Molecule *mp, int argc, Int *resSeqs, char *names);
401 int MoleculeMaximumResidueNumber(Molecule *mp, IntGroup *group);
402 int MoleculeMinimumResidueNumber(Molecule *mp, IntGroup *group);
406 int MoleculeCheckSanity(Molecule *mp);
408 #define MoleculeCheckSanity(mp)
411 int MoleculeCreateAnAtom(Molecule *mp, const Atom *ap, int pos);
412 int MoleculeMerge(Molecule *dst, Molecule *src, IntGroup *where, int resSeqOffset, Int *nactions, struct MolAction ***actions, Int forUndo);
413 int MoleculeUnmerge(Molecule *src, Molecule **dstp, IntGroup *where, int resSeqOffset, Int *nactions, struct MolAction ***actions, Int forUndo);
414 int MoleculeExtract(Molecule *src, Molecule **dstp, IntGroup *where, int dummyFlag);
415 int MoleculeAddBonds(Molecule *mp, Int nbonds, const Int *bonds, IntGroup *where, Int autoGenerate);
416 int MoleculeDeleteBonds(Molecule *mp, Int *bonds, IntGroup *where, Int **outRemoved, IntGroup **outRemovedPos);
417 int MoleculeAddAngles(Molecule *mp, const Int *angles, IntGroup *where);
418 int MoleculeDeleteAngles(Molecule *mp, Int *angles, IntGroup *where);
419 int MoleculeAddDihedrals(Molecule *mp, const Int *dihedrals, IntGroup *where);
420 int MoleculeDeleteDihedrals(Molecule *mp, Int *dihedrals, IntGroup *where);
421 int MoleculeAddImpropers(Molecule *mp, const Int *impropers, IntGroup *where);
422 int MoleculeDeleteImpropers(Molecule *mp, Int *impropers, IntGroup *where);
423 int MoleculeLookupBond(Molecule *mp, Int n1, Int n2);
424 int MoleculeLookupAngle(Molecule *mp, Int n1, Int n2, Int n3);
425 int MoleculeLookupDihedral(Molecule *mp, Int n1, Int n2, Int n3, Int n4);
426 int MoleculeLookupImproper(Molecule *mp, Int n1, Int n2, Int n3, Int n4);
429 Int MoleculeReplaceAllAngles(Molecule *mol, Int nangles, const Int *angles, Int **outAngles);
430 Int MoleculeReplaceAllDihedrals(Molecule *mol, Int ndihedrals, const Int *dihedrals, Int **outDihedrals);
431 Int MoleculeReplaceAllImpropers(Molecule *mol, Int nimpropers, const Int *impropers, Int **outImpropers);
433 Int MoleculeFindAllAngles(Molecule *mol, Int **outAngles);
434 Int MoleculeFindAllDihedrals(Molecule *mol, Int **outDihedrals);
435 Int MoleculeFindAllImpropers(Molecule *mol, Int **outImpropers);
438 Int MoleculeFindMissingAngles(Molecule *mol, Int **outAngles);
439 Int MoleculeFindMissingDihedrals(Molecule *mol, Int **outDihedrals);
440 Int MoleculeFindMissingImpropers(Molecule *mol, Int **outImpropers);
442 IntGroup *MoleculeSearchBondsIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
443 IntGroup *MoleculeSearchAnglesIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
444 IntGroup *MoleculeSearchDihedralsIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
445 IntGroup *MoleculeSearchImpropersIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
447 IntGroup *MoleculeSearchBondsAcrossAtomGroup(Molecule *mp, IntGroup *atomgroup);
449 IntGroup *MoleculeSearchAnglesIncludingBond(Molecule *mp, int n1, int n2);
450 IntGroup *MoleculeSearchDihedralsIncludingBond(Molecule *mp, int n1, int n2);
451 IntGroup *MoleculeSearchImpropersIncludingBond(Molecule *mp, int n1, int n2);
453 int MoleculeLookupAtomInResidue(Molecule *mp, int n1, int resno);
454 int MoleculeAnalyzeAtomName(const char *s, char *resName, int *resSeq, char *atomName);
455 int MoleculeAtomIndexFromString(Molecule *mp, const char *s);
457 int MoleculeFindCloseAtoms(Molecule *mp, Int index, Double limit, Int *outNbonds, Int **outBonds, Int triangle);
458 int MoleculeGuessBonds(Molecule *mp, Double limit, Int *outNbonds, Int **outBonds);
459 int MoleculeRebuildTablesFromConnects(Molecule *mp);
460 int MoleculeAreAtomsConnected(Molecule *mol, int idx1, int idx2);
462 void MoleculeGetAtomName(Molecule *mp, int index, char *buf, int bufsize);
464 void MoleculeSetSelection(Molecule *mp, IntGroup *select);
465 IntGroup *MoleculeGetSelection(Molecule *mp);
466 void MoleculeSelectAtom(Molecule *mp, int n1, int extending);
467 void MoleculeUnselectAtom(Molecule *mp, int n1);
468 void MoleculeToggleSelectionOfAtom(Molecule *mp, int n1);
469 int MoleculeIsAtomSelected(Molecule *mp, int n1);
470 int MoleculeIsBondSelected(Molecule *mp, int n1, int n2);
471 IntGroup *MoleculeModifySelectionByRemovingAtoms(Molecule *mp, IntGroup *selection, IntGroup *remove);
473 int MoleculeGetTransformForSymop(Molecule *mp, Symop symop, Transform *tf, int is_cartesian);
474 int MoleculeGetSymopForTransform(Molecule *mp, const Transform tf, Symop *symop, int is_cartesian);
476 int MoleculeTransformBySymop(Molecule *mp, const Vector *vpin, Vector *vpout, Symop symop);
477 int MoleculeAddExpandedAtoms(Molecule *mp, Symop symop, IntGroup *group, Int *indices, Int allowOverlap);
478 int MoleculeAmendBySymmetry(Molecule *mp, IntGroup *group, IntGroup **groupout, Vector **vpout);
480 int MoleculeShowAllAtoms(Molecule *mp);
481 int MoleculeShowReverse(Molecule *mp);
482 int MoleculeHideAtoms(Molecule *mp, IntGroup *ig);
484 int MoleculeRenumberAtoms(Molecule *mp, const Int *new2old, Int *old2new_out, Int isize);
486 void MoleculeTransform(Molecule *mp, Transform tr, IntGroup *group);
487 /*void MoleculeMove(Molecule *mp, Transform tr, IntGroup *group);*/
488 void MoleculeTranslate(Molecule *mp, const Vector *vp, IntGroup *group);
489 void MoleculeRotate(Molecule *mp, const Vector *axis, Double angle, const Vector *center, IntGroup *group);
490 int MoleculeCenterOfMass(Molecule *mp, Vector *center, IntGroup *group);
491 int MoleculeBounds(Molecule *mp, Vector *min, Vector *max, IntGroup *group);
493 Int *MoleculeSearchEquivalentAtoms(Molecule *mol, IntGroup *ig);
495 void MoleculeAddExpansion(Molecule *mp, Vector dr, Int symop, IntGroup *group, Double limit);
496 void MoleculeClearExpansion(Molecule *mp, IntGroup *group);
497 void MoleculeRemoveExpansion(Molecule *mp, Vector dr, Int symop, IntGroup *group);
498 void MoleculeAutoExpansion(Molecule *mp, const float *boxstart, const float *boxend, IntGroup *group, Double limit);
500 void MoleculeXtalToCartesian(Molecule *mp, Vector *dst, const Vector *src);
501 void MoleculeCartesianToXtal(Molecule *mp, Vector *dst, const Vector *src);
502 Double MoleculeMeasureBond(Molecule *mp, const Vector *vp1, const Vector *vp2);
503 Double MoleculeMeasureAngle(Molecule *mp, const Vector *vp1, const Vector *vp2, const Vector *vp3);
504 Double MoleculeMeasureDihedral(Molecule *mp, const Vector *vp1, const Vector *vp2, const Vector *vp3, const Vector *vp4);
506 IntGroup *MoleculeFragmentExcludingAtomGroup(Molecule *mp, int n1, IntGroup *exatoms);
507 IntGroup *MoleculeFragmentExcludingAtoms(Molecule *mp, int n1, int argc, int *argv);
508 IntGroup *MoleculeFragmentWithAtomGroups(Molecule *mp, IntGroup *inatoms, IntGroup *exatoms);
509 int MoleculeIsFragmentDetachable(Molecule *mp, IntGroup *group, int *n1, int *n2);
510 int MoleculeIsFragmentRotatable(Molecule *mp, IntGroup *group, int *n1, int *n2, IntGroup **rotGroup);
512 int MoleculeGetNumberOfFrames(Molecule *mp);
513 int MoleculeInsertFrames(Molecule *mp, IntGroup *group, const Vector *inFrame, const Vector *inFrameCell);
514 int MoleculeRemoveFrames(Molecule *mp, IntGroup *group, Vector *outFrame, Vector *outFrameCell);
515 int MoleculeSelectFrame(Molecule *mp, int frame, int copyback);
516 int MoleculeFlushFrames(Molecule *mp);
518 void MoleculeCalculatePiAnchorPosition(Molecule *mol, int idx);
519 int MoleculeSetPiAnchorList(Molecule *mol, Int idx, Int nentries, Int *entries, Double *weights, Int *nUndoActions, struct MolAction ***undoActions);
521 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);
522 int MoleculeGetDefaultMOGrid(Molecule *mp, Int npoints, Vector *op, Vector *xp, Vector *yp, Vector *zp, Int *nx, Int *ny, Int *nz);
523 const Cube *MoleculeGetCubeAtIndex(Molecule *mp, Int index);
524 int MoleculeLookUpCubeWithMONumber(Molecule *mp, Int mono);
525 int MoleculeClearCubeAtIndex(Molecule *mp, Int index);
526 int MoleculeOutputCube(Molecule *mp, Int index, const char *fname, const char *comment);
528 /*#define kMoleculePasteboardType "Molecule"
529 #define kParameterPasteboardType "Parameter" */
530 extern char *gMoleculePasteboardType;
531 extern char *gParameterPasteboardType;
532 extern char *gLoadSaveErrorMessage;
534 STUB void MoleculeRetainExternalObj(Molecule *mol);
535 STUB void MoleculeReleaseExternalObj(Molecule *mol);
537 STUB int MoleculeCallback_writeToPasteboard(const char *type, const void *data, int length);
538 STUB int MoleculeCallback_readFromPasteboard(const char *type, void **dptr, int *length);
539 STUB int MoleculeCallback_isDataInPasteboard(const char *type);
541 STUB Molecule *MoleculeCallback_openNewMolecule(const char *fname);
542 STUB void MoleculeCallback_notifyModification(Molecule *mp, int now_flag);
543 STUB Molecule *MoleculeCallback_currentMolecule(void);
544 STUB Molecule *MoleculeCallback_moleculeAtIndex(int idx);
545 STUB Molecule *MoleculeCallback_moleculeAtOrderedIndex(int idx);
546 STUB void MoleculeCallback_displayName(Molecule *mol, char *buf, int bufsize);
547 STUB void MoleculeCallback_pathName(Molecule *mol, char *buf, int bufsize);
548 STUB int MoleculeCallback_setDisplayName(Molecule *mol, const char *name);
550 STUB void MoleculeCallback_lockMutex(void *mutex);
551 STUB void MoleculeCallback_unlockMutex(void *mutex);
552 STUB void MoleculeCallback_disableModificationFromGUI(Molecule *mol);
553 STUB void MoleculeCallback_enableModificationFromGUI(Molecule *mol);
555 STUB void MoleculeCallback_cannotModifyMoleculeDuringMDError(Molecule *mol);
557 STUB int MoleculeCallback_callSubProcessAsync(Molecule *mol, const char *cmd, int (*callback)(Molecule *, int), int (*timerCallback)(Molecule *, int), FILE *output, FILE *errout);
559 /* This is also defined in Molby_extern.h, but it may be called from functions in Molecule.c */
560 STUB int MyAppCallback_checkInterrupt(void);
562 void MoleculeLock(Molecule *mol);
563 void MoleculeUnlock(Molecule *mol);
566 #define __MoleculeLock(mol) MoleculeLock(mol)
567 #define __MoleculeUnlock(mol) MoleculeUnlock(mol)
569 #define __MoleculeLock(mol)
570 #define __MoleculeUnlock(mol)
577 #endif /* __Molecule_h__ */