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__
28 #define ATOMS_MAX_SYMMETRY 12
29 #define ATOMS_MAX_NUMBER 100000000 /* Sufficiently large value */
31 /* Conversion between kcal/mol and internal energy unit (am*ang^2/fs^2, am = atomic mass) */
32 #define KCAL2INTERNAL (4.184e-4)
33 #define INTERNAL2KCAL (1.0/KCAL2INTERNAL)
34 #define J2INTERNAL (1e-4)
35 #define INTERNAL2J (1.0/J2INTERNAL)
37 #define BOLTZMANN (8.31441e-3*J2INTERNAL)
38 #define PI 3.14159265358979
40 /* Anisotropic thermal parameter */
41 typedef struct Aniso {
42 Double bij[6]; /* b11, b22, b33, b12, b13, b23 (ORTEP type 0) */
43 char has_bsig; /* Has sigma values? */
44 Double bsig[6]; /* sigma values */
45 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. */
48 /* Symmetry operation */
49 /* If periodic box is defined, dx/dy/dz denote multiples of the axes of the periodic box.
50 Otherwise, dx/dy/dz denote offset to the x/y/z coordinates of the atoms. */
51 typedef struct Symop {
56 unsigned int alive: 1;
64 /* Atom connection record */
65 /* If nconnects <= ATOM_CONNECT_LIMIT, data[] field is used. Otherwise,
66 memory is allocated by malloc(). */
67 #define ATOM_CONNECT_LIMIT 6
68 typedef struct AtomConnect {
69 Int count; /* Number of connections */
72 Int data[ATOM_CONNECT_LIMIT];
89 Vector r; /* position */
90 Vector v; /* velocity */
92 Vector sigma; /* For crystallographic data only; sigma for each crystallographic coordinates */
93 /* (Unlike r, these are not converted to the cartesian system) */
99 Int nframes; /* Multiple frames */
101 Symop symop; /* For symmetry-expanded atom */
102 Int symbase; /* The index of original atom for symmetry-expansion */
103 Int labelid; /* The label ID; 0 for no label */
104 short wrap_dx, wrap_dy, wrap_dz; /* Calculated by md_wrap_coordinates; used only in wrapped output. */
105 Double fix_force; /* 0: no fix, >0: fix at fix_pos with harmonic potential, <0: fix at fix_pos without force */
107 Byte mm_exclude; /* If nonzero, then this atom is excluded from MM/MD calculations */
108 Byte periodic_exclude; /* If nonzero, then this atom is excluded from periodic calculations */
111 extern Int gSizeOfAtomRecord;
113 #define ATOM_AT_INDEX(p, i) ((Atom *)((char *)(p) + (i) * gSizeOfAtomRecord))
114 #define ATOM_NEXT(p) ((Atom *)((char *)(p) + gSizeOfAtomRecord))
115 #define ATOM_PREV(p) ((Atom *)((char *)(p) - gSizeOfAtomRecord))
116 #define SYMOP_ALIVE(s) ((s.dx || s.dy || s.dz || s.sym) != 0)
117 #define SYMOP_EQUAL(s1, s2) (s1.dx == s2.dx && s1.dy == s2.dy && s1.dz == s2.dz && s1.sym == s2.sym)
118 #define SYMMETRY_AT_INDEX(p, i) (*((i) == 0 ? &gIdentityTransform : &p[i]))
120 /* atom.connects is a union entry, including direct data for nconnects <= ATOM_CONNECT_LIMIT
121 and malloc()'ed entry for nconnects > ATOM_CONNECT_LIMIT. The following functions
122 automatically take care of the memory allocation/deallocation. */
123 Int *AtomConnectData(AtomConnect *ac);
124 void AtomConnectResize(AtomConnect *ac, Int nconnects);
125 void AtomConnectInsertEntry(AtomConnect *ac, Int idx, Int connect);
126 void AtomConnectDeleteEntry(AtomConnect *ac, Int idx);
128 #define ATOM_CONNECT_PTR(ac) ((ac)->count > ATOM_CONNECT_LIMIT ? (ac)->u.ptr : (ac)->u.data)
130 /* 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. */
131 extern Atom *AtomDuplicate(Atom *dst, const Atom *src);
133 /* Duplicate an atom, except for the frame entry */
134 extern Atom *AtomDuplicateNoFrame(Atom *dst, const Atom *src);
136 /* Clean the content of an atom record */
137 extern void AtomClean(Atom *ap);
139 /* MolEnumerable type code */
150 /* Enumerable class to access to atoms, bonds, etc. */
151 typedef struct MolEnumerable {
152 struct Molecule *mol;
157 typedef struct AtomRef {
158 struct Molecule *mol;
162 /* Crystallographic cell parameter (also used as periodic box in MD) */
163 typedef struct XtalCell {
164 Double cell[6]; /* a, b, c, alpha, beta, gamma (in degree) */
165 Double rcell[6]; /* Reciprocal cell */
166 Vector axes[3]; /* Cartesian unit vectors along the three axis */
167 Vector origin; /* Cartesian origin of the periodic box */
168 char flags[3]; /* 1 for periodic, 0 for non-periodic */
169 char has_sigma; /* Has sigma? */
170 Transform tr; /* Crystal coord -> cartesian */
171 Transform rtr; /* Cartesian -> crystal coord */
172 Double cellsigma[6]; /* For crystallographic data; sigma for the cell parameters */
176 /* Dummy atoms to represent metal-pi bonds */
177 typedef struct PiAtom {
182 Double *coeffs; /* The piatom position is given by sum(i, atoms[connect.data[i]] * coeffs[i]) */
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 */
206 /* Exponent/coefficient info for a single gaussian primitive */
207 typedef struct PrimInfo {
208 Double A; /* Exponent */
209 Double C; /* Contraction coefficient */
210 Double Csp; /* P(S=P) contraction coefficient */
213 /* Gaussian orbital shell information */
214 typedef struct ShellInfo {
215 signed char sym; /* Symmetry of the basis; S, P, ... */
216 signed char ncomp; /* Number of components (S: 1, P: 3, SP: 4, etc.) */
217 signed char nprim; /* Number of primitives for this shell */
218 Int p_idx; /* Index to the PrimInfo (exponent/coefficient) table */
219 Int cn_idx; /* Index to the normalized (cached) contraction coefficient table */
220 Int a_idx; /* Index to the atom which this primitive belongs to */
221 Int m_idx; /* Index to the MO matrix */
224 /* Basis set and MO information */
225 typedef struct BasisSet {
226 Int nshells; /* Number of gaussian orbital shells */
227 ShellInfo *shells; /* Gaussian orbital shells */
228 Int npriminfos; /* Size of primitive information table */
229 PrimInfo *priminfos; /* Primitive information table */
230 Int ncns; /* Number of normalized (cached) contraction coefficient values */
231 Double *cns; /* Normalized (cached) contraction coefficients; (up to 10 values for each primitive) */
232 Int natoms; /* Number of atoms; separately cached here because MO info should be invariant during editing */
233 Vector *pos; /* Positions of atoms; the unit is bohr, not angstrom */
234 Double *nuccharges; /* Nuclear charges (for ECP atoms) */
235 Int ne_alpha, ne_beta; /* Number of alpha/beta electrons */
236 Int rflag; /* 0: UHF, 1: RHF, 2:ROHF */
237 Int ncomps; /* Number of AO components; equal to sum of shells[i].ncomp */
238 Int nmos; /* Number of MOs; equal to ncomps if close shell, ncomps*2 if open shell */
239 Double *mo; /* MO matrix (mo[i][j] represents the j-th AO coefficient for the i-th MO) */
240 Double *moenergies; /* MO energies */
241 Double *scfdensities; /* SCF densities; lower triangle of a symmetric matrix (size nmos*(nmos+1)/2) */
242 Int ncubes; /* Number of calculated MOs */
243 Cube **cubes; /* Calculated MOs (an array of pointers to Cubes) */
246 /* Electrostatic potential */
247 typedef struct Elpot {
252 /* Molecule record */
253 typedef struct Molecule {
258 Int *bonds; /* The size of array is 2*nbonds */
260 Int *angles; /* The size of array is 3*nangles */
262 Int *dihedrals; /* The size of array is 4*ndihedrals */
264 Int *impropers; /* The size of array is 4*nimpropers */
265 Int nresidues; /* Number of residues; maximum residue number + 1 (because residue 0 is 'undefined residue') */
268 Int nsyms; /* Symmetry operations; syms are always described in crystallographic units (even when the unit cell is not defined) */
270 Int npiatoms; /* Number of "dummy" atoms to represent pi-metal bonds */
273 Int *pibonds; /* Array to represent bond/angle/dihedral including piatoms. */
274 /* [n1, n2, -1, -1]: bonds,
275 [n1, n2, n3, -1]: angle,
276 [n1, n2, n3, n4]: dihedral,
277 where n# is atom index if it is <ATOMS_MAX_NUMBER and
278 is piatom index + ATOMS_MAX_NUMBER otherwise.
279 The size of array is 4*npibonds. */
282 Int nframes; /* The number of frames (>= 1). This is a cached value, and should be
283 recalculated from the atoms if it is -1 */
284 Int cframe; /* The current frame number */
286 /* Byte useFlexibleCell; *//* Obsolete (since 0.6.5; unit cell is frame dependent in all cases) */
288 Vector *frame_cells; /* The cell vectors for frames; (nframe_cells*4) array of Vectors */
290 struct MainView *mview; /* Reference to the MainView object if present (no retain) */
291 Int modifyCount; /* Internal counter for modification. This value is not to be modified
292 manually; instead, call MoleculeIncrementModifyCount() whenever
293 modification is done, which also takes care necessary notification
294 to the other part of the application (system dependent) */
296 struct MDArena *arena; /* Reference to the MDArena record during MM/MD run (no retain) */
298 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) */
300 /* Information from the dcd files */
301 Int startStep; /* the timestep for frame 0 */
302 Int stepsPerFrame; /* the number of timesteps between neighboring frames */
303 Double psPerStep; /* picosecond per step */
305 /* Information for basis sets and MOs */
308 /* Electrostatic potential */
312 /* Parameters specific for this molecule */
313 struct Parameter *par;
315 /* Flag to request rebuilding MD internal information */
318 /* Flag to clear selection of the parameter table */
319 Byte parameterTableSelectionNeedsClear;
321 /* Flag to request copying coordinates to MD arena */
322 Byte needsMDCopyCoordinates;
324 /* Prohibit modification of the topology (to avoid interfering MD) */
325 Byte noModifyTopology;
327 /* Flag to request aborting a subthread */
328 Byte requestAbortThread;
330 /* Flag to signal that a subthread is terminated */
331 Byte threadTerminated;
333 /* Mutex object. If non-NULL, it should be locked before modifying molecule */
336 /* Ruby pointer (see ruby_bind.c) */
338 Byte exmolobjProtected;
342 int strlen_limit(const char *s, int limit);
344 Molecule *MoleculeNew(void);
345 int MoleculeLoadFile(Molecule *mp, const char *fname, const char *ftype, char *errbuf, int errbufsize);
346 int MoleculeLoadPsfFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
347 int MoleculeLoadTepFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
348 int MoleculeLoadShelxFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
349 int MoleculeLoadGaussianFchkFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
350 int MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
351 Molecule *MoleculeNewWithName(const char *name);
352 Molecule *MoleculeInitWithAtoms(Molecule *mp, const Atom *atoms, int natoms);
353 Molecule *MoleculeInitWithMolecule(Molecule *mp2, Molecule *mp);
354 void MoleculeSetName(Molecule *par, const char *name);
355 const char *MoleculeGetName(Molecule *mp);
356 void MoleculeSetPath(Molecule *mol, const char *fname);
357 const char *MoleculeGetPath(Molecule *mol);
358 Molecule *MoleculeWithName(const char *name);
359 Molecule *MoleculeRetain(Molecule *mp);
360 void MoleculeRelease(Molecule *mp);
361 void MoleculeExchange(Molecule *mp1, Molecule *mp2);
363 int MoleculeAddGaussianOrbitalShell(Molecule *mol, Int sym, Int nprims, Int a_idx);
364 int MoleculeAddGaussianPrimitiveCoefficients(Molecule *mol, Double exponent, Double contraction, Double contraction_sp);
365 int MoleculeSetMOCoefficients(Molecule *mol, Int idx, Double energy, Int ncomps, Double *coeffs);
366 int MoleculeAllocateBasisSetRecord(Molecule *mol, Int rflag, Int ne_alpha, Int ne_beta);
368 void MoleculeIncrementModifyCount(Molecule *mp);
369 void MoleculeClearModifyCount(Molecule *mp);
371 MolEnumerable *MolEnumerableNew(Molecule *mol, int kind);
372 void MolEnumerableRelease(MolEnumerable *mseq);
373 AtomRef *AtomRefNew(Molecule *mol, int idx);
374 void AtomRefRelease(AtomRef *aref);
376 void MoleculeSetCell(Molecule *mp, Double a, Double b, Double c, Double alpha, Double beta, Double gamma, int convertCoordinates);
377 void MoleculeSetAniso(Molecule *mp, int n1, int type, Double x11, Double x22, Double x33, Double x12, Double x13, Double x23, const Double *sigmap);
378 void MoleculeSetAnisoBySymop(Molecule *mp, int idx);
379 int MoleculeSetPeriodicBox(Molecule *mp, const Vector *ax, const Vector *ay, const Vector *az, const Vector *ao, const char *periodic, int convertCoordinates);
381 int MoleculeReadCoordinatesFromFile(Molecule *mp, const char *fname, const char *ftype, char *errbuf, int errbufsize);
382 int MoleculeReadCoordinatesFromPdbFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
383 int MoleculeReadCoordinatesFromDcdFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
385 int MoleculeReadExtendedInfo(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
386 int MoleculeWriteExtendedInfo(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
388 int MoleculeWriteToFile(Molecule *mp, const char *fname, const char *ftype, char *errbuf, int errbufsize);
389 int MoleculeWriteToPsfFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
390 int MoleculeWriteToPdbFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
391 int MoleculeWriteToDcdFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
392 int MoleculeWriteToTepFile(Molecule *mp, const char *fname, char *errbuf, int errbufsize);
393 void MoleculeDump(Molecule *mol);
395 int MoleculePrepareMDArena(Molecule *mol, int check_only, char **retmsg);
397 char *MoleculeSerialize(Molecule *mp, Int *outLength, Int *timep);
398 Molecule *MoleculeDeserialize(const char *data, Int length, Int *timep);
400 void MoleculeCleanUpResidueTable(Molecule *mp);
401 int MoleculeChangeNumberOfResidues(Molecule *mp, int nresidues);
402 int MoleculeChangeResidueNumberWithArray(Molecule *mp, IntGroup *group, Int *resSeqs);
403 int MoleculeChangeResidueNumber(Molecule *mp, IntGroup *group, int resSeq);
404 int MoleculeOffsetResidueNumbers(Molecule *mp, IntGroup *group, int offset, int nresidues);
405 int MoleculeChangeResidueNames(Molecule *mp, int argc, Int *resSeqs, char *names);
406 int MoleculeMaximumResidueNumber(Molecule *mp, IntGroup *group);
407 int MoleculeMinimumResidueNumber(Molecule *mp, IntGroup *group);
409 int MoleculeCreateAnAtom(Molecule *mp, const Atom *ap, int pos);
410 int MoleculeMerge(Molecule *dst, Molecule *src, IntGroup *where, int resSeqOffset);
411 int MoleculeUnmerge(Molecule *src, Molecule **dstp, IntGroup *where, int resSeqOffset);
412 int MoleculeExtract(Molecule *src, Molecule **dstp, IntGroup *where, int dummyFlag);
413 int MoleculeAddBonds(Molecule *mp, Int nbonds, const Int *bonds);
414 int MoleculeDeleteBonds(Molecule *mp, Int nbonds, const Int *bonds);
415 int MoleculeAddAngles(Molecule *mp, const Int *angles, IntGroup *where);
416 int MoleculeDeleteAngles(Molecule *mp, Int *angles, IntGroup *where);
417 int MoleculeAddDihedrals(Molecule *mp, const Int *dihedrals, IntGroup *where);
418 int MoleculeDeleteDihedrals(Molecule *mp, Int *dihedrals, IntGroup *where);
419 int MoleculeAddImpropers(Molecule *mp, const Int *impropers, IntGroup *where);
420 int MoleculeDeleteImpropers(Molecule *mp, Int *impropers, IntGroup *where);
421 int MoleculeLookupBond(Molecule *mp, Int n1, Int n2);
422 int MoleculeLookupAngle(Molecule *mp, Int n1, Int n2, Int n3);
423 int MoleculeLookupDihedral(Molecule *mp, Int n1, Int n2, Int n3, Int n4);
424 int MoleculeLookupImproper(Molecule *mp, Int n1, Int n2, Int n3, Int n4);
427 Int MoleculeReplaceAllAngles(Molecule *mol, Int nangles, const Int *angles, Int **outAngles);
428 Int MoleculeReplaceAllDihedrals(Molecule *mol, Int ndihedrals, const Int *dihedrals, Int **outDihedrals);
429 Int MoleculeReplaceAllImpropers(Molecule *mol, Int nimpropers, const Int *impropers, Int **outImpropers);
431 Int MoleculeFindAllAngles(Molecule *mol, Int **outAngles);
432 Int MoleculeFindAllDihedrals(Molecule *mol, Int **outDihedrals);
433 Int MoleculeFindAllImpropers(Molecule *mol, Int **outImpropers);
436 Int MoleculeFindMissingAngles(Molecule *mol, Int **outAngles);
437 Int MoleculeFindMissingDihedrals(Molecule *mol, Int **outDihedrals);
438 Int MoleculeFindMissingImpropers(Molecule *mol, Int **outImpropers);
440 IntGroup *MoleculeSearchBondsIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
441 IntGroup *MoleculeSearchAnglesIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
442 IntGroup *MoleculeSearchDihedralsIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
443 IntGroup *MoleculeSearchImpropersIncludingAtoms(Molecule *mp, IntGroup *atomgroup);
445 IntGroup *MoleculeSearchBondsAcrossAtomGroup(Molecule *mp, IntGroup *atomgroup);
447 IntGroup *MoleculeSearchAnglesIncludingBond(Molecule *mp, int n1, int n2);
448 IntGroup *MoleculeSearchDihedralsIncludingBond(Molecule *mp, int n1, int n2);
449 IntGroup *MoleculeSearchImpropersIncludingBond(Molecule *mp, int n1, int n2);
451 int MoleculeLookupAtomInResidue(Molecule *mp, int n1, int resno);
452 int MoleculeAnalyzeAtomName(const char *s, char *resName, int *resSeq, char *atomName);
453 int MoleculeAtomIndexFromString(Molecule *mp, const char *s);
455 int MoleculeFindCloseAtoms(Molecule *mp, Int index, Double limit, Int *outNbonds, Int **outBonds, Int triangle);
456 int MoleculeGuessBonds(Molecule *mp, Double limit, Int *outNbonds, Int **outBonds);
457 int MoleculeAreAtomsConnected(Molecule *mp, int n1, int n2);
458 int MoleculeRebuildTablesFromConnects(Molecule *mp);
460 void MoleculeGetAtomName(Molecule *mp, int index, char *buf, int bufsize);
462 void MoleculeSetSelection(Molecule *mp, IntGroup *select);
463 IntGroup *MoleculeGetSelection(Molecule *mp);
464 void MoleculeSelectAtom(Molecule *mp, int n1, int extending);
465 void MoleculeUnselectAtom(Molecule *mp, int n1);
466 void MoleculeToggleSelectionOfAtom(Molecule *mp, int n1);
467 int MoleculeIsAtomSelected(Molecule *mp, int n1);
468 int MoleculeIsBondSelected(Molecule *mp, int n1, int n2);
469 IntGroup *MoleculeModifySelectionByRemovingAtoms(Molecule *mp, IntGroup *selection, IntGroup *remove);
471 int MoleculeGetTransformForSymop(Molecule *mp, Symop symop, Transform *tf, int is_cartesian);
472 int MoleculeGetSymopForTransform(Molecule *mp, const Transform tf, Symop *symop, int is_cartesian);
474 int MoleculeTransformBySymop(Molecule *mp, const Vector *vpin, Vector *vpout, Symop symop);
475 int MoleculeAddExpandedAtoms(Molecule *mp, Symop symop, IntGroup *group, Int *indices);
476 int MoleculeAmendBySymmetry(Molecule *mp, IntGroup *group, IntGroup **groupout, Vector **vpout);
478 int MoleculeShowAllAtoms(Molecule *mp);
479 int MoleculeShowReverse(Molecule *mp);
480 int MoleculeHideAtoms(Molecule *mp, IntGroup *ig);
482 int MoleculeRenumberAtoms(Molecule *mp, const Int *new2old, Int *old2new_out, Int isize);
484 void MoleculeTransform(Molecule *mp, Transform tr, IntGroup *group);
485 /*void MoleculeMove(Molecule *mp, Transform tr, IntGroup *group);*/
486 void MoleculeTranslate(Molecule *mp, const Vector *vp, IntGroup *group);
487 void MoleculeRotate(Molecule *mp, const Vector *axis, Double angle, const Vector *center, IntGroup *group);
488 int MoleculeCenterOfMass(Molecule *mp, Vector *center, IntGroup *group);
489 int MoleculeBounds(Molecule *mp, Vector *min, Vector *max, IntGroup *group);
491 Int *MoleculeSearchEquivalentAtoms(Molecule *mol, IntGroup *ig);
493 void MoleculeAddExpansion(Molecule *mp, Vector dr, Int symop, IntGroup *group, Double limit);
494 void MoleculeClearExpansion(Molecule *mp, IntGroup *group);
495 void MoleculeRemoveExpansion(Molecule *mp, Vector dr, Int symop, IntGroup *group);
496 void MoleculeAutoExpansion(Molecule *mp, const float *boxstart, const float *boxend, IntGroup *group, Double limit);
498 void MoleculeXtalToCartesian(Molecule *mp, Vector *dst, const Vector *src);
499 void MoleculeCartesianToXtal(Molecule *mp, Vector *dst, const Vector *src);
500 Double MoleculeMeasureBond(Molecule *mp, const Vector *vp1, const Vector *vp2);
501 Double MoleculeMeasureAngle(Molecule *mp, const Vector *vp1, const Vector *vp2, const Vector *vp3);
502 Double MoleculeMeasureDihedral(Molecule *mp, const Vector *vp1, const Vector *vp2, const Vector *vp3, const Vector *vp4);
504 IntGroup *MoleculeFragmentExcludingAtomGroup(Molecule *mp, int n1, IntGroup *exatoms);
505 IntGroup *MoleculeFragmentExcludingAtoms(Molecule *mp, int n1, int argc, int *argv);
506 IntGroup *MoleculeFragmentWithAtomGroups(Molecule *mp, IntGroup *inatoms, IntGroup *exatoms);
507 int MoleculeIsFragmentDetachable(Molecule *mp, IntGroup *group, int *n1, int *n2);
508 int MoleculeIsFragmentRotatable(Molecule *mp, IntGroup *group, int *n1, int *n2, IntGroup **rotGroup);
510 int MoleculeGetNumberOfFrames(Molecule *mp);
511 int MoleculeInsertFrames(Molecule *mp, IntGroup *group, const Vector *inFrame, const Vector *inFrameCell);
512 int MoleculeRemoveFrames(Molecule *mp, IntGroup *group, Vector *outFrame, Vector *outFrameCell);
513 int MoleculeSelectFrame(Molecule *mp, int frame, int copyback);
514 int MoleculeFlushFrames(Molecule *mp);
516 int MoleculeCalculatePiAtomPosition(Molecule *mol, int idx, Vector *vp);
518 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);
519 int MoleculeGetDefaultMOGrid(Molecule *mp, Int npoints, Vector *op, Vector *xp, Vector *yp, Vector *zp, Int *nx, Int *ny, Int *nz);
520 const Cube *MoleculeGetCubeAtIndex(Molecule *mp, Int index);
521 int MoleculeLookUpCubeWithMONumber(Molecule *mp, Int mono);
522 int MoleculeClearCubeAtIndex(Molecule *mp, Int index);
523 int MoleculeOutputCube(Molecule *mp, Int index, const char *fname, const char *comment);
525 /*#define kMoleculePasteboardType "Molecule"
526 #define kParameterPasteboardType "Parameter" */
527 extern char *gMoleculePasteboardType;
528 extern char *gParameterPasteboardType;
530 STUB void MoleculeRetainExternalObj(Molecule *mol);
531 STUB void MoleculeReleaseExternalObj(Molecule *mol);
533 STUB int MoleculeCallback_writeToPasteboard(const char *type, const void *data, int length);
534 STUB int MoleculeCallback_readFromPasteboard(const char *type, void **dptr, int *length);
535 STUB int MoleculeCallback_isDataInPasteboard(const char *type);
537 STUB Molecule *MoleculeCallback_openNewMolecule(const char *fname);
538 STUB void MoleculeCallback_notifyModification(Molecule *mp, int now_flag);
539 STUB Molecule *MoleculeCallback_currentMolecule(void);
540 STUB Molecule *MoleculeCallback_moleculeAtIndex(int idx);
541 STUB Molecule *MoleculeCallback_moleculeAtOrderedIndex(int idx);
542 STUB void MoleculeCallback_displayName(Molecule *mol, char *buf, int bufsize);
543 STUB void MoleculeCallback_pathName(Molecule *mol, char *buf, int bufsize);
544 STUB int MoleculeCallback_setDisplayName(Molecule *mol, const char *name);
546 STUB void MoleculeCallback_lockMutex(void *mutex);
547 STUB void MoleculeCallback_unlockMutex(void *mutex);
548 STUB void MoleculeCallback_cannotModifyMoleculeDuringMDError(Molecule *mol);
550 /* This is also defined in Molby_extern.h, but it may be called from functions in Molecule.c */
551 STUB int MyAppCallback_checkInterrupt(void);
553 void MoleculeLock(Molecule *mol);
554 void MoleculeUnlock(Molecule *mol);
557 #define __MoleculeLock(mol) MoleculeLock(mol)
558 #define __MoleculeUnlock(mol) MoleculeUnlock(mol)
560 #define __MoleculeLock(mol)
561 #define __MoleculeUnlock(mol)
568 #endif /* __Molecule_h__ */