1
/*****************************************************************************
2
TRAVIS - Trajectory Analyzer and Visualizer
3
http://www.travis-analyzer.de/
5
Copyright (c) 2009-2013 Martin Brehm
6
2012-2013 Martin Thomas
8
This file written by Martin Brehm.
10
This program is free software: you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
*****************************************************************************/
28
#include "statistics.h"
29
#include "maintools.h"
31
#include "interface.h"
1
/*****************************************************************************
2
TRAVIS - Trajectory Analyzer and Visualizer
3
http://www.travis-analyzer.de/
5
Copyright (c) 2009-2014 Martin Brehm
6
2012-2014 Martin Thomas
8
This file written by Martin Brehm.
10
This program is free software: you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
*****************************************************************************/
28
#include "statistics.h"
29
#include "maintools.h"
31
#include "interface.h"
32
32
#include "structurefactor.h"
38
char buf[4096], buf2[256];
42
int z, z0, z2, z3, z4, z5, z6, z7;
44
unsigned char ty, rty, atom;
45
unsigned char ty2, rty2, atom2;
49
CSingleMolecule *sm, *sm2;
57
g_bKeepUnfoldedCoords = false;
58
g_iDoubleBoxFactor = 1;
64
g_bSaveCoordsUnchanged = false;
65
g_bSDFUniform = false;
69
mprintf(YELLOW,"\n*** Interactive query of settings ***\n\n");
73
if (g_bUnknownElements)
78
mprintf(WHITE,"Unrecognized atom types: ");
79
for (z=0;z<g_oaAtoms.GetSize();z++)
81
if (z == g_iVirtAtomType)
84
at = (CAtom*)g_oaAtoms[z];
85
while (at->m_pMergedTo != NULL)
87
// mprintf("%s merged to %s\n",at->m_sName,at->m_pMergedTo->m_sName);
90
if (at->m_pElement->m_fRadius != 0)
95
mprintf("%s",at->m_sName);
101
if ((ti == 1) && (mystricmp("X",((CAtom*)g_oaAtoms[ti2])->m_sName) == 0))
102
{ // Only Wannier centers unrecognized.
103
mprintf(" Possibly, atom type \"X\" are Wannier centers. If so, do not assign data to them.\n\n");
108
if (AskYesNo(" Do you want to assign atom data to them (y/n)? [%s] ",tb2,tb2?"yes":"no"))
112
if (AskYesNo(" Automatically rename all atoms to corresponding elements (y/n)? [yes] ",true))
117
for (z=0;z<g_oaAtoms.GetSize();z++)
119
if (z == g_iVirtAtomType)
122
at = (CAtom*)g_oaAtoms[z];
123
if (at->m_pElement->m_fRadius != 0)
126
buf2[0] = at->m_sName[0];
127
buf2[1] = at->m_sName[1];
129
el = FindElement(buf2,true);
132
if (el->m_fRadius == 0)
138
el = FindElement(buf2,true);
141
if (el->m_fRadius == 0)
146
strcpy(buf2,at->m_sName);
151
mprintf(" - Skipping %s... (have no guess for atom type)\n",at->m_sName);
158
mprintf(" - Renaming %s to %s...\n",at->m_sName,buf2);
159
for (z2=0;z2<g_oaAtoms.GetSize();z2++)
161
if (((CAtom*)g_oaAtoms[z2])->m_pElement == el)
163
at = (CAtom*)g_oaAtoms[z2];
168
eprintf(" Strange error ^^\n");
170
for (z2=0;z2<(int)g_TimeStep.m_iGesAtomCount;z2++)
172
strcpy(buf,(char*)g_TimeStep.m_paLabels[z2]);
174
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
177
((CAtom*)g_oaAtoms[z])->m_iCount--;
180
// mprintf("\nmerging %s to %s.\n",((CAtom*)g_oaAtoms[z])->m_sName,at->m_sName);
181
((CAtom*)g_oaAtoms[z])->m_pMergedTo = at;
192
ti = g_oaAtoms.GetSize();
195
if (z == g_iVirtAtomType)
198
at = (CAtom*)g_oaAtoms[z];
200
while (at->m_pMergedTo != NULL)
202
// mprintf("%s merged to %s\n",at->m_sName,at->m_pMergedTo->m_sName);
203
at = at->m_pMergedTo;
206
if (at->m_pElement->m_fRadius != 0)
208
mprintf(WHITE,"\n * Element %s\n\n",at->m_sName);
210
buf2[0] = at->m_sName[0];
211
buf2[1] = at->m_sName[1];
213
el = FindElement(buf2,true);
216
if (el->m_fRadius == 0)
222
el = FindElement(buf2,true);
225
if (el->m_fRadius == 0)
230
strcpy(buf2,at->m_sName);
234
if (AskYesNo(" Do you want to rename this element (y/n)? [yes] ",true))
237
AskString(" Enter new name for %s: [%s] ",buf,buf2,at->m_sName,buf2);
240
eprintf("Atom labels may have maximum length of 7 characters.\n");
243
if (ContainsDigit(buf))
245
eprintf("Digits in element labels not allowed.\n");
248
el = FindElement(buf,true);
252
if (AskYesNo(" Element %s is known. Merge %s atoms into %s (y/n)? [yes] ",true,buf,at->m_sName,buf))
254
for (z2=0;z2<g_oaAtoms.GetSize();z2++)
256
if (((CAtom*)g_oaAtoms[z2])->m_pElement == el)
258
at = (CAtom*)g_oaAtoms[z2];
263
eprintf(" Strange error ^^\n");
268
mprintf(" Adding element %s...",buf);
270
try { at = new CAtom(); } catch(...) { at = NULL; }
271
if (at == NULL) NewException((double)sizeof(CAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
273
at->m_iIndex = g_oaAtoms.GetSize();
276
try { at->m_pElement = new CElement(); } catch(...) { at->m_pElement = NULL; }
277
if (at->m_pElement == NULL) NewException((double)sizeof(CElement),__FILE__,__LINE__,__PRETTY_FUNCTION__);
280
sprintf(at->m_sName,"%s",buf);
282
for (z2=0;z2<(int)g_TimeStep.m_iGesAtomCount;z2++)
284
strcpy(buf,(char*)g_TimeStep.m_paLabels[z2]);
286
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
289
((CAtom*)g_oaAtoms[z])->m_iCount--;
292
((CAtom*)g_oaAtoms[z])->m_pMergedTo = at;
293
if (el->m_fRadius != 0)
297
if (AskYesNo(" Do you want to copy the atom parameters from another element (y/n)? [yes] ",true))
300
AskString(" Copy atom parameters from which element? [%s] ",buf,buf2,buf2);
301
el = FindElement(buf,true);
304
eprintf("This element is not defined.\n");
307
if (el->m_fRadius == 0)
309
if (!AskYesNo(" This element has a radius of 0 (will form no bonds). Use it anyway (y/n)? [yes] ",true))
313
mprintf(WHITE,"\n A covalent radius of 0 pm hinders atoms of this kind from forming any bonds.\n\n");
315
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [%.2f] ",el->m_fRadius,el->m_fRadius);
316
at->m_pElement->m_fMass = AskFloat(" Please enter atom mass in u: [%.2f] ",el->m_fMass,el->m_fMass);
318
if (!tb && (fabs(at->m_pElement->m_fMass-el->m_fMass) < 0.01))
321
mprintf(RED,"\n Warning: ");
322
mprintf("Elements %s and %s keep their different labels, but will have\n",at->m_sName,buf);
323
mprintf(" the same mass and therefore also the same atom codes. They will not\n");
324
mprintf(" be distinguished in the molecule recognition!\n");
326
// mprintf(" Using mass=%.2fu, radius=%.2fpm, ord. number=%d.\n",at->m_pElement->m_fMass,el->m_fRadius,el->m_iOrd);
327
// at->m_pElement->CopyData(el);
330
el = FindElement(buf2,true);
331
mprintf(WHITE,"\n A covalent radius of 0 pm hinders atoms of this kind from forming any bonds.\n\n");
334
mprintf(" (Default values are for %s)\n\n",buf2);
335
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [%.2f] ",el->m_fRadius,el->m_fRadius);
336
at->m_pElement->m_fMass = AskFloat(" Please enter atom mass in u: [%.2f] ",el->m_fMass,el->m_fMass);
339
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [100] ",100);
340
at->m_pElement->m_fMass = AskFloat_ND(" Please enter atom mass in u: ");
346
mprintf(WHITE,"%d atoms in the system: ",g_iGesAtomCount);
348
for (z=0;z<g_oaAtoms.GetSize();z++)
350
if (z == g_iVirtAtomType)
352
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
354
mprintf("%dx %s",((CAtom*)g_oaAtoms[z])->m_iCount,((CAtom*)g_oaAtoms[z])->m_sName);
355
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
356
mprintf(" (merged to %s)",((CAtom*)g_oaAtoms[z])->m_pMergedTo->m_sName);
357
if (z < (int)g_oaAtoms.GetSize()-1)
358
if (z+1 != g_iVirtAtomType)
362
} // END IF CHANGE UNKNOWN
368
for (z=0;z<g_oaAtoms.GetSize();z++)
371
for (z3=0;z3<ia.GetSize();z3++)
376
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
378
if (z == g_iVirtAtomType)
380
for (z2=z+1;z2<g_oaAtoms.GetSize();z2++)
382
if (((CAtom*)g_oaAtoms[z2])->m_pMergedTo != NULL)
384
if (z2 == g_iVirtAtomType)
386
if (fabs(((CAtom*)g_oaAtoms[z])->m_pElement->m_fMass - ((CAtom*)g_oaAtoms[z2])->m_pElement->m_fMass) < 0.01)
392
mprintf(RED,"\n Warning: ");
393
mprintf("The following atoms have the same mass and will therefore not be\n");
394
mprintf(" distinguished in the molecule recognition:\n\n");
395
mprintf(WHITE," Mass=%.2f: %s, %s",((CAtom*)g_oaAtoms[z])->m_pElement->m_fMass,((CAtom*)g_oaAtoms[z])->m_sName,((CAtom*)g_oaAtoms[z2])->m_sName);
400
mprintf(WHITE,", %s",((CAtom*)g_oaAtoms[z2])->m_sName);
411
mprintf(" The advanced mode includes some options which are quite powerful,\n yet possibly weird or seldomly required. ");
412
mprintf("This includes support for\n NPT ensemble, non-periodic systems, user-definded virtual atoms, pseudomolecules, ...\n\n");
414
g_bAdvanced1 = AskYesNo(" Use the advanced mode up to the function selection menu (y/n)? [no] ",false);
422
mprintf(" Use periodic boundary conditions (0=no, x, y, z, xy, xz, xyz)? [xyz] ");
423
inpprintf("! Use periodic boundary conditions (0=no, x, y, z, xy, xz, xyz)? [xyz]\n");
425
} while (!ParsePeriodic(buf));
429
/* if (AskYesNo(" Enter Box Size anyways (e.g. fo RDFs) (yes/no)? [yes] ",true))
434
g_fBoxX = GuessBoxSize();
435
g_fBoxY = GuessBoxSize();
436
g_fBoxZ = GuessBoxSize();
437
mprintf("\nGuessed box size (for density 1.0 g/cm^3) is %.2f x %.2f x %.2f pm.\n\n",g_fBoxX,g_fBoxX,g_fBoxX);
439
// g_fBoxX = (g_TimeStep.m_vMax[0]-g_TimeStep.m_vMin[0])*10.0;
440
// g_fBoxY = (g_TimeStep.m_vMax[1]-g_TimeStep.m_vMin[1])*10.0;
441
// g_fBoxZ = (g_TimeStep.m_vMax[2]-g_TimeStep.m_vMin[2])*10.0;
442
// mprintf("\n Using cell vector of %.2f x %.2f x %.2f pm to \"fake\" non-periodic box.\n\n",g_fBoxX,g_fBoxY,g_fBoxZ);
445
ParsePeriodic("xyz");
450
mprintf(" A cell vector of %.2f pm would result in a density of 1.0 g/cm^3.\n\n",tf);
453
g_bNPT = AskYesNo(" Use time-dependent cell vector (NPT ensemble) (y/n)? [no] ",false);
455
} else g_bNPT = false;
461
mprintf(" Your PDB file contains cell vector information.\n\n");
464
mprintf(" The trajectory does not contain cell vector information.\n");
465
mprintf(" (supported: PDB file with \"CRYST1\" section, like written by GROMACS trjconv)\n");
466
mprintf(" You have to supply a plain text file which contains the cell vectors for each step.\n");
467
mprintf(" It should contain three space-separated floating point numbers (X, Y, Z vector) per line.\n");
468
mprintf(" These numbers need to be IN ANGSTROM! (1 angstrom = 100 pm)\n\n");
470
AskString_ND(" Please enter cell vector text file name: ",g_sNPTFile);
471
if (!FileExist(g_sNPTFile))
473
eprintf("Could not open file \"%s\" for reading.\n",g_sNPTFile);
476
g_fNPTFile = fopen(g_sNPTFile,"rt");
477
g_TimeStep.ReadCellVector(g_fNPTFile);
481
mprintf(" The initial cell vector is ( %.2f pm | %.2f pm | %.2f pm ).\n",g_fBoxX,g_fBoxY,g_fBoxZ);
482
mprintf(" The initial box density is %.6f g/cm^3.\n\n",tf*tf*tf/g_fBoxX/g_fBoxY/g_fBoxZ);
487
mprintf(" Cell vector found in trajectory file:\n");
488
mprintf(" X = %.2f pm, Y = %.2f pm, Z = %.2f pm\n\n",g_fBoxX,g_fBoxY,g_fBoxZ);
489
if (AskYesNo(" Use these values (y/n)? [yes] ",true))
493
if (!AskYesNo(" Are the 3 cell vectors of the same size (yes/no)? [yes] ",true))
496
g_fBoxX = AskFloat_ND(" Enter length of X cell vector in pm: ");
498
g_fBoxY = AskFloat_ND(" Enter length of Y cell vector in pm: ");
500
g_fBoxZ = AskFloat_ND(" Enter length of Z cell vector in pm: ");
503
g_fBoxX = AskFloat_ND(" Enter length of cell vector in pm: ");
507
if ((g_fBoxX <= 0) || (g_fBoxY <= 0) || (g_fBoxZ <= 0))
509
eprintf("Cell vector of length <= 0 is not allowed.\n");
513
if (g_bPeriodicX && g_bPeriodicY && g_bPeriodicZ)
515
mprintf("\n The box size is %.2f x %.2f x %.2f pm.\n",g_fBoxX,g_fBoxY,g_fBoxZ);
516
mprintf(" The overall box density is %.6f g/cm^3.\n",tf*tf*tf/g_fBoxX/g_fBoxY/g_fBoxZ);
517
if (tf*tf*tf/g_fBoxX/g_fBoxY/g_fBoxZ > 15.0f)
520
if (!AskYesNo(" The density of your box seems to be very high. Continue (y) or change input (n)? [n] ",false))
530
if (g_bAdvanced1 && g_bPeriodic)
533
if (AskYesNo(" Should the periodic box be multiplied (y/n)? [no] ",false))
539
g_iDoubleBoxX = AskUnsignedInteger(" Replicate the box n times in x direction: [2] ",2);
540
else g_iDoubleBoxX = 1;
543
g_iDoubleBoxY = AskUnsignedInteger(" Replicate the box n times in y direction: [2] ",2);
544
else g_iDoubleBoxY = 1;
547
g_iDoubleBoxZ = AskUnsignedInteger(" Replicate the box n times in z direction: [2] ",2);
548
else g_iDoubleBoxZ = 1;
550
g_iDoubleBoxFactor = g_iDoubleBoxX * g_iDoubleBoxY * g_iDoubleBoxZ;
551
g_fBoxX *= g_iDoubleBoxX;
552
g_fBoxY *= g_iDoubleBoxY;
553
g_fBoxZ *= g_iDoubleBoxZ;
554
g_iGesAtomCount *= g_iDoubleBoxFactor;
555
g_iGesVirtAtomCount *= g_iDoubleBoxFactor;
556
} else g_bDoubleBox = false;
557
} else g_bDoubleBox = false;
558
} else g_bDoubleBox = false;
560
try { g_pUniteTemp = new bool[g_iGesAtomCount]; } catch(...) { g_pUniteTemp = NULL; }
561
if (g_pUniteTemp == NULL) NewException((double)g_iGesAtomCount*sizeof(bool),__FILE__,__LINE__,__PRETTY_FUNCTION__);
568
g_fMinPeriodic = 1e30f;
570
if (g_fMinPeriodic > g_fBoxX)
571
g_fMinPeriodic = g_fBoxX;
573
if (g_fMinPeriodic > g_fBoxY)
574
g_fMinPeriodic = g_fBoxY;
576
if (g_fMinPeriodic > g_fBoxZ)
577
g_fMinPeriodic = g_fBoxZ;
587
g_iScanMolStep = AskInteger(" Execute molecule recognition for which time step (-1 = disable)? [0] ",0);
588
} else g_iScanMolStep = 0;
590
a = fopen(g_sInputTraj,"rb");
591
if ((g_bNPT) && (g_sNPTFile[0] != 0))
592
g_fNPTFile = fopen(g_sNPTFile,"rt");
593
if (g_iScanMolStep > 0)
595
mprintf(" Fast-forwarding to step %d...\n",g_iScanMolStep);
597
for (z=0;z<g_iScanMolStep;z++)
599
if ((g_bNPT) && (g_sNPTFile[0] != 0))
600
fgets(buf,256,g_fNPTFile);
601
if (fmod(z,g_iScanMolStep/60.0) < 1.0)
603
if (!g_TimeStep.SkipTimestep(a))
605
eprintf("Error.\n",g_iScanMolStep);
609
mprintf(WHITE,"]\n");
610
g_iFastForwardPos = ftell(a);
611
mprintf(" Step %d begins at offset %lu (%.1f MB).\n\n",g_iScanMolStep+1,g_iFastForwardPos,g_iFastForwardPos/1024.0/1024.0);
614
g_TimeStep.ReadTimestep(a,true);
617
if (g_sNPTFile[0] != 0)
618
g_TimeStep.ReadCellVector(g_fNPTFile);
619
mprintf("\n NPT: Using a cell vector of ( %.2f pm | %.2f pm | %.2f pm ) for molecule recognition.\n",g_fBoxX,g_fBoxY,g_fBoxZ);
624
mprintf("\n Stream input: Executing molecule recognition from first timestep...\n");
627
g_iCloseAtomCounter = 0;
629
if (!g_TimeStep.ScanMolecules())
635
if (g_sNPTFile[0] != 0)
641
mprintf("\n Uniting molecules which have been broken by wrapping...\n");
642
g_TimeStep.UniteMolecules(true);
645
mprintf(YELLOW,"\n*** The following %d kind%s of molecules ha%s been recognized:\n",g_oaMolecules.GetSize(),(g_oaMolecules.GetSize()>1)?"s":"",(g_oaMolecules.GetSize()>1)?"ve":"s");
646
mprintf(" (ordered by molecular mass)\n\n");
647
for (z=0;z<g_oaMolecules.GetSize();z++)
649
mprintf(WHITE," - Molecule %d: %s ",z+1,((CMolecule*)g_oaMolecules[z])->m_sName);
650
mprintf("(%d piece%s, %.2f g/mol)\n",((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize(),(((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize()>1)?"s":"",((CMolecule*)g_oaMolecules[z])->m_fMass);
651
sm = (CSingleMolecule*)g_oaSingleMolecules[((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex[0]];
652
mprintf(" (%d noneq. atom%s, %d noneq. bond%s, %d noneq. angle%s)\n",sm->m_iAtomClasses,(sm->m_iAtomClasses==1)?"":"s",sm->m_oaBondGroups.GetSize(),(sm->m_oaBondGroups.GetSize()==1)?"":"s",sm->m_oaAngleGroups.GetSize(),(sm->m_oaAngleGroups.GetSize()==1)?"":"s");
653
if (((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize() != 0)
655
if (((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize() == 1)
656
mprintf(WHITE," Detected %d ring:\n",((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize());
657
else mprintf(WHITE," Detected %d rings:\n",((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize());
658
for (z2=0;z2<((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize();z2++)
660
mprintf(WHITE," %2d.) %2d-ring: ",z2+1,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize());
661
if (((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize() > 20)
665
mprintf("%s%d",((CAtom*)g_oaAtoms[((CMolecule*)g_oaMolecules[z])->m_baAtomIndex[((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtomTypes[z2])->GetAt(z3)]])->m_sName,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetAt(z3)+1);
666
if (z3+1 < ((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize())
671
for (z3=((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize()-5;z3<((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize();z3++)
673
mprintf("%s%d",((CAtom*)g_oaAtoms[((CMolecule*)g_oaMolecules[z])->m_baAtomIndex[((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtomTypes[z2])->GetAt(z3)]])->m_sName,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetAt(z3)+1);
674
if (z3+1 < ((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize())
679
for (z3=0;z3<((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize();z3++)
681
mprintf("%s%d",((CAtom*)g_oaAtoms[((CMolecule*)g_oaMolecules[z])->m_baAtomIndex[((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtomTypes[z2])->GetAt(z3)]])->m_sName,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetAt(z3)+1);
682
if (z3+1 < ((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize())
689
mprintf(RED,"\n Showing only the first 10 rings.\n");
698
if (g_oaMolecules.GetSize() == 0)
700
eprintf("You don't have any atom/molecule in your simulation. This is probably not what you wanted.\n");
701
eprintf("Stopping execution.\n");
707
mprintf(WHITE,">>> Output of the molecule tree >>>\n");
708
g_TimeStep.PrintMegaTree();
709
mprintf(WHITE,"<<< Output of the molecule tree <<<\n\n");
715
if (!AskYesNo(" Accept these molecules (y) or change something (n)? [yes] ",true))
719
mprintf(" If you want some atom types to form no bonds at all, assign covalent radius 0 to them.\n");
721
mprintf(YELLOW,"\n *** Modify Molecules ***\n\n");
722
mprintf(" Your choices:\n\n");
724
mprintf(" 1.) Change covalent atom radii used for bond recognition\n");
725
mprintf(" 2.) Break specific bonds\n");
726
mprintf(" 3.) Rename elements\n");
729
switch(AskRangeInteger(" Please select: [done] ",1,3,0))
732
mprintf("\n These values have been used (covalent radii from literature multiplied with %.2f):\n\n",g_fBondFactor);
733
for (z=0;z<g_oaAtoms.GetSize()-1;z++)
734
mprintf(" - %-2s %5.1f pm\n",((CAtom*)g_oaAtoms[z])->m_sName,((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius*g_fBondFactor);
737
AskString(" Which radius do you want to change (RETURN=done)? ",buf,"");
738
if (strlen(buf) == 0)
740
for (z=0;z<g_oaAtoms.GetSize()-1;z++)
742
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
744
((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius = AskFloat(" Please enter new bond radius for %s in pm: [%.1f] ",((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius*g_fBondFactor,((CAtom*)g_oaAtoms[z])->m_sName,((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius*g_fBondFactor) / g_fBondFactor;
745
if (((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius == 0)
746
mprintf("\n Atom %s will form no bonds now.\n\n",((CAtom*)g_oaAtoms[z])->m_sName);
752
eprintf(" Atom \"%s\" is not in the system.\n\n",buf);
761
if (g_oaMolecules.GetSize() > 1)
763
_breakmol: ti = AskUnsignedInteger_ND(" Break bonds in which molecule (1-%d)? ",g_oaMolecules.GetSize())-1;
764
if ((ti < 0) || (ti >= (int)g_oaMolecules.GetSize()))
766
eprintf("Wrong Input.\n\n");
770
mol = (CMolecule*)g_oaMolecules[ti];
772
if (AskYesNo(" Break all bonds within this molecule (y/n)? [no] ",false))
774
for (z=0;z<mol->m_laSingleMolIndex.GetSize();z++)
776
sm = (CSingleMolecule*)g_oaSingleMolecules[mol->m_laSingleMolIndex[z]];
777
g_laBondBlackList.Append(&sm->m_laBonds);
781
_breaka1: AskString_ND(" Enter 1st atom of the bond to break (e.g. O2): ",buf);
782
if (!ParseAtom(buf,ti,ty,rty,atom))
784
_breaka2: AskString_ND(" Enter 2nd atom of the bond to break (e.g. O2): ",buf);
785
if (!ParseAtom(buf,ti,ty2,rty2,atom2))
787
for (z=0;z<mol->m_laSingleMolIndex.GetSize();z++)
789
sm = (CSingleMolecule*)g_oaSingleMolecules[mol->m_laSingleMolIndex[z]];
790
g_laBondBlackList.Add(((CxIntArray*)sm->m_oaAtomOffset[ty])->GetAt(atom));
791
g_laBondBlackList.Add(((CxIntArray*)sm->m_oaAtomOffset[ty2])->GetAt(atom2));
794
if (AskYesNo("\n Break another bond (y/n)? [no] ",false))
800
/*********************************************************************************************************************/
802
mprintf("\n The system contains the following atoms:\n\n ");
804
for (z=0;z<g_oaAtoms.GetSize();z++)
806
if (z == g_iVirtAtomType)
808
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
813
mprintf("%dx %s",((CAtom*)g_oaAtoms[z])->m_iCount,((CAtom*)g_oaAtoms[z])->m_sName);
818
AskString(" Which element to rename: [done] ",buf,"");
820
if (strlen(buf) == 0)
823
for (z=0;z<g_oaAtoms.GetSize();z++)
824
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
826
eprintf("\n Atom \"%s\" not in the system.\n\n",buf);
830
at = (CAtom*)g_oaAtoms[z];
832
AskString_ND(" Enter new name for %s: ",buf2,buf);
833
if (strlen(buf2) > 7)
835
eprintf("\n Atom labels may have maximum length of 7 characters.\n\n");
838
if (ContainsDigit(buf2))
840
eprintf("\n Digits in element labels not allowed.\n\n");
843
el = FindElement(buf2,true);
847
if (AskYesNo(" Element %s is known. Merge %s atoms into %s (y/n)? [yes] ",true,buf2,buf,buf2))
849
for (z2=0;z2<g_oaAtoms.GetSize();z2++)
851
if (((CAtom*)g_oaAtoms[z2])->m_pElement == el)
853
at = (CAtom*)g_oaAtoms[z2];
859
eprintf("\n Strange error ^^\n");
864
mprintf("\n Adding element %s...\n\n",buf2);
866
try { at = new CAtom(); } catch(...) { at = NULL; }
867
if (at == NULL) NewException((double)sizeof(CAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
869
at->m_iIndex = g_oaAtoms.GetSize();
873
try { at->m_pElement = new CElement(); } catch(...) { at->m_pElement = NULL; }
874
if (at->m_pElement == NULL) NewException((double)sizeof(CElement),__FILE__,__LINE__,__PRETTY_FUNCTION__);
876
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [100.0] ",100.0f);
877
at->m_pElement->m_fMass = AskFloat(" Please enter atom mass in u: [0] ",0);
878
sprintf(at->m_sName,"%s",buf2);
880
for (z2=0;z2<(int)g_TimeStep.m_iGesAtomCount;z2++)
882
strcpy(buf,(char*)g_TimeStep.m_paLabels[z2]);
884
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
887
((CAtom*)g_oaAtoms[z])->m_iCount--;
890
((CAtom*)g_oaAtoms[z])->m_pMergedTo = at;
894
mprintf("\n The system contains the following atoms:\n\n ");
896
for (z=0;z<g_oaAtoms.GetSize();z++)
898
if (z == g_iVirtAtomType)
900
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
905
mprintf("%dx %s",((CAtom*)g_oaAtoms[z])->m_iCount,((CAtom*)g_oaAtoms[z])->m_sName);
908
/*********************************************************************************************************************/
918
mprintf(WHITE,"\n Going back to molecule recognition with changed settings.\n\n");
921
mprintf(WHITE,"\n Nothing was changed, not repeating molecule recognition.\n\n");
926
g_bMegaMat = !AskYesNo(" Show bond matrices only for first representant of each molecule type (y/n)? [yes] ",true);
927
g_bMatOnlyBind = AskYesNo(" Show only bonds in the bond matrices (y/n)? [yes] ",true);
931
g_bMatOnlyBind = true;
934
mprintf(WHITE,"\nOutput of bond matrices:\n");
935
g_TimeStep.PrintMatrix(!g_bMegaMat,g_bMatOnlyBind);
938
mprintf(" You can create images of the structural formulas with the atom labels for easier\n");
939
mprintf(" identification of the atoms (requires installed GraphViz package - see www.graphviz.org).\n\n");
941
if (AskYesNo(" Create images of the structural formulas (y/n)? [no] ",false))
944
ti = AskUnsignedInteger(" How many iterations to perform for formula optimization? [10] ",10);
946
RenderStructFormulas(ti);
949
mprintf(WHITE,"\n The atoms are currently ordered by topological priority.\n");
955
// This block written @ Ballmer peak ;-P Try it out yourself.
956
if (AskYesNo(" Change the atom ordering in some molecule (y/n)? [no] ",false))
958
if (AskYesNo(" Order atoms like in the input file instead (y/n)? [no] ",false))
960
ReorderLikeInput(); // Crazy shit!! (Ballmer Peak)
964
sprintf(buf," Change atom ordering in which of the molecules (");
965
for (z=0;z<g_oaMolecules.GetSize();z++)
967
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
969
if (z < g_oaMolecules.GetSize()-1)
973
ti = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize())-1;
974
mol = (CMolecule*)g_oaMolecules[ti];
975
mol->m_oaNewNumbers.SetSize(mol->m_baAtomIndex.GetSize());
976
for (z=0;z<mol->m_baAtomIndex.GetSize();z++)
978
mprintf("* Atom type %s\n",((CAtom*)g_oaAtoms[mol->m_baAtomIndex[z]])->m_sName);
979
if (mol->m_oaNewNumbers[z] != NULL)
980
delete mol->m_oaNewNumbers[z];
982
try { mol->m_oaNewNumbers[z] = new CxIntArray("gather():mol->m_oaNewNumbers[z]"); } catch(...) { mol->m_oaNewNumbers[z] = NULL; }
983
if (mol->m_oaNewNumbers[z] == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
985
for (z2=0;z2<mol->m_waAtomCount[z];z2++)
988
ti2 = AskRangeInteger(" Which number should %s%d bear? [%d] ",1,mol->m_waAtomCount[z],z2+1,((CAtom*)g_oaAtoms[mol->m_baAtomIndex[z]])->m_sName,z2+1,z2+1);
989
for (z3=0;z3<z2;z3++)
990
if (((CxIntArray*)mol->m_oaNewNumbers[z])->GetAt(z3) == ti2-1)
992
eprintf("This number already was chosen for %s%d!\n",((CAtom*)g_oaAtoms[mol->m_baAtomIndex[z]])->m_sName,z3+1);
995
(*((CxIntArray*)mol->m_oaNewNumbers[z])).Add(ti2-1);
998
mprintf("\n Reordering atoms...");
1000
mprintf("Done.\n\n");
1001
if (AskYesNo(" Change atom ordering of another molecule (y/n)? [no] ",false))
1004
} // End "this block"
1006
mprintf(WHITE,"\n Going back to molecule recognition with changed settings.\n\n");
1009
} // END IF ADVANCED
1011
mprintf(WHITE,"\n Defining virtual atom #1 as molecular Center of Geometry:\n");
1012
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1014
mprintf(" - %s...\n",((CMolecule*)g_oaMolecules[z0])->m_sName);
1015
va = AddVirtualAtom(z0);
1017
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1018
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1019
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1020
va->m_faWeight[z] = 1.0f;
1021
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1024
mprintf(WHITE,"\n Defining virtual atom #2 as molecular Center of Mass:\n");
1025
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1027
mprintf(" - %s...\n",((CMolecule*)g_oaMolecules[z0])->m_sName);
1028
va = AddVirtualAtom(z0);
1030
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1031
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1034
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1036
tf = ((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_fMass;
1037
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1039
va->m_faWeight[z3] = tf;
1044
va->m_fGesWeight = tf2;
1045
if (va->m_fGesWeight == 0)
1047
eprintf(" Molecule %s has total mass of zero. Defining #2 as Center of Geometry.\n",((CMolecule*)g_oaMolecules[z0])->m_sName);
1048
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1049
va->m_faWeight[z] = 1.0f;
1050
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1054
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1056
m = (CMolecule*)g_oaMolecules[z0];
1057
if (m->m_oaRingAtoms.GetSize() != 0)
1059
mprintf(WHITE,"\n Defining ring centers in %s:\n",m->m_sName);
1060
for (z=0;z<m->m_oaRingAtoms.GetSize();z++)
1062
mprintf(" - Defining #%d as Center of Ring %d: ",z+3,z+1);
1063
for (z3=0;z3<((CxIntArray*)m->m_oaRingAtoms[z])->GetSize();z3++)
1065
mprintf("%s%d",((CAtom*)g_oaAtoms[m->m_baAtomIndex[((CxIntArray*)m->m_oaRingAtomTypes[z])->GetAt(z3)]])->m_sName,((CxIntArray*)m->m_oaRingAtoms[z])->GetAt(z3)+1);
1066
if (z3+1 < ((CxIntArray*)m->m_oaRingAtoms[z])->GetSize())
1070
va = AddVirtualAtom(z0);
1072
va->m_oCenterAtoms.m_pMolecule = m;
1073
for (z3=0;z3<((CxIntArray*)m->m_oaRingAtoms[z])->GetSize();z3++)
1074
va->m_oCenterAtoms.AddAtom(((CxIntArray*)m->m_oaRingAtomTypes[z])->GetAt(z3),((CxIntArray*)m->m_oaRingAtoms[z])->GetAt(z3),false);
1075
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1076
for (z3=0;z3<va->m_oCenterAtoms.m_iAtomGes;z3++)
1077
va->m_faWeight[z3] = 1.0f;
1078
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1086
if (AskYesNo("\n Define additional virtual atoms (y/n)? [no] ",false))
1089
sprintf(buf," To which molecule shall the virtual atom belong (");
1090
for (z=0;z<g_oaMolecules.GetSize();z++)
1092
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
1094
if (z < g_oaMolecules.GetSize()-1)
1099
z = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize());
1100
va = AddVirtualAtom(z-1);
1101
mprintf(WHITE,"\n*** Defining virtual atom #%d in %s\n",va->m_iMolVirtAtom+1,((CMolecule*)g_oaMolecules[va->m_iMolecule])->m_sName);
1102
va->m_iMode = AskRangeInteger(" Define v.a. as center (0) or through distance/angle/dihedral (1)? [center] ",0,1,0);
1103
if (va->m_iMode == 0)
1106
mprintf(" Which atoms to use for center (e.g. \"C1,C3-5,H\")? [all] ");
1107
inpprintf("! Which atoms to use for center (e.g. \"C1,C3-5,H\")? [all]\n");
1110
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1111
else if (!va->m_oCenterAtoms.ParseAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],buf))
1113
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1115
mprintf(" How shall these atoms be weightened (RETURN=equal, *=mass, #=manually)? [equal] ");
1116
inpprintf("! How shall these atoms be weightened (RETURN=equal, *=mass, #=manually)? [equal]\n");
1120
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1121
va->m_faWeight[z] = 1.0f;
1122
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1123
} else if (buf[0] == '*')
1127
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1129
tf = ((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_fMass;
1130
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1132
va->m_faWeight[z3] = tf;
1137
va->m_fGesWeight = tf2;
1138
if (va->m_fGesWeight == 0)
1140
eprintf("\n Molecule has total mass of zero. Weighting atoms equally.\n\n");
1141
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1142
va->m_faWeight[z] = 1.0f;
1143
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1145
} else if (buf[0] == '#')
1151
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1153
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1155
tf = AskFloat(" Enter the weight for %s%d: [1] ",1.0f,((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_sLabel, ((CxIntArray *)va->m_oCenterAtoms.m_oaAtoms[z])->GetAt(z2)+1);
1156
va->m_faWeight[z3] = tf;
1161
mprintf(" The sum of weights is %.4f.\n\n",tf2);
1162
va->m_fGesWeight = tf2;
1163
if (va->m_fGesWeight == 0)
1165
eprintf("Sum of weights may not be zero. Enter the weights again.\n\n");
1170
eprintf("Wrong input.\n");
1171
inpprintf("! Wrong input.\n");
1177
mprintf(" Enter 2nd atom for distance #%d- (e.g. C2): ",va->m_iMolVirtAtom+1);
1178
inpprintf("! Enter 2nd atom for distance #%d- (e.g. C2):\n",va->m_iMolVirtAtom+1);
1180
if (!ParseAtom(buf,va->m_iMolecule,va->m_iAtomType[0],va->m_iRealAtomType[0],va->m_iAtom[0]))
1182
if ((va->m_iRealAtomType[0] == g_iVirtAtomType) && (va->m_iAtom[0] == va->m_iMolVirtAtom))
1184
eprintf("This atom was already chosen.\n");
1188
mprintf(" Enter 3rd atom for angle #%d-%s%d- (e.g. C2)? ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1);
1189
inpprintf("! Enter 3rd atom for angle #%d-%s%d- (e.g. C2)?\n",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1);
1191
if (!ParseAtom(buf,va->m_iMolecule,va->m_iAtomType[1],va->m_iRealAtomType[1],va->m_iAtom[1]))
1193
if (((va->m_iRealAtomType[1] == g_iVirtAtomType) && (va->m_iAtom[1] == va->m_iMolVirtAtom)) || ((va->m_iRealAtomType[1] == va->m_iRealAtomType[0]) && (va->m_iAtom[1] == va->m_iAtom[0])))
1195
eprintf("This atom was already chosen.\n");
1199
mprintf(" Enter 4th atom for dihedral #%d-%s%d-%s%d- (e.g. C2)? ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1);
1200
inpprintf("! Enter 4th atom for dihedral #%d-%s%d-%s%d- (e.g. C2)?\n",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1);
1202
if (!ParseAtom(buf,va->m_iMolecule,va->m_iAtomType[2],va->m_iRealAtomType[2],va->m_iAtom[2]))
1204
if (((va->m_iRealAtomType[2] == g_iVirtAtomType) && (va->m_iAtom[2] == va->m_iMolVirtAtom)) || ((va->m_iRealAtomType[2] == va->m_iRealAtomType[0]) && (va->m_iAtom[2] == va->m_iAtom[0])) || ((va->m_iRealAtomType[2] == va->m_iRealAtomType[1]) && (va->m_iAtom[2] == va->m_iAtom[1])))
1206
eprintf("This atom was already chosen.\n");
1210
va->m_fValues[0] = AskFloat_ND(" Enter distance #%d-%s%d in pm: ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1);
1211
va->m_fValues[1] = AskFloat_ND(" Enter angle #%d-%s%d-%s%d in degree: ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1) * (float)Pi / 180.0f;
1212
va->m_fValues[2] = AskFloat_ND(" Enter dihedral #%d-%s%d-%s%d-%s%d in degree: ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[2]])->m_sName,va->m_iAtom[2]+1) * (float)Pi / 180.0f;
1215
if (AskYesNo("\n Define further virtual atoms (y/n)? [no] ",false))
1220
if (AskYesNo(" Do you want to define pseudo-molecules (y/n)? [no] ",false))
1224
mprintf("\n If you need the center of mass or center of geometry of the whole system, you should\n");
1225
mprintf(" define a pseudo-molecule over the whole system, and use its atoms #1 and #2.\n\n");
1226
if (AskYesNo(" Define a pseudo-molecule over the whole system (y/n)? [yes] ",true))
1229
/************************************************************************/
1231
try { m2 = new CMolecule(); } catch(...) { m2 = NULL; }
1232
if (m2 == NULL) NewException((double)sizeof(CMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1234
try { sm2 = new CSingleMolecule(); } catch(...) { sm2 = NULL; }
1235
if (sm2 == NULL) NewException((double)sizeof(CSingleMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1237
m2->m_bPseudo = true;
1238
sm2->m_bPseudo = true;
1239
m2->m_iIndex = g_oaMolecules.GetSize();
1240
sm2->m_iMolType = g_oaMolecules.GetSize();
1241
sm2->m_iMolSMIndex = 0;
1242
m2->m_laSingleMolIndex.Add(g_oaSingleMolecules.GetSize());
1243
g_oaMolecules.Add(m2);
1244
g_oaSingleMolecules.Add(sm2);
1246
mprintf(WHITE," >>> Pseudo-molecule %d (= molecule %d) >>>\n\n",ti,g_oaMolecules.GetSize());
1247
mprintf(" Adding all atoms from all molecules...\n");
1249
for (z=0;z<g_oaMolecules.GetSize();z++)
1251
m = (CMolecule*)g_oaMolecules[z];
1255
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
1256
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1258
ag->AddAllAtoms(m,false);
1262
for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++)
1265
for (z2=0;z2<ag->m_baAtomType.GetSize();z2++)
1267
m2->m_iAtomGes += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1269
for (z4=0;z4<m2->m_baAtomIndex.GetSize();z4++)
1271
if (m2->m_baAtomIndex[z4] == ag->m_baRealAtomType[z2])
1273
m2->m_waAtomCount[z4] += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1274
pia = (CxIntArray*)sm2->m_oaAtomOffset[z4];
1279
m2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1280
sm2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1281
m2->m_waAtomCount.Add(((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize());
1283
try { pia = new CxIntArray("gather():pia"); } catch(...) { pia = NULL; }
1284
if (pia == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1286
sm2->m_oaAtomOffset.Add(pia);
1288
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1290
for (z5=0;z5<ia.GetSize();z5++)
1292
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1293
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1295
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1297
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1299
eprintf("Weird error: Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1300
m2->m_waAtomCount[m2->m_waAtomCount.GetSize()-1]--;
1305
pia->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1312
/********************************************************************************/
1321
mprintf("\n You may define custom element labels. This enables keeping apart\n atoms of the same type from different molecules/positions.\n\n");
1322
tb = AskYesNo(" Keep the standard element labels (y) or define custom labels (n)? [yes] ",true);
1326
try { m2 = new CMolecule(); } catch(...) { m2 = NULL; }
1327
if (m2 == NULL) NewException((double)sizeof(CMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1329
try { sm2 = new CSingleMolecule(); } catch(...) { sm2 = NULL; }
1330
if (sm2 == NULL) NewException((double)sizeof(CSingleMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1332
m2->m_bPseudo = true;
1333
sm2->m_bPseudo = true;
1334
m2->m_iIndex = g_oaMolecules.GetSize();
1335
sm2->m_iMolType = g_oaMolecules.GetSize();
1336
sm2->m_iMolSMIndex = 0;
1337
m2->m_laSingleMolIndex.Add(g_oaSingleMolecules.GetSize());
1338
g_oaMolecules.Add(m2);
1339
g_oaSingleMolecules.Add(sm2);
1341
mprintf(WHITE," >>> Pseudo-molecule %d (= molecule %d) >>>\n\n",ti,g_oaMolecules.GetSize());
1343
mprintf(WHITE," You may define custom element labels. This enables keeping apart\n atoms of the same type from different molecules/positions.\n\n");
1344
tb = AskYesNo(" Keep the standard element labels (y) or define custom labels (n)? [yes] ",true);
1347
for (z=0;z<g_oaMolecules.GetSize();z++)
1349
m = (CMolecule*)g_oaMolecules[z];
1352
if (AskYesNo(" Use atoms from molecule %d (%s) (y/n)? [no] ",false,z+1,m->m_sName))
1355
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
1356
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1358
if (AskYesNo(" Use all atoms (y) from %s or only certain atoms (n)? [no] ",false,m->m_sName))
1360
ag->AddAllAtoms(m,false);
1364
AskString_ND(" Please enter atoms from %s to use (e.g. C1-3,H,O4): ",buf,m->m_sName);
1365
if (!ag->ParseAtoms(m,buf))
1369
if (m->m_laSingleMolIndex.GetSize() > 1)
1371
if (!AskYesNo(" Add selected atoms from all %s molecules (y), or only from certain molecules (n)? [yes] ",true,m->m_sName))
1374
AskString_ND(" Enter the %s molecules to use (range 1-%d, e.g. 1,3-6,8): ",buf,m->m_sName,m->m_laSingleMolIndex.GetSize());
1376
if (!ParseIntList(buf,&ia))
1378
for (z2=0;z2<ia.GetSize();z2++)
1380
if ((ia[z2] < 1) || (ia[z2] > m->m_laSingleMolIndex.GetSize()))
1382
eprintf("Invalid number: %d (should be between 1 and %d).\n",ia[z2],m->m_laSingleMolIndex.GetSize());
1389
for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++)
1394
if (!tb) // Custom Labels
1396
for (z2=0;z2<ag->m_baAtomType.GetSize();z2++)
1399
AskString(" How should %s from %s be labeled? [%s] ",buf,((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,m->m_sName,((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName);
1400
if (ContainsDigit(buf))
1402
eprintf("Digits in element labels not allowed.\n");
1405
for (z3=0;z3<g_oaAtoms.GetSize();z3++)
1407
if (mystricmp(buf,((CAtom*)g_oaAtoms[z3])->m_sName) == 0)
1413
if (strlen(buf) > 7)
1415
mprintf(" Element labels may only have up to 7 characters; truncating.\n");
1418
mprintf(" Adding new element label \"%s\"...\n",buf);
1420
try { at = new CAtom(); } catch(...) { at = NULL; }
1421
if (at == NULL) NewException((double)sizeof(CAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1423
at->m_iIndex = g_oaAtoms.GetSize();
1424
at->m_pElement = ((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_pElement;
1425
memcpy(at->m_sName,buf,8);
1426
at->m_iCount = ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1427
ti2 = g_oaAtoms.GetSize();
1430
m2->m_iAtomGes += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1431
for (z3=0;z3<m2->m_baAtomIndex.GetSize();z3++)
1433
if (m2->m_baAtomIndex[z3] == ti2)
1435
m2->m_waAtomCount[z3] += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1436
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1438
for (z5=0;z5<ia.GetSize();z5++)
1440
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1441
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1443
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1445
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1447
eprintf("Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1448
m2->m_waAtomCount[z3]--;
1453
// mprintf("Molecule %d, SM %d, Type %d, Atom %d: Line %d.\n",z,ia[z5],((CxIntArray*)sm->m_oaAtomOffset[z2])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1454
((CxIntArray*)sm2->m_oaAtomOffset[z3])->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1461
m2->m_baAtomIndex.Add(ti2);
1462
sm2->m_baAtomIndex.Add(ti2);
1463
m2->m_waAtomCount.Add(((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize());
1465
try { pia = new CxIntArray("gather():pia"); } catch(...) { pia = NULL; }
1466
if (pia == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1468
sm2->m_oaAtomOffset.Add(pia);
1469
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1471
for (z5=0;z5<ia.GetSize();z5++)
1473
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1474
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1476
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1478
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1480
eprintf("Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1481
m2->m_waAtomCount[m2->m_waAtomCount.GetSize()-1]--;
1486
pia->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1492
} else // If not custom labels
1494
for (z2=0;z2<ag->m_baAtomType.GetSize();z2++)
1496
for (z4=0;z4<m2->m_baAtomIndex.GetSize();z4++)
1498
if (m2->m_baAtomIndex[z4] == ag->m_baRealAtomType[z2])
1500
m2->m_waAtomCount[z4] += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1501
pia = (CxIntArray*)sm2->m_oaAtomOffset[z4];
1506
m2->m_iAtomGes += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1507
m2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1508
sm2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1509
m2->m_waAtomCount.Add(((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize());
1511
try { pia = new CxIntArray("gather():pia"); } catch(...) { pia = NULL; }
1512
if (pia == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1514
sm2->m_oaAtomOffset.Add(pia);
1516
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1518
for (z5=0;z5<ia.GetSize();z5++)
1520
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1521
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1523
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1525
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1527
eprintf("Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1528
m2->m_waAtomCount[m2->m_waAtomCount.GetSize()-1]--;
1533
pia->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1540
if (AskYesNo(" Use another set of atoms from %s (y/n)? [no] ",false,m->m_sName))
1542
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
1543
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1552
mprintf(WHITE," <<< Pseudo-molecule %d (= molecule %d) defined as %s <<<\n\n",ti,g_oaMolecules.GetSize(),m2->m_sName);
1553
if (AskYesNo(" Define another pseudo-molecule (y/n)? [no] ",false))
1554
goto _pseudomolnext;
1555
mprintf(WHITE,"\n The following pseudo-molecules have been defined:\n");
1556
mprintf(" (note: pseudo-molecules start with a $ sign)\n\n");
1558
for (z=0;z<g_oaMolecules.GetSize();z++)
1560
m = (CMolecule*)g_oaMolecules[z];
1564
mprintf(" %d.) Molecule %d - %s\n",ti,z+1,m->m_sName);
1567
mprintf(WHITE,"\n Defining virtual atom #1 as molecular Center of Geometry:\n");
1568
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1570
m = (CMolecule*)g_oaMolecules[z0];
1573
mprintf(" - %s...\n",m->m_sName);
1574
va = AddVirtualAtom(z0);
1576
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1577
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1578
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1579
va->m_faWeight[z] = 1.0f;
1580
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1583
mprintf(WHITE,"\n Defining virtual atom #2 as molecular Center of Mass:\n");
1584
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1586
m = (CMolecule*)g_oaMolecules[z0];
1589
mprintf(" - %s...\n",m->m_sName);
1590
va = AddVirtualAtom(z0);
1592
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1593
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1596
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1598
tf = ((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_fMass;
1599
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1601
va->m_faWeight[z3] = tf;
1606
va->m_fGesWeight = tf2;
1607
if (va->m_fGesWeight == 0)
1609
eprintf(" Molecule %s has total mass of zero. Defining #2 as Center of Geometry.\n",m->m_sName);
1610
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1611
va->m_faWeight[z] = 1.0f;
1612
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1618
mprintf(GREEN,"\n>>> %d virtual atoms have been defined: >>>\n",g_oaVirtualAtoms.GetSize());
1619
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1621
for (z=0;z<((CMolecule*)g_oaMolecules[z0])->m_laVirtualAtoms.GetSize();z++)
1623
va = (CVirtualAtom*)g_oaVirtualAtoms[((CMolecule*)g_oaMolecules[z0])->m_laVirtualAtoms[z]];
1624
if (va->m_iMolVirtAtom < 2)
1626
mprintf(WHITE,"\n #%d in %s: %s.",va->m_iMolVirtAtom+1,((CMolecule*)g_oaMolecules[va->m_iMolecule])->m_sName,(va->m_iMolVirtAtom==0)?"Center of Geometry":"Center of Mass");
1627
if (va->m_iMolVirtAtom == 1)
1631
mprintf(WHITE,"\n #%d in %s - defined through %s\n",va->m_iMolVirtAtom+1,((CMolecule*)g_oaMolecules[va->m_iMolecule])->m_sName,(va->m_iMode==0)?"center:":"distance/angle/dihedral:");
1632
if (va->m_iMode == 0)
1634
if (!((CMolecule*)g_oaMolecules[z0])->m_bPseudo || (z > 1))
1637
for (z2=0;z2<va->m_oCenterAtoms.m_baAtomType.GetSize();z2++)
1639
for (z3=0;z3<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z2])->GetSize();z3++)
1641
mprintf(" - %2s%-3d Weight %.2f%c\n",((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z2]])->m_sName,((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z2])->GetAt(z3)+1,va->m_faWeight[z4]/va->m_fGesWeight*100.0f,'%');
1645
} else mprintf(" (pseudo-molecule, skipping atoms)\n");
1648
mprintf(" - Distance #%d-%s%d = %.2f pm\n",z+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,va->m_fValues[0]);
1649
mprintf(" - Angle #%d-%s%d-%s%d = %.2f degree\n",z+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1,va->m_fValues[1]*180.0/Pi);
1650
mprintf(" - Dihedral #%d-%s%d-%s%d-%s%d = %.2f degree\n",z+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[2]])->m_sName,va->m_iAtom[2]+1,va->m_fValues[2]*180.0/Pi);
1654
mprintf(GREEN,"\n<<< End of virtual atoms <<<\n\n");
1657
g_TimeStep.UniteMolecules(false);
1659
g_TimeStep.CalcCenters();
1660
g_bFoldAtomwise = false;
1663
g_TimeStep.FoldMolecules();
1667
// g_TimeStep.WritePOV("step.pov");
1669
mprintf(WHITE,"\n>>> List of functions <<<\n\n");
1672
mprintf(" (You may specify multiple analyses at once, but\n");
1673
mprintf(" the safe way is to perform only one kind of analysis at a time.)\n");
1675
inpprintf("! Which functions to compute (comma separated)?\n");
1676
mprintf("\n Which functions to compute (comma separated)? ");
1679
if (!ParseFunctions(buf))
1681
eprintf("Wrong input.\n");
1682
inpprintf("! Wrong input.\n");
1687
if (g_bRegionAnalysis)
1689
if (!(g_bRDF || g_bSDF || g_bADF || g_bDDF || g_bCDF || g_bRevSDF || g_bDens))
1691
eprintf(" Region-specific analysis needs to be applied to some static analysis.\n\n");
1694
g_iaSMRegion.SetSize(g_oaSingleMolecules.GetSize());
1695
for (z=0;z<g_oaSingleMolecules.GetSize();z++)
1696
g_iaSMRegion[z] = (rand()%2)+1;
1699
if (g_bVoro || g_bVoid || g_bSaveJustTraj || g_bSaveRefEnv || g_bCutCluster)
1700
g_bNeedMoleculeWrap = true;
1702
if (g_bNPT && (g_bACF || g_bMSD))
1704
mprintf(RED," Warning: ");
1705
mprintf("When a variable cell vector is used, dynamical analyses (like spectra or MSDs)\n");
1706
mprintf(" will give erroneous results.\n\n");
1709
mprintf(WHITE," The advanced mode includes some options which are quite powerful,\n yet possibly weird or seldomly required.\n\n");
1711
g_bAdvanced2 = AskYesNo(" Use the advanced mode for the main part (y/n)? [no] ",false);
1714
if (g_bThermo || g_bVDF || g_bRaman || g_bCombined || g_bBondACF || g_bVHDF || g_bACF || g_bUseVelocities || g_bUseForces || g_bMSD || g_bAggregation || g_bDLDisp || g_bDLDF || g_bDACF || g_bRDyn || g_bIRSpec || g_bIRSpec || g_bTimeDiff || g_bDeriv)
1716
g_fTimestepLength = AskFloat(" Enter the length of one trajectory time step in fs: [0.5] ",0.5f);
1720
/*********** Interface ***************/
1721
if (!Interface_BeforeAnalysis())
1726
mprintf(YELLOW,"*** Combined Distribution Function\n\n");
1727
g_iCDFChannels = AskUnsignedInteger(" How many channels should the Combined Distribution Function have? [2] ",2);
1729
try { g_iObsChannel = new int[g_iCDFChannels]; } catch(...) { g_iObsChannel = NULL; }
1730
if (g_iObsChannel == NULL) NewException((double)g_iCDFChannels*sizeof(int),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1732
mprintf(" Choose from these functions: rdf, adf, ddf, dip, vdf");
1733
if (g_bBetaFeatures)
1734
mprintf(", pldf, lidf");
1736
for (z=0;z<g_iCDFChannels;z++)
1739
AskString_ND(" Channel %d: Enter function type (e.g. rdf): ",buf,z+1);
1740
if (mystricmp(buf,"rdf")==0)
1742
g_iObsChannel[z] = 0;
1744
} else if (mystricmp(buf,"adf")==0)
1746
g_iObsChannel[z] = 1;
1748
} else if (mystricmp(buf,"ddf")==0)
1750
g_iObsChannel[z] = 2;
1752
} else if (mystricmp(buf,"dip")==0)
1754
g_iObsChannel[z] = 3;
1756
} else if (mystricmp(buf,"vdf")==0)
1758
g_iObsChannel[z] = 4;
1760
} else if ((mystricmp(buf,"pldf")==0) && g_bBetaFeatures)
1762
g_iObsChannel[z] = 5;
1764
} else if ((mystricmp(buf,"lidf")==0) && g_bBetaFeatures)
1766
g_iObsChannel[z] = 6;
1770
eprintf("Wrong input.\n");
1771
inpprintf("! Wrong input.\n");
1775
} else g_iCDFChannels = 1;
1777
if (g_bDipDF || g_bDipole)
1782
try { g_pVoroWrapper = new CVoroWrapper(); } catch(...) { g_pVoroWrapper = NULL; }
1783
if (g_pVoroWrapper == NULL) NewException((double)sizeof(CVoroWrapper),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1785
g_pVoroWrapper->Parse();
1790
try { g_pSFac = new CStructureFactor(); } catch(...) { g_pSFac = NULL; }
1791
if (g_pSFac == NULL) NewException((double)sizeof(CStructureFactor),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1798
try { g_pResp = new CResp(); } catch(...) { g_pResp = NULL; }
1799
if (g_pResp == NULL) NewException((double)sizeof(CResp),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1801
g_pResp->m_pTimeStep = &g_TimeStep;
1802
g_pResp->ParseResp();
1810
try { g_pFFGen = new CFFGen(); } catch(...) { g_pFFGen = NULL; }
1811
if (g_pFFGen == NULL) NewException((double)sizeof(CFFGen),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1813
g_pFFGen->Parse(&g_TimeStep);
1820
try { g_pVoroWrapper = new CVoroWrapper(); } catch(...) { g_pVoroWrapper = NULL; }
1821
if (g_pVoroWrapper == NULL) NewException((double)sizeof(CVoroWrapper),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1823
try { g_pVoroAnalysis = new CVoroAnalysis(); } catch(...) { g_pVoroAnalysis = NULL; }
1824
if (g_pVoroAnalysis == NULL) NewException((double)sizeof(CVoroAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1826
g_pVoroAnalysis->Parse();
1831
mprintf(WHITE,">>> Selection of Aggregation Functions >>>\n\n");
1833
g_bDACF = AskYesNo(" Compute Dimer Existence Autocorrelation Functions (DACFs) (y/n)? [yes] ",true);
1834
g_bDLDF = AskYesNo(" Compute Dimer Lifetime Distribution Functions (DLDFs) (y/n)? [yes] ",true);
1835
g_bDDisp = AskYesNo(" Compute Dimer Displacement Functions / Pair Diffusion (y/n)? [no] ",false);
1838
g_bPairMSD = AskYesNo(" Compute Pair Mean Square Displacement (Pair Diffusion) (y/n)? [yes] ",true);
1839
g_bDLDisp = AskYesNo(" Compute combined Dimer Lifetime/Displacement Function (DLDisp) (y/n)? [yes] ",true);
1846
mprintf(WHITE,"\n<<< Selection of Aggregation Functions <<<\n\n");
1851
mprintf(WHITE,">>> Selection of Neighborhood Exchange Functions >>>\n\n");
1852
mprintf(WHITE,"\n<<< Selection of Neighborhood Exchange Functions <<<\n\n");
1857
if (g_bRDyn || g_bIRSpec)
1858
g_bRDynCacheMode = AskYesNo(" Use RDyn cached mode (do this unless there are problems) (y/n)? [yes] ",true);
1861
g_bMSDCacheMode = AskYesNo(" Use MSD cached mode (do this unless there are problems) (y/n)? [yes] ",true);
1864
g_bRDynCacheMode = true;
1865
g_bMSDCacheMode = true;
1868
if (g_bClusterAnalysis)
1870
try { g_pClusterAnalysis = new CClusterAnalysis(); } catch(...) { g_pClusterAnalysis = NULL; }
1871
if (g_pClusterAnalysis == NULL) NewException((double)sizeof(CClusterAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1873
g_pClusterAnalysis->Parse();
1878
try { g_pMicroHet = new CMicroHet(); } catch(...) { g_pMicroHet = NULL; }
1879
if (g_pMicroHet == NULL) NewException((double)sizeof(CMicroHet),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1881
g_pMicroHet->Parse();
1886
try { g_pThermoAnalysis = new CThermoAnalysis(); } catch(...) { g_pThermoAnalysis = NULL; }
1887
if (g_pThermoAnalysis == NULL) NewException((double)sizeof(CThermoAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1889
g_pThermoAnalysis->Parse();
1894
try { g_pFESA = new CFESAnalysis(); } catch(...) { g_pFESA = NULL; }
1895
if (g_pFESA == NULL) NewException((double)sizeof(CFESAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1902
// mprintf(YELLOW,">>> Select Autocorrelation Functions >>>\n\n");
1905
g_bVACF = AskYesNo(" Calculate velocity autocorrelation function / power spectra (y/n)? [yes] ",true);
1906
else g_bVACF = true;
1909
g_bUseVelocities = true;
1911
/* if (g_bBetaFeatures)
1912
g_bBondACF = AskYesNo(" Calculate bond vibration spectra (y/n)? [no] ",false);
1913
else*/ g_bBondACF = false;
1915
/* g_bDipACF = AskYesNo(" Calculate dipole autocorrelation function / IR spectra (y/n)? [no] ",false);
1919
// mprintf(YELLOW,"\n<<< End of Select Autocorrelation Functions <<<\n\n");
1924
mprintf(WHITE,">>> Bond vibration spectra >>>\n\n");
1925
if (g_iTrajSteps != -1)
1926
g_iBondACFDepth = AskUnsignedInteger(" Enter bond ACF depth in time steps: [%d] ",g_iTrajSteps/2,g_iTrajSteps/2);
1927
else g_iBondACFDepth = AskUnsignedInteger(" Enter bond ACF depth in time steps: [%d] ",4096,4096);
1928
ti = CalcFFTSize(g_iBondACFDepth,false);
1929
if (g_iBondACFDepth != ti)
1931
mprintf(WHITE,"\n The next \"fast\" size for FFT is %d. Using this instead of %d as size.\n",ti,g_iBondACFDepth);
1932
g_iBondACFDepth = ti;
1934
g_bBondACFNormalize = AskYesNo(" Normalize all bond ACFs (removes intensity info for the peaks) (y/n)? [no] ",false);
1935
g_bBondACFSymmetrize = AskYesNo(" Symmetrize all bond ACFs (y/n)? [no] ",false);
1936
g_bBondACFWindow = AskYesNo(" Apply window function to bond ACFs (y/n)? [yes] ",true);
1937
g_bBondACFDebug = AskYesNo(" Write out bond ACF debug data (y/n)? [no] ",false);
1938
mprintf(WHITE,"\n<<< End of Bond vibration spectra <<<\n\n");
1941
if (g_bRDyn || g_bIRSpec || g_bBondACF || g_bVACF)
1944
g_bACFFFT = AskYesNo(" Use fourier transform for autocorrelation (much faster) (y/n)? [yes] ",true);
1945
else g_bACFFFT = true;
1946
} else g_bACFFFT = true;
1948
if (g_bCDF || g_bDipDF || g_bRDF || g_bVHDF || g_bSDF || g_bPlDF || g_bLiDF || g_bVoidSDF || g_bRevSDF || g_bADF || g_bDDF || g_bSaveRefEnv || g_bCutCluster || g_bCond || g_bNbAnalysis)
1950
if (g_oaMolecules.GetSize() > 1)
1952
sprintf(buf,"\n Which of the molecules should be the reference molecule (");
1953
for (z=0;z<g_oaMolecules.GetSize();z++)
1955
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
1957
if (z < g_oaMolecules.GetSize()-1)
1961
g_iFixMol = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
1962
} else g_iFixMol = 0;
1963
mprintf(WHITE,"\n %s is the reference molecule.\n\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
1964
} else g_iFixMol = -1;
1968
mprintf(YELLOW,">>> Save environment of the reference molecule >>>\n\n");
1969
g_bSaveRefWithEnv = AskYesNo(" Save the reference molecule itself (y/n)? [yes] ",true);
1970
g_bRefEnvCenter = AskYesNo(" Center the reference molecule in the box (y/n)? [yes] ",true);
1971
if (g_bRefEnvCenter)
1973
mprintf("\n The first reference atom will be put into the middle of the box.\n\n");
1974
g_bRefEnvFix = AskYesNo(" Fix rotational freedom of the reference molecule (y/n)? [no] ",false);
1977
mprintf("\n The 2nd reference atom will be put onto the positive X axis,\n");
1978
mprintf(" and the 3rd reference atom into the X-Y plane with positive Y values.\n\n");
1980
mprintf(WHITE," You will be asked for the reference atom(s) lateron.\n\n");
1982
if (((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize() > 1)
1983
g_iSaveRefMol = AskRangeInteger(" Which representative of the reference molecules to use (1-%d)? [1] ",1,((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize(),1,((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize()) - 1;
1984
else g_iSaveRefMol = 0;
1985
mprintf(WHITE,"\nPlease choose mode for neighborhood detection:\n\n");
1986
inpprintf("! Please choose mode for neighborhood detection:\n");
1987
mprintf(" 1.) Search neighbors once in the beginning and always show those.\n");
1988
mprintf(" 2.) Search neighbors in every step and show the current neighbors.\n");
1989
mprintf(" (Warning: Neighbor count differs from step to step - be aware.\n");
1990
mprintf(" 3.) Find the frequentiest neighbors over all steps and always show those.\n\n");
1991
mprintf(WHITE," Please note: ");
1992
mprintf("Programs such as VMD cannot handle variable atom count \n");
1993
mprintf(" along a trajectory and will therefore not work properly with mode 2!\n\n");
1994
g_iNbhMode = AskRangeInteger(" Choice (1-3): [3] ",1,3,3);
1995
mprintf(YELLOW,"\n<<< End of Save environment of the reference molecule <<<\n\n");
2000
mprintf(WHITE,">>> Cut clusters >>>\n\n");
2001
g_bSaveRefWithEnv = AskYesNo(" Show reference molecule itself (y/n)? [yes] ",true);
2002
g_bRefEnvCenter = AskYesNo(" Center reference molecule in the box (y/n)? [yes] ",true);
2003
if (g_bRefEnvCenter)
2004
g_bRefEnvFix = AskYesNo(" Fix rotational freedom of the reference molecule (y/n)? [no] ",false);
2006
g_iClusterCount = AskUnsignedInteger(" How many clusters to create? [100] ",100);
2007
g_iClusterSteps = AskUnsignedInteger(" How many time steps to use for cluster creation? [%d] ",g_iTrajSteps,g_iTrajSteps);
2008
mprintf("\nCreating cluster distribution...");
2009
for (z=0;z<g_iClusterCount;z++)
2011
if (fmod(z,g_iClusterCount/25.0) < 1.0)
2018
eprintf("Error: Too few molecules / time steps for requested cluster count.\n");
2021
ti = ((((unsigned long)rand()%16384)+rand()*16384) % g_iClusterSteps) + 1;
2022
ti2 = rand()%((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize();
2023
for (z2=0;z2<g_iaClusterSteps.GetSize();z2++)
2024
if ((g_iaClusterSteps[z2] == ti) && (g_iaClusterMol[z2] == ti2))
2026
g_iaClusterSteps.Add(ti);
2027
g_iaClusterMol.Add(ti2);
2030
mprintf("Sorting cluster distribution...");
2031
for (z=0;z<g_iClusterCount-1;z++)
2033
if (fmod(z,(g_iClusterCount-1)/25.0) < 1.0)
2038
for (z2=z;z2<g_iClusterCount;z2++)
2040
if (g_iaClusterSteps[z2] < ti)
2042
ti = g_iaClusterSteps[z2];
2043
ti2 = g_iaClusterMol[z2];
2045
} else if (g_iaClusterSteps[z2] == ti)
2047
if (g_iaClusterMol[z2] < ti2)
2049
ti2 = g_iaClusterMol[z2];
2056
ti = g_iaClusterSteps[z];
2057
g_iaClusterSteps[z] = g_iaClusterSteps[ti3];
2058
g_iaClusterSteps[ti3] = ti;
2059
ti = g_iaClusterMol[z];
2060
g_iaClusterMol[z] = g_iaClusterMol[ti3];
2061
g_iaClusterMol[ti3] = ti;
2063
mprintf("Done.\n\n");
2064
mprintf("Writing cluster selection to \"cluster.csv\"...");
2065
a = OpenFileWrite("cluster.csv",true);
2066
mfprintf(a,"# Cluster; Timestep; Ref. Mol.\n");
2068
for (z=0;z<g_iClusterCount;z++)
2069
mfprintf(a,"%d; %d; %d\n",z+1,g_iaClusterSteps[z],g_iaClusterMol[z]+1);
2072
mprintf("Done.\n\n");
2073
mprintf(WHITE,"<<< End of Cut clusters <<<\n\n");
2076
if (g_bSDF || g_bVoidSDF || g_bAvg || ((g_bSaveRefEnv || g_bCutCluster) && g_bRefEnvFix)) // Nur fuer SDFs: Welche zwei weiteren Atome fixieren?
2078
g_iRefSystemDim = 3;
2080
mprintf(" Please enter three reference atoms (e.g. C1,H2,O1): ");
2081
inpprintf("! Please enter three reference atoms (e.g. C1,H2,O1):\n");
2083
if (!ParseRefSystem(g_iFixMol,buf,3))
2087
for (z2=0;z2<z;z2++)
2089
if ((g_iFixAtomType[z] == g_iFixAtomType[z2]) && (g_iFixAtom[z] == g_iFixAtom[z2]))
2091
eprintf("Please enter three different atoms.\n\n");
2092
inpprintf("! Please enter three different atoms.\n");
2098
mprintf(WHITE,"Reference plane: Fixing in %s the %d. %s-, the %d. %s- and the %d. %s atom.\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName,g_iFixAtom[1]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[1]])->m_sName,g_iFixAtom[2]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[2]])->m_sName);
2100
} else if (g_bRevSDF)
2102
g_iRefSystemDim = 2;
2104
mprintf(" Please enter two reference atoms (e.g. C1,H3): ");
2105
inpprintf("! Please enter two reference atoms (e.g. C1,H3):\n");
2107
if (!ParseRefSystem(g_iFixMol,buf,2))
2109
if ((g_iFixAtomType[0] == g_iFixAtomType[1]) && (g_iFixAtom[0] == g_iFixAtom[1]))
2111
eprintf("Please enter two different atoms.\n\n");
2112
inpprintf("! Please enter two different atoms.\n");
2116
mprintf(WHITE,"Reference axis: Fixing in %s the %d. %s and the %d. %s atom.\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName,g_iFixAtom[1]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[1]])->m_sName);
2118
} else if (g_bVHDF || g_bRDF || g_bADF || g_bPlDF || g_bLiDF || g_bDDF || g_bSaveRefEnv || g_bSaveRefEnv || g_bCutCluster) // Fuer Verteilungsfunktion: Welches Atom im Ursprung
2120
g_iRefSystemDim = 1;
2124
mprintf(" Please enter the atom to put into the box center (e.g. C3): [center of mass] ");
2125
inpprintf("! Please enter the atom to put into the box center (e.g. C3): [center of mass]\n");
2129
if (!ParseRefSystem(g_iFixMol,"#2",1))
2131
eprintf("Weird error.\n");
2132
inpprintf("! Weird error.\n");
2135
} else if (!ParseRefSystem(g_iFixMol,buf,1))
2138
mprintf(WHITE,"Reference atom: Fixing in %s the %d. %s atom.\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName);
2142
if (!ParseRefSystem(g_iFixMol,"#2",1))
2144
eprintf("Weird error.\n");
2145
inpprintf("! Weird error.\n");
2149
} else if (g_iFixMol != -1)
2151
g_iRefSystemDim = 1;
2152
if (!ParseRefSystem(g_iFixMol,"#2",1))
2154
eprintf("Weird error.\n");
2157
mprintf(" Reference atom: Fixing in %s the %d. %s atom.\n\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName);
2160
if (g_bSaveRefEnv || g_bCutCluster)
2162
mprintf(WHITE,">>> Neighborhood Definition >>>\n\n");
2164
try { g_pNbSet = new CNbSet(); } catch(...) { g_pNbSet = NULL; }
2165
if (g_pNbSet == NULL) NewException((double)sizeof(CNbSet),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2167
g_pNbSet->Parse(g_iFixMol);
2168
mprintf(WHITE,"\n<<< End of Neighborhood Definition <<<\n\n");
2172
if (AskYesNo(" Create a temporal development overlay (TDO) plot (y/n)? [no] ",false))
2175
g_laTDOSteps.RemoveAll();
2176
if (AskYesNo(" Use equidistant intervals (y) or specify each point (n) (y/n)? [yes] ",true))
2179
g_iTDOCount = AskUnsignedInteger(" Enter the overlay count: [5] ",5);
2180
g_iTDOStart = AskUnsignedInteger(" Enter the starting timestep: [0] ",0);
2181
g_iTDOStride = AskUnsignedInteger(" Enter the overlay distance in steps: [1000] ",1000);
2182
for (z=0;z<g_iTDOCount;z++)
2183
g_laTDOSteps.Add(g_iTDOStart+z*g_iTDOStride);
2189
ti = AskUnsignedInteger(" Enter timestep for %dth overlay: [done] ",999999,g_laTDOSteps.GetSize()+1);
2192
g_laTDOSteps.Add(ti);
2195
g_fTDOBleaching = AskRangeFloat(" Enter the TDO bleaching grade (0-1): [0.8] ",0.0f,1.0f,0.8f);
2196
} else g_bTDO = false;
2200
if (g_bAggregation || g_bNbAnalysis || g_bPlDF || g_bLiDF || g_bRDyn || g_bIRSpec || g_bDipDF || g_bMSD || g_bADF || g_bDDF || g_bVACF || g_bDipACF || g_bRevSDF || g_bSDF || g_bVHDF || g_bRDF || g_bDens || g_bVDF || g_bFDF || g_bCond) // Fuer Verteilungsfunktion: Welches Atom beobachten?
2205
g_bVACFCacheMode = AskYesNo(" Use VACF cached mode (do this unless there are problems) (y/n)? [yes] ",true);
2206
else g_bVACFCacheMode = true;
2210
g_bGlobalVACF = AskYesNo(" Compute power spectrum of whole system (y/n)? [yes] ",true);
2213
if (!AskYesNo(" Compute also power spectra for certain atoms/molecules (y/n)? [no] ",false))
2217
g_bGlobalVACF = AskYesNo(" Compute global velocity ACF of whole system (y/n)? [yes] ",true);
2220
if (!AskYesNo(" Compute also velocity ACFs for certain atoms/molecules (y/n)? [no] ",false))
2227
g_bGlobalIR = AskYesNo(" Compute IR spectrum of whole system (y/n)? [yes] ",true);
2229
if (!AskYesNo(" Compute also IR spectra for certain molecule types (y/n)? [no] ",false))
2235
g_bGlobalDipACF = AskYesNo(" Create global dipole ACF of all atoms (y/n)? [yes] ",true);
2238
mprintf(YELLOW,"\n>>> Observation %d >>>\n\n",g_oaObserv.GetSize()+1);
2240
try { o = new CObservation(); } catch(...) { o = NULL; }
2241
if (o == NULL) NewException((double)sizeof(CObservation),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2243
o->m_pConditions = NULL;
2245
o->m_bTimeDev = false;
2246
if (g_bAggregation || g_bNbExchange)
2249
o->m_bOthers = false;
2250
} else if (g_bNbAnalysis)
2253
o->m_bOthers = true;
2254
mprintf(" Performing this observation intermolecular.\n\n");
2255
} else if (g_iFixMol != -1)
2257
if (AskRangeInteger(" Perform this observation intramolecular (within the reference molecule) (0) or intermolecular (1)? [1] ",0,1,1) == 1)
2260
o->m_bOthers = true;
2264
o->m_bOthers = false;
2270
o->m_bOthers = true;
2276
mprintf(WHITE," Please note: ");
2277
mprintf("Although you specified this observation to be intermolecular, you may of course\n");
2278
mprintf(" choose atoms from RM only (or OM only), which will yield an intramolecular quantity.\n\n");
2281
o->m_bSecondShowMol = AskYesNo(" CDF: Perform a three-body analysis (y) or observe one molecule at a time (n)? [no] ",false);
2282
else o->m_bSecondShowMol = false;
2283
if (o->m_bSecondShowMol)
2285
mprintf(WHITE,"\n You have to select two observed molecules (OMs):\n");
2286
mprintf(" The first CDF channel observes the 1st OM, the second channel observes the 2nd OM.\n\n");
2288
if (g_oaMolecules.GetSize() > 1)
2291
if (o->m_bSecondShowMol)
2292
sprintf(buf," Which 1st molecule should be observed (");
2293
else sprintf(buf," Which molecule should be observed (");
2294
for (z=0;z<g_oaMolecules.GetSize();z++)
2296
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
2298
if (z < g_oaMolecules.GetSize()-1)
2302
o->m_iShowMol = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
2303
if ((((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize() == 1) && (o->m_iShowMol == g_iFixMol))
2305
eprintf("Error: There is only 1 molecule of %s.\n--> Intermolecular observation between %s and %s not possible.\n\n",((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2310
mprintf(" Only one molecule type, choosing %s as observed molecule (OM).\n",((CMolecule*)g_oaMolecules[0])->m_sName);
2313
o->m_iShowMolCount = ((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();
2314
if (o->m_bSecondShowMol)
2316
if (g_oaMolecules.GetSize() > 1)
2319
sprintf(buf," Which 2nd molecule should be observed (");
2320
for (z=0;z<g_oaMolecules.GetSize();z++)
2322
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
2324
if (z < g_oaMolecules.GetSize()-1)
2328
o->m_iShowMol2 = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
2329
if ((((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize() == 1) && (o->m_iShowMol2 == g_iFixMol))
2331
eprintf("Error: There is only 1 molecule of %s.\n --> Intermolecular observation between %s and %s not possible.\n\n",((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2334
} else o->m_iShowMol2 = 0;
2335
o->m_iShowMol2Count = ((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize();
2336
if (o->m_iShowMol == o->m_iShowMol2)
2337
o->m_bExclude1eq2 = AskYesNo(" Exclude the case \"1st OM = 2nd OM\" (y/n)? [yes] ",true);
2338
else o->m_bExclude1eq2 = false;
2343
o->m_iShowMol2 = -1;
2344
o->m_bSecondShowMol = false;
2345
o->m_iShowMolCount = 1;
2349
if ((o->m_bSecondShowMol) && (o->m_iShowMol != o->m_iShowMol2))
2350
sprintf(buf," of %s / %s / %s",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2351
else if ((o->m_iShowMol != -1) && (g_iFixMol != -1))
2352
sprintf(buf," of %s / %s",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2353
else if (g_iFixMol != -1) sprintf(buf," of %s",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
2355
if (g_iFixMol != -1)
2359
if (AskYesNo(" Observe only certain molecules%s (y/n)? [no] ",false,buf))
2361
o->m_bObsCertain = true;
2362
if (!g_bCDF && (g_bRDF || g_bADF || g_bDDF || g_bDipDF))
2363
o->m_bDecompDist = AskYesNo(" Decompose distribution functions into contributions from molecules (y/n)? [yes] ",true);
2365
if (((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize() > 1)
2367
mprintf(" Which %s molecules (RM) to take into account (e.g. 1,3-7)? [all] ",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
2368
inpprintf("! Which %s molecules (RM) to take into account (e.g. 1,3-7)? [all]\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
2372
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();z++)
2373
o->m_waObsRefList.Add(z);
2376
ParseIntList(buf,&o->m_waObsRefList);
2377
for (z=0;z<o->m_waObsRefList.GetSize();z++)
2378
o->m_waObsRefList[z]--;
2380
} else o->m_waObsRefList.Add(0);
2382
// mprintf("RefList[0] = %d\n",o->m_waObsRefList[0]);
2384
if (o->m_iShowMol != -1)
2386
if (((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize() > 1)
2388
mprintf(" Which %s molecules (OM) to take into account (e.g. 1,3-7)? [all] ",((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2389
inpprintf("! Which %s molecules (OM) to take into account (e.g. 1,3-7)? [all]\n",((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2393
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();z++)
2394
o->m_waObsShowList.Add(z);
2397
ParseIntList(buf,&o->m_waObsShowList);
2398
for (z=0;z<o->m_waObsShowList.GetSize();z++)
2399
o->m_waObsShowList[z]--;
2401
} else o->m_waObsShowList.Add(0);
2402
} else o->m_waObsShowList.Add(0); // Dummy
2404
if (o->m_bSecondShowMol)
2406
if (o->m_iShowMol2 != -1)
2408
if (((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize() > 1)
2410
mprintf(" Which %s molecules (2nd OM) to take into account (e.g. 1,3-7)? [all] ",((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2411
inpprintf("! Which %s molecules (2nd OM) to take into account (e.g. 1,3-7)? [all]\n",((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2415
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize();z++)
2416
o->m_waObsShow2List.Add(z);
2419
ParseIntList(buf,&o->m_waObsShow2List);
2420
for (z=0;z<o->m_waObsShow2List.GetSize();z++)
2421
o->m_waObsShow2List[z]--;
2423
} else o->m_waObsShow2List.Add(0);
2424
} else o->m_waObsShow2List.Add(0); // Dummy
2426
} else // if not onlysome
2428
o->m_bObsCertain = false;
2429
o->m_bDecompDist = false;
2431
} else // if not advanced
2433
o->m_bObsCertain = false;
2434
o->m_bDecompDist = false;
2438
o->m_bObsCertain = false;
2439
o->m_bDecompDist = false;
2442
o->m_bDecompType = false;
2444
if ((!o->m_bObsCertain) && (!g_bCDF) && g_bAdvanced2 && (g_bRDF || g_bADF || g_bDDF || g_bDipDF))
2446
if (AskYesNo(" Decompose this observation into contributions from different elements (y/n)? [no] ",false))
2448
o->m_bDecompType = true;
2452
if (g_bRegionAnalysis)
2454
AskString(" Take reference molecules from which regions? [all] ",buf,"0");
2455
ParseIntList(buf,&o->m_iaRMRegions);
2456
// for (z6=0;z6<o->m_iaRMRegions.GetSize();z6++)
2457
// if (o->m_iaRMRegions[z6] != 0)
2458
// o->m_iaRMRegions[z6]--;
2462
if (o->m_bSecondShowMol)
2464
AskString(" Take 1st observed molecules from which regions? [all] ",buf,"0");
2465
ParseIntList(buf,&o->m_iaOM1Regions);
2466
// for (z6=0;z6<o->m_iaOM1Regions.GetSize();z6++)
2467
// if (o->m_iaOM1Regions[z6] != 0)
2468
// o->m_iaOM1Regions[z6]--;
2469
AskString(" Take 2nd observed molecules from which regions? [all] ",buf,"0");
2470
ParseIntList(buf,&o->m_iaOM2Regions);
2471
// for (z6=0;z6<o->m_iaOM2Regions.GetSize();z6++)
2472
// if (o->m_iaOM2Regions[z6] != 0)
2473
// o->m_iaOM2Regions[z6]--;
2476
AskString(" Take observed molecules from which regions? [all] ",buf,"0");
2477
ParseIntList(buf,&o->m_iaOM1Regions);
2478
// for (z6=0;z6<o->m_iaOM1Regions.GetSize();z6++)
2479
// if (o->m_iaOM1Regions[z6] != 0)
2480
// o->m_iaOM1Regions[z6]--;
2485
if (g_bAggregation || g_bNbExchange)
2487
try { o->m_pDACF = new CDACF(); } catch(...) { o->m_pDACF = NULL; }
2488
if (o->m_pDACF == NULL) NewException((double)sizeof(CDACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2490
o->m_pDACF->Parse();
2495
try { o->m_pRDyn = new CReorDyn(); } catch(...) { o->m_pRDyn = NULL; }
2496
if (o->m_pRDyn == NULL) NewException((double)sizeof(CReorDyn),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2498
o->m_pRDyn->m_iShowMol = o->m_iShowMol;
2499
o->m_pRDyn->Parse();
2504
try { o->m_pIRSpec = new CReorDyn(); } catch(...) { o->m_pIRSpec = NULL; }
2505
if (o->m_pIRSpec == NULL) NewException((double)sizeof(CReorDyn),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2507
o->m_pIRSpec->m_iShowMol = o->m_iShowMol;
2508
o->m_pIRSpec->ParseSpec();
2513
try { o->m_pDensityDF = new CDensDF(); } catch(...) { o->m_pDensityDF = NULL; }
2514
if (o->m_pDensityDF == NULL) NewException((double)sizeof(CDensDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2516
o->m_pDensityDF->m_iShowMol = o->m_iShowMol;
2517
o->m_pDensityDF->Parse();
2522
try { o->m_pSDF = new CSDF(); } catch(...) { o->m_pSDF = NULL; }
2523
if (o->m_pSDF == NULL) NewException((double)sizeof(CSDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
39
char buf[4096], buf2[256];
43
int z, z0, z2, z3, z4, z5, z6, z7;
45
unsigned char ty, rty, atom;
46
unsigned char ty2, rty2, atom2;
50
CSingleMolecule *sm, *sm2;
58
g_bKeepUnfoldedCoords = false;
59
g_iDoubleBoxFactor = 1;
65
g_bSaveCoordsUnchanged = false;
66
g_bSDFUniform = false;
70
mprintf(YELLOW,"\n*** Interactive query of settings ***\n\n");
74
if (g_bUnknownElements)
79
mprintf(WHITE,"Unrecognized atom types: ");
80
for (z=0;z<g_oaAtoms.GetSize();z++)
82
if (z == g_iVirtAtomType)
85
at = (CAtom*)g_oaAtoms[z];
86
while (at->m_pMergedTo != NULL)
88
// mprintf("%s merged to %s\n",at->m_sName,at->m_pMergedTo->m_sName);
91
if (at->m_pElement->m_fRadius != 0)
96
mprintf("%s",at->m_sName);
102
if ((ti == 1) && (mystricmp("X",((CAtom*)g_oaAtoms[ti2])->m_sName) == 0))
103
{ // Only Wannier centers unrecognized.
104
mprintf(" Possibly, atom type \"X\" are Wannier centers. If so, do not assign data to them.\n\n");
109
if (AskYesNo(" Do you want to assign atom data to them (y/n)? [%s] ",tb2,tb2?"yes":"no"))
113
if (AskYesNo(" Automatically rename all atoms to corresponding elements (y/n)? [yes] ",true))
118
for (z=0;z<g_oaAtoms.GetSize();z++)
120
if (z == g_iVirtAtomType)
123
at = (CAtom*)g_oaAtoms[z];
124
if (at->m_pElement->m_fRadius != 0)
127
buf2[0] = at->m_sName[0];
128
buf2[1] = at->m_sName[1];
130
el = FindElement(buf2,true);
133
if (el->m_fRadius == 0)
139
el = FindElement(buf2,true);
142
if (el->m_fRadius == 0)
147
strcpy(buf2,at->m_sName);
152
mprintf(" - Skipping %s... (have no guess for atom type)\n",at->m_sName);
159
mprintf(" - Renaming %s to %s...\n",at->m_sName,buf2);
160
for (z2=0;z2<g_oaAtoms.GetSize();z2++)
162
if (((CAtom*)g_oaAtoms[z2])->m_pElement == el)
164
at = (CAtom*)g_oaAtoms[z2];
169
eprintf(" Strange error ^^\n");
171
for (z2=0;z2<(int)g_TimeStep.m_iGesAtomCount;z2++)
173
strcpy(buf,(char*)g_TimeStep.m_paLabels[z2]);
175
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
178
((CAtom*)g_oaAtoms[z])->m_iCount--;
181
// mprintf("\nmerging %s to %s.\n",((CAtom*)g_oaAtoms[z])->m_sName,at->m_sName);
182
((CAtom*)g_oaAtoms[z])->m_pMergedTo = at;
193
ti = g_oaAtoms.GetSize();
196
if (z == g_iVirtAtomType)
199
at = (CAtom*)g_oaAtoms[z];
201
while (at->m_pMergedTo != NULL)
203
// mprintf("%s merged to %s\n",at->m_sName,at->m_pMergedTo->m_sName);
204
at = at->m_pMergedTo;
207
if (at->m_pElement->m_fRadius != 0)
209
mprintf(WHITE,"\n * Element %s\n\n",at->m_sName);
211
buf2[0] = at->m_sName[0];
212
buf2[1] = at->m_sName[1];
214
el = FindElement(buf2,true);
217
if (el->m_fRadius == 0)
223
el = FindElement(buf2,true);
226
if (el->m_fRadius == 0)
231
strcpy(buf2,at->m_sName);
235
if (AskYesNo(" Do you want to rename this element (y/n)? [yes] ",true))
238
AskString(" Enter new name for %s: [%s] ",buf,buf2,at->m_sName,buf2);
241
eprintf("Atom labels may have maximum length of 7 characters.\n");
244
if (ContainsDigit(buf))
246
eprintf("Digits in element labels not allowed.\n");
249
el = FindElement(buf,true);
253
if (AskYesNo(" Element %s is known. Merge %s atoms into %s (y/n)? [yes] ",true,buf,at->m_sName,buf))
255
for (z2=0;z2<g_oaAtoms.GetSize();z2++)
257
if (((CAtom*)g_oaAtoms[z2])->m_pElement == el)
259
at = (CAtom*)g_oaAtoms[z2];
264
eprintf(" Strange error ^^\n");
269
mprintf(" Adding element %s...",buf);
271
try { at = new CAtom(); } catch(...) { at = NULL; }
272
if (at == NULL) NewException((double)sizeof(CAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
274
at->m_iIndex = g_oaAtoms.GetSize();
277
try { at->m_pElement = new CElement(); } catch(...) { at->m_pElement = NULL; }
278
if (at->m_pElement == NULL) NewException((double)sizeof(CElement),__FILE__,__LINE__,__PRETTY_FUNCTION__);
281
sprintf(at->m_sName,"%s",buf);
283
for (z2=0;z2<(int)g_TimeStep.m_iGesAtomCount;z2++)
285
strcpy(buf,(char*)g_TimeStep.m_paLabels[z2]);
287
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
290
((CAtom*)g_oaAtoms[z])->m_iCount--;
293
((CAtom*)g_oaAtoms[z])->m_pMergedTo = at;
294
if (el->m_fRadius != 0)
298
if (AskYesNo(" Do you want to copy the atom parameters from another element (y/n)? [yes] ",true))
301
AskString(" Copy atom parameters from which element? [%s] ",buf,buf2,buf2);
302
el = FindElement(buf,true);
305
eprintf("This element is not defined.\n");
308
if (el->m_fRadius == 0)
310
if (!AskYesNo(" This element has a radius of 0 (will form no bonds). Use it anyway (y/n)? [yes] ",true))
314
mprintf(WHITE,"\n A covalent radius of 0 pm hinders atoms of this kind from forming any bonds.\n\n");
316
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [%.2f] ",el->m_fRadius,el->m_fRadius);
317
at->m_pElement->m_fMass = AskFloat(" Please enter atom mass in u: [%.2f] ",el->m_fMass,el->m_fMass);
319
if (!tb && (fabs(at->m_pElement->m_fMass-el->m_fMass) < 0.01))
322
mprintf(RED,"\n Warning: ");
323
mprintf("Elements %s and %s keep their different labels, but will have\n",at->m_sName,buf);
324
mprintf(" the same mass and therefore also the same atom codes. They will not\n");
325
mprintf(" be distinguished in the molecule recognition!\n");
327
// mprintf(" Using mass=%.2fu, radius=%.2fpm, ord. number=%d.\n",at->m_pElement->m_fMass,el->m_fRadius,el->m_iOrd);
328
// at->m_pElement->CopyData(el);
331
el = FindElement(buf2,true);
332
mprintf(WHITE,"\n A covalent radius of 0 pm hinders atoms of this kind from forming any bonds.\n\n");
335
mprintf(" (Default values are for %s)\n\n",buf2);
336
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [%.2f] ",el->m_fRadius,el->m_fRadius);
337
at->m_pElement->m_fMass = AskFloat(" Please enter atom mass in u: [%.2f] ",el->m_fMass,el->m_fMass);
340
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [100] ",100);
341
at->m_pElement->m_fMass = AskFloat_ND(" Please enter atom mass in u: ");
347
mprintf(WHITE,"%d atoms in the system: ",g_iGesAtomCount);
349
for (z=0;z<g_oaAtoms.GetSize();z++)
351
if (z == g_iVirtAtomType)
353
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
355
mprintf("%dx %s",((CAtom*)g_oaAtoms[z])->m_iCount,((CAtom*)g_oaAtoms[z])->m_sName);
356
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
357
mprintf(" (merged to %s)",((CAtom*)g_oaAtoms[z])->m_pMergedTo->m_sName);
358
if (z < (int)g_oaAtoms.GetSize()-1)
359
if (z+1 != g_iVirtAtomType)
363
} // END IF CHANGE UNKNOWN
369
for (z=0;z<g_oaAtoms.GetSize();z++)
372
for (z3=0;z3<ia.GetSize();z3++)
377
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
379
if (z == g_iVirtAtomType)
381
for (z2=z+1;z2<g_oaAtoms.GetSize();z2++)
383
if (((CAtom*)g_oaAtoms[z2])->m_pMergedTo != NULL)
385
if (z2 == g_iVirtAtomType)
387
if (fabs(((CAtom*)g_oaAtoms[z])->m_pElement->m_fMass - ((CAtom*)g_oaAtoms[z2])->m_pElement->m_fMass) < 0.01)
393
mprintf(RED,"\n Warning: ");
394
mprintf("The following atoms have the same mass and will therefore not be\n");
395
mprintf(" distinguished in the molecule recognition:\n\n");
396
mprintf(WHITE," Mass=%.2f: %s, %s",((CAtom*)g_oaAtoms[z])->m_pElement->m_fMass,((CAtom*)g_oaAtoms[z])->m_sName,((CAtom*)g_oaAtoms[z2])->m_sName);
401
mprintf(WHITE,", %s",((CAtom*)g_oaAtoms[z2])->m_sName);
412
mprintf(" The advanced mode includes some options which are quite powerful,\n yet possibly weird or seldomly required. ");
413
mprintf("This includes support for\n NPT ensemble, non-periodic systems, user-definded virtual atoms, pseudomolecules, ...\n\n");
415
g_bAdvanced1 = AskYesNo(" Use the advanced mode up to the function selection menu (y/n)? [no] ",false);
423
mprintf(" Use periodic boundary conditions (0=no, x, y, z, xy, xz, xyz)? [xyz] ");
424
inpprintf("! Use periodic boundary conditions (0=no, x, y, z, xy, xz, xyz)? [xyz]\n");
426
} while (!ParsePeriodic(buf));
430
/* if (AskYesNo(" Enter Box Size anyways (e.g. fo RDFs) (yes/no)? [yes] ",true))
435
g_fBoxX = GuessBoxSize();
436
g_fBoxY = GuessBoxSize();
437
g_fBoxZ = GuessBoxSize();
438
mprintf("\nGuessed box size (for density 1.0 g/cm^3) is %.2f x %.2f x %.2f pm.\n\n",g_fBoxX,g_fBoxX,g_fBoxX);
440
// g_fBoxX = (g_TimeStep.m_vMax[0]-g_TimeStep.m_vMin[0])*10.0;
441
// g_fBoxY = (g_TimeStep.m_vMax[1]-g_TimeStep.m_vMin[1])*10.0;
442
// g_fBoxZ = (g_TimeStep.m_vMax[2]-g_TimeStep.m_vMin[2])*10.0;
443
// mprintf("\n Using cell vector of %.2f x %.2f x %.2f pm to \"fake\" non-periodic box.\n\n",g_fBoxX,g_fBoxY,g_fBoxZ);
446
ParsePeriodic("xyz");
451
mprintf(" A cell vector of %.2f pm would result in a density of 1.0 g/cm^3.\n\n",tf);
454
g_bNPT = AskYesNo(" Use time-dependent cell vector (NPT ensemble) (y/n)? [no] ",false);
456
} else g_bNPT = false;
462
mprintf(" Your PDB file contains cell vector information.\n\n");
465
mprintf(" The trajectory does not contain cell vector information.\n");
466
mprintf(" (supported: PDB file with \"CRYST1\" section, like written by GROMACS trjconv)\n");
467
mprintf(" You have to supply a plain text file which contains the cell vectors for each step.\n");
468
mprintf(" It should contain three space-separated floating point numbers (X, Y, Z vector) per line.\n");
469
mprintf(" These numbers need to be IN ANGSTROM! (1 angstrom = 100 pm)\n\n");
471
AskString_ND(" Please enter cell vector text file name: ",g_sNPTFile);
472
if (!FileExist(g_sNPTFile))
474
eprintf("Could not open file \"%s\" for reading.\n",g_sNPTFile);
477
g_fNPTFile = fopen(g_sNPTFile,"rt");
478
g_TimeStep.ReadCellVector(g_fNPTFile);
482
mprintf(" The initial cell vector is ( %.2f pm | %.2f pm | %.2f pm ).\n",g_fBoxX,g_fBoxY,g_fBoxZ);
483
mprintf(" The initial box density is %.6f g/cm^3.\n\n",tf*tf*tf/g_fBoxX/g_fBoxY/g_fBoxZ);
488
mprintf(" Cell vector found in trajectory file:\n");
489
mprintf(" X = %.2f pm, Y = %.2f pm, Z = %.2f pm\n\n",g_fBoxX,g_fBoxY,g_fBoxZ);
490
if (AskYesNo(" Use these values (y/n)? [yes] ",true))
494
if (!AskYesNo(" Are the 3 cell vectors of the same size (yes/no)? [yes] ",true))
497
g_fBoxX = AskFloat_ND(" Enter length of X cell vector in pm: ");
499
g_fBoxY = AskFloat_ND(" Enter length of Y cell vector in pm: ");
501
g_fBoxZ = AskFloat_ND(" Enter length of Z cell vector in pm: ");
504
g_fBoxX = AskFloat_ND(" Enter length of cell vector in pm: ");
508
if ((g_fBoxX <= 0) || (g_fBoxY <= 0) || (g_fBoxZ <= 0))
510
eprintf("Cell vector of length <= 0 is not allowed.\n");
514
if (g_bPeriodicX && g_bPeriodicY && g_bPeriodicZ)
516
mprintf("\n The box size is %.2f x %.2f x %.2f pm.\n",g_fBoxX,g_fBoxY,g_fBoxZ);
517
mprintf(" The overall box density is %.6f g/cm^3.\n",tf*tf*tf/g_fBoxX/g_fBoxY/g_fBoxZ);
518
if (tf*tf*tf/g_fBoxX/g_fBoxY/g_fBoxZ > 15.0f)
521
if (!AskYesNo(" The density of your box seems to be very high. Continue (y) or change input (n)? [n] ",false))
531
if (g_bAdvanced1 && g_bPeriodic)
534
if (AskYesNo(" Should the periodic box be multiplied (y/n)? [no] ",false))
540
g_iDoubleBoxX = AskUnsignedInteger(" Replicate the box n times in x direction: [2] ",2);
541
else g_iDoubleBoxX = 1;
544
g_iDoubleBoxY = AskUnsignedInteger(" Replicate the box n times in y direction: [2] ",2);
545
else g_iDoubleBoxY = 1;
548
g_iDoubleBoxZ = AskUnsignedInteger(" Replicate the box n times in z direction: [2] ",2);
549
else g_iDoubleBoxZ = 1;
551
g_iDoubleBoxFactor = g_iDoubleBoxX * g_iDoubleBoxY * g_iDoubleBoxZ;
552
g_fBoxX *= g_iDoubleBoxX;
553
g_fBoxY *= g_iDoubleBoxY;
554
g_fBoxZ *= g_iDoubleBoxZ;
555
g_iGesAtomCount *= g_iDoubleBoxFactor;
556
g_iGesVirtAtomCount *= g_iDoubleBoxFactor;
557
} else g_bDoubleBox = false;
558
} else g_bDoubleBox = false;
559
} else g_bDoubleBox = false;
561
try { g_pUniteTemp = new bool[g_iGesAtomCount]; } catch(...) { g_pUniteTemp = NULL; }
562
if (g_pUniteTemp == NULL) NewException((double)g_iGesAtomCount*sizeof(bool),__FILE__,__LINE__,__PRETTY_FUNCTION__);
569
g_fMinPeriodic = 1e30f;
571
if (g_fMinPeriodic > g_fBoxX)
572
g_fMinPeriodic = g_fBoxX;
574
if (g_fMinPeriodic > g_fBoxY)
575
g_fMinPeriodic = g_fBoxY;
577
if (g_fMinPeriodic > g_fBoxZ)
578
g_fMinPeriodic = g_fBoxZ;
588
g_iScanMolStep = AskInteger(" Execute molecule recognition for which time step (-1 = disable)? [0] ",0);
589
} else g_iScanMolStep = 0;
591
a = fopen(g_sInputTraj,"rb");
592
if ((g_bNPT) && (g_sNPTFile[0] != 0))
593
g_fNPTFile = fopen(g_sNPTFile,"rt");
594
if (g_iScanMolStep > 0)
596
mprintf(" Fast-forwarding to step %d...\n",g_iScanMolStep);
598
for (z=0;z<g_iScanMolStep;z++)
600
if ((g_bNPT) && (g_sNPTFile[0] != 0))
601
fgets(buf,256,g_fNPTFile);
602
if (fmod(z,g_iScanMolStep/60.0) < 1.0)
604
if (!g_TimeStep.SkipTimestep(a))
606
eprintf("Error.\n",g_iScanMolStep);
610
mprintf(WHITE,"]\n");
611
g_iFastForwardPos = ftell(a);
612
mprintf(" Step %d begins at offset %lu (%.1f MB).\n\n",g_iScanMolStep+1,g_iFastForwardPos,g_iFastForwardPos/1024.0/1024.0);
615
g_TimeStep.ReadTimestep(a,true);
618
if (g_sNPTFile[0] != 0)
619
g_TimeStep.ReadCellVector(g_fNPTFile);
620
mprintf("\n NPT: Using a cell vector of ( %.2f pm | %.2f pm | %.2f pm ) for molecule recognition.\n",g_fBoxX,g_fBoxY,g_fBoxZ);
625
mprintf("\n Stream input: Executing molecule recognition from first timestep...\n");
628
g_iCloseAtomCounter = 0;
630
if (!g_TimeStep.ScanMolecules())
636
if (g_sNPTFile[0] != 0)
642
mprintf("\n Uniting molecules which have been broken by wrapping...\n");
643
g_TimeStep.UniteMolecules(true);
646
mprintf(YELLOW,"\n*** The following %d kind%s of molecules ha%s been recognized:\n",g_oaMolecules.GetSize(),(g_oaMolecules.GetSize()>1)?"s":"",(g_oaMolecules.GetSize()>1)?"ve":"s");
647
mprintf(" (ordered by molecular mass)\n\n");
648
for (z=0;z<g_oaMolecules.GetSize();z++)
650
mprintf(WHITE," - Molecule %d: %s ",z+1,((CMolecule*)g_oaMolecules[z])->m_sName);
651
mprintf("(%d piece%s, %.2f g/mol)\n",((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize(),(((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize()>1)?"s":"",((CMolecule*)g_oaMolecules[z])->m_fMass);
652
sm = (CSingleMolecule*)g_oaSingleMolecules[((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex[0]];
653
mprintf(" (%d noneq. atom%s, %d noneq. bond%s, %d noneq. angle%s)\n",sm->m_iAtomClasses,(sm->m_iAtomClasses==1)?"":"s",sm->m_oaBondGroups.GetSize(),(sm->m_oaBondGroups.GetSize()==1)?"":"s",sm->m_oaAngleGroups.GetSize(),(sm->m_oaAngleGroups.GetSize()==1)?"":"s");
654
if (((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize() != 0)
656
if (((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize() == 1)
657
mprintf(WHITE," Detected %d ring:\n",((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize());
658
else mprintf(WHITE," Detected %d rings:\n",((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize());
659
for (z2=0;z2<((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms.GetSize();z2++)
661
mprintf(WHITE," %2d.) %2d-ring: ",z2+1,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize());
662
if (((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize() > 20)
666
mprintf("%s%d",((CAtom*)g_oaAtoms[((CMolecule*)g_oaMolecules[z])->m_baAtomIndex[((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtomTypes[z2])->GetAt(z3)]])->m_sName,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetAt(z3)+1);
667
if (z3+1 < ((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize())
672
for (z3=((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize()-5;z3<((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize();z3++)
674
mprintf("%s%d",((CAtom*)g_oaAtoms[((CMolecule*)g_oaMolecules[z])->m_baAtomIndex[((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtomTypes[z2])->GetAt(z3)]])->m_sName,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetAt(z3)+1);
675
if (z3+1 < ((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize())
680
for (z3=0;z3<((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize();z3++)
682
mprintf("%s%d",((CAtom*)g_oaAtoms[((CMolecule*)g_oaMolecules[z])->m_baAtomIndex[((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtomTypes[z2])->GetAt(z3)]])->m_sName,((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetAt(z3)+1);
683
if (z3+1 < ((CxIntArray*)((CMolecule*)g_oaMolecules[z])->m_oaRingAtoms[z2])->GetSize())
690
mprintf(RED,"\n Showing only the first 10 rings.\n");
699
if (g_oaMolecules.GetSize() == 0)
701
eprintf("You don't have any atom/molecule in your simulation. This is probably not what you wanted.\n");
702
eprintf("Stopping execution.\n");
708
mprintf(WHITE,">>> Output of the molecule tree >>>\n");
709
g_TimeStep.PrintMegaTree();
710
mprintf(WHITE,"<<< Output of the molecule tree <<<\n\n");
716
if (!AskYesNo(" Accept these molecules (y) or change something (n)? [yes] ",true))
720
mprintf(" If you want some atom types to form no bonds at all, assign covalent radius 0 to them.\n");
722
mprintf(YELLOW,"\n *** Modify Molecules ***\n\n");
723
mprintf(" Your choices:\n\n");
725
mprintf(" 1.) Change covalent atom radii used for bond recognition\n");
726
mprintf(" 2.) Break specific bonds\n");
727
mprintf(" 3.) Rename elements\n");
730
switch(AskRangeInteger(" Please select: [done] ",1,3,0))
733
mprintf("\n These values have been used (covalent radii from literature multiplied with %.2f):\n\n",g_fBondFactor);
734
for (z=0;z<g_oaAtoms.GetSize()-1;z++)
735
mprintf(" - %-2s %5.1f pm\n",((CAtom*)g_oaAtoms[z])->m_sName,((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius*g_fBondFactor);
738
AskString(" Which radius do you want to change (RETURN=done)? ",buf,"");
739
if (strlen(buf) == 0)
741
for (z=0;z<g_oaAtoms.GetSize()-1;z++)
743
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
745
((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius = AskFloat(" Please enter new bond radius for %s in pm: [%.1f] ",((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius*g_fBondFactor,((CAtom*)g_oaAtoms[z])->m_sName,((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius*g_fBondFactor) / g_fBondFactor;
746
if (((CAtom*)g_oaAtoms[z])->m_pElement->m_fRadius == 0)
747
mprintf("\n Atom %s will form no bonds now.\n\n",((CAtom*)g_oaAtoms[z])->m_sName);
753
eprintf(" Atom \"%s\" is not in the system.\n\n",buf);
762
if (g_oaMolecules.GetSize() > 1)
764
_breakmol: ti = AskUnsignedInteger_ND(" Break bonds in which molecule (1-%d)? ",g_oaMolecules.GetSize())-1;
765
if ((ti < 0) || (ti >= (int)g_oaMolecules.GetSize()))
767
eprintf("Wrong Input.\n\n");
771
mol = (CMolecule*)g_oaMolecules[ti];
773
if (AskYesNo(" Break all bonds within this molecule (y/n)? [no] ",false))
775
for (z=0;z<mol->m_laSingleMolIndex.GetSize();z++)
777
sm = (CSingleMolecule*)g_oaSingleMolecules[mol->m_laSingleMolIndex[z]];
778
g_laBondBlackList.Append(&sm->m_laBonds);
782
_breaka1: AskString_ND(" Enter 1st atom of the bond to break (e.g. O2): ",buf);
783
if (!ParseAtom(buf,ti,ty,rty,atom))
785
_breaka2: AskString_ND(" Enter 2nd atom of the bond to break (e.g. O2): ",buf);
786
if (!ParseAtom(buf,ti,ty2,rty2,atom2))
788
for (z=0;z<mol->m_laSingleMolIndex.GetSize();z++)
790
sm = (CSingleMolecule*)g_oaSingleMolecules[mol->m_laSingleMolIndex[z]];
791
g_laBondBlackList.Add(((CxIntArray*)sm->m_oaAtomOffset[ty])->GetAt(atom));
792
g_laBondBlackList.Add(((CxIntArray*)sm->m_oaAtomOffset[ty2])->GetAt(atom2));
795
if (AskYesNo("\n Break another bond (y/n)? [no] ",false))
801
/*********************************************************************************************************************/
803
mprintf("\n The system contains the following atoms:\n\n ");
805
for (z=0;z<g_oaAtoms.GetSize();z++)
807
if (z == g_iVirtAtomType)
809
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
814
mprintf("%dx %s",((CAtom*)g_oaAtoms[z])->m_iCount,((CAtom*)g_oaAtoms[z])->m_sName);
819
AskString(" Which element to rename: [done] ",buf,"");
821
if (strlen(buf) == 0)
824
for (z=0;z<g_oaAtoms.GetSize();z++)
825
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
827
eprintf("\n Atom \"%s\" not in the system.\n\n",buf);
831
at = (CAtom*)g_oaAtoms[z];
833
AskString_ND(" Enter new name for %s: ",buf2,buf);
834
if (strlen(buf2) > 7)
836
eprintf("\n Atom labels may have maximum length of 7 characters.\n\n");
839
if (ContainsDigit(buf2))
841
eprintf("\n Digits in element labels not allowed.\n\n");
844
el = FindElement(buf2,true);
848
if (AskYesNo(" Element %s is known. Merge %s atoms into %s (y/n)? [yes] ",true,buf2,buf,buf2))
850
for (z2=0;z2<g_oaAtoms.GetSize();z2++)
852
if (((CAtom*)g_oaAtoms[z2])->m_pElement == el)
854
at = (CAtom*)g_oaAtoms[z2];
860
eprintf("\n Strange error ^^\n");
865
mprintf("\n Adding element %s...\n\n",buf2);
867
try { at = new CAtom(); } catch(...) { at = NULL; }
868
if (at == NULL) NewException((double)sizeof(CAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
870
at->m_iIndex = g_oaAtoms.GetSize();
874
try { at->m_pElement = new CElement(); } catch(...) { at->m_pElement = NULL; }
875
if (at->m_pElement == NULL) NewException((double)sizeof(CElement),__FILE__,__LINE__,__PRETTY_FUNCTION__);
877
at->m_pElement->m_fRadius = AskFloat(" Please enter covalent radius in pm: [100.0] ",100.0f);
878
at->m_pElement->m_fMass = AskFloat(" Please enter atom mass in u: [0] ",0);
879
sprintf(at->m_sName,"%s",buf2);
881
for (z2=0;z2<(int)g_TimeStep.m_iGesAtomCount;z2++)
883
strcpy(buf,(char*)g_TimeStep.m_paLabels[z2]);
885
if (mystricmp(buf,((CAtom*)g_oaAtoms[z])->m_sName) == 0)
888
((CAtom*)g_oaAtoms[z])->m_iCount--;
891
((CAtom*)g_oaAtoms[z])->m_pMergedTo = at;
895
mprintf("\n The system contains the following atoms:\n\n ");
897
for (z=0;z<g_oaAtoms.GetSize();z++)
899
if (z == g_iVirtAtomType)
901
if (((CAtom*)g_oaAtoms[z])->m_pMergedTo != NULL)
906
mprintf("%dx %s",((CAtom*)g_oaAtoms[z])->m_iCount,((CAtom*)g_oaAtoms[z])->m_sName);
909
/*********************************************************************************************************************/
919
mprintf(WHITE,"\n Going back to molecule recognition with changed settings.\n\n");
922
mprintf(WHITE,"\n Nothing was changed, not repeating molecule recognition.\n\n");
927
g_bMegaMat = !AskYesNo(" Show bond matrices only for first representant of each molecule type (y/n)? [yes] ",true);
928
g_bMatOnlyBind = AskYesNo(" Show only bonds in the bond matrices (y/n)? [yes] ",true);
932
g_bMatOnlyBind = true;
935
mprintf(WHITE,"\nOutput of bond matrices:\n");
936
g_TimeStep.PrintMatrix(!g_bMegaMat,g_bMatOnlyBind);
939
mprintf(" You can create images of the structural formulas with the atom labels for easier\n");
940
mprintf(" identification of the atoms (requires installed GraphViz package - see www.graphviz.org).\n\n");
942
if (AskYesNo(" Create images of the structural formulas (y/n)? [no] ",false))
945
ti = AskUnsignedInteger(" How many iterations to perform for formula optimization? [10] ",10);
947
RenderStructFormulas(ti);
950
mprintf(WHITE,"\n The atoms are currently ordered by topological priority.\n");
956
// This block written @ Ballmer peak ;-P Try it out yourself.
957
if (AskYesNo(" Change the atom ordering in some molecule (y/n)? [no] ",false))
959
if (AskYesNo(" Order atoms like in the input file instead (y/n)? [no] ",false))
961
ReorderLikeInput(); // Crazy shit!! (Ballmer Peak)
965
sprintf(buf," Change atom ordering in which of the molecules (");
966
for (z=0;z<g_oaMolecules.GetSize();z++)
968
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
970
if (z < g_oaMolecules.GetSize()-1)
974
ti = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize())-1;
975
mol = (CMolecule*)g_oaMolecules[ti];
976
mol->m_oaNewNumbers.SetSize(mol->m_baAtomIndex.GetSize());
977
for (z=0;z<mol->m_baAtomIndex.GetSize();z++)
979
mprintf("* Atom type %s\n",((CAtom*)g_oaAtoms[mol->m_baAtomIndex[z]])->m_sName);
980
if (mol->m_oaNewNumbers[z] != NULL)
981
delete mol->m_oaNewNumbers[z];
983
try { mol->m_oaNewNumbers[z] = new CxIntArray("gather():mol->m_oaNewNumbers[z]"); } catch(...) { mol->m_oaNewNumbers[z] = NULL; }
984
if (mol->m_oaNewNumbers[z] == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
986
for (z2=0;z2<mol->m_waAtomCount[z];z2++)
989
ti2 = AskRangeInteger(" Which number should %s%d bear? [%d] ",1,mol->m_waAtomCount[z],z2+1,((CAtom*)g_oaAtoms[mol->m_baAtomIndex[z]])->m_sName,z2+1,z2+1);
990
for (z3=0;z3<z2;z3++)
991
if (((CxIntArray*)mol->m_oaNewNumbers[z])->GetAt(z3) == ti2-1)
993
eprintf("This number already was chosen for %s%d!\n",((CAtom*)g_oaAtoms[mol->m_baAtomIndex[z]])->m_sName,z3+1);
996
(*((CxIntArray*)mol->m_oaNewNumbers[z])).Add(ti2-1);
999
mprintf("\n Reordering atoms...");
1001
mprintf("Done.\n\n");
1002
if (AskYesNo(" Change atom ordering of another molecule (y/n)? [no] ",false))
1005
} // End "this block"
1007
mprintf(WHITE,"\n Going back to molecule recognition with changed settings.\n\n");
1010
} // END IF ADVANCED
1012
mprintf(WHITE,"\n Defining virtual atom #1 as molecular Center of Geometry:\n");
1013
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1015
mprintf(" - %s...\n",((CMolecule*)g_oaMolecules[z0])->m_sName);
1016
va = AddVirtualAtom(z0);
1018
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1019
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1020
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1021
va->m_faWeight[z] = 1.0f;
1022
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1025
mprintf(WHITE,"\n Defining virtual atom #2 as molecular Center of Mass:\n");
1026
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1028
mprintf(" - %s...\n",((CMolecule*)g_oaMolecules[z0])->m_sName);
1029
va = AddVirtualAtom(z0);
1031
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1032
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1035
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1037
tf = ((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_fMass;
1038
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1040
va->m_faWeight[z3] = tf;
1045
va->m_fGesWeight = tf2;
1046
if (va->m_fGesWeight == 0)
1048
eprintf(" Molecule %s has total mass of zero. Defining #2 as Center of Geometry.\n",((CMolecule*)g_oaMolecules[z0])->m_sName);
1049
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1050
va->m_faWeight[z] = 1.0f;
1051
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1055
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1057
m = (CMolecule*)g_oaMolecules[z0];
1058
if (m->m_oaRingAtoms.GetSize() != 0)
1060
mprintf(WHITE,"\n Defining ring centers in %s:\n",m->m_sName);
1061
for (z=0;z<m->m_oaRingAtoms.GetSize();z++)
1063
mprintf(" - Defining #%d as Center of Ring %d: ",z+3,z+1);
1064
for (z3=0;z3<((CxIntArray*)m->m_oaRingAtoms[z])->GetSize();z3++)
1066
mprintf("%s%d",((CAtom*)g_oaAtoms[m->m_baAtomIndex[((CxIntArray*)m->m_oaRingAtomTypes[z])->GetAt(z3)]])->m_sName,((CxIntArray*)m->m_oaRingAtoms[z])->GetAt(z3)+1);
1067
if (z3+1 < ((CxIntArray*)m->m_oaRingAtoms[z])->GetSize())
1071
va = AddVirtualAtom(z0);
1073
va->m_oCenterAtoms.m_pMolecule = m;
1074
for (z3=0;z3<((CxIntArray*)m->m_oaRingAtoms[z])->GetSize();z3++)
1075
va->m_oCenterAtoms.AddAtom(((CxIntArray*)m->m_oaRingAtomTypes[z])->GetAt(z3),((CxIntArray*)m->m_oaRingAtoms[z])->GetAt(z3),false);
1076
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1077
for (z3=0;z3<va->m_oCenterAtoms.m_iAtomGes;z3++)
1078
va->m_faWeight[z3] = 1.0f;
1079
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1087
if (AskYesNo("\n Define additional virtual atoms (y/n)? [no] ",false))
1090
sprintf(buf," To which molecule shall the virtual atom belong (");
1091
for (z=0;z<g_oaMolecules.GetSize();z++)
1093
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
1095
if (z < g_oaMolecules.GetSize()-1)
1100
z = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize());
1101
va = AddVirtualAtom(z-1);
1102
mprintf(WHITE,"\n*** Defining virtual atom #%d in %s\n",va->m_iMolVirtAtom+1,((CMolecule*)g_oaMolecules[va->m_iMolecule])->m_sName);
1103
va->m_iMode = AskRangeInteger(" Define v.a. as center (0) or through distance/angle/dihedral (1)? [center] ",0,1,0);
1104
if (va->m_iMode == 0)
1107
mprintf(" Which atoms to use for center (e.g. \"C1,C3-5,H\")? [all] ");
1108
inpprintf("! Which atoms to use for center (e.g. \"C1,C3-5,H\")? [all]\n");
1111
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1112
else if (!va->m_oCenterAtoms.ParseAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],buf))
1114
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1116
mprintf(" How shall these atoms be weightened (RETURN=equal, *=mass, #=manually)? [equal] ");
1117
inpprintf("! How shall these atoms be weightened (RETURN=equal, *=mass, #=manually)? [equal]\n");
1121
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1122
va->m_faWeight[z] = 1.0f;
1123
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1124
} else if (buf[0] == '*')
1128
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1130
tf = ((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_fMass;
1131
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1133
va->m_faWeight[z3] = tf;
1138
va->m_fGesWeight = tf2;
1139
if (va->m_fGesWeight == 0)
1141
eprintf("\n Molecule has total mass of zero. Weighting atoms equally.\n\n");
1142
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1143
va->m_faWeight[z] = 1.0f;
1144
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1146
} else if (buf[0] == '#')
1152
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1154
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1156
tf = AskFloat(" Enter the weight for %s%d: [1] ",1.0f,((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_sLabel, ((CxIntArray *)va->m_oCenterAtoms.m_oaAtoms[z])->GetAt(z2)+1);
1157
va->m_faWeight[z3] = tf;
1162
mprintf(" The sum of weights is %.4f.\n\n",tf2);
1163
va->m_fGesWeight = tf2;
1164
if (va->m_fGesWeight == 0)
1166
eprintf("Sum of weights may not be zero. Enter the weights again.\n\n");
1171
eprintf("Wrong input.\n");
1172
inpprintf("! Wrong input.\n");
1178
mprintf(" Enter 2nd atom for distance #%d- (e.g. C2): ",va->m_iMolVirtAtom+1);
1179
inpprintf("! Enter 2nd atom for distance #%d- (e.g. C2):\n",va->m_iMolVirtAtom+1);
1181
if (!ParseAtom(buf,va->m_iMolecule,va->m_iAtomType[0],va->m_iRealAtomType[0],va->m_iAtom[0]))
1183
if ((va->m_iRealAtomType[0] == g_iVirtAtomType) && (va->m_iAtom[0] == va->m_iMolVirtAtom))
1185
eprintf("This atom was already chosen.\n");
1189
mprintf(" Enter 3rd atom for angle #%d-%s%d- (e.g. C2)? ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1);
1190
inpprintf("! Enter 3rd atom for angle #%d-%s%d- (e.g. C2)?\n",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1);
1192
if (!ParseAtom(buf,va->m_iMolecule,va->m_iAtomType[1],va->m_iRealAtomType[1],va->m_iAtom[1]))
1194
if (((va->m_iRealAtomType[1] == g_iVirtAtomType) && (va->m_iAtom[1] == va->m_iMolVirtAtom)) || ((va->m_iRealAtomType[1] == va->m_iRealAtomType[0]) && (va->m_iAtom[1] == va->m_iAtom[0])))
1196
eprintf("This atom was already chosen.\n");
1200
mprintf(" Enter 4th atom for dihedral #%d-%s%d-%s%d- (e.g. C2)? ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1);
1201
inpprintf("! Enter 4th atom for dihedral #%d-%s%d-%s%d- (e.g. C2)?\n",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1);
1203
if (!ParseAtom(buf,va->m_iMolecule,va->m_iAtomType[2],va->m_iRealAtomType[2],va->m_iAtom[2]))
1205
if (((va->m_iRealAtomType[2] == g_iVirtAtomType) && (va->m_iAtom[2] == va->m_iMolVirtAtom)) || ((va->m_iRealAtomType[2] == va->m_iRealAtomType[0]) && (va->m_iAtom[2] == va->m_iAtom[0])) || ((va->m_iRealAtomType[2] == va->m_iRealAtomType[1]) && (va->m_iAtom[2] == va->m_iAtom[1])))
1207
eprintf("This atom was already chosen.\n");
1211
va->m_fValues[0] = AskFloat_ND(" Enter distance #%d-%s%d in pm: ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1);
1212
va->m_fValues[1] = AskFloat_ND(" Enter angle #%d-%s%d-%s%d in degree: ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1) * (float)Pi / 180.0f;
1213
va->m_fValues[2] = AskFloat_ND(" Enter dihedral #%d-%s%d-%s%d-%s%d in degree: ",va->m_iMolVirtAtom+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[2]])->m_sName,va->m_iAtom[2]+1) * (float)Pi / 180.0f;
1216
if (AskYesNo("\n Define further virtual atoms (y/n)? [no] ",false))
1221
if (AskYesNo(" Do you want to define pseudo-molecules (y/n)? [no] ",false))
1225
mprintf("\n If you need the center of mass or center of geometry of the whole system, you should\n");
1226
mprintf(" define a pseudo-molecule over the whole system, and use its atoms #1 and #2.\n\n");
1227
if (AskYesNo(" Define a pseudo-molecule over the whole system (y/n)? [yes] ",true))
1230
/************************************************************************/
1232
try { m2 = new CMolecule(); } catch(...) { m2 = NULL; }
1233
if (m2 == NULL) NewException((double)sizeof(CMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1235
try { sm2 = new CSingleMolecule(); } catch(...) { sm2 = NULL; }
1236
if (sm2 == NULL) NewException((double)sizeof(CSingleMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1238
m2->m_bPseudo = true;
1239
sm2->m_bPseudo = true;
1240
m2->m_iIndex = g_oaMolecules.GetSize();
1241
sm2->m_iMolType = g_oaMolecules.GetSize();
1242
sm2->m_iMolSMIndex = 0;
1243
m2->m_laSingleMolIndex.Add(g_oaSingleMolecules.GetSize());
1244
g_oaMolecules.Add(m2);
1245
g_oaSingleMolecules.Add(sm2);
1247
mprintf(WHITE," >>> Pseudo-molecule %d (= molecule %d) >>>\n\n",ti,g_oaMolecules.GetSize());
1248
mprintf(" Adding all atoms from all molecules...\n");
1250
for (z=0;z<g_oaMolecules.GetSize();z++)
1252
m = (CMolecule*)g_oaMolecules[z];
1256
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
1257
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1259
ag->AddAllAtoms(m,false);
1263
for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++)
1266
for (z2=0;z2<ag->m_baAtomType.GetSize();z2++)
1268
m2->m_iAtomGes += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1270
for (z4=0;z4<m2->m_baAtomIndex.GetSize();z4++)
1272
if (m2->m_baAtomIndex[z4] == ag->m_baRealAtomType[z2])
1274
m2->m_waAtomCount[z4] += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1275
pia = (CxIntArray*)sm2->m_oaAtomOffset[z4];
1280
m2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1281
sm2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1282
m2->m_waAtomCount.Add(((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize());
1284
try { pia = new CxIntArray("gather():pia"); } catch(...) { pia = NULL; }
1285
if (pia == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1287
sm2->m_oaAtomOffset.Add(pia);
1289
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1291
for (z5=0;z5<ia.GetSize();z5++)
1293
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1294
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1296
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1298
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1300
eprintf("Weird error: Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1301
m2->m_waAtomCount[m2->m_waAtomCount.GetSize()-1]--;
1306
pia->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1313
/********************************************************************************/
1322
mprintf("\n You may define custom element labels. This enables keeping apart\n atoms of the same type from different molecules/positions.\n\n");
1323
tb = AskYesNo(" Keep the standard element labels (y) or define custom labels (n)? [yes] ",true);
1327
try { m2 = new CMolecule(); } catch(...) { m2 = NULL; }
1328
if (m2 == NULL) NewException((double)sizeof(CMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1330
try { sm2 = new CSingleMolecule(); } catch(...) { sm2 = NULL; }
1331
if (sm2 == NULL) NewException((double)sizeof(CSingleMolecule),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1333
m2->m_bPseudo = true;
1334
sm2->m_bPseudo = true;
1335
m2->m_iIndex = g_oaMolecules.GetSize();
1336
sm2->m_iMolType = g_oaMolecules.GetSize();
1337
sm2->m_iMolSMIndex = 0;
1338
m2->m_laSingleMolIndex.Add(g_oaSingleMolecules.GetSize());
1339
g_oaMolecules.Add(m2);
1340
g_oaSingleMolecules.Add(sm2);
1342
mprintf(WHITE," >>> Pseudo-molecule %d (= molecule %d) >>>\n\n",ti,g_oaMolecules.GetSize());
1344
mprintf(WHITE," You may define custom element labels. This enables keeping apart\n atoms of the same type from different molecules/positions.\n\n");
1345
tb = AskYesNo(" Keep the standard element labels (y) or define custom labels (n)? [yes] ",true);
1348
for (z=0;z<g_oaMolecules.GetSize();z++)
1350
m = (CMolecule*)g_oaMolecules[z];
1353
if (AskYesNo(" Use atoms from molecule %d (%s) (y/n)? [no] ",false,z+1,m->m_sName))
1356
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
1357
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1359
if (AskYesNo(" Use all atoms (y) from %s or only certain atoms (n)? [no] ",false,m->m_sName))
1361
ag->AddAllAtoms(m,false);
1365
AskString_ND(" Please enter atoms from %s to use (e.g. C1-3,H,O4): ",buf,m->m_sName);
1366
if (!ag->ParseAtoms(m,buf))
1370
if (m->m_laSingleMolIndex.GetSize() > 1)
1372
if (!AskYesNo(" Add selected atoms from all %s molecules (y), or only from certain molecules (n)? [yes] ",true,m->m_sName))
1375
AskString_ND(" Enter the %s molecules to use (range 1-%d, e.g. 1,3-6,8): ",buf,m->m_sName,m->m_laSingleMolIndex.GetSize());
1377
if (!ParseIntList(buf,&ia))
1379
for (z2=0;z2<ia.GetSize();z2++)
1381
if ((ia[z2] < 1) || (ia[z2] > m->m_laSingleMolIndex.GetSize()))
1383
eprintf("Invalid number: %d (should be between 1 and %d).\n",ia[z2],m->m_laSingleMolIndex.GetSize());
1390
for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++)
1395
if (!tb) // Custom Labels
1397
for (z2=0;z2<ag->m_baAtomType.GetSize();z2++)
1400
AskString(" How should %s from %s be labeled? [%s] ",buf,((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,m->m_sName,((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName);
1401
if (ContainsDigit(buf))
1403
eprintf("Digits in element labels not allowed.\n");
1406
for (z3=0;z3<g_oaAtoms.GetSize();z3++)
1408
if (mystricmp(buf,((CAtom*)g_oaAtoms[z3])->m_sName) == 0)
1414
if (strlen(buf) > 7)
1416
mprintf(" Element labels may only have up to 7 characters; truncating.\n");
1419
mprintf(" Adding new element label \"%s\"...\n",buf);
1421
try { at = new CAtom(); } catch(...) { at = NULL; }
1422
if (at == NULL) NewException((double)sizeof(CAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1424
at->m_iIndex = g_oaAtoms.GetSize();
1425
at->m_pElement = ((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_pElement;
1426
memcpy(at->m_sName,buf,8);
1427
at->m_iCount = ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1428
ti2 = g_oaAtoms.GetSize();
1431
m2->m_iAtomGes += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1432
for (z3=0;z3<m2->m_baAtomIndex.GetSize();z3++)
1434
if (m2->m_baAtomIndex[z3] == ti2)
1436
m2->m_waAtomCount[z3] += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1437
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1439
for (z5=0;z5<ia.GetSize();z5++)
1441
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1442
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1444
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1446
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1448
eprintf("Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1449
m2->m_waAtomCount[z3]--;
1454
// mprintf("Molecule %d, SM %d, Type %d, Atom %d: Line %d.\n",z,ia[z5],((CxIntArray*)sm->m_oaAtomOffset[z2])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1455
((CxIntArray*)sm2->m_oaAtomOffset[z3])->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1462
m2->m_baAtomIndex.Add(ti2);
1463
sm2->m_baAtomIndex.Add(ti2);
1464
m2->m_waAtomCount.Add(((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize());
1466
try { pia = new CxIntArray("gather():pia"); } catch(...) { pia = NULL; }
1467
if (pia == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1469
sm2->m_oaAtomOffset.Add(pia);
1470
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1472
for (z5=0;z5<ia.GetSize();z5++)
1474
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1475
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1477
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1479
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1481
eprintf("Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1482
m2->m_waAtomCount[m2->m_waAtomCount.GetSize()-1]--;
1487
pia->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1493
} else // If not custom labels
1495
for (z2=0;z2<ag->m_baAtomType.GetSize();z2++)
1497
for (z4=0;z4<m2->m_baAtomIndex.GetSize();z4++)
1499
if (m2->m_baAtomIndex[z4] == ag->m_baRealAtomType[z2])
1501
m2->m_waAtomCount[z4] += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1502
pia = (CxIntArray*)sm2->m_oaAtomOffset[z4];
1507
m2->m_iAtomGes += ((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize();
1508
m2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1509
sm2->m_baAtomIndex.Add(ag->m_baRealAtomType[z2]);
1510
m2->m_waAtomCount.Add(((CxIntArray*)ag->m_oaAtoms[z2])->GetSize() * ia.GetSize());
1512
try { pia = new CxIntArray("gather():pia"); } catch(...) { pia = NULL; }
1513
if (pia == NULL) NewException((double)sizeof(CxIntArray),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1515
sm2->m_oaAtomOffset.Add(pia);
1517
for (z4=0;z4<((CxIntArray*)ag->m_oaAtoms[z2])->GetSize();z4++)
1519
for (z5=0;z5<ia.GetSize();z5++)
1521
sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ia[z5]]];
1522
for (z6=0;z6<sm2->m_oaAtomOffset.GetSize();z6++)
1524
for (z7=0;z7<((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetSize();z7++)
1526
if (((CxIntArray*)sm2->m_oaAtomOffset[z6])->GetAt(z7) == ((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)))
1528
eprintf("Atom %s%d from %s[%d] is already in the pseudo-molecule; skipping.\n",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z2]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)+1,m->m_sName,ia[z5]+1);
1529
m2->m_waAtomCount[m2->m_waAtomCount.GetSize()-1]--;
1534
pia->Add(((CxIntArray*)sm->m_oaAtomOffset[ag->m_baAtomType[z2]])->GetAt(((CxIntArray*)ag->m_oaAtoms[z2])->GetAt(z4)));
1541
if (AskYesNo(" Use another set of atoms from %s (y/n)? [no] ",false,m->m_sName))
1543
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
1544
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1553
mprintf(WHITE," <<< Pseudo-molecule %d (= molecule %d) defined as %s <<<\n\n",ti,g_oaMolecules.GetSize(),m2->m_sName);
1554
if (AskYesNo(" Define another pseudo-molecule (y/n)? [no] ",false))
1555
goto _pseudomolnext;
1556
mprintf(WHITE,"\n The following pseudo-molecules have been defined:\n");
1557
mprintf(" (note: pseudo-molecules start with a $ sign)\n\n");
1559
for (z=0;z<g_oaMolecules.GetSize();z++)
1561
m = (CMolecule*)g_oaMolecules[z];
1565
mprintf(" %d.) Molecule %d - %s\n",ti,z+1,m->m_sName);
1568
mprintf(WHITE,"\n Defining virtual atom #1 as molecular Center of Geometry:\n");
1569
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1571
m = (CMolecule*)g_oaMolecules[z0];
1574
mprintf(" - %s...\n",m->m_sName);
1575
va = AddVirtualAtom(z0);
1577
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1578
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1579
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1580
va->m_faWeight[z] = 1.0f;
1581
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1584
mprintf(WHITE,"\n Defining virtual atom #2 as molecular Center of Mass:\n");
1585
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1587
m = (CMolecule*)g_oaMolecules[z0];
1590
mprintf(" - %s...\n",m->m_sName);
1591
va = AddVirtualAtom(z0);
1593
va->m_oCenterAtoms.AddAllAtoms((CMolecule*)g_oaMolecules[va->m_iMolecule],false);
1594
va->m_faWeight.SetSize(va->m_oCenterAtoms.m_iAtomGes);
1597
for (z=0;z<va->m_oCenterAtoms.m_baAtomType.GetSize();z++)
1599
tf = ((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z]])->m_pElement->m_fMass;
1600
for (z2=0;z2<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z])->GetSize();z2++)
1602
va->m_faWeight[z3] = tf;
1607
va->m_fGesWeight = tf2;
1608
if (va->m_fGesWeight == 0)
1610
eprintf(" Molecule %s has total mass of zero. Defining #2 as Center of Geometry.\n",m->m_sName);
1611
for (z=0;z<va->m_oCenterAtoms.m_iAtomGes;z++)
1612
va->m_faWeight[z] = 1.0f;
1613
va->m_fGesWeight = (float)va->m_oCenterAtoms.m_iAtomGes;
1619
mprintf(GREEN,"\n>>> %d virtual atoms have been defined: >>>\n",g_oaVirtualAtoms.GetSize());
1620
for (z0=0;z0<g_oaMolecules.GetSize();z0++)
1622
for (z=0;z<((CMolecule*)g_oaMolecules[z0])->m_laVirtualAtoms.GetSize();z++)
1624
va = (CVirtualAtom*)g_oaVirtualAtoms[((CMolecule*)g_oaMolecules[z0])->m_laVirtualAtoms[z]];
1625
if (va->m_iMolVirtAtom < 2)
1627
mprintf(WHITE,"\n #%d in %s: %s.",va->m_iMolVirtAtom+1,((CMolecule*)g_oaMolecules[va->m_iMolecule])->m_sName,(va->m_iMolVirtAtom==0)?"Center of Geometry":"Center of Mass");
1628
if (va->m_iMolVirtAtom == 1)
1632
mprintf(WHITE,"\n #%d in %s - defined through %s\n",va->m_iMolVirtAtom+1,((CMolecule*)g_oaMolecules[va->m_iMolecule])->m_sName,(va->m_iMode==0)?"center:":"distance/angle/dihedral:");
1633
if (va->m_iMode == 0)
1635
if (!((CMolecule*)g_oaMolecules[z0])->m_bPseudo || (z > 1))
1638
for (z2=0;z2<va->m_oCenterAtoms.m_baAtomType.GetSize();z2++)
1640
for (z3=0;z3<((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z2])->GetSize();z3++)
1642
mprintf(" - %2s%-3d Weight %.2f%c\n",((CAtom*)g_oaAtoms[va->m_oCenterAtoms.m_baRealAtomType[z2]])->m_sName,((CxIntArray*)va->m_oCenterAtoms.m_oaAtoms[z2])->GetAt(z3)+1,va->m_faWeight[z4]/va->m_fGesWeight*100.0f,'%');
1646
} else mprintf(" (pseudo-molecule, skipping atoms)\n");
1649
mprintf(" - Distance #%d-%s%d = %.2f pm\n",z+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,va->m_fValues[0]);
1650
mprintf(" - Angle #%d-%s%d-%s%d = %.2f degree\n",z+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1,va->m_fValues[1]*180.0/Pi);
1651
mprintf(" - Dihedral #%d-%s%d-%s%d-%s%d = %.2f degree\n",z+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[0]])->m_sName,va->m_iAtom[0]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[1]])->m_sName,va->m_iAtom[1]+1,((CAtom*)g_oaAtoms[va->m_iRealAtomType[2]])->m_sName,va->m_iAtom[2]+1,va->m_fValues[2]*180.0/Pi);
1655
mprintf(GREEN,"\n<<< End of virtual atoms <<<\n\n");
1658
g_TimeStep.UniteMolecules(false);
1660
g_TimeStep.CalcCenters();
1661
g_bFoldAtomwise = false;
1664
g_TimeStep.FoldMolecules();
1668
// g_TimeStep.WritePOV("step.pov");
1670
mprintf(WHITE,"\n>>> List of functions <<<\n\n");
1673
mprintf(" (You may specify multiple analyses at once, but\n");
1674
mprintf(" the safe way is to perform only one kind of analysis at a time.)\n");
1676
inpprintf("! Which functions to compute (comma separated)?\n");
1677
mprintf("\n Which functions to compute (comma separated)? ");
1680
if (!ParseFunctions(buf))
1682
eprintf("Wrong input.\n");
1683
inpprintf("! Wrong input.\n");
1688
if (g_bRegionAnalysis)
1690
if (!(g_bRDF || g_bSDF || g_bADF || g_bDDF || g_bCDF || g_bRevSDF || g_bDens))
1692
eprintf(" Region-specific analysis needs to be applied to some static analysis.\n\n");
1695
g_iaSMRegion.SetSize(g_oaSingleMolecules.GetSize());
1696
for (z=0;z<g_oaSingleMolecules.GetSize();z++)
1697
g_iaSMRegion[z] = (rand()%2)+1;
1700
if (g_bVoro || g_bVoid || g_bSaveJustTraj || g_bSaveRefEnv || g_bCutCluster)
1701
g_bNeedMoleculeWrap = true;
1703
if (g_bNPT && (g_bACF || g_bMSD))
1705
mprintf(RED," Warning: ");
1706
mprintf("When a variable cell vector is used, dynamical analyses (like spectra or MSDs)\n");
1707
mprintf(" will give erroneous results.\n\n");
1710
mprintf(WHITE," The advanced mode includes some options which are quite powerful,\n yet possibly weird or seldomly required.\n\n");
1712
g_bAdvanced2 = AskYesNo(" Use the advanced mode for the main part (y/n)? [no] ",false);
1715
if (g_bThermo || g_bVDF || g_bRaman || g_bCombined || g_bBondACF || g_bVHDF || g_bACF || g_bUseVelocities || g_bUseForces || g_bMSD || g_bAggregation || g_bDLDisp || g_bDLDF || g_bDACF || g_bRDyn || g_bIRSpec || g_bIRSpec || g_bTimeDiff || g_bDeriv)
1717
g_fTimestepLength = AskFloat(" Enter the length of one trajectory time step in fs: [0.5] ",0.5f);
1721
/*********** Interface ***************/
1722
if (!Interface_BeforeAnalysis())
1727
mprintf(YELLOW,"*** Combined Distribution Function\n\n");
1728
g_iCDFChannels = AskUnsignedInteger(" How many channels should the Combined Distribution Function have? [2] ",2);
1730
try { g_iObsChannel = new int[g_iCDFChannels]; } catch(...) { g_iObsChannel = NULL; }
1731
if (g_iObsChannel == NULL) NewException((double)g_iCDFChannels*sizeof(int),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1733
mprintf(" Choose from these functions: rdf, adf, ddf, dip, vdf");
1734
if (g_bBetaFeatures)
1735
mprintf(", pldf, lidf");
1737
for (z=0;z<g_iCDFChannels;z++)
1740
AskString_ND(" Channel %d: Enter function type (e.g. rdf): ",buf,z+1);
1741
if (mystricmp(buf,"rdf")==0)
1743
g_iObsChannel[z] = 0;
1745
} else if (mystricmp(buf,"adf")==0)
1747
g_iObsChannel[z] = 1;
1749
} else if (mystricmp(buf,"ddf")==0)
1751
g_iObsChannel[z] = 2;
1753
} else if (mystricmp(buf,"dip")==0)
1755
g_iObsChannel[z] = 3;
1757
} else if (mystricmp(buf,"vdf")==0)
1759
g_iObsChannel[z] = 4;
1761
} else if ((mystricmp(buf,"pldf")==0) && g_bBetaFeatures)
1763
g_iObsChannel[z] = 5;
1765
} else if ((mystricmp(buf,"lidf")==0) && g_bBetaFeatures)
1767
g_iObsChannel[z] = 6;
1771
eprintf("Wrong input.\n");
1772
inpprintf("! Wrong input.\n");
1776
} else g_iCDFChannels = 1;
1778
if (g_bDipDF || g_bDipole)
1783
try { g_pVoroWrapper = new CVoroWrapper(); } catch(...) { g_pVoroWrapper = NULL; }
1784
if (g_pVoroWrapper == NULL) NewException((double)sizeof(CVoroWrapper),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1786
g_pVoroWrapper->Parse();
1791
try { g_pSFac = new CStructureFactor(); } catch(...) { g_pSFac = NULL; }
1792
if (g_pSFac == NULL) NewException((double)sizeof(CStructureFactor),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1799
try { g_pResp = new CResp(); } catch(...) { g_pResp = NULL; }
1800
if (g_pResp == NULL) NewException((double)sizeof(CResp),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1802
g_pResp->m_pTimeStep = &g_TimeStep;
1803
g_pResp->ParseResp();
1811
try { g_pFFGen = new CFFGen(); } catch(...) { g_pFFGen = NULL; }
1812
if (g_pFFGen == NULL) NewException((double)sizeof(CFFGen),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1814
g_pFFGen->Parse(&g_TimeStep);
1821
try { g_pVoroWrapper = new CVoroWrapper(); } catch(...) { g_pVoroWrapper = NULL; }
1822
if (g_pVoroWrapper == NULL) NewException((double)sizeof(CVoroWrapper),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1824
try { g_pVoroAnalysis = new CVoroAnalysis(); } catch(...) { g_pVoroAnalysis = NULL; }
1825
if (g_pVoroAnalysis == NULL) NewException((double)sizeof(CVoroAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1827
g_pVoroAnalysis->Parse();
1832
mprintf(WHITE,">>> Selection of Aggregation Functions >>>\n\n");
1834
g_bDACF = AskYesNo(" Compute Dimer Existence Autocorrelation Functions (DACFs) (y/n)? [yes] ",true);
1835
g_bDLDF = AskYesNo(" Compute Dimer Lifetime Distribution Functions (DLDFs) (y/n)? [yes] ",true);
1836
g_bDDisp = AskYesNo(" Compute Dimer Displacement Functions / Pair Diffusion (y/n)? [no] ",false);
1839
g_bPairMSD = AskYesNo(" Compute Pair Mean Square Displacement (Pair Diffusion) (y/n)? [yes] ",true);
1840
g_bDLDisp = AskYesNo(" Compute combined Dimer Lifetime/Displacement Function (DLDisp) (y/n)? [yes] ",true);
1847
mprintf(WHITE,"\n<<< Selection of Aggregation Functions <<<\n\n");
1852
mprintf(WHITE,">>> Selection of Neighborhood Exchange Functions >>>\n\n");
1853
mprintf(WHITE,"\n<<< Selection of Neighborhood Exchange Functions <<<\n\n");
1858
if (g_bRDyn || g_bIRSpec)
1859
g_bRDynCacheMode = AskYesNo(" Use RDyn cached mode (do this unless there are problems) (y/n)? [yes] ",true);
1862
g_bMSDCacheMode = AskYesNo(" Use MSD cached mode (do this unless there are problems) (y/n)? [yes] ",true);
1865
g_bRDynCacheMode = true;
1866
g_bMSDCacheMode = true;
1869
if (g_bClusterAnalysis)
1871
try { g_pClusterAnalysis = new CClusterAnalysis(); } catch(...) { g_pClusterAnalysis = NULL; }
1872
if (g_pClusterAnalysis == NULL) NewException((double)sizeof(CClusterAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1874
g_pClusterAnalysis->Parse();
1879
try { g_pMicroHet = new CMicroHet(); } catch(...) { g_pMicroHet = NULL; }
1880
if (g_pMicroHet == NULL) NewException((double)sizeof(CMicroHet),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1882
g_pMicroHet->Parse();
1887
try { g_pThermoAnalysis = new CThermoAnalysis(); } catch(...) { g_pThermoAnalysis = NULL; }
1888
if (g_pThermoAnalysis == NULL) NewException((double)sizeof(CThermoAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1890
g_pThermoAnalysis->Parse();
1895
try { g_pFESA = new CFESAnalysis(); } catch(...) { g_pFESA = NULL; }
1896
if (g_pFESA == NULL) NewException((double)sizeof(CFESAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
1903
// mprintf(YELLOW,">>> Select Autocorrelation Functions >>>\n\n");
1906
g_bVACF = AskYesNo(" Calculate velocity autocorrelation function / power spectra (y/n)? [yes] ",true);
1907
else g_bVACF = true;
1910
g_bUseVelocities = true;
1912
/* if (g_bBetaFeatures)
1913
g_bBondACF = AskYesNo(" Calculate bond vibration spectra (y/n)? [no] ",false);
1914
else*/ g_bBondACF = false;
1916
/* g_bDipACF = AskYesNo(" Calculate dipole autocorrelation function / IR spectra (y/n)? [no] ",false);
1920
// mprintf(YELLOW,"\n<<< End of Select Autocorrelation Functions <<<\n\n");
1925
mprintf(WHITE,">>> Bond vibration spectra >>>\n\n");
1926
if (g_iTrajSteps != -1)
1927
g_iBondACFDepth = AskUnsignedInteger(" Enter bond ACF depth in time steps: [%d] ",g_iTrajSteps/2,g_iTrajSteps/2);
1928
else g_iBondACFDepth = AskUnsignedInteger(" Enter bond ACF depth in time steps: [%d] ",4096,4096);
1929
ti = CalcFFTSize(g_iBondACFDepth,false);
1930
if (g_iBondACFDepth != ti)
1932
mprintf(WHITE,"\n The next \"fast\" size for FFT is %d. Using this instead of %d as size.\n",ti,g_iBondACFDepth);
1933
g_iBondACFDepth = ti;
1935
g_bBondACFNormalize = AskYesNo(" Normalize all bond ACFs (removes intensity info for the peaks) (y/n)? [no] ",false);
1936
g_bBondACFSymmetrize = AskYesNo(" Symmetrize all bond ACFs (y/n)? [no] ",false);
1937
g_bBondACFWindow = AskYesNo(" Apply window function to bond ACFs (y/n)? [yes] ",true);
1938
g_bBondACFDebug = AskYesNo(" Write out bond ACF debug data (y/n)? [no] ",false);
1939
mprintf(WHITE,"\n<<< End of Bond vibration spectra <<<\n\n");
1942
if (g_bRDyn || g_bIRSpec || g_bBondACF || g_bVACF)
1945
g_bACFFFT = AskYesNo(" Use fourier transform for autocorrelation (much faster) (y/n)? [yes] ",true);
1946
else g_bACFFFT = true;
1947
} else g_bACFFFT = true;
1949
if (g_bCDF || g_bPlProj || g_bDipDF || g_bRDF || g_bVHDF || g_bSDF || g_bPlDF || g_bLiDF || g_bVoidSDF || g_bRevSDF || g_bADF || g_bDDF || g_bSaveRefEnv || g_bCutCluster || g_bCond || g_bNbAnalysis)
1951
if (g_oaMolecules.GetSize() > 1)
1953
sprintf(buf,"\n Which of the molecules should be the reference molecule (");
1954
for (z=0;z<g_oaMolecules.GetSize();z++)
1956
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
1958
if (z < g_oaMolecules.GetSize()-1)
1962
g_iFixMol = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
1963
} else g_iFixMol = 0;
1964
mprintf(WHITE,"\n %s is the reference molecule.\n\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
1965
} else g_iFixMol = -1;
1969
mprintf(YELLOW,">>> Save environment of the reference molecule >>>\n\n");
1970
g_bSaveRefWithEnv = AskYesNo(" Save the reference molecule itself (y/n)? [yes] ",true);
1971
g_bRefEnvCenter = AskYesNo(" Center the reference molecule in the box (y/n)? [yes] ",true);
1972
if (g_bRefEnvCenter)
1974
mprintf("\n The first reference atom will be put into the middle of the box.\n\n");
1975
g_bRefEnvFix = AskYesNo(" Fix rotational freedom of the reference molecule (y/n)? [no] ",false);
1978
mprintf("\n The 2nd reference atom will be put onto the positive X axis,\n");
1979
mprintf(" and the 3rd reference atom into the X-Y plane with positive Y values.\n\n");
1981
mprintf(WHITE," You will be asked for the reference atom(s) lateron.\n\n");
1983
if (((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize() > 1)
1984
g_iSaveRefMol = AskRangeInteger(" Which representative of the reference molecules to use (1-%d)? [1] ",1,((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize(),1,((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize()) - 1;
1985
else g_iSaveRefMol = 0;
1986
mprintf(WHITE,"\nPlease choose mode for neighborhood detection:\n\n");
1987
inpprintf("! Please choose mode for neighborhood detection:\n");
1988
mprintf(" 1.) Search neighbors once in the beginning and always show those.\n");
1989
mprintf(" 2.) Search neighbors in every step and show the current neighbors.\n");
1990
mprintf(" (Warning: Neighbor count differs from step to step - be aware.\n");
1991
mprintf(" 3.) Find the frequentiest neighbors over all steps and always show those.\n\n");
1992
mprintf(WHITE," Please note: ");
1993
mprintf("Programs such as VMD cannot handle variable atom count \n");
1994
mprintf(" along a trajectory and will therefore not work properly with mode 2!\n\n");
1995
g_iNbhMode = AskRangeInteger(" Choice (1-3): [3] ",1,3,3);
1996
mprintf(YELLOW,"\n<<< End of Save environment of the reference molecule <<<\n\n");
2001
mprintf(WHITE,">>> Cut clusters >>>\n\n");
2002
g_bSaveRefWithEnv = AskYesNo(" Show reference molecule itself (y/n)? [yes] ",true);
2003
g_bRefEnvCenter = AskYesNo(" Center reference molecule in the box (y/n)? [yes] ",true);
2004
if (g_bRefEnvCenter)
2005
g_bRefEnvFix = AskYesNo(" Fix rotational freedom of the reference molecule (y/n)? [no] ",false);
2007
g_iClusterCount = AskUnsignedInteger(" How many clusters to create? [100] ",100);
2008
g_iClusterSteps = AskUnsignedInteger(" How many time steps to use for cluster creation? [%d] ",g_iTrajSteps,g_iTrajSteps);
2009
mprintf("\nCreating cluster distribution...");
2010
for (z=0;z<g_iClusterCount;z++)
2012
if (fmod(z,g_iClusterCount/25.0) < 1.0)
2019
eprintf("Error: Too few molecules / time steps for requested cluster count.\n");
2022
ti = ((((unsigned long)rand()%16384)+rand()*16384) % g_iClusterSteps) + 1;
2023
ti2 = rand()%((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize();
2024
for (z2=0;z2<g_iaClusterSteps.GetSize();z2++)
2025
if ((g_iaClusterSteps[z2] == ti) && (g_iaClusterMol[z2] == ti2))
2027
g_iaClusterSteps.Add(ti);
2028
g_iaClusterMol.Add(ti2);
2031
mprintf("Sorting cluster distribution...");
2032
for (z=0;z<g_iClusterCount-1;z++)
2034
if (fmod(z,(g_iClusterCount-1)/25.0) < 1.0)
2039
for (z2=z;z2<g_iClusterCount;z2++)
2041
if (g_iaClusterSteps[z2] < ti)
2043
ti = g_iaClusterSteps[z2];
2044
ti2 = g_iaClusterMol[z2];
2046
} else if (g_iaClusterSteps[z2] == ti)
2048
if (g_iaClusterMol[z2] < ti2)
2050
ti2 = g_iaClusterMol[z2];
2057
ti = g_iaClusterSteps[z];
2058
g_iaClusterSteps[z] = g_iaClusterSteps[ti3];
2059
g_iaClusterSteps[ti3] = ti;
2060
ti = g_iaClusterMol[z];
2061
g_iaClusterMol[z] = g_iaClusterMol[ti3];
2062
g_iaClusterMol[ti3] = ti;
2064
mprintf("Done.\n\n");
2065
mprintf("Writing cluster selection to \"cluster.csv\"...");
2066
a = OpenFileWrite("cluster.csv",true);
2067
mfprintf(a,"# Cluster; Timestep; Ref. Mol.\n");
2069
for (z=0;z<g_iClusterCount;z++)
2070
mfprintf(a,"%d; %d; %d\n",z+1,g_iaClusterSteps[z],g_iaClusterMol[z]+1);
2073
mprintf("Done.\n\n");
2074
mprintf(WHITE,"<<< End of Cut clusters <<<\n\n");
2077
if (g_bSDF || g_bPlProj || g_bVoidSDF || g_bAvg || ((g_bSaveRefEnv || g_bCutCluster) && g_bRefEnvFix)) // Nur fuer SDFs: Welche zwei weiteren Atome fixieren?
2079
g_iRefSystemDim = 3;
2081
mprintf(WHITE," You have to choose three reference atoms from the reference molecule %s:\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
2082
mprintf(" The first reference atom will be put into the center.\n");
2083
mprintf(" The 2nd reference atom will be put onto the positive X axis.\n");
2084
mprintf(" The 3rd reference atom will be put into the X-Y plane with positive Y values.\n\n");
2085
mprintf(" Please enter three comma-separated reference atoms (e.g. \"C1,H2,O1\"): ");
2086
inpprintf("! Please enter three comma-separated reference atoms (e.g. \"C1,H2,O1\"):\n");
2088
if (!ParseRefSystem(g_iFixMol,buf,3))
2092
for (z2=0;z2<z;z2++)
2094
if ((g_iFixAtomType[z] == g_iFixAtomType[z2]) && (g_iFixAtom[z] == g_iFixAtom[z2]))
2096
eprintf("Please enter three pairwise different atoms.\n\n");
2097
inpprintf("! Please enter three pairwise different atoms.\n");
2103
mprintf(WHITE," Reference plane: Fixing in %s the %d. %s-, the %d. %s- and the %d. %s atom.\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName,g_iFixAtom[1]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[1]])->m_sName,g_iFixAtom[2]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[2]])->m_sName);
2105
} else if (g_bRevSDF)
2107
g_iRefSystemDim = 2;
2109
mprintf(" Please enter two reference atoms (e.g. C1,H3): ");
2110
inpprintf("! Please enter two reference atoms (e.g. C1,H3):\n");
2112
if (!ParseRefSystem(g_iFixMol,buf,2))
2114
if ((g_iFixAtomType[0] == g_iFixAtomType[1]) && (g_iFixAtom[0] == g_iFixAtom[1]))
2116
eprintf("Please enter two different atoms.\n\n");
2117
inpprintf("! Please enter two different atoms.\n");
2121
mprintf(WHITE,"Reference axis: Fixing in %s the %d. %s and the %d. %s atom.\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName,g_iFixAtom[1]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[1]])->m_sName);
2123
} else if (g_bVHDF || g_bRDF || g_bADF || g_bPlDF || g_bLiDF || g_bDDF || g_bSaveRefEnv || g_bSaveRefEnv || g_bCutCluster) // Fuer Verteilungsfunktion: Welches Atom im Ursprung
2125
g_iRefSystemDim = 1;
2129
mprintf(" Please enter the atom to put into the box center (e.g. C3): [center of mass] ");
2130
inpprintf("! Please enter the atom to put into the box center (e.g. C3): [center of mass]\n");
2134
if (!ParseRefSystem(g_iFixMol,"#2",1))
2136
eprintf("Weird error.\n");
2137
inpprintf("! Weird error.\n");
2140
} else if (!ParseRefSystem(g_iFixMol,buf,1))
2143
mprintf(WHITE,"Reference atom: Fixing in %s the %d. %s atom.\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName);
2147
if (!ParseRefSystem(g_iFixMol,"#2",1))
2149
eprintf("Weird error.\n");
2150
inpprintf("! Weird error.\n");
2154
} else if (g_iFixMol != -1)
2156
g_iRefSystemDim = 1;
2157
if (!ParseRefSystem(g_iFixMol,"#2",1))
2159
eprintf("Weird error.\n");
2162
mprintf(" Reference atom: Fixing in %s the %d. %s atom.\n\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,g_iFixAtom[0]+1,((CAtom*)g_oaAtoms[g_iFixRealAtomType[0]])->m_sName);
2165
if (g_bSaveRefEnv || g_bCutCluster)
2167
mprintf(WHITE,">>> Neighborhood Definition >>>\n\n");
2169
try { g_pNbSet = new CNbSet(); } catch(...) { g_pNbSet = NULL; }
2170
if (g_pNbSet == NULL) NewException((double)sizeof(CNbSet),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2172
g_pNbSet->Parse(g_iFixMol);
2173
mprintf(WHITE,"\n<<< End of Neighborhood Definition <<<\n\n");
2177
if (AskYesNo(" Create a temporal development overlay (TDO) plot (y/n)? [no] ",false))
2180
g_laTDOSteps.RemoveAll();
2181
if (AskYesNo(" Use equidistant intervals (y) or specify each point (n) (y/n)? [yes] ",true))
2184
g_iTDOCount = AskUnsignedInteger(" Enter the overlay count: [5] ",5);
2185
g_iTDOStart = AskUnsignedInteger(" Enter the starting timestep: [0] ",0);
2186
g_iTDOStride = AskUnsignedInteger(" Enter the overlay distance in steps: [1000] ",1000);
2187
for (z=0;z<g_iTDOCount;z++)
2188
g_laTDOSteps.Add(g_iTDOStart+z*g_iTDOStride);
2194
ti = AskUnsignedInteger(" Enter timestep for %dth overlay: [done] ",999999,g_laTDOSteps.GetSize()+1);
2197
g_laTDOSteps.Add(ti);
2200
g_fTDOBleaching = AskRangeFloat(" Enter the TDO bleaching grade (0-1): [0.8] ",0.0f,1.0f,0.8f);
2201
} else g_bTDO = false;
2205
if (g_bPlProj || g_bAggregation || g_bNbAnalysis || g_bPlDF || g_bLiDF || g_bRDyn || g_bIRSpec || g_bDipDF || g_bMSD || g_bADF || g_bDDF || g_bVACF || g_bDipACF || g_bRevSDF || g_bSDF || g_bVHDF || g_bRDF || g_bDens || g_bVDF || g_bFDF || g_bCond) // Fuer Verteilungsfunktion: Welches Atom beobachten?
2210
g_bVACFCacheMode = AskYesNo(" Use VACF cached mode (do this unless there are problems) (y/n)? [yes] ",true);
2211
else g_bVACFCacheMode = true;
2215
g_bGlobalVACF = AskYesNo(" Compute power spectrum of whole system (y/n)? [yes] ",true);
2218
if (!AskYesNo(" Compute also power spectra for certain atoms/molecules (y/n)? [no] ",false))
2222
g_bGlobalVACF = AskYesNo(" Compute global velocity ACF of whole system (y/n)? [yes] ",true);
2225
if (!AskYesNo(" Compute also velocity ACFs for certain atoms/molecules (y/n)? [no] ",false))
2232
g_bGlobalIR = AskYesNo(" Compute IR spectrum of whole system (y/n)? [yes] ",true);
2234
if (!AskYesNo(" Compute also IR spectra for certain molecule types (y/n)? [no] ",false))
2240
g_bGlobalDipACF = AskYesNo(" Create global dipole ACF of all atoms (y/n)? [yes] ",true);
2243
mprintf(YELLOW,"\n>>> Observation %d >>>\n\n",g_oaObserv.GetSize()+1);
2245
try { o = new CObservation(); } catch(...) { o = NULL; }
2246
if (o == NULL) NewException((double)sizeof(CObservation),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2248
o->m_pConditions = NULL;
2250
o->m_bTimeDev = false;
2251
if (g_bAggregation || g_bNbExchange)
2254
o->m_bOthers = false;
2255
} else if (g_bNbAnalysis)
2258
o->m_bOthers = true;
2259
mprintf(" Performing this observation intermolecular.\n\n");
2260
} else if (g_iFixMol != -1)
2262
if (AskRangeInteger(" Perform this observation intramolecular (within the reference molecule) (0) or intermolecular (1)? [1] ",0,1,1) == 1)
2265
o->m_bOthers = true;
2269
o->m_bOthers = false;
2275
o->m_bOthers = true;
2281
mprintf(WHITE," Please note: ");
2282
mprintf("Although you specified this observation to be intermolecular, you may of course\n");
2283
mprintf(" choose atoms from RM only (or OM only), which will yield an intramolecular quantity.\n\n");
2286
o->m_bSecondShowMol = AskYesNo(" CDF: Perform a three-body analysis (y) or observe one molecule at a time (n)? [no] ",false);
2287
else o->m_bSecondShowMol = false;
2288
if (o->m_bSecondShowMol)
2290
mprintf(WHITE,"\n You have to select two observed molecules (OMs):\n");
2291
mprintf(" The first CDF channel observes the 1st OM, the second channel observes the 2nd OM.\n\n");
2293
if (g_oaMolecules.GetSize() > 1)
2296
if (o->m_bSecondShowMol)
2297
sprintf(buf," Which 1st molecule should be observed (");
2298
else sprintf(buf," Which molecule should be observed (");
2299
for (z=0;z<g_oaMolecules.GetSize();z++)
2301
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
2303
if (z < g_oaMolecules.GetSize()-1)
2307
o->m_iShowMol = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
2308
if ((((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize() == 1) && (o->m_iShowMol == g_iFixMol))
2310
eprintf("Error: There is only 1 molecule of %s.\n--> Intermolecular observation between %s and %s not possible.\n\n",((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2315
mprintf(" Only one molecule type, choosing %s as observed molecule (OM).\n",((CMolecule*)g_oaMolecules[0])->m_sName);
2318
o->m_iShowMolCount = ((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();
2319
if (o->m_bSecondShowMol)
2321
if (g_oaMolecules.GetSize() > 1)
2324
sprintf(buf," Which 2nd molecule should be observed (");
2325
for (z=0;z<g_oaMolecules.GetSize();z++)
2327
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
2329
if (z < g_oaMolecules.GetSize()-1)
2333
o->m_iShowMol2 = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
2334
if ((((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize() == 1) && (o->m_iShowMol2 == g_iFixMol))
2336
eprintf("Error: There is only 1 molecule of %s.\n --> Intermolecular observation between %s and %s not possible.\n\n",((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2339
} else o->m_iShowMol2 = 0;
2340
o->m_iShowMol2Count = ((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize();
2341
if (o->m_iShowMol == o->m_iShowMol2)
2342
o->m_bExclude1eq2 = AskYesNo(" Exclude the case \"1st OM = 2nd OM\" (y/n)? [yes] ",true);
2343
else o->m_bExclude1eq2 = false;
2348
o->m_iShowMol2 = -1;
2349
o->m_bSecondShowMol = false;
2350
o->m_iShowMolCount = 1;
2354
if ((o->m_bSecondShowMol) && (o->m_iShowMol != o->m_iShowMol2))
2355
sprintf(buf," of %s / %s / %s",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2356
else if ((o->m_iShowMol != -1) && (g_iFixMol != -1))
2357
sprintf(buf," of %s / %s",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2358
else if (g_iFixMol != -1) sprintf(buf," of %s",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
2360
if (g_iFixMol != -1)
2364
if (AskYesNo(" Observe only certain molecules%s (y/n)? [no] ",false,buf))
2366
o->m_bObsCertain = true;
2367
if (!g_bCDF && (g_bRDF || g_bADF || g_bDDF || g_bDipDF))
2368
o->m_bDecompDist = AskYesNo(" Decompose distribution functions into contributions from molecules (y/n)? [yes] ",true);
2370
if (((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize() > 1)
2372
mprintf(" Which %s molecules (RM) to take into account (e.g. 1,3-7)? [all] ",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
2373
inpprintf("! Which %s molecules (RM) to take into account (e.g. 1,3-7)? [all]\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName);
2377
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();z++)
2378
o->m_waObsRefList.Add(z);
2381
ParseIntList(buf,&o->m_waObsRefList);
2382
for (z=0;z<o->m_waObsRefList.GetSize();z++)
2383
o->m_waObsRefList[z]--;
2385
} else o->m_waObsRefList.Add(0);
2387
// mprintf("RefList[0] = %d\n",o->m_waObsRefList[0]);
2389
if (o->m_iShowMol != -1)
2391
if (((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize() > 1)
2393
mprintf(" Which %s molecules (OM) to take into account (e.g. 1,3-7)? [all] ",((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2394
inpprintf("! Which %s molecules (OM) to take into account (e.g. 1,3-7)? [all]\n",((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
2398
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();z++)
2399
o->m_waObsShowList.Add(z);
2402
ParseIntList(buf,&o->m_waObsShowList);
2403
for (z=0;z<o->m_waObsShowList.GetSize();z++)
2404
o->m_waObsShowList[z]--;
2406
} else o->m_waObsShowList.Add(0);
2407
} else o->m_waObsShowList.Add(0); // Dummy
2409
if (o->m_bSecondShowMol)
2411
if (o->m_iShowMol2 != -1)
2413
if (((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize() > 1)
2415
mprintf(" Which %s molecules (2nd OM) to take into account (e.g. 1,3-7)? [all] ",((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2416
inpprintf("! Which %s molecules (2nd OM) to take into account (e.g. 1,3-7)? [all]\n",((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_sName);
2420
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol2])->m_laSingleMolIndex.GetSize();z++)
2421
o->m_waObsShow2List.Add(z);
2424
ParseIntList(buf,&o->m_waObsShow2List);
2425
for (z=0;z<o->m_waObsShow2List.GetSize();z++)
2426
o->m_waObsShow2List[z]--;
2428
} else o->m_waObsShow2List.Add(0);
2429
} else o->m_waObsShow2List.Add(0); // Dummy
2431
} else // if not onlysome
2433
o->m_bObsCertain = false;
2434
o->m_bDecompDist = false;
2436
} else // if not advanced
2438
o->m_bObsCertain = false;
2439
o->m_bDecompDist = false;
2443
o->m_bObsCertain = false;
2444
o->m_bDecompDist = false;
2447
o->m_bDecompType = false;
2449
if ((!o->m_bObsCertain) && (!g_bCDF) && g_bAdvanced2 && (g_bRDF || g_bADF || g_bDDF || g_bDipDF))
2451
if (AskYesNo(" Decompose this observation into contributions from different elements (y/n)? [no] ",false))
2453
o->m_bDecompType = true;
2457
if (g_bRegionAnalysis)
2459
AskString(" Take reference molecules from which regions? [all] ",buf,"0");
2460
ParseIntList(buf,&o->m_iaRMRegions);
2461
// for (z6=0;z6<o->m_iaRMRegions.GetSize();z6++)
2462
// if (o->m_iaRMRegions[z6] != 0)
2463
// o->m_iaRMRegions[z6]--;
2467
if (o->m_bSecondShowMol)
2469
AskString(" Take 1st observed molecules from which regions? [all] ",buf,"0");
2470
ParseIntList(buf,&o->m_iaOM1Regions);
2471
// for (z6=0;z6<o->m_iaOM1Regions.GetSize();z6++)
2472
// if (o->m_iaOM1Regions[z6] != 0)
2473
// o->m_iaOM1Regions[z6]--;
2474
AskString(" Take 2nd observed molecules from which regions? [all] ",buf,"0");
2475
ParseIntList(buf,&o->m_iaOM2Regions);
2476
// for (z6=0;z6<o->m_iaOM2Regions.GetSize();z6++)
2477
// if (o->m_iaOM2Regions[z6] != 0)
2478
// o->m_iaOM2Regions[z6]--;
2481
AskString(" Take observed molecules from which regions? [all] ",buf,"0");
2482
ParseIntList(buf,&o->m_iaOM1Regions);
2483
// for (z6=0;z6<o->m_iaOM1Regions.GetSize();z6++)
2484
// if (o->m_iaOM1Regions[z6] != 0)
2485
// o->m_iaOM1Regions[z6]--;
2490
if (g_bAggregation || g_bNbExchange)
2492
try { o->m_pDACF = new CDACF(); } catch(...) { o->m_pDACF = NULL; }
2493
if (o->m_pDACF == NULL) NewException((double)sizeof(CDACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2495
o->m_pDACF->Parse();
2500
try { o->m_pRDyn = new CReorDyn(); } catch(...) { o->m_pRDyn = NULL; }
2501
if (o->m_pRDyn == NULL) NewException((double)sizeof(CReorDyn),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2503
o->m_pRDyn->m_iShowMol = o->m_iShowMol;
2504
o->m_pRDyn->Parse();
2509
try { o->m_pIRSpec = new CReorDyn(); } catch(...) { o->m_pIRSpec = NULL; }
2510
if (o->m_pIRSpec == NULL) NewException((double)sizeof(CReorDyn),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2512
o->m_pIRSpec->m_iShowMol = o->m_iShowMol;
2513
o->m_pIRSpec->ParseSpec();
2518
try { o->m_pDensityDF = new CDensDF(); } catch(...) { o->m_pDensityDF = NULL; }
2519
if (o->m_pDensityDF == NULL) NewException((double)sizeof(CDensDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2521
o->m_pDensityDF->m_iShowMol = o->m_iShowMol;
2522
o->m_pDensityDF->Parse();
2527
try { o->m_pSDF = new CSDF(); } catch(...) { o->m_pSDF = NULL; }
2528
if (o->m_pSDF == NULL) NewException((double)sizeof(CSDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2530
o->m_pSDF->m_bIntra = o->m_bSelf;
2531
o->m_pSDF->m_iShowMol = o->m_iShowMol;
2532
o->m_pSDF->Parse(false);
2537
try { o->m_pPlProj = new CPlProj(); } catch(...) { o->m_pPlProj = NULL; }
2538
if (o->m_pPlProj == NULL) NewException((double)sizeof(CPlProj),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2525
o->m_pSDF->m_bIntra = o->m_bSelf;
2526
o->m_pSDF->m_iShowMol = o->m_iShowMol;
2527
o->m_pSDF->Parse(false);
2532
try { o->m_pRevSDF = new CRevSDF(); } catch(...) { o->m_pRevSDF = NULL; }
2533
if (o->m_pRevSDF == NULL) NewException((double)sizeof(CRevSDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2535
o->m_pRevSDF->m_bIntra = o->m_bSelf;
2536
o->m_pRevSDF->m_iShowMol = o->m_iShowMol;
2537
o->m_pRevSDF->Parse();
2542
try { o->m_pNbAnalysis = new CNbAnalysis(); } catch(...) { o->m_pNbAnalysis = NULL; }
2543
if (o->m_pNbAnalysis == NULL) NewException((double)sizeof(CNbAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2545
o->m_pNbAnalysis->m_iShowMol = o->m_iShowMol;
2546
o->m_pNbAnalysis->Parse();
2549
try { o->m_pRDF = new CRDF*[g_iCDFChannels]; } catch(...) { o->m_pRDF = NULL; }
2550
if (o->m_pRDF == NULL) NewException((double)g_iCDFChannels*sizeof(CRDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2552
try { o->m_pADF = new CADF*[g_iCDFChannels]; } catch(...) { o->m_pADF = NULL; }
2553
if (o->m_pADF == NULL) NewException((double)g_iCDFChannels*sizeof(CADF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2555
try { o->m_pDDF = new CDDF*[g_iCDFChannels]; } catch(...) { o->m_pDDF = NULL; }
2556
if (o->m_pDDF == NULL) NewException((double)g_iCDFChannels*sizeof(CDDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2558
try { o->m_pDipDF = new CDipDF*[g_iCDFChannels]; } catch(...) { o->m_pDipDF = NULL; }
2559
if (o->m_pDipDF == NULL) NewException((double)g_iCDFChannels*sizeof(CDipDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2561
try { o->m_pVDF = new CVDF*[g_iCDFChannels]; } catch(...) { o->m_pVDF = NULL; }
2562
if (o->m_pVDF == NULL) NewException((double)g_iCDFChannels*sizeof(CVDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2564
try { o->m_pPlDF = new CPlDF*[g_iCDFChannels]; } catch(...) { o->m_pPlDF = NULL; }
2565
if (o->m_pPlDF == NULL) NewException((double)g_iCDFChannels*sizeof(CVDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2567
try { o->m_pLiDF = new CLiDF*[g_iCDFChannels]; } catch(...) { o->m_pLiDF = NULL; }
2568
if (o->m_pLiDF == NULL) NewException((double)g_iCDFChannels*sizeof(CVDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2570
for (z=0;z<g_iCDFChannels;z++)
2572
o->m_pRDF[z] = NULL;
2573
o->m_pADF[z] = NULL;
2574
o->m_pDDF[z] = NULL;
2575
o->m_pDipDF[z] = NULL;
2576
o->m_pVDF[z] = NULL;
2577
o->m_pPlDF[z] = NULL;
2578
o->m_pLiDF[z] = NULL;
2583
try { o->m_pCDF = new CCDF(); } catch(...) { o->m_pCDF = NULL; }
2584
if (o->m_pCDF == NULL) NewException((double)sizeof(CCDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2586
try { o->m_pCDF->m_iCombinations = new int[g_iCDFChannels]; } catch(...) { o->m_pCDF->m_iCombinations = NULL; }
2587
if (o->m_pCDF->m_iCombinations == NULL) NewException((double)g_iCDFChannels*sizeof(int),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2589
mprintf(BLUE,"\n>>> Combined Distribution Function >>>\n");
2590
// o->m_pCDF->m_bChannelAll = new bool[g_iCDFChannels];
2591
o->m_pCDF->m_iCombinationProd = 1;
2592
for (z=0;z<g_iCDFChannels;z++)
2540
o->m_pPlProj->m_bIntra = o->m_bSelf;
2541
o->m_pPlProj->m_iShowMol = o->m_iShowMol;
2542
o->m_pPlProj->Parse();
2547
try { o->m_pRevSDF = new CRevSDF(); } catch(...) { o->m_pRevSDF = NULL; }
2548
if (o->m_pRevSDF == NULL) NewException((double)sizeof(CRevSDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2550
o->m_pRevSDF->m_bIntra = o->m_bSelf;
2551
o->m_pRevSDF->m_iShowMol = o->m_iShowMol;
2552
o->m_pRevSDF->Parse();
2557
try { o->m_pNbAnalysis = new CNbAnalysis(); } catch(...) { o->m_pNbAnalysis = NULL; }
2558
if (o->m_pNbAnalysis == NULL) NewException((double)sizeof(CNbAnalysis),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2560
o->m_pNbAnalysis->m_iShowMol = o->m_iShowMol;
2561
o->m_pNbAnalysis->Parse();
2564
try { o->m_pRDF = new CRDF*[g_iCDFChannels]; } catch(...) { o->m_pRDF = NULL; }
2565
if (o->m_pRDF == NULL) NewException((double)g_iCDFChannels*sizeof(CRDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2567
try { o->m_pADF = new CADF*[g_iCDFChannels]; } catch(...) { o->m_pADF = NULL; }
2568
if (o->m_pADF == NULL) NewException((double)g_iCDFChannels*sizeof(CADF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2570
try { o->m_pDDF = new CDDF*[g_iCDFChannels]; } catch(...) { o->m_pDDF = NULL; }
2571
if (o->m_pDDF == NULL) NewException((double)g_iCDFChannels*sizeof(CDDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2573
try { o->m_pDipDF = new CDipDF*[g_iCDFChannels]; } catch(...) { o->m_pDipDF = NULL; }
2574
if (o->m_pDipDF == NULL) NewException((double)g_iCDFChannels*sizeof(CDipDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2576
try { o->m_pVDF = new CVDF*[g_iCDFChannels]; } catch(...) { o->m_pVDF = NULL; }
2577
if (o->m_pVDF == NULL) NewException((double)g_iCDFChannels*sizeof(CVDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2579
try { o->m_pPlDF = new CPlDF*[g_iCDFChannels]; } catch(...) { o->m_pPlDF = NULL; }
2580
if (o->m_pPlDF == NULL) NewException((double)g_iCDFChannels*sizeof(CVDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2582
try { o->m_pLiDF = new CLiDF*[g_iCDFChannels]; } catch(...) { o->m_pLiDF = NULL; }
2583
if (o->m_pLiDF == NULL) NewException((double)g_iCDFChannels*sizeof(CVDF*),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2585
for (z=0;z<g_iCDFChannels;z++)
2587
o->m_pRDF[z] = NULL;
2588
o->m_pADF[z] = NULL;
2589
o->m_pDDF[z] = NULL;
2590
o->m_pDipDF[z] = NULL;
2591
o->m_pVDF[z] = NULL;
2592
o->m_pPlDF[z] = NULL;
2593
o->m_pLiDF[z] = NULL;
2598
try { o->m_pCDF = new CCDF(); } catch(...) { o->m_pCDF = NULL; }
2599
if (o->m_pCDF == NULL) NewException((double)sizeof(CCDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2601
try { o->m_pCDF->m_iCombinations = new int[g_iCDFChannels]; } catch(...) { o->m_pCDF->m_iCombinations = NULL; }
2602
if (o->m_pCDF->m_iCombinations == NULL) NewException((double)g_iCDFChannels*sizeof(int),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2604
mprintf(BLUE,"\n>>> Combined Distribution Function >>>\n");
2605
// o->m_pCDF->m_bChannelAll = new bool[g_iCDFChannels];
2606
o->m_pCDF->m_iCombinationProd = 1;
2607
for (z=0;z<g_iCDFChannels;z++)
2609
mprintf(BLUE,"\n### Channel %d ###\n",z+1);
2610
switch(g_iObsChannel[z])
2613
try { o->m_pRDF[z] = new CRDF(); } catch(...) { o->m_pRDF[z] = NULL; }
2614
if (o->m_pRDF[z] == NULL) NewException((double)sizeof(CRDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2616
if (o->m_bSecondShowMol && (z == 1))
2617
o->m_pRDF[z]->m_iShowMol = o->m_iShowMol2;
2618
else o->m_pRDF[z]->m_iShowMol = o->m_iShowMol;
2619
o->m_pRDF[z]->Parse();
2620
o->m_pCDF->m_iCombinations[z] = o->m_pRDF[z]->m_iCombinations;
2621
o->m_pCDF->m_iCombinationProd *= o->m_pRDF[z]->m_iCombinations;
2622
/* if (o->m_pRDF[z]->m_bSaveDist)
2623
o->m_bTimeDev = true;*/
2627
try { o->m_pADF[z] = new CADF(); } catch(...) { o->m_pADF[z] = NULL; }
2628
if (o->m_pADF[z] == NULL) NewException((double)sizeof(CADF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2630
if (o->m_bSecondShowMol && (z == 1))
2631
o->m_pADF[z]->m_iShowMol = o->m_iShowMol2;
2632
else o->m_pADF[z]->m_iShowMol = o->m_iShowMol;
2633
o->m_pADF[z]->Parse();
2634
o->m_pCDF->m_iCombinations[z] = o->m_pADF[z]->m_iCombinations;
2635
o->m_pCDF->m_iCombinationProd *= o->m_pADF[z]->m_iCombinations;
2636
/* if (o->m_pADF[z]->m_bSaveAngle)
2637
o->m_bTimeDev = true;*/
2641
try { o->m_pDDF[z] = new CDDF(); } catch(...) { o->m_pDDF[z] = NULL; }
2642
if (o->m_pDDF[z] == NULL) NewException((double)sizeof(CDDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2644
if (o->m_bSecondShowMol && (z == 1))
2645
o->m_pDDF[z]->m_iShowMol = o->m_iShowMol2;
2646
else o->m_pDDF[z]->m_iShowMol = o->m_iShowMol;
2647
o->m_pDDF[z]->Parse();
2648
o->m_pCDF->m_iCombinations[z] = o->m_pDDF[z]->m_iCombinations;
2649
o->m_pCDF->m_iCombinationProd *= o->m_pDDF[z]->m_iCombinations;
2650
/* if (o->m_pDDF[z]->m_bSaveAngle)
2651
o->m_bTimeDev = true;*/
2655
try { o->m_pDipDF[z] = new CDipDF(); } catch(...) { o->m_pDipDF[z] = NULL; }
2656
if (o->m_pDipDF[z] == NULL) NewException((double)sizeof(CDipDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2658
if (o->m_bSecondShowMol && (z == 1))
2659
o->m_pDipDF[z]->m_iShowMol = o->m_iShowMol2;
2660
else o->m_pDipDF[z]->m_iShowMol = o->m_iShowMol;
2661
o->m_pDipDF[z]->m_iCombinations = 1;
2662
o->m_pDipDF[z]->Parse();
2663
o->m_pCDF->m_iCombinations[z] = 1;
2664
/* if (o->m_pDipDF[z]->m_bSaveDipole)
2665
o->m_bTimeDev = true;*/
2669
try { o->m_pVDF[z] = new CVDF(); } catch(...) { o->m_pVDF[z] = NULL; }
2670
if (o->m_pVDF[z] == NULL) NewException((double)sizeof(CVDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2672
if (o->m_bSecondShowMol && (z == 1))
2673
o->m_pVDF[z]->m_iShowMol = o->m_iShowMol2;
2674
else o->m_pVDF[z]->m_iShowMol = o->m_iShowMol;
2675
o->m_pVDF[z]->Parse();
2676
o->m_pCDF->m_iCombinations[z] = o->m_pVDF[z]->m_iCombinations;
2677
o->m_pCDF->m_iCombinationProd *= o->m_pVDF[z]->m_iCombinations;
2678
g_bUseVelocities = true;
2679
/* if (o->m_pVDF[z]->m_bSaveSpeed)
2680
o->m_bTimeDev = true;*/
2684
try { o->m_pPlDF[z] = new CPlDF(); } catch(...) { o->m_pPlDF[z] = NULL; }
2685
if (o->m_pPlDF[z] == NULL) NewException((double)sizeof(CPlDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2687
if (o->m_bSecondShowMol && (z == 1))
2688
o->m_pPlDF[z]->m_iShowMol = o->m_iShowMol2;
2689
else o->m_pPlDF[z]->m_iShowMol = o->m_iShowMol;
2690
o->m_pPlDF[z]->Parse();
2691
o->m_pCDF->m_iCombinations[z] = o->m_pPlDF[z]->m_iCombinations;
2692
o->m_pCDF->m_iCombinationProd *= o->m_pPlDF[z]->m_iCombinations;
2696
try { o->m_pLiDF[z] = new CLiDF(); } catch(...) { o->m_pLiDF[z] = NULL; }
2697
if (o->m_pLiDF[z] == NULL) NewException((double)sizeof(CLiDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2699
if (o->m_bSecondShowMol && (z == 1))
2700
o->m_pLiDF[z]->m_iShowMol = o->m_iShowMol2;
2701
else o->m_pLiDF[z]->m_iShowMol = o->m_iShowMol;
2702
o->m_pLiDF[z]->Parse();
2703
o->m_pCDF->m_iCombinations[z] = o->m_pLiDF[z]->m_iCombinations;
2704
o->m_pCDF->m_iCombinationProd *= o->m_pLiDF[z]->m_iCombinations;
2708
o->m_pCDF->m_bChannelAll[z] = AskYesNo(" Should this CDF Channel observe all OMs (y) or only the current one (n)? [no] ",false);
2709
else o->m_pCDF->m_bChannelAll[z] = false;*/
2711
/* mprintf(" Write out temporal development for this CDF (1=yes,0=no)? [no] ");
2713
o->m_pCDF->m_bTimeDev = (atoi(buf)!=0);
2714
if (o->m_pCDF->m_bTimeDev)
2715
o->m_bTimeDev = true;*/
2719
try { o->m_pCDF->m_iResolution = new int[g_iCDFChannels]; } catch(...) { o->m_pCDF->m_iResolution = NULL; }
2720
if (o->m_pCDF->m_iResolution == NULL) NewException((double)g_iCDFChannels*sizeof(int),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2722
for (z=0;z<g_iCDFChannels;z++)
2724
switch(g_iObsChannel[z])
2726
case 0: sprintf(buf,"RDF"); break;
2727
case 1: sprintf(buf,"ADF"); break;
2728
case 2: sprintf(buf,"DDF"); break;
2729
case 3: sprintf(buf,"DipDF"); break;
2730
case 4: sprintf(buf,"VDF"); break;
2731
case 5: sprintf(buf,"PlDF"); break;
2732
case 6: sprintf(buf,"LiDF"); break;
2734
o->m_pCDF->m_iResolution[z] = AskUnsignedInteger(" Please enter the resolution (bin count) for CDF channel %d (%s): [100] ",100,z+1,buf);
2738
o->m_pCDF->m_iHistogramRes = AskUnsignedInteger(" Please enter CDF histogram resolution (0=no histogram): [5000] ",5000);
2739
else o->m_pCDF->m_iHistogramRes = 0;
2741
if (g_iCDFChannels == 2)
2743
try { o->m_pCDF->m_pCombineList = new char[o->m_pCDF->m_iCombinationProd]; } catch(...) { o->m_pCDF->m_pCombineList = NULL; }
2744
if (o->m_pCDF->m_pCombineList == NULL) NewException((double)o->m_pCDF->m_iCombinationProd*sizeof(char),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2746
if ((o->m_pCDF->m_iCombinations[0] > 1) && (o->m_pCDF->m_iCombinations[1] > 1))
2749
for (z=0;z<g_iCDFChannels;z++)
2751
mprintf(WHITE,"CDF channel %d has the following %d observations:\n",z+1,o->m_pCDF->m_iCombinations[z]);
2752
o->ListCDFObservations(z);
2755
if (o->m_pCDF->m_iCombinations[0] == o->m_pCDF->m_iCombinations[1])
2757
if (AskYesNo(" Combine n-th with n-th observation? (y/n) [yes] ",true))
2759
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2760
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2761
o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]+z2] = (z==z2)?1:0;
2767
if (!AskYesNo(" Combine each with each observation (y), or use only some combinations (n)? [yes] ",true))
2769
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2770
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2771
o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]+z2] = 0;
2773
mprintf("\n Please enter all the combinations you want to observe.\n");
2774
mprintf(" Enter each combination as a comma-separated %d-tuple (e.g. ",g_iCDFChannels);
2775
for (z=0;z<g_iCDFChannels;z++)
2778
if (z+1 < g_iCDFChannels)
2783
AskString(" Enter combination (return=finished): ",buf,"");
2786
tempwa.RemoveAll_KeepSize();
2787
ParseIntList(buf,&tempwa);
2788
if (tempwa.GetSize() != g_iCDFChannels)
2790
eprintf(" Wrong input, %d instead of %d values.\n",tempwa.GetSize(),g_iCDFChannels);
2793
for (z=0;z<g_iCDFChannels;z++)
2795
if ((tempwa[z] < 1) || (tempwa[z] > o->m_pCDF->m_iCombinations[z]))
2797
eprintf(" Wrong input, channel %d has only %d observations (%d requested).\n",z+1,o->m_pCDF->m_iCombinations[z],tempwa[z]);
2802
if (o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]+tempwa[1]] == 1)
2804
eprintf(" This combination has already been added.\n");
2807
o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]+tempwa[1]] = 1;
2809
} else goto _combineall;
2815
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2816
o->m_pCDF->m_pCombineList[z] = 1;
2819
o->m_pCDF->m_iCombinationsEnabled = 0;
2820
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2821
if (o->m_pCDF->m_pCombineList[z] != 0)
2822
o->m_pCDF->m_iCombinationsEnabled++;
2824
if (o->m_pCDF->m_iCombinationsEnabled == 1)
2826
mprintf(WHITE,"\n Using 1 combination for each RM-OM pair.\n\n");
2829
mprintf(WHITE,"\n Using %d combinations for each RM-OM pair:\n\n",o->m_pCDF->m_iCombinationsEnabled);
2831
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2833
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2835
if (o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]+z2] == 1)
2837
mprintf(" %2d.) %2d - %2d\n",z3+1,z+1,z2+1);
2847
o->m_pCDF->m_bAxisDivide = AskYesNo(" Write out +/- correlation plot for this CDF (y/n)? [no] ",false);
2849
if (o->m_pCDF->m_bAxisDivide)
2850
o->m_pCDF->m_bAxisDivideAll = AskYesNo(" Also write tensor product and axis projection quotients (y/n)? [no] ",false);
2853
o->m_pCDF->m_bAxisDivide = false;
2854
o->m_pCDF->m_bAxisDivideAll = false;
2859
o->m_pCDF->m_bGraceBunch = AskYesNo(" Write out grace stack (multiple 2D plots) for this CDF (y/n)? [no] ",false);
2860
if (o->m_pCDF->m_bGraceBunch)
2862
o->m_pCDF->m_iGraceBunchC1 = AskUnsignedInteger(" How many graphs do you want do draw in the channel 1 grace stack (0=disable)? [10] ",10);
2863
o->m_pCDF->m_iGraceBunchC2 = AskUnsignedInteger(" How many graphs do you want do draw in the channel 2 grace stack (0=disable)? [10] ",10);
2865
} else o->m_pCDF->m_bGraceBunch = false;
2868
if (g_iCDFChannels == 3)
2872
try { o->m_pCDF->m_pCombineList = new char[o->m_pCDF->m_iCombinationProd]; } catch(...) { o->m_pCDF->m_pCombineList = NULL; }
2873
if (o->m_pCDF->m_pCombineList == NULL) NewException((double)o->m_pCDF->m_iCombinationProd*sizeof(char),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2875
if ((o->m_pCDF->m_iCombinations[0] > 1) || (o->m_pCDF->m_iCombinations[1] > 1) || (o->m_pCDF->m_iCombinations[2] > 1))
2877
for (z=0;z<g_iCDFChannels;z++)
2879
mprintf(WHITE,"CDF channel %d has the following %d observations:\n",z+1,o->m_pCDF->m_iCombinations[z]);
2880
o->ListCDFObservations(z);
2883
if (!AskYesNo(" Combine each with each observation (y), or use only some combinations (n)? [yes] ",true))
2885
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2886
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2887
for (z3=0;z3<o->m_pCDF->m_iCombinations[2];z3++)
2888
o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+z2*o->m_pCDF->m_iCombinations[2]+z3] = 0;
2890
mprintf("\n Please enter all the combinations you want to observe.\n");
2891
mprintf(" Enter each combination as a comma-separated %d-tuple (e.g. ",g_iCDFChannels);
2892
for (z=0;z<g_iCDFChannels;z++)
2895
if (z+1 < g_iCDFChannels)
2900
AskString(" Enter combination (return=finished): ",buf,"");
2903
tempwa.RemoveAll_KeepSize();
2904
ParseIntList(buf,&tempwa);
2905
if (tempwa.GetSize() != g_iCDFChannels)
2907
eprintf(" Wrong input, %d instead of %d values.\n",tempwa.GetSize(),g_iCDFChannels);
2910
for (z=0;z<g_iCDFChannels;z++)
2912
if ((tempwa[z] < 1) || (tempwa[z] > o->m_pCDF->m_iCombinations[z]))
2914
eprintf(" Wrong input, channel %d has only %d observations (%d requested).\n",z+1,o->m_pCDF->m_iCombinations[z],tempwa[z]);
2919
if (o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+tempwa[1]*o->m_pCDF->m_iCombinations[2]+tempwa[2]] == 1)
2921
eprintf(" This combination has already been added.\n");
2924
o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+tempwa[1]*o->m_pCDF->m_iCombinations[2]+tempwa[2]] = 1;
2926
} else goto _3combineall;
2930
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2931
o->m_pCDF->m_pCombineList[z] = 1;
2934
o->m_pCDF->m_iCombinationsEnabled = 0;
2935
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2936
if (o->m_pCDF->m_pCombineList[z] != 0)
2937
o->m_pCDF->m_iCombinationsEnabled++;
2939
if (o->m_pCDF->m_iCombinationsEnabled == 1)
2941
mprintf(WHITE,"\n Using 1 combination for each RM-OM pair.\n\n");
2944
mprintf(WHITE,"\n Using %d combinations for each RM-OM pair:\n\n",o->m_pCDF->m_iCombinationsEnabled);
2946
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2947
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2948
for (z3=0;z3<o->m_pCDF->m_iCombinations[2];z3++)
2949
if (o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+z2*o->m_pCDF->m_iCombinations[2]+z3] == 1)
2951
mprintf(" %2d.) %2d - %2d - %2d\n",z4+1,z+1,z2+1,z3+1);
2959
o->m_pCDF->m_b3DSlices = AskYesNo(" Write out 2D slices for this CDF (y/n)? [no] ",false);
2961
if (o->m_pCDF->m_b3DSlices)
2963
o->m_pCDF->m_i3DSliceIntervals[z] = AskUnsignedInteger(" How many slice intervals to create along channel %d axis (0=skip)? [0] ",0,z+1);
2964
} else o->m_pCDF->m_b3DSlices = false;
2965
} // end if channels == 3
2970
o->m_pCDF->m_bDumpDat = AskYesNo(" Write out input tuples (very large!) for this CDF (y/n)? [no] ",false);
2971
if ((g_iCDFChannels == 2) && (g_iObsChannel[0] == 0) && (g_iObsChannel[1] == 1))
2972
o->m_pCDF->m_iNormalize = AskRangeInteger(" Normalize uniformly (3), data range (2), integral (1), or do not normalize (0)? [1] ",0,3,1);
2973
else o->m_pCDF->m_iNormalize = AskRangeInteger(" Normalize data range (2), integral (1), or do not normalize (0)? [1] ",0,2,1);
2974
if (o->m_pCDF->m_iNormalize == 1)
2975
o->m_pCDF->m_fNormValue = AskFloat(" Set CDF integral to which value? [1000000] ",1000000.0f);
2976
if (o->m_pCDF->m_iNormalize == 2)
2977
o->m_pCDF->m_fNormValue = AskFloat(" Set maximum entry to which value? [100] ",100.0f);
2980
o->m_pCDF->m_bDumpDat = false;
2981
o->m_pCDF->m_iNormalize = 1;
2982
o->m_pCDF->m_fNormValue = 1000000.0f;
2985
mprintf(BLUE,"\n<<< End of Combined Distribution Function <<<\n\n");
2990
try { o->m_pRDF[0] = new CRDF(); } catch(...) { o->m_pRDF[0] = NULL; }
2991
if (o->m_pRDF[0] == NULL) NewException((double)sizeof(CRDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2993
o->m_pRDF[0]->m_iShowMol = o->m_iShowMol;
2994
o->m_pRDF[0]->Parse();
2995
o->m_pRDF[0]->m_bSelf = o->m_bSelf;
2999
try { o->m_pPlDF[0] = new CPlDF(); } catch(...) { o->m_pPlDF[0] = NULL; }
3000
if (o->m_pPlDF[0] == NULL) NewException((double)sizeof(CPlDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3002
o->m_pPlDF[0]->m_iShowMol = o->m_iShowMol;
3003
o->m_pPlDF[0]->Parse();
3004
o->m_pPlDF[0]->m_bSelf = o->m_bSelf;
3008
try { o->m_pLiDF[0] = new CLiDF(); } catch(...) { o->m_pLiDF[0] = NULL; }
3009
if (o->m_pLiDF[0] == NULL) NewException((double)sizeof(CLiDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3011
o->m_pLiDF[0]->m_iShowMol = o->m_iShowMol;
3012
o->m_pLiDF[0]->Parse();
3013
o->m_pLiDF[0]->m_bSelf = o->m_bSelf;
3017
try { o->m_pVHDF = new CVHDF(); } catch(...) { o->m_pVHDF = NULL; }
3018
if (o->m_pVHDF == NULL) NewException((double)sizeof(CVHDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3020
o->m_pVHDF->m_iShowMol = o->m_iShowMol;
3021
o->m_pVHDF->m_bSelf = o->m_bSelf;
3022
o->m_pVHDF->Parse();
3026
try { o->m_pADF[0] = new CADF(); } catch(...) { o->m_pADF[0] = NULL; }
3027
if (o->m_pADF[0] == NULL) NewException((double)sizeof(CADF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3029
o->m_pADF[0]->m_iShowMol = o->m_iShowMol;
3030
o->m_pADF[0]->m_bSelf = o->m_bSelf;
3031
o->m_pADF[0]->Parse();
3035
try { o->m_pDDF[0] = new CDDF(); } catch(...) { o->m_pDDF[0] = NULL; }
3036
if (o->m_pDDF[0] == NULL) NewException((double)sizeof(CDDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3038
o->m_pDDF[0]->m_iShowMol = o->m_iShowMol;
3039
o->m_pDDF[0]->m_bSelf = o->m_bSelf;
3040
o->m_pDDF[0]->Parse();
3044
try { o->m_pDipDF[0] = new CDipDF(); } catch(...) { o->m_pDipDF[0] = NULL; }
3045
if (o->m_pDipDF[0] == NULL) NewException((double)sizeof(CDipDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3047
o->m_pDipDF[0]->m_iShowMol = o->m_iShowMol;
3048
o->m_pDipDF[0]->m_bSelf = o->m_bSelf;
3049
o->m_pDipDF[0]->Parse();
3053
try { o->m_pVDF[0] = new CVDF(); } catch(...) { o->m_pVDF[0] = NULL; }
3054
if (o->m_pVDF[0] == NULL) NewException((double)sizeof(CVDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3056
o->m_pVDF[0]->m_iShowMol = o->m_iShowMol;
3057
o->m_pVDF[0]->m_bSelf = true;
3058
o->m_pVDF[0]->Parse();
3059
g_bUseVelocities = true;
3063
try { o->m_pMSD = new CMSD(); } catch(...) { o->m_pMSD = NULL; }
3064
if (o->m_pMSD == NULL) NewException((double)sizeof(CMSD),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3066
o->m_pMSD->m_iShowMol = o->m_iShowMol;
3071
if ((g_bCDF && (g_iCDFChannels == 2)) || g_bRDF || g_bADF || g_bVDF || g_bDDF || g_bDipDF)
3073
if (!o->m_bSecondShowMol)
3075
if (AskYesNo(" Save temporal development for this observation (y/n)? [no] ",false))
3077
mprintf(WHITE,"\n>>> Save temporal development >>>\n\n");
3078
o->m_bTimeDev = true;
3080
if (g_fTimestepLength == 0)
3082
g_fTimestepLength = AskFloat(" Enter the length of one trajectory time step in fs: [0.5] ",0.5f);
3086
if (g_bDDF && (!g_bCDF))
3088
if ((o->m_pDDF[0]->m_iDeriv == 0) && (!o->m_pDDF[0]->m_bCosine) && (!o->m_pDDF[0]->m_bAbs) && (!o->m_pDDF[0]->m_bPositive))
3090
mprintf("\n You can include full rotations into the DDF's temporal development.\n");
3091
mprintf(" This means, if a dihedral makes a full rotation, the value will be 360 deg insteat of 0 deg.\n");
3092
mprintf(" You may count the number of full rotations during simulation in this way.\n\n");
3093
o->m_pDDF[0]->m_bRotate = AskYesNo(" Include full rotations into the DDF's temporal development (y/n)? [no] ",false);
3094
} else o->m_pDDF[0]->m_bRotate = false;
3095
if (o->m_pDDF[0]->m_bRotate)
3097
mprintf(WHITE,"\n Warning: ");
3098
mprintf("This only works if your trajectory time step is small enough to ensure\n");
3099
mprintf(" that the dihedral is never changing more than 180 deg within one step!\n\n");
3102
if (g_bRDF || g_bADF || g_bVDF || g_bDDF || g_bDipDF)
3104
if (AskYesNo(" Create combined development/histogram-plots for 2D analyses (y/n)? [yes] ",true))
3107
o->m_bCombinedPlot = true;
3108
if (AskYesNo(" Use grey tones for combined plot (y) or standard colors (n)? [no] ",false))
3110
o->m_bCombinedGreyMode = true;
3111
o->m_iCombinedGreyMin = AskRangeInteger(" Darkest shade of grey to use (0=black, 255=white)? [128] ",0,255,128);
3112
o->m_iCombinedGreyMax = AskRangeInteger(" Lightest shade of grey to use (0=black, 255=white)? [224] ",o->m_iCombinedGreyMin,255,224);
3113
o->m_iCombinedGreyShades = AskUnsignedInteger(" How many different shades of grey to use? [4] ",4);
3114
} else o->m_bCombinedGreyMode = false;
3115
} else o->m_bCombinedPlot = false;
3116
} else o->m_bCombinedPlot = false;
3118
if (((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize() > 1)
3120
mprintf(" Save development for which rep. of the reference molecule (e.g. 1,3-7)? [1] ");
3121
inpprintf("! Save development for which rep. of the reference molecule (e.g. 1,3-7)? [1]\n");
3124
o->m_waSaveRefList.Add(0);
3126
ParseIntList(buf,&o->m_waSaveRefList);
3127
for (z=0;z<o->m_waSaveRefList.GetSize();z++)
3128
o->m_waSaveRefList[z]--;
3130
} else o->m_waSaveRefList.Add(0);
3131
if (o->m_iShowMol != -1)
3133
if (((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize() > 1)
3135
mprintf(" Save development for which rep. of the observed molecule (e.g. 1,3-7)? [all] ");
3136
inpprintf("! Save development for which rep. of the observed molecule (e.g. 1,3-7)? [all]\n");
3140
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();z++)
3141
o->m_waSaveShowList.Add(z);
3144
ParseIntList(buf,&o->m_waSaveShowList);
3145
for (z=0;z<o->m_waSaveShowList.GetSize();z++)
3146
o->m_waSaveShowList[z]--;
3148
} else o->m_waSaveShowList.Add(0);
3149
} else o->m_waSaveShowList.Add(0); // Dummy
3150
if ((o->m_waSaveRefList.GetSize() > 1) && (o->m_bOthers))
3151
o->m_bSaveSeparateFiles = AskYesNo(" Developments for different ref. molecules to same (n) or different (y) files? [yes] ",true);
3152
else o->m_bSaveSeparateFiles = false;
3153
if ((g_bCDF) && (g_iCDFChannels == 2))
3155
if (AskYesNo(" Generate time development animation (TDO) for CDF (y/n)? [no] ",false))
3157
o->m_pCDF->m_bTDAnimation = true;
3158
o->m_pCDF->m_iTDASteps = AskUnsignedInteger(" How many steps should the animation have? [1000] ",1000);
3159
o->m_pCDF->m_iTDAStride = AskUnsignedInteger(" Enter distance between the frames in timesteps: [100] ",50);
3160
o->m_pCDF->m_iTDATail = AskUnsignedInteger(" Enter length of the tail in timesteps: [100] ",100);
3161
o->m_pCDF->m_bTDATrace = AskYesNo(" Show trace (y/n)? [yes] ",true);
3162
o->m_pCDF->m_iTDAResX = AskUnsignedInteger(" Enter width (in pixel) of the TDA images: [640] ",640);
3163
o->m_pCDF->m_iTDAResY = AskUnsignedInteger(" Enter height (in pixel) of the TDA images: [480] ",480);
3164
} else o->m_pCDF->m_bTDAnimation = false;
3166
mprintf("\n Saving temporal development for reference molecules ");
3167
for (z=0;z<o->m_waSaveRefList.GetSize();z++)
3169
if (z < (int)o->m_waSaveRefList.GetSize()-1)
3171
mprintf("%d, ",o->m_waSaveRefList[z]+1);
3172
if (((z+1) % 16) == 0)
3174
} else mprintf("%d",o->m_waSaveRefList[z]+1);
3178
mprintf("\n and for observed molecules ");
3179
for (z=0;z<o->m_waSaveShowList.GetSize();z++)
3181
if (z < (int)o->m_waSaveShowList.GetSize()-1)
3183
mprintf("%d, ",o->m_waSaveShowList[z]+1);
3184
if (((z+1) % 16) == 0)
3186
} else mprintf("%d",o->m_waSaveShowList[z]+1);
3190
mprintf(WHITE,"\n<<< End of Save temporal development <<<\n\n");
3191
} else o->m_bTimeDev = false;
3195
if (AskYesNo(" Create a temporal difference plot for this observation (y/n)? [no] ",false))
3197
o->m_bTimeDiff = true;
3199
o->m_iTimeDiffDepth = AskUnsignedInteger(" Enter temporal depth of this plot in time steps: [1000] ",1000);
3200
o->m_b3DTimeDiff = AskYesNo(" Create also 3D temporal difference plots (y/n)? [yes] ",true);
3201
if (o->m_b3DTimeDiff)
3207
tf = o->m_pRDF[0]->m_fMinDist;
3208
tf2 = o->m_pRDF[0]->m_fMaxDist;
3212
tf = o->m_pADF[0]->m_fMinAngle;
3213
tf2 = o->m_pADF[0]->m_fMaxAngle;
3217
tf = o->m_pDDF[0]->m_fMinAngle;
3218
tf2 = o->m_pDDF[0]->m_fMaxAngle;
3222
tf = o->m_pVDF[0]->m_fMinSpeed;
3223
tf2 = o->m_pVDF[0]->m_fMaxSpeed;
3227
tf = o->m_pDipDF[0]->m_fDipoleMin;
3228
tf2 = o->m_pDipDF[0]->m_fDipoleMax;
3230
o->m_iTimeDiffStride3D = AskUnsignedInteger(" Take every n-th time step for the tau axis: [%d] ",o->m_iTimeDiffDepth/100,o->m_iTimeDiffDepth/100);
3231
o->m_fTimeDiffMinVal3D = AskFloat(" Enter min. value for the starting point: [%.2f] ",tf,tf);
3232
o->m_fTimeDiffMaxVal3D = AskFloat(" Enter max. value for the starting point: [%.2f] ",tf2,tf2);
3233
o->m_iTimeDiffRes3D = AskUnsignedInteger(" Enter binning resolution for the starting value: [100] ",100);
3234
mprintf("\n Temporal before/after 3D plot:\n");
3235
o->m_iTimeDiffDistSteps= AskUnsignedInteger(" Every how many time steps create a 2D slice (0 to disable): [0] ",0);
3236
o->m_fTimeDiffDistMinValX = AskFloat(" Enter min. value for the starting point: [%.2f] ",tf,tf);
3237
o->m_fTimeDiffDistMaxValX = AskFloat(" Enter max. value for the starting point: [%.2f] ",tf2,tf2);
3238
o->m_iTimeDiffDistResX = AskUnsignedInteger(" Enter binning resolution for the X axis: [100] ",100);
3239
o->m_fTimeDiffDistMinValY = AskFloat(" Enter min. value for the end point: [%.2f] ",tf,tf);
3240
o->m_fTimeDiffDistMaxValY = AskFloat(" Enter max. value for the end point: [%.2f] ",tf2,tf2);
3241
o->m_iTimeDiffDistResY = AskUnsignedInteger(" Enter binning resolution for the Y axis: [100] ",100);
3244
} else o->m_bTimeDiff = false;
3245
} else o->m_bTimeDiff = false;
3248
o->m_bTimeDev = false;
3249
o->m_bTimeDiff = false;
3253
o->m_bTimeDev = false;
3254
o->m_bTimeDiff = false;
3257
if ((g_iFixMol != -1) && (o->m_iShowMol != -1) && (g_bRDyn || g_bDipDF || g_bMSD || g_bADF || g_bPlDF || g_bLiDF || g_bDDF || g_bVACF || g_bDipACF ||g_bRevSDF || g_bSDF || g_bPlProj || g_bVHDF || g_bRDF || g_bVDF || g_bFDF || g_bCond))
3261
if (AskYesNo(" Add a condition to this observation (y/n)? [no] ",false))
3264
mprintf(GREEN,"\n>>> Condition input >>>\n\n");
3265
// mprintf("You may enter several sets of conditions. They are connected with \"or\",\nonly one of them needs to apply to take a configuration into account.\n\n");
3266
// mprintf("In each set of conditions, you may enter several conditions. They are connected\nwith \"and\", all of them have to apply to make this set of conditions apply.\n");
3268
if (o->m_bSecondShowMol)
3270
if (!AskYesNo(" Add a condition between RM and 1st OM (y/n)? [yes] ",true))
3272
mprintf(WHITE,"\n *** Input of Condition between RM and 1st OM ***\n\n");
3275
try { o->m_pConditions = new CConditionGroup(); } catch(...) { o->m_pConditions = NULL; }
3276
if (o->m_pConditions == NULL) NewException((double)sizeof(CConditionGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3278
o->m_pConditions->m_iShowMol = o->m_iShowMol;
3279
o->m_pConditions->Parse(g_iFixMol,o->m_iShowMol);
3282
if (o->m_bSecondShowMol)
3285
if (!AskYesNo(" Add a condition between RM and 2nd OM (y/n)? [yes] ",true))
3287
mprintf(WHITE,"\n *** Input of Condition between RM and 2nd OM ***\n\n");
3289
try { o->m_pConditionsOM2 = new CConditionGroup(); } catch(...) { o->m_pConditionsOM2 = NULL; }
3290
if (o->m_pConditionsOM2 == NULL) NewException((double)sizeof(CConditionGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3292
o->m_pConditionsOM2->m_iShowMol = o->m_iShowMol2;
3293
o->m_pConditionsOM2->Parse(g_iFixMol,o->m_iShowMol2);
3297
if (o->m_pConditions != NULL)
3299
if (o->m_pConditions->m_bInvertCondition)
3301
o->m_bBinOnlyNotPassedAtoms = false;
3302
o->m_bBinOnlyPassedAtoms = false;
3307
if (o->m_pConditionsOM2 != NULL)
3309
if (o->m_pConditionsOM2->m_bInvertCondition)
3311
o->m_bBinOnlyNotPassedAtoms = false;
3312
o->m_bBinOnlyPassedAtoms = false;
3317
mprintf("\n Normally, TRAVIS evaluates the condition for each RM-OM pair. If the condition\n");
3318
mprintf(" is fulfilled, all atoms from this pair are evaluated. The following question\n");
3319
mprintf(" enables to take into account only exactly the atoms which fulfilled the condition.\n\n");
3321
mprintf(" If you have a distance condition with \"nearest neighbor mode\", only the atom\n");
3322
mprintf(" from the OM that is closest to the RM will be taken into account.\n\n");
3324
o->m_bBinOnlyPassedAtoms = AskYesNo(" Add only atoms to the bin that passed the condition(s) (y/n)? [no] ",false);
3325
/* if (!o->m_bBinOnlyPassedAtoms)
3326
o->m_bBinOnlyNotPassedAtoms = AskYesNo(" Add only atoms to the bin that did NOT pass the condition(s) (y/n)? [no] ",false);
3327
else*/ o->m_bBinOnlyNotPassedAtoms = false;
3330
g_bSaveCondSnapshot = AskYesNo(" Save a snapshot every time the conditions are fulfilled (y/n)? [no] ",false);
3332
if (g_bSaveCondSnapshot)
3333
g_bNeedMoleculeWrap = true;
3335
if (g_bSaveCondSnapshot)
3337
g_bSaveCondWholeBox = AskYesNo(" Save the whole box (y) or only the RM/OM pair (n)? [no] ",false);
3338
if (g_bSaveCondWholeBox)
3339
mprintf("\n The RM that fulfills the condition will be centered (coordinates 0|0|0).\n");
3342
mprintf(GREEN,"\n<<< End of Condition input <<<\n\n");
3348
mprintf(WHITE,"\n>>> Velocity autocorrelation function >>>\n\n");
3350
try { o->m_pVACF = new CACF(); } catch(...) { o->m_pVACF = NULL; }
3351
if (o->m_pVACF == NULL) NewException((double)sizeof(CACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3353
o->m_pVACF->m_iShowMol = o->m_iShowMol;
3354
o->m_pVACF->Parse();
3355
mprintf(WHITE,"\n<< End of Velocity autocorrelation function <<<\n\n");
3360
mprintf(WHITE,"\n>>> Dipole moment autocorrelation function >>>\n\n");
3362
try { o->m_pDipACF = new CACF(); } catch(...) { o->m_pDipACF = NULL; }
3363
if (o->m_pDipACF == NULL) NewException((double)sizeof(CACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3365
o->m_pDipACF->Parse();
3366
mprintf(WHITE,"\n<<< End of Dipole moment autocorrelation function <<<\n\n");
3369
if (g_bUseVelocities)
3371
if (g_iFixMol != -1)
3372
o->m_bVelocityRelToRef = (AskRangeInteger(" Use absolute velocities (0) or relative to the reference molecule (1)? [0] ",0,1,0) != 0);
3373
else o->m_bVelocityRelToRef = false;
3376
mprintf(YELLOW,"\n<<< End of Observation %d <<<\n",g_oaObserv.GetSize());
3378
if (AskYesNo("\n Add another observation (y/n)? [no] ",false))
3382
mprintf(WHITE,">>> Observation List >>>\n\n");
3383
for (z2=0;z2<g_oaObserv.GetSize();z2++)
3385
mprintf(YELLOW," *** Observation %d\n",z2+1);
3386
o = (CObservation*)g_oaObserv[z2];
3389
mprintf(" - Condition between %s and %s\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
3393
mprintf(" - Aggregation functions - %d value sets:\n",o->m_pDACF->m_oaSubDACFs.GetSize());
3394
for (z3=0;z3<o->m_pDACF->m_oaSubDACFs.GetSize();z3++)
3395
mprintf(" > %s\n",((CDACFSub*)o->m_pDACF->m_oaSubDACFs[z3])->m_sName);
3400
mprintf(" - Neighborhood exchange functions:\n");
3401
for (z3=0;z3<o->m_pDACF->m_oaSubDACFs.GetSize();z3++)
3402
mprintf(" > %s\n",((CDACFSub*)o->m_pDACF->m_oaSubDACFs[z3])->m_sName);
3406
mprintf(" - Reorientation Dynamics: %s\n",o->m_pRDyn->m_sName);
3409
mprintf(" - IR Spectrum: %s\n",o->m_pIRSpec->m_sName);
3412
mprintf(" - Density DF: %s\n",o->m_pDensityDF->m_sName);
3415
mprintf(" - SDF: %s\n",o->m_pSDF->m_sName);
3418
mprintf(" - Plane Projection DF: %s\n",o->m_pPlProj->m_sName);
3421
mprintf(" - Pseudo SDF: %s\n",o->m_pRevSDF->m_sName);
3424
mprintf(" - Neighborhood Analysis: %s\n",o->m_pNbAnalysis->m_sName);
3427
mprintf(" - VACF: %s\n",o->m_pVACF->m_sName);
3430
mprintf(" - MSD: %s\n",o->m_pMSD->m_sName);
3433
mprintf(" - VHDF: %s\n",o->m_pVHDF->m_sName);
3437
mprintf(" - Combined Distribution Function:\n");
3438
for (z3=0;z3<g_iCDFChannels;z3++)
3440
if (o->m_pRDF[z3] != NULL)
3441
mprintf(" - Channel %d: RDF: %s\n",z3+1,o->m_pRDF[z3]->m_sName);
3442
if (o->m_pADF[z3] != NULL)
3443
mprintf(" - Channel %d: ADF: %s\n",z3+1,o->m_pADF[z3]->m_sName);
3444
if (o->m_pDDF[z3] != NULL)
3445
mprintf(" - Channel %d: DDF: %s\n",z3+1,o->m_pDDF[z3]->m_sName);
3446
if (o->m_pDipDF[z3] != NULL)
3447
mprintf(" - Channel %d: DipDF: %s\n",z3+1,o->m_pDipDF[z3]->m_sName);
3448
if (o->m_pVDF[z3] != NULL)
3449
mprintf(" - Channel %d: VDF: %s\n",z3+1,o->m_pVDF[z3]->m_sName);
3450
if (o->m_pPlDF[z3] != NULL)
3451
mprintf(" - Channel %d: PlDF: %s\n",z3+1,o->m_pPlDF[z3]->m_sName);
3452
if (o->m_pLiDF[z3] != NULL)
3453
mprintf(" - Channel %d: LiDF: %s\n",z3+1,o->m_pLiDF[z3]->m_sName);
3458
mprintf(" - RDF: %s\n",o->m_pRDF[0]->m_sName);
3460
mprintf(" - DipDF: %s\n",o->m_pDipDF[0]->m_sName);
3462
mprintf(" - ADF: %s\n",o->m_pADF[0]->m_sName);
3464
mprintf(" - DDF: %s\n",o->m_pDDF[0]->m_sName);
3466
mprintf(" - VDF: %s\n",o->m_pVDF[0]->m_sName);
3468
mprintf(" - PlDF: %s\n",o->m_pPlDF[0]->m_sName);
3470
mprintf(" - LiDF: %s\n",o->m_pLiDF[0]->m_sName);
3473
mprintf(WHITE,"\n<<< End of Observation List <<<\n\n");
3477
if (g_bVACF && g_bGlobalVACF)
3479
try { g_pGlobalVACF = new CACF(); } catch(...) { g_pGlobalVACF = NULL; }
3480
if (g_pGlobalVACF == NULL) NewException((double)sizeof(CACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3482
mprintf(WHITE,"\n>>> Global velocity autocorrelation function >>>\n\n");
3483
g_pGlobalVACF->Parse();
3484
mprintf(WHITE,"\n<<< End of global velocity autocorrelation function <<<\n\n");
3487
if (g_bIRSpec && g_bGlobalIR)
3489
try { g_pGlobalIR = new CReorDyn(); } catch(...) { g_pGlobalIR = NULL; }
3490
if (g_pGlobalIR == NULL) NewException((double)sizeof(CReorDyn),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3492
mprintf(WHITE,"\n*** Definition of system-wide IR spectrum ***\n\n");
3493
g_pGlobalIR->ParseSpec();
3496
if (g_bSDF || g_bVoidSDF || g_bCreateRevSDF)
3498
g_iSDFSmoothGrade = AskInteger(" Up to which degree should the SDFs be smoothened (0=not at all)? [3] ",3);
3503
g_bSDFUniform = AskYesNo(" Calculate SDF values in nm^-3 (n) or relative to uniform density (y)? [no] ",false);
3504
if (g_bSDFUniform && ((!g_bPeriodicX) || (!g_bPeriodicY) || (!g_bPeriodicZ)))
3506
eprintf("\n Error: Uniform particle density is only defined for XYZ-periodic systems.\n\n");
3507
goto _sdf_norm_again;
3510
// g_iSDFScale = AskRangeInteger(" SDF values in ppm (1), pm^-3 (2), nm^-3 (3) or rel. to uniform density (4)? [4] ",1,4,4) - 1;
3511
// g_iSDFScale = 2; // nm^-3
3512
} else if (g_bCDF && (g_iCDFChannels == 3))
3513
g_iSDFSmoothGrade = AskInteger(" Up to which degree should the 3D CDFs be smoothened (0=not at all)? [3] ",3);
3515
// if (g_bVDF || g_bSVDF)
3516
// g_bSaveVelForce = AskYesNo(" Save maximum/averaged velocity time development (y/n)? [yes] ",true);
3518
// if (g_bVDF || g_bFDF)
3520
// g_fVelPercentage = AskFloat(" Which percentage of all velocities/forces to take into account? [95] ",95.0f);
3521
// g_fForcePercentage = g_fVelPercentage;
3523
g_bSaveVelForce = false;
3525
if ((g_bSDF && g_bAdvanced2) || g_bSaveRefEnv || g_bCutCluster || g_bSaveJustTraj)
3527
mprintf(WHITE,"\n>>> Coordinate output options >>>\n\n");
3529
if ((g_bSDF && g_bAdvanced2) || g_bSaveRefEnv || g_bCutCluster)
3532
g_bWriteAtomwise = (AskRangeInteger(" Sort output coordinates by molecules (0) or by element types (1)? [molecules] ",0,1,0)!=0);
3533
else g_bWriteAtomwise = false;
3536
g_bSaveVirtAtoms = AskYesNo(" Save also virtual atoms (y/n)? [no] ",false);
3538
if (g_bSaveVirtAtoms)
3540
if (AskYesNo(" Ref.Env.: Use alias names (instead of #) for virtual atoms (y/n)? [no] ",false))
3542
for (z2=0;z2<g_oaMolecules.GetSize();z2++)
3544
CMolecule *m = (CMolecule*)g_oaMolecules[z2];
3545
for (z=0;z<m->m_baAtomIndex.GetSize();z++)
3547
if (m->m_baAtomIndex[z] != g_iVirtAtomType)
3549
for (z3=0;z3<m->m_waAtomCount[z];z3++)
3551
mprintf(" How to name atom #%d in %s? [#%d] ",z3+1,m->m_sName,z3+1);
3552
inpprintf("! How to name atom #%d in %s? [#%d]\n",z3+1,m->m_sName,z3+1);
3554
if (strlen(buf) != 0)
3555
strcpy(((CVirtualAtom*)g_oaVirtualAtoms[m->m_laVirtualAtoms[z3]])->m_sLabel,buf);
3562
if (g_bSaveRefEnv || g_bCutCluster)
3563
g_bEnvWriteDetailedInfo = AskYesNo(" Write detailed (long) comment lines into output xyz file (y/n)? [yes] ",true);
3564
else g_bEnvWriteDetailedInfo = false;
3566
if ((g_bSaveRefEnv || g_bCutCluster) && !g_bEnvDisableSortNb)
3567
g_bEnvSortNb = AskYesNo(" Sort molecules according to distance from reference molecule (y/n)? [yes] ",true);
3568
else g_bEnvSortNb = false;
3570
mprintf(WHITE,"\n<<< End of Coordinate output options <<<\n\n");
3573
g_bWriteAtomwise = false;
3574
g_bSaveVirtAtoms = false;
3577
if (g_bSaveRefEnv || g_bCutCluster)
3578
g_bCenterZero = AskYesNo(" Put the center of the system to (0|0|0) (y) or to (x/2|y/2|z/2) (n)? [yes] ",true);
3580
g_bMiddleAvg = false;
3583
if (g_bSaveJustTraj)
3585
mprintf(WHITE,"\n>>> Process Trajectory >>>\n\n");
3588
g_bSaveTrajNoRot = AskYesNo(" Remove angular momentum from trajectory (y/n)? [no] ",false);
3589
else g_bSaveTrajNoRot = false;
3591
if (g_bSaveTrajNoRot)
3593
mprintf("\n This centers the mass center of the system. All atoms of the system are saved.\n\n");
3594
g_bSaveCoordsUnchanged = false;
3595
g_bSaveJustCenter = false;
3596
if(AskYesNo(" Put the center of the system to (0|0|0) (y) or to (x/2|y/2|z/2) (n)? [yes] ",true))
3597
g_bCenterZero = true;
3598
else g_bCenterZero = false;
3602
switch(AskRangeInteger(" Put the center of the system to (0|0|0) (0), to (x/2|y/2|z/2) (1), or leave coords unchanged (2)? [1] ",0,2,1))
3605
g_bCenterZero = true;
3606
g_bSaveCoordsUnchanged = false;
3609
g_bCenterZero = false;
3610
g_bSaveCoordsUnchanged = false;
3613
g_bSaveCoordsUnchanged = true;
3617
if (!g_bSaveCoordsUnchanged)
3618
g_bSaveJustCenter = AskYesNo("\n Put a specific atom into the box center (y/n)? [no] ",false);
3619
else g_bSaveJustCenter = false;
3622
if (g_bSaveJustCenter)
3624
if (g_oaMolecules.GetSize() > 1)
3626
sprintf(buf," Choose center atom from which of the molecules (");
3627
for (z=0;z<g_oaMolecules.GetSize();z++)
3629
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
3631
if (z < g_oaMolecules.GetSize()-1)
3635
g_iSaveJustMol = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
3639
mprintf(" Choosing center atom from %s.\n",((CMolecule*)g_oaMolecules[0])->m_sName);
3641
if (((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_laSingleMolIndex.GetSize() > 1)
3642
g_iSaveJustSM = AskRangeInteger(" Take which representant from %s (1-%d)? [1] ",1,((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_laSingleMolIndex.GetSize(),1,((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_sName,((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_laSingleMolIndex.GetSize()) - 1;
3643
else g_iSaveJustSM = 0;
3645
AskString(" Which atom from %s %d to put into the box center? [#2] ",buf,"#2",((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_sName,g_iSaveJustSM+1);
3646
if (!ParseAtom(buf,g_iSaveJustMol,g_iSaveJustAtomType,g_iSaveJustRealAtomType,g_iSaveJustAtom))
3649
g_iSaveGesAtoms = 0;
3650
if (!AskYesNo(" Save all atoms in the system (y/n)? [yes] ",true))
3653
for (z=0;z<g_oaMolecules.GetSize();z++)
3655
if (AskYesNo(" Save (some/all) atoms from molecule %s (y/n)? [yes] ",true,((CMolecule*)g_oaMolecules[z])->m_sName))
3657
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
3658
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3660
g_oaSaveMolecules.Add(ag);
3661
_savejust1: mprintf(" Which atoms to save from %s (e.g. \"C1,C3-5,H\")? [all] ",((CMolecule*)g_oaMolecules[z])->m_sName);
3662
inpprintf("! Which atoms to save from %s (e.g. \"C1,C3-5,H\")? [all]\n",((CMolecule*)g_oaMolecules[z])->m_sName);
3665
ag->AddAllAtoms((CMolecule*)g_oaMolecules[z],g_bSaveVirtAtoms);
3666
else if (!ag->ParseAtoms((CMolecule*)g_oaMolecules[z],buf))
3668
g_iSaveGesAtoms += ag->m_iAtomGes * ((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize();
3674
for (z=0;z<g_oaMolecules.GetSize();z++)
3676
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
3677
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3679
g_oaSaveMolecules.Add(ag);
3680
ag->AddAllAtoms((CMolecule*)g_oaMolecules[z],g_bSaveVirtAtoms);
3681
g_iSaveGesAtoms += ag->m_iAtomGes * ((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize();
3685
if (g_bUnknownElements)
3687
g_bUnwrapWannier = AskYesNo(" Write out Wannier centers together with trajectory (y/n)? [no] ",false);
3689
if (g_bUnwrapWannier)
3692
} else g_bUnwrapWannier = false;
3694
if ((!g_bSaveCoordsUnchanged) && (!g_bSaveTrajNoRot))
3695
g_bUnwrap = AskYesNo(" Try to unwrap the trajectory (y/n)? [no] ",false);
3696
else g_bUnwrap = false;
3699
mprintf("\n Attention! This feature only works if the time step\n in the trajectory is quite small. One particle may never\n move further than half of the box length in one time step!\n");
3701
mprintf("\nSaving %d atoms per step:\n",g_iSaveGesAtoms);
3702
for (z2=0;z2<g_oaSaveMolecules.GetSize();z2++)
3704
ag = (CAtomGroup*)g_oaSaveMolecules[z2];
3705
mprintf(" - In %s: ",ag->m_pMolecule->m_sName);
3706
for (z=0;z<ag->m_baAtomType.GetSize();z++)
3708
for (z3=0;z3<((CxIntArray*)ag->m_oaAtoms[z])->GetSize();z3++)
3710
mprintf("%s%d",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z])->GetAt(z3)+1);
3711
if (z3 < ((CxIntArray*)ag->m_oaAtoms[z])->GetSize()-1)
3714
if (z+1 < ag->m_baAtomType.GetSize())
3719
// g_bTrajAtomwise = (AskRangeInteger("\n Save trajectory ordered molecule-wise (0) or atom-wise (1)? [0] ",0,1,0)!=0);
3725
if ((int)g_iSaveGesAtoms == g_iGesAtomCount)
2594
mprintf(BLUE,"\n### Channel %d ###\n",z+1);
2595
switch(g_iObsChannel[z])
3727
switch(AskRangeInteger(" Sort output coordinates by molecules (0), element types (1), or input file order (2)? [0] ",0,2,0))
2598
try { o->m_pRDF[z] = new CRDF(); } catch(...) { o->m_pRDF[z] = NULL; }
2599
if (o->m_pRDF[z] == NULL) NewException((double)sizeof(CRDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2601
if (o->m_bSecondShowMol && (z == 1))
2602
o->m_pRDF[z]->m_iShowMol = o->m_iShowMol2;
2603
else o->m_pRDF[z]->m_iShowMol = o->m_iShowMol;
2604
o->m_pRDF[z]->Parse();
2605
o->m_pCDF->m_iCombinations[z] = o->m_pRDF[z]->m_iCombinations;
2606
o->m_pCDF->m_iCombinationProd *= o->m_pRDF[z]->m_iCombinations;
2607
/* if (o->m_pRDF[z]->m_bSaveDist)
2608
o->m_bTimeDev = true;*/
3730
g_bWriteAtomwise = false;
3731
g_bWriteInputOrder = false;
2612
try { o->m_pADF[z] = new CADF(); } catch(...) { o->m_pADF[z] = NULL; }
2613
if (o->m_pADF[z] == NULL) NewException((double)sizeof(CADF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2615
if (o->m_bSecondShowMol && (z == 1))
2616
o->m_pADF[z]->m_iShowMol = o->m_iShowMol2;
2617
else o->m_pADF[z]->m_iShowMol = o->m_iShowMol;
2618
o->m_pADF[z]->Parse();
2619
o->m_pCDF->m_iCombinations[z] = o->m_pADF[z]->m_iCombinations;
2620
o->m_pCDF->m_iCombinationProd *= o->m_pADF[z]->m_iCombinations;
2621
/* if (o->m_pADF[z]->m_bSaveAngle)
2622
o->m_bTimeDev = true;*/
3734
g_bWriteAtomwise = true;
3735
g_bWriteInputOrder = false;
2626
try { o->m_pDDF[z] = new CDDF(); } catch(...) { o->m_pDDF[z] = NULL; }
2627
if (o->m_pDDF[z] == NULL) NewException((double)sizeof(CDDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2629
if (o->m_bSecondShowMol && (z == 1))
2630
o->m_pDDF[z]->m_iShowMol = o->m_iShowMol2;
2631
else o->m_pDDF[z]->m_iShowMol = o->m_iShowMol;
2632
o->m_pDDF[z]->Parse();
2633
o->m_pCDF->m_iCombinations[z] = o->m_pDDF[z]->m_iCombinations;
2634
o->m_pCDF->m_iCombinationProd *= o->m_pDDF[z]->m_iCombinations;
2635
/* if (o->m_pDDF[z]->m_bSaveAngle)
2636
o->m_bTimeDev = true;*/
2640
try { o->m_pDipDF[z] = new CDipDF(); } catch(...) { o->m_pDipDF[z] = NULL; }
2641
if (o->m_pDipDF[z] == NULL) NewException((double)sizeof(CDipDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2643
if (o->m_bSecondShowMol && (z == 1))
2644
o->m_pDipDF[z]->m_iShowMol = o->m_iShowMol2;
2645
else o->m_pDipDF[z]->m_iShowMol = o->m_iShowMol;
2646
o->m_pDipDF[z]->m_iCombinations = 1;
2647
o->m_pDipDF[z]->Parse();
2648
o->m_pCDF->m_iCombinations[z] = 1;
2649
/* if (o->m_pDipDF[z]->m_bSaveDipole)
2650
o->m_bTimeDev = true;*/
2654
try { o->m_pVDF[z] = new CVDF(); } catch(...) { o->m_pVDF[z] = NULL; }
2655
if (o->m_pVDF[z] == NULL) NewException((double)sizeof(CVDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2657
if (o->m_bSecondShowMol && (z == 1))
2658
o->m_pVDF[z]->m_iShowMol = o->m_iShowMol2;
2659
else o->m_pVDF[z]->m_iShowMol = o->m_iShowMol;
2660
o->m_pVDF[z]->Parse();
2661
o->m_pCDF->m_iCombinations[z] = o->m_pVDF[z]->m_iCombinations;
2662
o->m_pCDF->m_iCombinationProd *= o->m_pVDF[z]->m_iCombinations;
2663
g_bUseVelocities = true;
2664
/* if (o->m_pVDF[z]->m_bSaveSpeed)
2665
o->m_bTimeDev = true;*/
2669
try { o->m_pPlDF[z] = new CPlDF(); } catch(...) { o->m_pPlDF[z] = NULL; }
2670
if (o->m_pPlDF[z] == NULL) NewException((double)sizeof(CPlDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2672
if (o->m_bSecondShowMol && (z == 1))
2673
o->m_pPlDF[z]->m_iShowMol = o->m_iShowMol2;
2674
else o->m_pPlDF[z]->m_iShowMol = o->m_iShowMol;
2675
o->m_pPlDF[z]->Parse();
2676
o->m_pCDF->m_iCombinations[z] = o->m_pPlDF[z]->m_iCombinations;
2677
o->m_pCDF->m_iCombinationProd *= o->m_pPlDF[z]->m_iCombinations;
2681
try { o->m_pLiDF[z] = new CLiDF(); } catch(...) { o->m_pLiDF[z] = NULL; }
2682
if (o->m_pLiDF[z] == NULL) NewException((double)sizeof(CLiDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2684
if (o->m_bSecondShowMol && (z == 1))
2685
o->m_pLiDF[z]->m_iShowMol = o->m_iShowMol2;
2686
else o->m_pLiDF[z]->m_iShowMol = o->m_iShowMol;
2687
o->m_pLiDF[z]->Parse();
2688
o->m_pCDF->m_iCombinations[z] = o->m_pLiDF[z]->m_iCombinations;
2689
o->m_pCDF->m_iCombinationProd *= o->m_pLiDF[z]->m_iCombinations;
2693
o->m_pCDF->m_bChannelAll[z] = AskYesNo(" Should this CDF Channel observe all OMs (y) or only the current one (n)? [no] ",false);
2694
else o->m_pCDF->m_bChannelAll[z] = false;*/
2696
/* mprintf(" Write out temporal development for this CDF (1=yes,0=no)? [no] ");
2698
o->m_pCDF->m_bTimeDev = (atoi(buf)!=0);
2699
if (o->m_pCDF->m_bTimeDev)
2700
o->m_bTimeDev = true;*/
2704
try { o->m_pCDF->m_iResolution = new int[g_iCDFChannels]; } catch(...) { o->m_pCDF->m_iResolution = NULL; }
2705
if (o->m_pCDF->m_iResolution == NULL) NewException((double)g_iCDFChannels*sizeof(int),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2707
for (z=0;z<g_iCDFChannels;z++)
2709
switch(g_iObsChannel[z])
2711
case 0: sprintf(buf,"RDF"); break;
2712
case 1: sprintf(buf,"ADF"); break;
2713
case 2: sprintf(buf,"DDF"); break;
2714
case 3: sprintf(buf,"DipDF"); break;
2715
case 4: sprintf(buf,"VDF"); break;
2716
case 5: sprintf(buf,"PlDF"); break;
2717
case 6: sprintf(buf,"LiDF"); break;
2719
o->m_pCDF->m_iResolution[z] = AskUnsignedInteger(" Please enter the resolution (bin count) for CDF channel %d (%s): [100] ",100,z+1,buf);
2723
o->m_pCDF->m_iHistogramRes = AskUnsignedInteger(" Please enter CDF histogram resolution (0=no histogram): [5000] ",5000);
2724
else o->m_pCDF->m_iHistogramRes = 0;
2726
if (g_iCDFChannels == 2)
2728
try { o->m_pCDF->m_pCombineList = new char[o->m_pCDF->m_iCombinationProd]; } catch(...) { o->m_pCDF->m_pCombineList = NULL; }
2729
if (o->m_pCDF->m_pCombineList == NULL) NewException((double)o->m_pCDF->m_iCombinationProd*sizeof(char),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2731
if ((o->m_pCDF->m_iCombinations[0] > 1) && (o->m_pCDF->m_iCombinations[1] > 1))
2734
for (z=0;z<g_iCDFChannels;z++)
2736
mprintf(WHITE,"CDF channel %d has the following %d observations:\n",z+1,o->m_pCDF->m_iCombinations[z]);
2737
o->ListCDFObservations(z);
2740
if (o->m_pCDF->m_iCombinations[0] == o->m_pCDF->m_iCombinations[1])
2742
if (AskYesNo(" Combine n-th with n-th observation? (y/n) [yes] ",true))
2744
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2745
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2746
o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]+z2] = (z==z2)?1:0;
2752
if (!AskYesNo(" Combine each with each observation (y), or use only some combinations (n)? [yes] ",true))
2754
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2755
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2756
o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]+z2] = 0;
2758
mprintf("\n Please enter all the combinations you want to observe.\n");
2759
mprintf(" Enter each combination as a comma-separated %d-tuple (e.g. ",g_iCDFChannels);
2760
for (z=0;z<g_iCDFChannels;z++)
2763
if (z+1 < g_iCDFChannels)
2768
AskString(" Enter combination (return=finished): ",buf,"");
2771
tempwa.RemoveAll_KeepSize();
2772
ParseIntList(buf,&tempwa);
2773
if (tempwa.GetSize() != g_iCDFChannels)
2775
eprintf(" Wrong input, %d instead of %d values.\n",tempwa.GetSize(),g_iCDFChannels);
2778
for (z=0;z<g_iCDFChannels;z++)
2780
if ((tempwa[z] < 1) || (tempwa[z] > o->m_pCDF->m_iCombinations[z]))
2782
eprintf(" Wrong input, channel %d has only %d observations (%d requested).\n",z+1,o->m_pCDF->m_iCombinations[z],tempwa[z]);
2787
if (o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]+tempwa[1]] == 1)
2789
eprintf(" This combination has already been added.\n");
2792
o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]+tempwa[1]] = 1;
2794
} else goto _combineall;
2800
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2801
o->m_pCDF->m_pCombineList[z] = 1;
2804
o->m_pCDF->m_iCombinationsEnabled = 0;
2805
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2806
if (o->m_pCDF->m_pCombineList[z] != 0)
2807
o->m_pCDF->m_iCombinationsEnabled++;
2809
if (o->m_pCDF->m_iCombinationsEnabled == 1)
2811
mprintf(WHITE,"\n Using 1 combination for each RM-OM pair.\n\n");
2814
mprintf(WHITE,"\n Using %d combinations for each RM-OM pair:\n\n",o->m_pCDF->m_iCombinationsEnabled);
2816
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2818
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2820
if (o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]+z2] == 1)
2822
mprintf(" %2d.) %2d - %2d\n",z3+1,z+1,z2+1);
2832
o->m_pCDF->m_bAxisDivide = AskYesNo(" Write out +/- correlation plot for this CDF (y/n)? [no] ",false);
2834
if (o->m_pCDF->m_bAxisDivide)
2835
o->m_pCDF->m_bAxisDivideAll = AskYesNo(" Also write tensor product and axis projection quotients (y/n)? [no] ",false);
2838
o->m_pCDF->m_bAxisDivide = false;
2839
o->m_pCDF->m_bAxisDivideAll = false;
2844
o->m_pCDF->m_bGraceBunch = AskYesNo(" Write out grace stack (multiple 2D plots) for this CDF (y/n)? [no] ",false);
2845
if (o->m_pCDF->m_bGraceBunch)
2847
o->m_pCDF->m_iGraceBunchC1 = AskUnsignedInteger(" How many graphs do you want do draw in the channel 1 grace stack (0=disable)? [10] ",10);
2848
o->m_pCDF->m_iGraceBunchC2 = AskUnsignedInteger(" How many graphs do you want do draw in the channel 2 grace stack (0=disable)? [10] ",10);
2850
} else o->m_pCDF->m_bGraceBunch = false;
2853
if (g_iCDFChannels == 3)
2857
try { o->m_pCDF->m_pCombineList = new char[o->m_pCDF->m_iCombinationProd]; } catch(...) { o->m_pCDF->m_pCombineList = NULL; }
2858
if (o->m_pCDF->m_pCombineList == NULL) NewException((double)o->m_pCDF->m_iCombinationProd*sizeof(char),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2860
if ((o->m_pCDF->m_iCombinations[0] > 1) || (o->m_pCDF->m_iCombinations[1] > 1) || (o->m_pCDF->m_iCombinations[2] > 1))
2862
for (z=0;z<g_iCDFChannels;z++)
2864
mprintf(WHITE,"CDF channel %d has the following %d observations:\n",z+1,o->m_pCDF->m_iCombinations[z]);
2865
o->ListCDFObservations(z);
2868
if (!AskYesNo(" Combine each with each observation (y), or use only some combinations (n)? [yes] ",true))
2870
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2871
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2872
for (z3=0;z3<o->m_pCDF->m_iCombinations[2];z3++)
2873
o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+z2*o->m_pCDF->m_iCombinations[2]+z3] = 0;
2875
mprintf("\n Please enter all the combinations you want to observe.\n");
2876
mprintf(" Enter each combination as a comma-separated %d-tuple (e.g. ",g_iCDFChannels);
2877
for (z=0;z<g_iCDFChannels;z++)
2880
if (z+1 < g_iCDFChannels)
2885
AskString(" Enter combination (return=finished): ",buf,"");
2888
tempwa.RemoveAll_KeepSize();
2889
ParseIntList(buf,&tempwa);
2890
if (tempwa.GetSize() != g_iCDFChannels)
2892
eprintf(" Wrong input, %d instead of %d values.\n",tempwa.GetSize(),g_iCDFChannels);
2895
for (z=0;z<g_iCDFChannels;z++)
2897
if ((tempwa[z] < 1) || (tempwa[z] > o->m_pCDF->m_iCombinations[z]))
2899
eprintf(" Wrong input, channel %d has only %d observations (%d requested).\n",z+1,o->m_pCDF->m_iCombinations[z],tempwa[z]);
2904
if (o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+tempwa[1]*o->m_pCDF->m_iCombinations[2]+tempwa[2]] == 1)
2906
eprintf(" This combination has already been added.\n");
2909
o->m_pCDF->m_pCombineList[tempwa[0]*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+tempwa[1]*o->m_pCDF->m_iCombinations[2]+tempwa[2]] = 1;
2911
} else goto _3combineall;
2915
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2916
o->m_pCDF->m_pCombineList[z] = 1;
2919
o->m_pCDF->m_iCombinationsEnabled = 0;
2920
for (z=0;z<o->m_pCDF->m_iCombinationProd;z++)
2921
if (o->m_pCDF->m_pCombineList[z] != 0)
2922
o->m_pCDF->m_iCombinationsEnabled++;
2924
if (o->m_pCDF->m_iCombinationsEnabled == 1)
2926
mprintf(WHITE,"\n Using 1 combination for each RM-OM pair.\n\n");
2929
mprintf(WHITE,"\n Using %d combinations for each RM-OM pair:\n\n",o->m_pCDF->m_iCombinationsEnabled);
2931
for (z=0;z<o->m_pCDF->m_iCombinations[0];z++)
2932
for (z2=0;z2<o->m_pCDF->m_iCombinations[1];z2++)
2933
for (z3=0;z3<o->m_pCDF->m_iCombinations[2];z3++)
2934
if (o->m_pCDF->m_pCombineList[z*o->m_pCDF->m_iCombinations[1]*o->m_pCDF->m_iCombinations[2]+z2*o->m_pCDF->m_iCombinations[2]+z3] == 1)
2936
mprintf(" %2d.) %2d - %2d - %2d\n",z4+1,z+1,z2+1,z3+1);
2944
o->m_pCDF->m_b3DSlices = AskYesNo(" Write out 2D slices for this CDF (y/n)? [no] ",false);
2946
if (o->m_pCDF->m_b3DSlices)
2948
o->m_pCDF->m_i3DSliceIntervals[z] = AskUnsignedInteger(" How many slice intervals to create along channel %d axis (0=skip)? [0] ",0,z+1);
2949
} else o->m_pCDF->m_b3DSlices = false;
2950
} // end if channels == 3
2955
o->m_pCDF->m_bDumpDat = AskYesNo(" Write out input tuples (very large!) for this CDF (y/n)? [no] ",false);
2956
if ((g_iCDFChannels == 2) && (g_iObsChannel[0] == 0) && (g_iObsChannel[1] == 1))
2957
o->m_pCDF->m_iNormalize = AskRangeInteger(" Normalize uniformly (3), data range (2), integral (1), or do not normalize (0)? [1] ",0,3,1);
2958
else o->m_pCDF->m_iNormalize = AskRangeInteger(" Normalize data range (2), integral (1), or do not normalize (0)? [1] ",0,2,1);
2959
if (o->m_pCDF->m_iNormalize == 1)
2960
o->m_pCDF->m_fNormValue = AskFloat(" Set CDF integral to which value? [1000000] ",1000000.0f);
2961
if (o->m_pCDF->m_iNormalize == 2)
2962
o->m_pCDF->m_fNormValue = AskFloat(" Set maximum entry to which value? [100] ",100.0f);
2965
o->m_pCDF->m_bDumpDat = false;
2966
o->m_pCDF->m_iNormalize = 1;
2967
o->m_pCDF->m_fNormValue = 1000000.0f;
2970
mprintf(BLUE,"\n<<< End of Combined Distribution Function <<<\n\n");
2975
try { o->m_pRDF[0] = new CRDF(); } catch(...) { o->m_pRDF[0] = NULL; }
2976
if (o->m_pRDF[0] == NULL) NewException((double)sizeof(CRDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2978
o->m_pRDF[0]->m_iShowMol = o->m_iShowMol;
2979
o->m_pRDF[0]->Parse();
2980
o->m_pRDF[0]->m_bSelf = o->m_bSelf;
2984
try { o->m_pPlDF[0] = new CPlDF(); } catch(...) { o->m_pPlDF[0] = NULL; }
2985
if (o->m_pPlDF[0] == NULL) NewException((double)sizeof(CPlDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2987
o->m_pPlDF[0]->m_iShowMol = o->m_iShowMol;
2988
o->m_pPlDF[0]->Parse();
2989
o->m_pPlDF[0]->m_bSelf = o->m_bSelf;
2993
try { o->m_pLiDF[0] = new CLiDF(); } catch(...) { o->m_pLiDF[0] = NULL; }
2994
if (o->m_pLiDF[0] == NULL) NewException((double)sizeof(CLiDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
2996
o->m_pLiDF[0]->m_iShowMol = o->m_iShowMol;
2997
o->m_pLiDF[0]->Parse();
2998
o->m_pLiDF[0]->m_bSelf = o->m_bSelf;
3002
try { o->m_pVHDF = new CVHDF(); } catch(...) { o->m_pVHDF = NULL; }
3003
if (o->m_pVHDF == NULL) NewException((double)sizeof(CVHDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3005
o->m_pVHDF->m_iShowMol = o->m_iShowMol;
3006
o->m_pVHDF->m_bSelf = o->m_bSelf;
3007
o->m_pVHDF->Parse();
3011
try { o->m_pADF[0] = new CADF(); } catch(...) { o->m_pADF[0] = NULL; }
3012
if (o->m_pADF[0] == NULL) NewException((double)sizeof(CADF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3014
o->m_pADF[0]->m_iShowMol = o->m_iShowMol;
3015
o->m_pADF[0]->m_bSelf = o->m_bSelf;
3016
o->m_pADF[0]->Parse();
3020
try { o->m_pDDF[0] = new CDDF(); } catch(...) { o->m_pDDF[0] = NULL; }
3021
if (o->m_pDDF[0] == NULL) NewException((double)sizeof(CDDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3023
o->m_pDDF[0]->m_iShowMol = o->m_iShowMol;
3024
o->m_pDDF[0]->m_bSelf = o->m_bSelf;
3025
o->m_pDDF[0]->Parse();
3029
try { o->m_pDipDF[0] = new CDipDF(); } catch(...) { o->m_pDipDF[0] = NULL; }
3030
if (o->m_pDipDF[0] == NULL) NewException((double)sizeof(CDipDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3032
o->m_pDipDF[0]->m_iShowMol = o->m_iShowMol;
3033
o->m_pDipDF[0]->m_bSelf = o->m_bSelf;
3034
o->m_pDipDF[0]->Parse();
3038
try { o->m_pVDF[0] = new CVDF(); } catch(...) { o->m_pVDF[0] = NULL; }
3039
if (o->m_pVDF[0] == NULL) NewException((double)sizeof(CVDF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3041
o->m_pVDF[0]->m_iShowMol = o->m_iShowMol;
3042
o->m_pVDF[0]->m_bSelf = true;
3043
o->m_pVDF[0]->Parse();
3044
g_bUseVelocities = true;
3048
try { o->m_pMSD = new CMSD(); } catch(...) { o->m_pMSD = NULL; }
3049
if (o->m_pMSD == NULL) NewException((double)sizeof(CMSD),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3051
o->m_pMSD->m_iShowMol = o->m_iShowMol;
3056
if ((g_bCDF && (g_iCDFChannels == 2)) || g_bRDF || g_bADF || g_bVDF || g_bDDF || g_bDipDF)
3058
if (!o->m_bSecondShowMol)
3060
if (AskYesNo(" Save temporal development for this observation (y/n)? [no] ",false))
3062
mprintf(WHITE,"\n>>> Save temporal development >>>\n\n");
3063
o->m_bTimeDev = true;
3065
if (g_fTimestepLength == 0)
3067
g_fTimestepLength = AskFloat(" Enter the length of one trajectory time step in fs: [0.5] ",0.5f);
3071
if (g_bDDF && (!g_bCDF))
3073
if ((o->m_pDDF[0]->m_iDeriv == 0) && (!o->m_pDDF[0]->m_bCosine) && (!o->m_pDDF[0]->m_bAbs) && (!o->m_pDDF[0]->m_bPositive))
3075
mprintf("\n You can include full rotations into the DDF's temporal development.\n");
3076
mprintf(" This means, if a dihedral makes a full rotation, the value will be 360 deg insteat of 0 deg.\n");
3077
mprintf(" You may count the number of full rotations during simulation in this way.\n\n");
3078
o->m_pDDF[0]->m_bRotate = AskYesNo(" Include full rotations into the DDF's temporal development (y/n)? [no] ",false);
3079
} else o->m_pDDF[0]->m_bRotate = false;
3080
if (o->m_pDDF[0]->m_bRotate)
3082
mprintf(WHITE,"\n Warning: ");
3083
mprintf("This only works if your trajectory time step is small enough to ensure\n");
3084
mprintf(" that the dihedral is never changing more than 180 deg within one step!\n\n");
3087
if (g_bRDF || g_bADF || g_bVDF || g_bDDF || g_bDipDF)
3089
if (AskYesNo(" Create combined development/histogram-plots for 2D analyses (y/n)? [yes] ",true))
3092
o->m_bCombinedPlot = true;
3093
if (AskYesNo(" Use grey tones for combined plot (y) or standard colors (n)? [no] ",false))
3095
o->m_bCombinedGreyMode = true;
3096
o->m_iCombinedGreyMin = AskRangeInteger(" Darkest shade of grey to use (0=black, 255=white)? [128] ",0,255,128);
3097
o->m_iCombinedGreyMax = AskRangeInteger(" Lightest shade of grey to use (0=black, 255=white)? [224] ",o->m_iCombinedGreyMin,255,224);
3098
o->m_iCombinedGreyShades = AskUnsignedInteger(" How many different shades of grey to use? [4] ",4);
3099
} else o->m_bCombinedGreyMode = false;
3100
} else o->m_bCombinedPlot = false;
3101
} else o->m_bCombinedPlot = false;
3103
if (((CMolecule*)g_oaMolecules[g_iFixMol])->m_laSingleMolIndex.GetSize() > 1)
3105
mprintf(" Save development for which rep. of the reference molecule (e.g. 1,3-7)? [1] ");
3106
inpprintf("! Save development for which rep. of the reference molecule (e.g. 1,3-7)? [1]\n");
3109
o->m_waSaveRefList.Add(0);
3111
ParseIntList(buf,&o->m_waSaveRefList);
3112
for (z=0;z<o->m_waSaveRefList.GetSize();z++)
3113
o->m_waSaveRefList[z]--;
3115
} else o->m_waSaveRefList.Add(0);
3116
if (o->m_iShowMol != -1)
3118
if (((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize() > 1)
3120
mprintf(" Save development for which rep. of the observed molecule (e.g. 1,3-7)? [all] ");
3121
inpprintf("! Save development for which rep. of the observed molecule (e.g. 1,3-7)? [all]\n");
3125
for (z=0;z<((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_laSingleMolIndex.GetSize();z++)
3126
o->m_waSaveShowList.Add(z);
3129
ParseIntList(buf,&o->m_waSaveShowList);
3130
for (z=0;z<o->m_waSaveShowList.GetSize();z++)
3131
o->m_waSaveShowList[z]--;
3133
} else o->m_waSaveShowList.Add(0);
3134
} else o->m_waSaveShowList.Add(0); // Dummy
3135
if ((o->m_waSaveRefList.GetSize() > 1) && (o->m_bOthers))
3136
o->m_bSaveSeparateFiles = AskYesNo(" Developments for different ref. molecules to same (n) or different (y) files? [yes] ",true);
3137
else o->m_bSaveSeparateFiles = false;
3138
if ((g_bCDF) && (g_iCDFChannels == 2))
3140
if (AskYesNo(" Generate time development animation (TDO) for CDF (y/n)? [no] ",false))
3142
o->m_pCDF->m_bTDAnimation = true;
3143
o->m_pCDF->m_iTDASteps = AskUnsignedInteger(" How many steps should the animation have? [1000] ",1000);
3144
o->m_pCDF->m_iTDAStride = AskUnsignedInteger(" Enter distance between the frames in timesteps: [100] ",50);
3145
o->m_pCDF->m_iTDATail = AskUnsignedInteger(" Enter length of the tail in timesteps: [100] ",100);
3146
o->m_pCDF->m_bTDATrace = AskYesNo(" Show trace (y/n)? [yes] ",true);
3147
o->m_pCDF->m_iTDAResX = AskUnsignedInteger(" Enter width (in pixel) of the TDA images: [640] ",640);
3148
o->m_pCDF->m_iTDAResY = AskUnsignedInteger(" Enter height (in pixel) of the TDA images: [480] ",480);
3149
} else o->m_pCDF->m_bTDAnimation = false;
3151
mprintf("\n Saving temporal development for reference molecules ");
3152
for (z=0;z<o->m_waSaveRefList.GetSize();z++)
3154
if (z < (int)o->m_waSaveRefList.GetSize()-1)
3156
mprintf("%d, ",o->m_waSaveRefList[z]+1);
3157
if (((z+1) % 16) == 0)
3159
} else mprintf("%d",o->m_waSaveRefList[z]+1);
3163
mprintf("\n and for observed molecules ");
3164
for (z=0;z<o->m_waSaveShowList.GetSize();z++)
3166
if (z < (int)o->m_waSaveShowList.GetSize()-1)
3168
mprintf("%d, ",o->m_waSaveShowList[z]+1);
3169
if (((z+1) % 16) == 0)
3171
} else mprintf("%d",o->m_waSaveShowList[z]+1);
3175
mprintf(WHITE,"\n<<< End of Save temporal development <<<\n\n");
3176
} else o->m_bTimeDev = false;
3180
if (AskYesNo(" Create a temporal difference plot for this observation (y/n)? [no] ",false))
3182
o->m_bTimeDiff = true;
3184
o->m_iTimeDiffDepth = AskUnsignedInteger(" Enter temporal depth of this plot in time steps: [1000] ",1000);
3185
o->m_b3DTimeDiff = AskYesNo(" Create also 3D temporal difference plots (y/n)? [yes] ",true);
3186
if (o->m_b3DTimeDiff)
3192
tf = o->m_pRDF[0]->m_fMinDist;
3193
tf2 = o->m_pRDF[0]->m_fMaxDist;
3197
tf = o->m_pADF[0]->m_fMinAngle;
3198
tf2 = o->m_pADF[0]->m_fMaxAngle;
3202
tf = o->m_pDDF[0]->m_fMinAngle;
3203
tf2 = o->m_pDDF[0]->m_fMaxAngle;
3207
tf = o->m_pVDF[0]->m_fMinSpeed;
3208
tf2 = o->m_pVDF[0]->m_fMaxSpeed;
3212
tf = o->m_pDipDF[0]->m_fDipoleMin;
3213
tf2 = o->m_pDipDF[0]->m_fDipoleMax;
3215
o->m_iTimeDiffStride3D = AskUnsignedInteger(" Take every n-th time step for the tau axis: [%d] ",o->m_iTimeDiffDepth/100,o->m_iTimeDiffDepth/100);
3216
o->m_fTimeDiffMinVal3D = AskFloat(" Enter min. value for the starting point: [%.2f] ",tf,tf);
3217
o->m_fTimeDiffMaxVal3D = AskFloat(" Enter max. value for the starting point: [%.2f] ",tf2,tf2);
3218
o->m_iTimeDiffRes3D = AskUnsignedInteger(" Enter binning resolution for the starting value: [100] ",100);
3219
mprintf("\n Temporal before/after 3D plot:\n");
3220
o->m_iTimeDiffDistSteps= AskUnsignedInteger(" Every how many time steps create a 2D slice (0 to disable): [0] ",0);
3221
o->m_fTimeDiffDistMinValX = AskFloat(" Enter min. value for the starting point: [%.2f] ",tf,tf);
3222
o->m_fTimeDiffDistMaxValX = AskFloat(" Enter max. value for the starting point: [%.2f] ",tf2,tf2);
3223
o->m_iTimeDiffDistResX = AskUnsignedInteger(" Enter binning resolution for the X axis: [100] ",100);
3224
o->m_fTimeDiffDistMinValY = AskFloat(" Enter min. value for the end point: [%.2f] ",tf,tf);
3225
o->m_fTimeDiffDistMaxValY = AskFloat(" Enter max. value for the end point: [%.2f] ",tf2,tf2);
3226
o->m_iTimeDiffDistResY = AskUnsignedInteger(" Enter binning resolution for the Y axis: [100] ",100);
3229
} else o->m_bTimeDiff = false;
3230
} else o->m_bTimeDiff = false;
3233
o->m_bTimeDev = false;
3234
o->m_bTimeDiff = false;
3238
o->m_bTimeDev = false;
3239
o->m_bTimeDiff = false;
3242
if ((g_iFixMol != -1) && (o->m_iShowMol != -1) && (g_bRDyn || g_bDipDF || g_bMSD || g_bADF || g_bPlDF || g_bLiDF || g_bDDF || g_bVACF || g_bDipACF ||g_bRevSDF || g_bSDF || g_bVHDF || g_bRDF || g_bVDF || g_bFDF || g_bCond))
3246
if (AskYesNo(" Add a condition to this observation (y/n)? [no] ",false))
3249
mprintf(GREEN,"\n>>> Condition input >>>\n\n");
3250
// mprintf("You may enter several sets of conditions. They are connected with \"or\",\nonly one of them needs to apply to take a configuration into account.\n\n");
3251
// mprintf("In each set of conditions, you may enter several conditions. They are connected\nwith \"and\", all of them have to apply to make this set of conditions apply.\n");
3253
if (o->m_bSecondShowMol)
3255
if (!AskYesNo(" Add a condition between RM and 1st OM (y/n)? [yes] ",true))
3257
mprintf(WHITE,"\n *** Input of Condition between RM and 1st OM ***\n\n");
3260
try { o->m_pConditions = new CConditionGroup(); } catch(...) { o->m_pConditions = NULL; }
3261
if (o->m_pConditions == NULL) NewException((double)sizeof(CConditionGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3263
o->m_pConditions->m_iShowMol = o->m_iShowMol;
3264
o->m_pConditions->Parse(g_iFixMol,o->m_iShowMol);
3267
if (o->m_bSecondShowMol)
3270
if (!AskYesNo(" Add a condition between RM and 2nd OM (y/n)? [yes] ",true))
3272
mprintf(WHITE,"\n *** Input of Condition between RM and 2nd OM ***\n\n");
3274
try { o->m_pConditionsOM2 = new CConditionGroup(); } catch(...) { o->m_pConditionsOM2 = NULL; }
3275
if (o->m_pConditionsOM2 == NULL) NewException((double)sizeof(CConditionGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3277
o->m_pConditionsOM2->m_iShowMol = o->m_iShowMol2;
3278
o->m_pConditionsOM2->Parse(g_iFixMol,o->m_iShowMol2);
3282
if (o->m_pConditions != NULL)
3284
if (o->m_pConditions->m_bInvertCondition)
3286
o->m_bBinOnlyNotPassedAtoms = false;
3287
o->m_bBinOnlyPassedAtoms = false;
3292
if (o->m_pConditionsOM2 != NULL)
3294
if (o->m_pConditionsOM2->m_bInvertCondition)
3296
o->m_bBinOnlyNotPassedAtoms = false;
3297
o->m_bBinOnlyPassedAtoms = false;
3302
mprintf("\n Normally, TRAVIS evaluates the condition for each RM-OM pair. If the condition\n");
3303
mprintf(" is fulfilled, all atoms from this pair are evaluated. The following question\n");
3304
mprintf(" enables to take into account only exactly the atoms which fulfilled the condition.\n\n");
3306
mprintf(" If you have a distance condition with \"nearest neighbor mode\", only the atom\n");
3307
mprintf(" from the OM that is closest to the RM will be taken into account.\n\n");
3309
o->m_bBinOnlyPassedAtoms = AskYesNo(" Add only atoms to the bin that passed the condition(s) (y/n)? [no] ",false);
3310
/* if (!o->m_bBinOnlyPassedAtoms)
3311
o->m_bBinOnlyNotPassedAtoms = AskYesNo(" Add only atoms to the bin that did NOT pass the condition(s) (y/n)? [no] ",false);
3312
else*/ o->m_bBinOnlyNotPassedAtoms = false;
3315
g_bSaveCondSnapshot = AskYesNo(" Save a snapshot every time the conditions are fulfilled (y/n)? [no] ",false);
3317
if (g_bSaveCondSnapshot)
3318
g_bNeedMoleculeWrap = true;
3320
if (g_bSaveCondSnapshot)
3322
g_bSaveCondWholeBox = AskYesNo(" Save the whole box (y) or only the RM/OM pair (n)? [no] ",false);
3323
if (g_bSaveCondWholeBox)
3324
mprintf("\n The RM that fulfills the condition will be centered (coordinates 0|0|0).\n");
3327
mprintf(GREEN,"\n<<< End of Condition input <<<\n\n");
3333
mprintf(WHITE,"\n>>> Velocity autocorrelation function >>>\n\n");
3335
try { o->m_pVACF = new CACF(); } catch(...) { o->m_pVACF = NULL; }
3336
if (o->m_pVACF == NULL) NewException((double)sizeof(CACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3338
o->m_pVACF->m_iShowMol = o->m_iShowMol;
3339
o->m_pVACF->Parse();
3340
mprintf(WHITE,"\n<< End of Velocity autocorrelation function <<<\n\n");
3345
mprintf(WHITE,"\n>>> Dipole moment autocorrelation function >>>\n\n");
3347
try { o->m_pDipACF = new CACF(); } catch(...) { o->m_pDipACF = NULL; }
3348
if (o->m_pDipACF == NULL) NewException((double)sizeof(CACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3350
o->m_pDipACF->Parse();
3351
mprintf(WHITE,"\n<<< End of Dipole moment autocorrelation function <<<\n\n");
3354
if (g_bUseVelocities)
3356
if (g_iFixMol != -1)
3357
o->m_bVelocityRelToRef = (AskRangeInteger(" Use absolute velocities (0) or relative to the reference molecule (1)? [0] ",0,1,0) != 0);
3358
else o->m_bVelocityRelToRef = false;
3361
mprintf(YELLOW,"\n<<< End of Observation %d <<<\n",g_oaObserv.GetSize());
3363
if (AskYesNo("\n Add another observation (y/n)? [no] ",false))
3367
mprintf(WHITE,">>> Observation List >>>\n\n");
3368
for (z2=0;z2<g_oaObserv.GetSize();z2++)
3370
mprintf(YELLOW," *** Observation %d\n",z2+1);
3371
o = (CObservation*)g_oaObserv[z2];
3374
mprintf(" - Condition between %s and %s\n",((CMolecule*)g_oaMolecules[g_iFixMol])->m_sName,((CMolecule*)g_oaMolecules[o->m_iShowMol])->m_sName);
3378
mprintf(" - Aggregation functions - %d value sets:\n",o->m_pDACF->m_oaSubDACFs.GetSize());
3379
for (z3=0;z3<o->m_pDACF->m_oaSubDACFs.GetSize();z3++)
3380
mprintf(" > %s\n",((CDACFSub*)o->m_pDACF->m_oaSubDACFs[z3])->m_sName);
3385
mprintf(" - Neighborhood exchange functions:\n");
3386
for (z3=0;z3<o->m_pDACF->m_oaSubDACFs.GetSize();z3++)
3387
mprintf(" > %s\n",((CDACFSub*)o->m_pDACF->m_oaSubDACFs[z3])->m_sName);
3391
mprintf(" - Reorientation Dynamics: %s\n",o->m_pRDyn->m_sName);
3394
mprintf(" - IR Spectrum: %s\n",o->m_pIRSpec->m_sName);
3397
mprintf(" - Density DF: %s\n",o->m_pDensityDF->m_sName);
3400
mprintf(" - SDF: %s\n",o->m_pSDF->m_sName);
3403
mprintf(" - Pseudo SDF: %s\n",o->m_pRevSDF->m_sName);
3406
mprintf(" - Neighborhood Analysis: %s\n",o->m_pNbAnalysis->m_sName);
3409
mprintf(" - VACF: %s\n",o->m_pVACF->m_sName);
3412
mprintf(" - MSD: %s\n",o->m_pMSD->m_sName);
3415
mprintf(" - VHDF: %s\n",o->m_pVHDF->m_sName);
3419
mprintf(" - Combined Distribution Function:\n");
3420
for (z3=0;z3<g_iCDFChannels;z3++)
3422
if (o->m_pRDF[z3] != NULL)
3423
mprintf(" - Channel %d: RDF: %s\n",z3+1,o->m_pRDF[z3]->m_sName);
3424
if (o->m_pADF[z3] != NULL)
3425
mprintf(" - Channel %d: ADF: %s\n",z3+1,o->m_pADF[z3]->m_sName);
3426
if (o->m_pDDF[z3] != NULL)
3427
mprintf(" - Channel %d: DDF: %s\n",z3+1,o->m_pDDF[z3]->m_sName);
3428
if (o->m_pDipDF[z3] != NULL)
3429
mprintf(" - Channel %d: DipDF: %s\n",z3+1,o->m_pDipDF[z3]->m_sName);
3430
if (o->m_pVDF[z3] != NULL)
3431
mprintf(" - Channel %d: VDF: %s\n",z3+1,o->m_pVDF[z3]->m_sName);
3432
if (o->m_pPlDF[z3] != NULL)
3433
mprintf(" - Channel %d: PlDF: %s\n",z3+1,o->m_pPlDF[z3]->m_sName);
3434
if (o->m_pLiDF[z3] != NULL)
3435
mprintf(" - Channel %d: LiDF: %s\n",z3+1,o->m_pLiDF[z3]->m_sName);
3440
mprintf(" - RDF: %s\n",o->m_pRDF[0]->m_sName);
3442
mprintf(" - DipDF: %s\n",o->m_pDipDF[0]->m_sName);
3444
mprintf(" - ADF: %s\n",o->m_pADF[0]->m_sName);
3446
mprintf(" - DDF: %s\n",o->m_pDDF[0]->m_sName);
3448
mprintf(" - VDF: %s\n",o->m_pVDF[0]->m_sName);
3450
mprintf(" - PlDF: %s\n",o->m_pPlDF[0]->m_sName);
3452
mprintf(" - LiDF: %s\n",o->m_pLiDF[0]->m_sName);
3455
mprintf(WHITE,"\n<<< End of Observation List <<<\n\n");
3459
if (g_bVACF && g_bGlobalVACF)
3461
try { g_pGlobalVACF = new CACF(); } catch(...) { g_pGlobalVACF = NULL; }
3462
if (g_pGlobalVACF == NULL) NewException((double)sizeof(CACF),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3464
mprintf(WHITE,"\n>>> Global velocity autocorrelation function >>>\n\n");
3465
g_pGlobalVACF->Parse();
3466
mprintf(WHITE,"\n<<< End of global velocity autocorrelation function <<<\n\n");
3469
if (g_bIRSpec && g_bGlobalIR)
3471
try { g_pGlobalIR = new CReorDyn(); } catch(...) { g_pGlobalIR = NULL; }
3472
if (g_pGlobalIR == NULL) NewException((double)sizeof(CReorDyn),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3474
mprintf(WHITE,"\n*** Definition of system-wide IR spectrum ***\n\n");
3475
g_pGlobalIR->ParseSpec();
3478
if (g_bSDF || g_bVoidSDF || g_bCreateRevSDF)
3480
g_iSDFSmoothGrade = AskInteger(" Up to which degree should the SDFs be smoothened (0=not at all)? [3] ",3);
3485
g_bSDFUniform = AskYesNo(" Calculate SDF values in nm^-3 (n) or relative to uniform density (y)? [no] ",false);
3486
if (g_bSDFUniform && ((!g_bPeriodicX) || (!g_bPeriodicY) || (!g_bPeriodicZ)))
3488
eprintf("\n Error: Uniform particle density is only defined for XYZ-periodic systems.\n\n");
3489
goto _sdf_norm_again;
3492
// g_iSDFScale = AskRangeInteger(" SDF values in ppm (1), pm^-3 (2), nm^-3 (3) or rel. to uniform density (4)? [4] ",1,4,4) - 1;
3493
// g_iSDFScale = 2; // nm^-3
3494
} else if (g_bCDF && (g_iCDFChannels == 3))
3495
g_iSDFSmoothGrade = AskInteger(" Up to which degree should the 3D CDFs be smoothened (0=not at all)? [3] ",3);
3497
// if (g_bVDF || g_bSVDF)
3498
// g_bSaveVelForce = AskYesNo(" Save maximum/averaged velocity time development (y/n)? [yes] ",true);
3500
// if (g_bVDF || g_bFDF)
3502
// g_fVelPercentage = AskFloat(" Which percentage of all velocities/forces to take into account? [95] ",95.0f);
3503
// g_fForcePercentage = g_fVelPercentage;
3505
g_bSaveVelForce = false;
3507
if ((g_bSDF && g_bAdvanced2) || g_bSaveRefEnv || g_bCutCluster || g_bSaveJustTraj)
3509
mprintf(WHITE,"\n>>> Coordinate output options >>>\n\n");
3512
g_bWriteAtomwise = (AskRangeInteger(" Sort output coordinates after molecules (0) or after elements (1)? [molecules] ",0,1,0)!=0);
3513
else g_bWriteAtomwise = false;
3515
g_bSaveVirtAtoms = AskYesNo(" Save also virtual atoms (y/n)? [no] ",false);
3517
if (g_bSaveVirtAtoms)
3519
if (AskYesNo(" Ref.Env.: Use alias names (instead of #) for virtual atoms (y/n)? [no] ",false))
3521
for (z2=0;z2<g_oaMolecules.GetSize();z2++)
3523
CMolecule *m = (CMolecule*)g_oaMolecules[z2];
3524
for (z=0;z<m->m_baAtomIndex.GetSize();z++)
3526
if (m->m_baAtomIndex[z] != g_iVirtAtomType)
3528
for (z3=0;z3<m->m_waAtomCount[z];z3++)
3530
mprintf(" How to name atom #%d in %s? [#%d] ",z3+1,m->m_sName,z3+1);
3531
inpprintf("! How to name atom #%d in %s? [#%d]\n",z3+1,m->m_sName,z3+1);
3533
if (strlen(buf) != 0)
3534
strcpy(((CVirtualAtom*)g_oaVirtualAtoms[m->m_laVirtualAtoms[z3]])->m_sLabel,buf);
3541
if (g_bSaveRefEnv || g_bCutCluster)
3542
g_bEnvWriteDetailedInfo = AskYesNo(" Write detailed (long) comment lines into output xyz file (y/n)? [yes] ",true);
3543
else g_bEnvWriteDetailedInfo = false;
3545
if ((g_bSaveRefEnv || g_bCutCluster) && !g_bEnvDisableSortNb)
3546
g_bEnvSortNb = AskYesNo(" Sort molecules according to distance from reference molecule (y/n)? [yes] ",true);
3547
else g_bEnvSortNb = false;
3549
mprintf(WHITE,"\n<<< End of Coordinate output options <<<\n\n");
3552
g_bWriteAtomwise = false;
3553
g_bSaveVirtAtoms = false;
3556
if (g_bSaveRefEnv || g_bCutCluster)
3557
g_bCenterZero = AskYesNo(" Put the center of the system to (0|0|0) (y) or to (x/2|y/2|z/2) (n)? [yes] ",true);
3559
g_bMiddleAvg = false;
3562
if (g_bSaveJustTraj)
3564
mprintf(WHITE,"\n>>> Process Trajectory >>>\n\n");
3567
g_bSaveTrajNoRot = AskYesNo(" Remove angular momentum from trajectory (y/n)? [no] ",false);
3568
else g_bSaveTrajNoRot = false;
3570
if (g_bSaveTrajNoRot)
3572
mprintf("\n This centers the mass center of the system. All atoms of the system are saved.\n\n");
3573
g_bSaveCoordsUnchanged = false;
3574
g_bSaveJustCenter = false;
3575
if(AskYesNo(" Put the center of the system to (0|0|0) (y) or to (x/2|y/2|z/2) (n)? [yes] ",true))
3576
g_bCenterZero = true;
3577
else g_bCenterZero = false;
3581
switch(AskRangeInteger(" Put the center of the system to (0|0|0) (0), to (x/2|y/2|z/2) (1), or leave coords unchanged (2)? [1] ",0,2,1))
3584
g_bCenterZero = true;
3585
g_bSaveCoordsUnchanged = false;
3588
g_bCenterZero = false;
3589
g_bSaveCoordsUnchanged = false;
3592
g_bSaveCoordsUnchanged = true;
3596
if (!g_bSaveCoordsUnchanged)
3597
g_bSaveJustCenter = AskYesNo("\n Put a specific atom into the box center (y/n)? [no] ",false);
3598
else g_bSaveJustCenter = false;
3601
if (g_bSaveJustCenter)
3603
if (g_oaMolecules.GetSize() > 1)
3605
sprintf(buf," Choose center atom from which of the molecules (");
3606
for (z=0;z<g_oaMolecules.GetSize();z++)
3608
sprintf(buf2,"%s=%d",((CMolecule*)g_oaMolecules[z])->m_sName,z+1);
3610
if (z < g_oaMolecules.GetSize()-1)
3614
g_iSaveJustMol = AskRangeInteger_ND(buf,1,g_oaMolecules.GetSize()) - 1;
3618
mprintf(" Choosing center atom from %s.\n",((CMolecule*)g_oaMolecules[0])->m_sName);
3620
if (((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_laSingleMolIndex.GetSize() > 1)
3621
g_iSaveJustSM = AskRangeInteger(" Take which representant from %s (1-%d)? [1] ",1,((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_laSingleMolIndex.GetSize(),1,((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_sName,((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_laSingleMolIndex.GetSize()) - 1;
3622
else g_iSaveJustSM = 0;
3624
AskString(" Which atom from %s %d to put into the box center? [#2] ",buf,"#2",((CMolecule*)g_oaMolecules[g_iSaveJustMol])->m_sName,g_iSaveJustSM+1);
3625
if (!ParseAtom(buf,g_iSaveJustMol,g_iSaveJustAtomType,g_iSaveJustRealAtomType,g_iSaveJustAtom))
3628
g_iSaveGesAtoms = 0;
3629
if (!AskYesNo(" Save all atoms in the system (y/n)? [yes] ",true))
3632
for (z=0;z<g_oaMolecules.GetSize();z++)
3634
if (AskYesNo(" Save (some/all) atoms from molecule %s (y/n)? [yes] ",true,((CMolecule*)g_oaMolecules[z])->m_sName))
3636
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
3637
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3639
g_oaSaveMolecules.Add(ag);
3640
_savejust1: mprintf(" Which atoms to save from %s (e.g. \"C1,C3-5,H\")? [all] ",((CMolecule*)g_oaMolecules[z])->m_sName);
3641
inpprintf("! Which atoms to save from %s (e.g. \"C1,C3-5,H\")? [all]\n",((CMolecule*)g_oaMolecules[z])->m_sName);
3644
ag->AddAllAtoms((CMolecule*)g_oaMolecules[z],g_bSaveVirtAtoms);
3645
else if (!ag->ParseAtoms((CMolecule*)g_oaMolecules[z],buf))
3647
g_iSaveGesAtoms += ag->m_iAtomGes * ((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize();
3653
for (z=0;z<g_oaMolecules.GetSize();z++)
3655
try { ag = new CAtomGroup(); } catch(...) { ag = NULL; }
3656
if (ag == NULL) NewException((double)sizeof(CAtomGroup),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3658
g_oaSaveMolecules.Add(ag);
3659
ag->AddAllAtoms((CMolecule*)g_oaMolecules[z],g_bSaveVirtAtoms);
3660
g_iSaveGesAtoms += ag->m_iAtomGes * ((CMolecule*)g_oaMolecules[z])->m_laSingleMolIndex.GetSize();
3664
if (g_bUnknownElements)
3666
g_bUnwrapWannier = AskYesNo(" Write out Wannier centers together with trajectory (y/n)? [no] ",false);
3668
if (g_bUnwrapWannier)
3671
} else g_bUnwrapWannier = false;
3673
if ((!g_bSaveCoordsUnchanged) && (!g_bSaveTrajNoRot))
3674
g_bUnwrap = AskYesNo(" Try to unwrap the trajectory (y/n)? [no] ",false);
3675
else g_bUnwrap = false;
3678
mprintf("\n Attention! This feature only works if the time step\n in the trajectory is quite small. One particle may never\n move further than half of the box length in one time step!\n");
3680
mprintf("\nSaving %d atoms per step:\n",g_iSaveGesAtoms);
3681
for (z2=0;z2<g_oaSaveMolecules.GetSize();z2++)
3683
ag = (CAtomGroup*)g_oaSaveMolecules[z2];
3684
mprintf(" - In %s: ",ag->m_pMolecule->m_sName);
3685
for (z=0;z<ag->m_baAtomType.GetSize();z++)
3687
for (z3=0;z3<((CxIntArray*)ag->m_oaAtoms[z])->GetSize();z3++)
3689
mprintf("%s%d",((CAtom*)g_oaAtoms[ag->m_baRealAtomType[z]])->m_sName,((CxIntArray*)ag->m_oaAtoms[z])->GetAt(z3)+1);
3690
if (z3 < ((CxIntArray*)ag->m_oaAtoms[z])->GetSize()-1)
3693
if (z+1 < ag->m_baAtomType.GetSize())
3698
// g_bTrajAtomwise = (AskRangeInteger("\n Save trajectory ordered molecule-wise (0) or atom-wise (1)? [0] ",0,1,0)!=0);
3699
mprintf(WHITE,"\n<<<< End of Process Trajectory <<<\n\n");
3700
} else g_bUnwrap = false;
3704
g_vaUnwrapArray.SetSize(g_oaSingleMolecules.GetSize());
3705
for (z=0;z<g_vaUnwrapArray.GetSize();z++)
3706
g_vaUnwrapArray[z] = 0;
3711
try { g_pReact = new CReact(); } catch(...) { g_pReact = NULL; }
3712
if (g_pReact == NULL) NewException((double)sizeof(CReact),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3716
// g_bSilentProgress = true;
3721
if (g_bPeriodic && (g_bSDF || g_bSaveRefEnv || g_bCutCluster || g_bRevSDF) && (!g_bUnwrap))
3724
mprintf("\n Wrapping molecules into the box.\n");
3725
} else if (g_bSaveJustTraj && !g_bSaveTrajNoRot && !g_bUnwrap)
3727
if (g_bPeriodic && (!g_bUnwrap) && (!g_bSaveCoordsUnchanged))
3729
g_bFold = AskYesNo("\n Wrap the molecules into the box (y/n)? [yes] ",true);
3732
mprintf("\n Not wrapping molecules into the box.\n");
3738
mprintf("\n Not wrapping molecules into the box.\n");
3738
g_bWriteAtomwise = false;
3739
g_bWriteInputOrder = true;
3742
eprintf("Should never happen ^^\n");
3747
g_bWriteAtomwise = (AskRangeInteger(" Sort output coordinates by molecules (0) or by element types (1)? [0] ",0,1,0)!=0);
3748
g_bWriteInputOrder = false;
3752
g_bWriteAtomwise = false;
3753
g_bWriteInputOrder = false;
3756
mprintf(WHITE,"\n<<<< End of Process Trajectory <<<\n\n");
3757
} else g_bUnwrap = false;
3761
g_vaUnwrapArray.SetSize(g_oaSingleMolecules.GetSize());
3762
for (z=0;z<g_vaUnwrapArray.GetSize();z++)
3763
g_vaUnwrapArray[z] = 0;
3768
try { g_pReact = new CReact(); } catch(...) { g_pReact = NULL; }
3769
if (g_pReact == NULL) NewException((double)sizeof(CReact),__FILE__,__LINE__,__PRETTY_FUNCTION__);
3773
// g_bSilentProgress = true;
3778
if (g_bPeriodic && (g_bSDF || g_bPlProj || g_bSaveRefEnv || g_bCutCluster || g_bRevSDF) && (!g_bUnwrap))
3781
// mprintf("\n Wrapping molecules into the box.\n");
3782
} else if (g_bSaveJustTraj && !g_bSaveTrajNoRot && !g_bUnwrap)
3784
if (g_bPeriodic && (!g_bUnwrap) && (!g_bSaveCoordsUnchanged))
3786
g_bFold = AskYesNo("\n Wrap the molecules into the box (y/n)? [yes] ",true);
3789
// mprintf("\n Not wrapping molecules into the box.\n");
3795
// mprintf("\n Not wrapping molecules into the box.\n");
3741
3798
if (g_bAdvanced2 && g_bFold)
3742
g_bFoldAtomwise = (AskRangeInteger(" Wrap molecule-wise (0) or atom-wise (1)? [0] ",0,1,0)!=0);
3743
else g_bFoldAtomwise = false;
3745
if (g_bMSD || g_bPairMSD || g_bSaveJustTraj || g_bACF || (g_bIRSpec && g_bDipoleRefFixed) || g_bVHDF/* || g_bThermo*/)
3748
g_bRemoveCOM = AskYesNo(" Remove center of mass movement of the MD box (y/n)? [no] ",false);
3749
else g_bRemoveCOM = AskYesNo(" Remove center of mass movement of the MD box (y/n)? [yes] ",true);
3750
} else g_bRemoveCOM = false;
3752
if (g_bUseVelocities && (g_fTimestepLength > 1.0))
3754
mprintf(RED,"\n Warning: ");
3755
mprintf("Atom velocities are obtained from positions by numerical differentiation.\n");
3756
mprintf(" This is only reliable for trajectory timestep distances <= approx. 1 fs.\n");
3757
mprintf(" Your timestep distance is %.2f fs, which is larger than 1 fs.\n\n",g_fTimestepLength);
3759
if (!AskYesNo(" Proceed anyway (y/n)? [yes] ",true))
3763
if (g_TimeStep.GetCommentNumberCount() > 0)
3765
g_bSkipDoubleSteps = AskYesNo(" Skip repeated time steps (y/n)? [no] ",false);
3766
if (g_bSkipDoubleSteps)
3769
mprintf(" The comment line is \"%s\".\n",g_TimeStep.m_pComment);
3770
if (g_TimeStep.GetCommentNumberCount() > 1)
3772
if (!AskYesNo(" Does this line contain the time step number (y/n)? [yes] ",true))
3773
g_bSkipDoubleSteps = false;
3774
if (g_bSkipDoubleSteps)
3776
sprintf(buf," Choose the time step number: ");
3777
for (z=0;z<g_TimeStep.GetCommentNumberCount();z++)
3778
if (z < g_TimeStep.GetCommentNumberCount()-1)
3780
sprintf(buf2,"%ld (%d), ",g_TimeStep.ExtractNumber(z),z+1);
3784
sprintf(buf2,"%ld (%d)",g_TimeStep.ExtractNumber(z),z+1);
3787
strcat(buf," [1] ");
3788
g_iNumberPos = AskRangeInteger(buf,1,g_TimeStep.GetCommentNumberCount(),1) - 1;
3791
if (!AskYesNo(" Is %d the time step number of the first time step (y/n)? [yes] ",true,g_TimeStep.ExtractNumber(0)))
3792
g_bSkipDoubleSteps = false;
3794
if (!g_bSkipDoubleSteps)
3795
mprintf(" NOT skipping repeated time steps.\n");
3803
if (AskYesNo(" Perform a multi-interval analysis (y/n)? [no] ",false))
3805
g_bMultiInterval = true;
3806
if (AskYesNo(" Use equidistant intervals (y) or enter data manually (n)? [yes] ",true))
3808
g_iMultiIntervalBegin = AskUnsignedInteger(" In which time step to start processing the trajectory? [1] ",1) - 1;
3809
if (g_iMultiIntervalBegin == -1)
3810
g_iMultiIntervalBegin = 0;
3811
ti = AskUnsignedInteger(" How many intervals to create? [5] ",5);
3812
if (g_iTrajSteps != -1)
3814
g_iMultiIntervalStride = AskUnsignedInteger(" Start a new interval each n-th step? [%d] ",g_iTrajSteps/ti,g_iTrajSteps/ti);
3815
g_iMultiIntervalLength = AskUnsignedInteger(" Enter the length in steps of one interval: [%d] ",g_iTrajSteps/ti,g_iTrajSteps/ti);
3818
g_iMultiIntervalStride = AskUnsignedInteger(" Start a new interval each n-th step? [%d] ",10000/ti,10000/ti);
3819
g_iMultiIntervalLength = AskUnsignedInteger(" Enter the length in steps of one interval: [%d] ",10000/ti,10000/ti);
3823
g_laMultiIntervalStart.Add(g_iMultiIntervalBegin+z*g_iMultiIntervalStride);
3824
g_laMultiIntervalEnd.Add(g_iMultiIntervalBegin+z*g_iMultiIntervalStride+g_iMultiIntervalLength);
3829
ti = AskInteger(" Enter starting time step of %d. interval: [quit] ",-1,g_laMultiIntervalStart.GetSize()+1);
3832
eprintf("Please enter a number >= 1.\n");
3833
goto _intervalagain;
3837
g_laMultiIntervalStart.Add(ti-1);
3838
g_laMultiIntervalEnd.Add(AskUnsignedInteger_ND(" Enter ending time step of %d. interval: ",g_laMultiIntervalStart.GetSize())-1);
3839
goto _intervalagain;
3842
mprintf(WHITE,"\n* %d Intervals have been defined:\n",g_laMultiIntervalStart.GetSize());
3843
for (z=0;z<g_laMultiIntervalStart.GetSize();z++)
3844
mprintf(" - Interval %2d: Steps %6d - %6d.\n",z+1,g_laMultiIntervalStart[z]+1,g_laMultiIntervalEnd[z]+1);
3846
} else goto _nomulti;
3850
g_iBeginStep = AskUnsignedInteger(" In which time step to start processing the trajectory? [1] ",1) - 1;
3851
if (g_iBeginStep == -1)
3853
g_iMaxStep = AskUnsignedInteger(" How many time steps to use (from this position on)? [all] ",0);
3854
if (g_iMaxStep == 0)
3855
g_iMaxStep = -1; // Alle verwenden
3857
g_iStride = AskUnsignedInteger(" Use every n-th time step from the trajectory? [1] ",1);
3859
if (g_iTrajSteps != -1)
3861
if (g_iMaxStep == -1)
3862
mprintf(YELLOW,"\n Using %d time steps: Every %d%s within range %d - approx. %d.\n",(g_iTrajSteps-g_iBeginStep)/g_iStride,g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1,g_iTrajSteps);
3863
else mprintf(YELLOW,"\n Using %d time steps: Every %d%s within range %d - %d.\n",g_iMaxStep/g_iStride,g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1,g_iBeginStep+g_iMaxStep);
3864
} else if (g_iMaxStep != -1)
3865
mprintf(YELLOW,"\n Using %d time steps: Every %d%s within range %d - %d.\n",g_iMaxStep/g_iStride,g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1,g_iBeginStep+g_iMaxStep);
3866
else mprintf(YELLOW,"\n Using every %d%s time step beginning from step %d.\n",g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1);
3869
if (g_iTrajSteps != -1)
3871
if (g_iMaxStep == -1)
3872
ti = (g_iTrajSteps-g_iBeginStep)/g_iStride;
3873
else ti = g_iMaxStep/g_iStride;
3874
} else if (g_iMaxStep != -1)
3875
ti = g_iMaxStep/g_iStride;
3881
for (z=0;z<g_oaObserv.GetSize();z++)
3883
o = (CObservation*)g_oaObserv[z];
3884
if (o->m_pMSD->m_iResolution > ti)
3886
eprintf("\n MSD resolution of %d requires at least %d time steps, but using only %d steps.\n This will lead to erroneous results!\n\n",o->m_pMSD->m_iResolution,o->m_pMSD->m_iResolution,ti);
3887
if (!AskYesNo(" Continue anyway (y/n)? [yes] ",true))
3895
for (z=0;z<g_oaObserv.GetSize();z++)
3897
o = (CObservation*)g_oaObserv[z];
3898
if (o->m_pRDyn->m_iDepth*o->m_pRDyn->m_iStride > ti)
3900
eprintf("\n Reorientation dynamics resolution of %d requires at least %d time steps, but using only %d steps.\n This will lead to erroneous results!\n\n",o->m_pRDyn->m_iDepth*o->m_pRDyn->m_iStride,o->m_pRDyn->m_iDepth*o->m_pRDyn->m_iStride,ti);
3901
if (!AskYesNo(" Continue anyway (y/n)? [yes] ",true))
3909
for (z=0;z<g_oaObserv.GetSize();z++)
3911
o = (CObservation*)g_oaObserv[z];
3912
if (o->m_pIRSpec->m_iDepth*o->m_pIRSpec->m_iStride > ti)
3914
eprintf("\n IR spectrum resolution of %d requires at least %d time steps, but using only %d steps.\n This will lead to erroneous results!\n\n",o->m_pIRSpec->m_iDepth*o->m_pIRSpec->m_iStride,o->m_pIRSpec->m_iDepth*o->m_pIRSpec->m_iStride,ti);
3915
if (!AskYesNo(" Continue anyway (y/n)? [yes] ",true))
3924
if (g_bScanVelocities)
3926
mprintf(WHITE,"\n>>> Velocity Pre-Analysis >>>\n\n");
3927
g_iScanVelStart = AskUnsignedInteger(" Start in which time step for velocity pre-analysis? [0] ",0);
3928
g_iScanVelSteps = AskUnsignedInteger(" Use how many time steps from this point on for vel. pre-analysis? [all] ",0);
3929
g_iScanVelStride = AskUnsignedInteger(" Use every n-th step for velocity pre-analysis? [10] ",10);
3930
mprintf(WHITE,"\n<<< End of Velocity Pre-Analysis <<<\n");
3933
if (g_bSaveRefEnv && (g_iNbhMode == 3))
3935
mprintf(WHITE,"\n>>> Neighborhood Pre-Analysis >>>\n\n");
3936
g_iScanNbhStart = AskUnsignedInteger(" Start in which time step for neighborhood analysis? [0] ",0);
3937
g_iScanNbhSteps = AskUnsignedInteger(" Use how many time steps from this point on for nbh analysis? [all] ",0);
3938
g_iScanNbhStride = AskUnsignedInteger(" Use every n-th step for the neighborhood analysis? [10] ",10);
3939
mprintf(WHITE,"\n<<< End of Neighborhood Pre-Analysis <<<\n");
3942
mprintf(WHITE,"\n########## All information collected ##########\n\n");
3800
if (g_bSDF || g_bPlProj)
3801
g_bFoldAtomwise = (AskRangeInteger(" Wrap molecule-wise (0) or atom-wise (1)? [1] ",0,1,1)!=0);
3803
g_bFoldAtomwise = (AskRangeInteger(" Wrap molecule-wise (0) or atom-wise (1)? [0] ",0,1,0)!=0);
3806
if (g_bSDF || g_bPlProj)
3807
g_bFoldAtomwise = true;
3809
g_bFoldAtomwise = false;
3814
if (g_bFoldAtomwise)
3815
mprintf("\n Wrapping molecules into the box (atom-wise).\n\n");
3816
else mprintf("\n Wrapping molecules into the box (molecule-wise).\n\n");
3817
} else mprintf("\n Not wrapping molecules into the box.\n\n");
3819
if (g_bMSD || g_bPairMSD || g_bSaveJustTraj || g_bACF || (g_bIRSpec && g_bDipoleRefFixed) || g_bVHDF/* || g_bThermo*/)
3822
g_bRemoveCOM = AskYesNo(" Remove center of mass movement of the box (y/n)? [no] ",false);
3823
else g_bRemoveCOM = AskYesNo(" Remove center of mass movement of the box (y/n)? [yes] ",true);
3827
mprintf(" Not removing center of mass movement of the box.\n\n");
3828
g_bRemoveCOM = false;
3831
if (g_bUseVelocities && (g_fTimestepLength > 1.0))
3833
mprintf(RED," Warning: ");
3834
mprintf("Atom velocities are obtained from positions by numerical differentiation.\n");
3835
mprintf(" This is only reliable for trajectory timestep distances <= approx. 1 fs.\n");
3836
mprintf(" Your timestep distance is %.2f fs, which is larger than 1 fs.\n\n",g_fTimestepLength);
3838
if (!AskYesNo(" Proceed anyway (y/n)? [yes] ",true))
3842
if (g_TimeStep.GetCommentNumberCount() > 0)
3844
g_bSkipDoubleSteps = AskYesNo(" Skip repeated time steps (y/n)? [no] ",false);
3845
if (g_bSkipDoubleSteps)
3848
mprintf(" The comment line is \"%s\".\n",g_TimeStep.m_pComment);
3849
if (g_TimeStep.GetCommentNumberCount() > 1)
3851
if (!AskYesNo(" Does this line contain the time step number (y/n)? [yes] ",true))
3852
g_bSkipDoubleSteps = false;
3853
if (g_bSkipDoubleSteps)
3855
sprintf(buf," Choose the time step number: ");
3856
for (z=0;z<g_TimeStep.GetCommentNumberCount();z++)
3857
if (z < g_TimeStep.GetCommentNumberCount()-1)
3859
sprintf(buf2,"%ld (%d), ",g_TimeStep.ExtractNumber(z),z+1);
3863
sprintf(buf2,"%ld (%d)",g_TimeStep.ExtractNumber(z),z+1);
3866
strcat(buf," [1] ");
3867
g_iNumberPos = AskRangeInteger(buf,1,g_TimeStep.GetCommentNumberCount(),1) - 1;
3870
if (!AskYesNo(" Is %d the time step number of the first time step (y/n)? [yes] ",true,g_TimeStep.ExtractNumber(0)))
3871
g_bSkipDoubleSteps = false;
3873
if (!g_bSkipDoubleSteps)
3874
mprintf(" NOT skipping repeated time steps.\n");
3882
if (AskYesNo(" Perform a multi-interval analysis (y/n)? [no] ",false))
3884
g_bMultiInterval = true;
3885
if (AskYesNo(" Use equidistant intervals (y) or enter data manually (n)? [yes] ",true))
3887
g_iMultiIntervalBegin = AskUnsignedInteger(" In which time step to start processing the trajectory? [1] ",1) - 1;
3888
if (g_iMultiIntervalBegin == -1)
3889
g_iMultiIntervalBegin = 0;
3890
ti = AskUnsignedInteger(" How many intervals to create? [5] ",5);
3891
if (g_iTrajSteps != -1)
3893
g_iMultiIntervalStride = AskUnsignedInteger(" Start a new interval each n-th step? [%d] ",g_iTrajSteps/ti,g_iTrajSteps/ti);
3894
g_iMultiIntervalLength = AskUnsignedInteger(" Enter the length in steps of one interval: [%d] ",g_iTrajSteps/ti,g_iTrajSteps/ti);
3897
g_iMultiIntervalStride = AskUnsignedInteger(" Start a new interval each n-th step? [%d] ",10000/ti,10000/ti);
3898
g_iMultiIntervalLength = AskUnsignedInteger(" Enter the length in steps of one interval: [%d] ",10000/ti,10000/ti);
3902
g_laMultiIntervalStart.Add(g_iMultiIntervalBegin+z*g_iMultiIntervalStride);
3903
g_laMultiIntervalEnd.Add(g_iMultiIntervalBegin+z*g_iMultiIntervalStride+g_iMultiIntervalLength);
3908
ti = AskInteger(" Enter starting time step of %d. interval: [quit] ",-1,g_laMultiIntervalStart.GetSize()+1);
3911
eprintf("Please enter a number >= 1.\n");
3912
goto _intervalagain;
3916
g_laMultiIntervalStart.Add(ti-1);
3917
g_laMultiIntervalEnd.Add(AskUnsignedInteger_ND(" Enter ending time step of %d. interval: ",g_laMultiIntervalStart.GetSize())-1);
3918
goto _intervalagain;
3921
mprintf(WHITE,"\n* %d Intervals have been defined:\n",g_laMultiIntervalStart.GetSize());
3922
for (z=0;z<g_laMultiIntervalStart.GetSize();z++)
3923
mprintf(" - Interval %2d: Steps %6d - %6d.\n",z+1,g_laMultiIntervalStart[z]+1,g_laMultiIntervalEnd[z]+1);
3925
} else goto _nomulti;
3929
g_iBeginStep = AskUnsignedInteger(" In which time step to start processing the trajectory? [1] ",1) - 1;
3930
if (g_iBeginStep == -1)
3932
g_iMaxStep = AskUnsignedInteger(" How many time steps to use (from this position on)? [all] ",0);
3933
if (g_iMaxStep == 0)
3934
g_iMaxStep = -1; // Alle verwenden
3936
g_iStride = AskUnsignedInteger(" Use every n-th time step from the trajectory? [1] ",1);
3938
if (g_iTrajSteps != -1)
3940
if (g_iMaxStep == -1)
3941
mprintf(YELLOW,"\n Using %d time steps: Every %d%s within range %d - approx. %d.\n",(g_iTrajSteps-g_iBeginStep)/g_iStride,g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1,g_iTrajSteps);
3942
else mprintf(YELLOW,"\n Using %d time steps: Every %d%s within range %d - %d.\n",g_iMaxStep/g_iStride,g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1,g_iBeginStep+g_iMaxStep);
3943
} else if (g_iMaxStep != -1)
3944
mprintf(YELLOW,"\n Using %d time steps: Every %d%s within range %d - %d.\n",g_iMaxStep/g_iStride,g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1,g_iBeginStep+g_iMaxStep);
3945
else mprintf(YELLOW,"\n Using every %d%s time step beginning from step %d.\n",g_iStride,(g_iStride==1)?"st":"th",g_iBeginStep+1);
3948
if (g_iTrajSteps != -1)
3950
if (g_iMaxStep == -1)
3951
ti = (g_iTrajSteps-g_iBeginStep)/g_iStride;
3952
else ti = g_iMaxStep/g_iStride;
3953
} else if (g_iMaxStep != -1)
3954
ti = g_iMaxStep/g_iStride;
3960
for (z=0;z<g_oaObserv.GetSize();z++)
3962
o = (CObservation*)g_oaObserv[z];
3963
if (o->m_pMSD->m_iResolution > ti)
3965
eprintf("\n MSD resolution of %d requires at least %d time steps, but using only %d steps.\n This will lead to erroneous results!\n\n",o->m_pMSD->m_iResolution,o->m_pMSD->m_iResolution,ti);
3966
if (!AskYesNo(" Continue anyway (y/n)? [yes] ",true))
3974
for (z=0;z<g_oaObserv.GetSize();z++)
3976
o = (CObservation*)g_oaObserv[z];
3977
if (o->m_pRDyn->m_iDepth*o->m_pRDyn->m_iStride > ti)
3979
eprintf("\n Reorientation dynamics resolution of %d requires at least %d time steps, but using only %d steps.\n This will lead to erroneous results!\n\n",o->m_pRDyn->m_iDepth*o->m_pRDyn->m_iStride,o->m_pRDyn->m_iDepth*o->m_pRDyn->m_iStride,ti);
3980
if (!AskYesNo(" Continue anyway (y/n)? [yes] ",true))
3988
for (z=0;z<g_oaObserv.GetSize();z++)
3990
o = (CObservation*)g_oaObserv[z];
3991
if (o->m_pIRSpec->m_iDepth*o->m_pIRSpec->m_iStride > ti)
3993
eprintf("\n IR spectrum resolution of %d requires at least %d time steps, but using only %d steps.\n This will lead to erroneous results!\n\n",o->m_pIRSpec->m_iDepth*o->m_pIRSpec->m_iStride,o->m_pIRSpec->m_iDepth*o->m_pIRSpec->m_iStride,ti);
3994
if (!AskYesNo(" Continue anyway (y/n)? [yes] ",true))
4003
if (g_bScanVelocities)
4005
mprintf(WHITE,"\n>>> Velocity Pre-Analysis >>>\n\n");
4006
g_iScanVelStart = AskUnsignedInteger(" Start in which time step for velocity pre-analysis? [0] ",0);
4007
g_iScanVelSteps = AskUnsignedInteger(" Use how many time steps from this point on for vel. pre-analysis? [all] ",0);
4008
g_iScanVelStride = AskUnsignedInteger(" Use every n-th step for velocity pre-analysis? [10] ",10);
4009
mprintf(WHITE,"\n<<< End of Velocity Pre-Analysis <<<\n");
4012
if (g_bSaveRefEnv && (g_iNbhMode == 3))
4014
mprintf(WHITE,"\n>>> Neighborhood Pre-Analysis >>>\n\n");
4015
g_iScanNbhStart = AskUnsignedInteger(" Start in which time step for neighborhood analysis? [0] ",0);
4016
g_iScanNbhSteps = AskUnsignedInteger(" Use how many time steps from this point on for nbh analysis? [all] ",0);
4017
g_iScanNbhStride = AskUnsignedInteger(" Use every n-th step for the neighborhood analysis? [10] ",10);
4018
mprintf(WHITE,"\n<<< End of Neighborhood Pre-Analysis <<<\n");
4021
mprintf(WHITE,"\n########## All information collected ##########\n\n");
4028
/* a = fopen("struct.xyz","wt");
4029
mfprintf(a,"%d\n\n",g_iGesAtomCount*20);
4034
g_pTempTimestep = new CTimeStep();
4035
g_pTempTimestep->CopyFrom(&g_TimeStep);
4036
g_pTempTimestep->CenterCOM();
4039
vec1[0] = ((rand()%20001)-10000)/10000.0;
4040
vec1[1] = ((rand()%20001)-10000)/10000.0;
4041
vec1[2] = ((rand()%20001)-10000)/10000.0;
4043
tf = (rand()%10000)/10000.0*2.0*Pi;
4045
g_pTempTimestep->Transform(ma);
4047
vec1[0] = (rand()%20000)/10.0;
4048
vec1[1] = (rand()%20000)/10.0;
4049
vec1[2] = (rand()%20000)/10.0;
4051
for (z2=0;z2<g_iGesAtomCount;z2++)
4052
g_pTempTimestep->m_vaCoords[z2] += vec1;
4054
sprintf(buf,"coord_%02d.xyz",z+1);
4055
b = fopen(buf,"wt");
4056
// mfprintf(b,"%d\n\n",g_iGesAtomCount);
4057
for (z2=0;z2<g_iGesAtomCount;z2++)
4059
mfprintf(a,"%s %f %f %f\n",((CAtom*)g_oaAtoms[g_waAtomRealElement[z2]])->m_sName,g_pTempTimestep->m_vaCoords[z2][0]/100.0,g_pTempTimestep->m_vaCoords[z2][1]/100.0,g_pTempTimestep->m_vaCoords[z2][2]/100.0);
4060
mfprintf(b,"%s %f %f %f\n",((CAtom*)g_oaAtoms[g_waAtomRealElement[z2]])->m_sName,g_pTempTimestep->m_vaCoords[z2][0]/100.0,g_pTempTimestep->m_vaCoords[z2][1]/100.0,g_pTempTimestep->m_vaCoords[z2][2]/100.0);