Commit 66e0089a authored by Daniel Leidert's avatar Daniel Leidert

New upstream version 161013

parent 6d2f2e36
......@@ -664,7 +664,7 @@ public:
FILE *a;
unsigned int i;
int x, y, z;
double ff;
float ff;
// char buf[256];
CxString buf;
......@@ -691,19 +691,19 @@ public:
i = m_iRes[2];
fwrite(&i,4,1,a);
ff = (double)m_fMinVal[0]/100.0;
ff = (float)m_fMinVal[0]/100.0;
fwrite(&ff,4,1,a);
ff = (double)m_fMaxVal[0]/100.0;
ff = (float)m_fMaxVal[0]/100.0;
fwrite(&ff,4,1,a);
ff = (double)m_fMinVal[1]/100.0;
ff = (float)m_fMinVal[1]/100.0;
fwrite(&ff,4,1,a);
ff = (double)m_fMaxVal[1]/100.0;
ff = (float)m_fMaxVal[1]/100.0;
fwrite(&ff,4,1,a);
ff = (double)m_fMinVal[2]/100.0;
ff = (float)m_fMinVal[2]/100.0;
fwrite(&ff,4,1,a);
ff = (double)m_fMaxVal[2]/100.0;
ff = (float)m_fMaxVal[2]/100.0;
fwrite(&ff,4,1,a);
} else
{
......@@ -714,19 +714,19 @@ public:
i = m_iRes[2]+2;
fwrite(&i,4,1,a);
ff = (double)0;
ff = (float)0;
fwrite(&ff,4,1,a);
ff = (double)100;
ff = (float)100;
fwrite(&ff,4,1,a);
ff = (double)0;
ff = (float)0;
fwrite(&ff,4,1,a);
ff = (double)100;
ff = (float)100;
fwrite(&ff,4,1,a);
ff = (double)0;
ff = (float)0;
fwrite(&ff,4,1,a);
ff = (double)100;
ff = (float)100;
fwrite(&ff,4,1,a);
}
......@@ -734,7 +734,7 @@ public:
{
for (z=0;z<m_iRes[0]*m_iRes[1]*m_iRes[2];z++)
{
ff = (double)m_pBin[z];
ff = (float)m_pBin[z];
fwrite(&ff,4,1,a);
}
} else
......@@ -747,7 +747,7 @@ public:
{
if ((z == 0) || (z == m_iRes[2]+1) || (y == 0) || (y == m_iRes[1]+1) || (x == 0) || (x == m_iRes[0]+1))
ff = 0;
else ff = (double)m_pBin[(z-1)*m_iRes[0]*m_iRes[1] + (y-1)*m_iRes[0] + x-1];
else ff = (float)m_pBin[(z-1)*m_iRes[0]*m_iRes[1] + (y-1)*m_iRes[0] + x-1];
fwrite(&ff,4,1,a);
}
}
......
......@@ -44,8 +44,8 @@ void DumpBacktrace()
{
p = (CxTracePoint*)g_oaBackTrace[z];
if (p->m_sMessage[0] == 0)
mprintf(" %d.) %s in %s after Line %lu.\n",z+1,p->m_sFunction,p->m_sFile,p->m_iLine);
else mprintf(" %d.) %s in %s after Line %lu: \"%s\"\n",z+1,p->m_sFunction,p->m_sFile,p->m_iLine,p->m_sMessage);
mprintf(" %d.) %s in %s after line %lu.\n",z+1,p->m_sFunction,p->m_sFile,p->m_iLine);
else mprintf(" %d.) %s in %s after line %lu: \"%s\"\n",z+1,p->m_sFunction,p->m_sFile,p->m_iLine,p->m_sMessage);
}
mprintf(YELLOW,"<<< Backtrace\n");
}
......@@ -154,8 +154,8 @@ void Crash()
b = g_bGlobalPsycho;
g_bGlobalPsycho = false;
mprintf(WHITE,"TRAVIS apparently has crashed :-( Sorry.\n");
mprintf(WHITE,"Please send the Log File (travis.log) to the developer,\n");
mprintf(WHITE,"making him able to analyze this error.\n");
mprintf(WHITE,"Please send the log file (travis.log) to the developers,\n");
mprintf(WHITE,"making them able to analyze and fix this error.\n");
BTDUMP;
#ifdef TARGET_LINUX
DumpLinuxBacktrace();
......@@ -168,7 +168,7 @@ void Crash()
g_bGlobalPsycho = false;
mprintf("\n");
}
eprintf("Delivering Control to Operating System.\n");
eprintf("Delivering control to operating system.\n");
/*#ifdef TARGET_WINDOWS
char buf[2];
gets(buf);
......@@ -196,7 +196,7 @@ void CrashInt()
g_bGlobalPsycho = false;
mprintf("\n");
}
eprintf("Delivering Control to Operating System.\n");
eprintf("Delivering control to operating system.\n");
/*#ifdef TARGET_WINDOWS
char buf[2];
gets(buf);
......@@ -208,7 +208,7 @@ void CrashInt()
void SIGNAL_SEGV(int param)
{
(void)param; // Suppress "unused parameter" warning
eprintf("\n\n*** SIGSEGV caught: Segmentation Fault ***\n");
eprintf("\n\n*** SIGSEGV caught: Segmentation fault ***\n");
Crash();
}
......@@ -216,7 +216,7 @@ void SIGNAL_SEGV(int param)
void SIGNAL_FPE(int param)
{
(void)param; // Suppress "unused parameter" warning
eprintf("\n\n*** SIGFPE caught: Floating Point Exception ***\n");
eprintf("\n\n*** SIGFPE caught: Floating point exception ***\n");
Crash();
}
......@@ -224,7 +224,7 @@ void SIGNAL_FPE(int param)
void SIGNAL_ILL(int param)
{
(void)param; // Suppress "unused parameter" warning
eprintf("\n\n*** SIGILL caught: Illegal Instruction ***\n");
eprintf("\n\n*** SIGILL caught: Illegal instruction ***\n");
Crash();
}
......@@ -246,7 +246,7 @@ void SIGNAL_INT(int param)
{
g_bGlobalPsycho = false;
eprintf("\n\n*** SIGINT caught: Hard interrupt by user ***\n");
eprintf("Stopping Execution.\n");
eprintf("Stopping execution.\n");
g_bGlobalPsycho = b;
CrashInt();
exit(0);
......@@ -257,7 +257,7 @@ void SIGNAL_INT(int param)
void SIGNAL_ABRT(int param)
{
(void)param; // Suppress "unused parameter" warning
eprintf("\n\n*** SIGABRT caught: Abnormal Program Termination ***\n");
eprintf("\n\n*** SIGABRT caught: Abnormal program termination ***\n");
Crash();
}
......@@ -334,7 +334,7 @@ void NewException(double d, const char *filename, int line, const char *function
#ifdef TARGET_LINUX
DumpLinuxBacktrace();
#endif
eprintf("Delivering Control to Operating System.\n");
eprintf("Delivering control to operating system.\n");
abort();
}
......@@ -359,7 +359,7 @@ void NewException(double d, const char *filename, int line, const char *function
#ifdef TARGET_LINUX
DumpLinuxBacktrace();
#endif
eprintf("Delivering Control to Operating System.\n");
eprintf("Delivering control to operating system.\n");
abort();
}
......@@ -42,7 +42,7 @@ public:
int swapAtom(int offset);
private:
unsigned char _ty, _rty, _atom;
int _ty, _rty, _atom;
CxObArray _molAtoms;
CxObArray _orderArrays;
CxObArray _timedev;
......
......@@ -26,7 +26,7 @@
#define CONFIG_H
#define SOURCE_VERSION "Oct 02 2016"
#define SOURCE_VERSION "Oct 13 2016"
// Uncomment the following line for an official release
#define RELEASE_VERSION "1.14.0"
......
......@@ -44,8 +44,8 @@ bool GatherInfos()
bool tb=false, tb2;
int z, z0, z2, z3, z4, z5, z6, z7;
int ti, ti2, ti3;
unsigned char ty, rty, atom;
unsigned char ty2, rty2, atom2;
int ty, rty, atom;
int ty2, rty2, atom2;
CVirtualAtom *va;
CObservation *o;
CMolecule *mol;
......
......@@ -37,9 +37,9 @@ CxObArray g_oaObserv;
CxObArray g_oaVirtualAtoms;
CTimeStep g_TimeStep;
char g_iFixMol; // Welches Molekuel fixieren wir?
unsigned char g_iFixAtomType[3]; // Welches Element fixieren wir? (3 mal wegen den 3 Fixpunkten)
unsigned char g_iFixRealAtomType[3]; // Wie Eben, nur Index auf g_pAtoms
unsigned char g_iFixAtom[3]; // Welche Atome in in dem Molekuel fixieren?
int g_iFixAtomType[3]; // Welches Element fixieren wir? (3 mal wegen den 3 Fixpunkten)
int g_iFixRealAtomType[3]; // Wie Eben, nur Index auf g_pAtoms
int g_iFixAtom[3]; // Welche Atome in in dem Molekuel fixieren?
int g_iCurrentTimeStep, g_iLastTimeStep, g_iNextTimeStep;
unsigned long g_iSteps; // Zaehler fuer die schon verarbeiteten Zeitschritte
unsigned char g_iBinning;
......@@ -156,6 +156,7 @@ CxWordArray g_waAtomMolUID;
CxWordArray g_waAtomRealElement;
CxDoubleArray g_faAtomCode;
CxDoubleArray g_faVdWRadius;
CxObArray g_oaMolAtoms;
CxByteArray g_baAtomPassedCondition;
......@@ -331,9 +332,9 @@ bool g_bCenterZero;
bool g_bSaveJustCenter;
int g_iSaveJustMol;
int g_iSaveJustSM;
unsigned char g_iSaveJustAtomType;
unsigned char g_iSaveJustRealAtomType;
unsigned char g_iSaveJustAtom;
int g_iSaveJustAtomType;
int g_iSaveJustRealAtomType;
int g_iSaveJustAtom;
bool g_bTimeDiff;
bool g_bDeriv;
......
......@@ -42,9 +42,9 @@ extern CxObArray g_oaObserv;
extern CxObArray g_oaVirtualAtoms;
extern CTimeStep g_TimeStep;
extern char g_iFixMol; // Welches Molekuel fixieren wir?
extern unsigned char g_iFixAtomType[3]; // Welches Element fixieren wir? (3 mal wegen den 3 Fixpunkten)
extern unsigned char g_iFixRealAtomType[3]; // Wie Eben, nur Index auf g_pAtoms
extern unsigned char g_iFixAtom[3]; // Welche Atome in in dem Molekuel fixieren?
extern int g_iFixAtomType[3]; // Welches Element fixieren wir? (3 mal wegen den 3 Fixpunkten)
extern int g_iFixRealAtomType[3]; // Wie Eben, nur Index auf g_pAtoms
extern int g_iFixAtom[3]; // Welche Atome in in dem Molekuel fixieren?
extern int g_iCurrentTimeStep, g_iLastTimeStep, g_iNextTimeStep;
extern unsigned long g_iSteps; // Zaehler fuer die schon verarbeiteten Zeitschritte
extern unsigned char g_iBinning;
......@@ -153,6 +153,7 @@ extern CxWordArray g_waAtomRealElement;
extern CxDoubleArray g_faAtomCode;
extern CxDoubleArray g_faVdWRadius;
extern CxWordArray g_waAtomMolUID;
extern CxObArray g_oaMolAtoms;
extern CxByteArray g_baAtomPassedCondition;
......@@ -322,9 +323,9 @@ extern bool g_bCenterZero;
extern bool g_bSaveJustCenter;
extern int g_iSaveJustMol;
extern int g_iSaveJustSM;
extern unsigned char g_iSaveJustAtomType;
extern unsigned char g_iSaveJustRealAtomType;
extern unsigned char g_iSaveJustAtom;
extern int g_iSaveJustAtomType;
extern int g_iSaveJustRealAtomType;
extern int g_iSaveJustAtom;
extern bool g_bTimeDiff;
extern bool g_bDeriv;
......
......@@ -201,7 +201,7 @@ _unb_found:;
}*/
bool ParseAtom(const char *s, int refmol, unsigned char &ty, unsigned char &rty, unsigned char &atom)
bool ParseAtom(const char *s, int refmol, int &ty, int &rty, int &atom)
{
BTIN;
CMolecule *mol;
......@@ -1106,6 +1106,30 @@ void SortAtoms()
}
void SortElements()
{
BTIN;
int z, z2;
int i;
CElement *e;
for (z=0;z<g_oaElements.GetSize();z++)
{
i = z;
for (z2=z+1;z2<g_oaElements.GetSize();z2++)
if (strcmp(((CElement*)g_oaElements[i])->m_sLabel,((CElement*)g_oaElements[z2])->m_sLabel) > 0)
i = z2;
if (i != z)
{
e = (CElement*)g_oaElements[z];
g_oaElements[z] = g_oaElements[i];
g_oaElements[i] = e;
}
}
BTOUT;
}
bool SetAnalysis(const char *s)
{
BTIN;
......@@ -3660,7 +3684,7 @@ void ParseDipole()
parseCoreCharges();
int i;
for (i = 0; i < g_oaMolecules.GetSize(); i++) {
unsigned char rty;
int rty;
ParseAtom("#2", i, ((CMolecule *)g_oaMolecules[i])->m_iDipoleCenterType, rty, ((CMolecule *)g_oaMolecules[i])->m_iDipoleCenterIndex);
((CMolecule *)g_oaMolecules[i])->m_iDipoleMode = 6;
}
......@@ -3675,7 +3699,7 @@ void ParseDipole()
parseCoreCharges();
int i;
for (i = 0; i < g_oaMolecules.GetSize(); i++) {
unsigned char rty;
int rty;
ParseAtom("#2", i, ((CMolecule *)g_oaMolecules[i])->m_iDipoleCenterType, rty, ((CMolecule *)g_oaMolecules[i])->m_iDipoleCenterIndex);
((CMolecule *)g_oaMolecules[i])->m_iDipoleMode = 7;
}
......@@ -3911,7 +3935,7 @@ void ParseDipole()
if (g_bTegri) {
g_bVoroIntegrateCharge = true;
parseCoreCharges();
unsigned char rty;
int rty;
ParseAtom("#2", mol, ((CMolecule *)g_oaMolecules[mol])->m_iDipoleCenterType, rty, ((CMolecule *)g_oaMolecules[mol])->m_iDipoleCenterIndex);
((CMolecule *)g_oaMolecules[mol])->m_iDipoleMode = 6;
} else {
......@@ -3922,7 +3946,7 @@ void ParseDipole()
g_bVoroIntegrateCharge = true;
g_bVoroIntegrateDipoleMoment = true;
parseCoreCharges();
unsigned char rty;
int rty;
ParseAtom("#2", mol, ((CMolecule *)g_oaMolecules[mol])->m_iDipoleCenterType, rty, ((CMolecule *)g_oaMolecules[mol])->m_iDipoleCenterIndex);
((CMolecule *)g_oaMolecules[mol])->m_iDipoleMode = 7;
} else {
......@@ -3942,7 +3966,7 @@ void ParseDipole()
if (fabs(((CMolecule *)g_oaMolecules[i])->m_fCharge) > 0.001) {
mprintf("\n");
mprintf(" Molecule %s is charged (%.4f). Input of a dipole reference point is required.\n",((CMolecule *)g_oaMolecules[i])->m_sName, ((CMolecule *)g_oaMolecules[i])->m_fCharge);
unsigned char rty;
int rty;
CxString buf;
do {
AskString(" Please enter dipole reference point: [#2] ", &buf, "#2");
......@@ -5117,7 +5141,7 @@ void parseMagneticDipole() {
int i;
for (i = 0; i < g_oaMolecules.GetSize(); i++) {
unsigned char rty;
int rty;
ParseAtom("#2", i, ((CMolecule *)g_oaMolecules[i])->m_iMagneticDipoleCenterType, rty, ((CMolecule *)g_oaMolecules[i])->m_iMagneticDipoleCenterIndex);
}
......
......@@ -76,7 +76,7 @@ void AddAnalysis(CAnalysisGroup* g, const char *name, const char *abbrev);
void InitAnalyses();
void DumpAnalyses();
//void UniteNb();
bool ParseAtom(const char *s, int refmol, unsigned char &ty, unsigned char &rty, unsigned char &atom);
bool ParseAtom(const char *s, int refmol, int &ty, int &rty, int &atom);
bool ParseRefSystem(int refmol, const char *s, int points);
CTimeStep* GetTimeStep(int i);
CTimeStep** GetTimeStepAddress(int i);
......@@ -91,6 +91,7 @@ CElement* FindElement(const char *s, bool quiet);
double GuessBoxSize();
void strtolower(char *s);
void SortAtoms();
void SortElements();
bool SetAnalysis(const char *s);
bool ParseFunctions(const char *s);
bool ParsePeriodic(const char *s);
......
......@@ -51,6 +51,9 @@
#include "reordyn.h"
#include "revsdf.h"
#include "nbexchange.h"
#include <vector>
#include <string>
class CDACF;
class CPlProj;
......@@ -81,7 +84,7 @@ public:
CVirtualAtom();
~CVirtualAtom();
unsigned char m_iMolVirtAtom;
int m_iMolVirtAtom;
char m_sLabel[8];
CAtomGroup m_oCenterAtoms;
unsigned long m_iIndex;
......@@ -89,9 +92,9 @@ public:
unsigned char m_iMode; // 0 - Schwerpunkt, 1 - Bond/Angle/Dihedral, 2 - Dipolvektor, 3 - Geschw.-Vektor, 4 - Kraftvektor
CxDoubleArray m_faWeight;
double m_fGesWeight;
unsigned char m_iAtomType[3];
unsigned char m_iRealAtomType[3];
unsigned char m_iAtom[3];
int m_iAtomType[3];
int m_iRealAtomType[3];
int m_iAtom[3];
double m_fValues[3];
};
......@@ -118,13 +121,16 @@ public:
int m_iWannierCount;
double m_fMass;
int m_iIndex;
unsigned char m_iDipoleCenterType; // Atomsorte (fuer Molekuel, nicht global) des Dipolzentrums
unsigned char m_iDipoleCenterIndex; // Atomnummer des Dipolzentrums
int m_iDipoleCenterType; // Atomsorte (fuer Molekuel, nicht global) des Dipolzentrums
int m_iDipoleCenterIndex; // Atomnummer des Dipolzentrums
double m_fCharge;
bool m_bPseudo;
bool m_bChargesAssigned;
CxObArray m_oaCharges;
char **m_sFFLabels;
// std::vector<std::string> m_saFFLabels;
// std::vector<CFFAtomType*> m_oaFFAtomTypes;
std::vector<int> m_iaFFAtomTypes;
std::vector<double> m_faCharges;
int m_iDipoleMode;
FILE *m_pDipoleFile;
......@@ -132,8 +138,8 @@ public:
int m_iMagneticDipoleMode;
FILE *m_pMagneticDipoleFile;
int m_iMagneticDipoleCommentIndex[3];
unsigned char m_iMagneticDipoleCenterType;
unsigned char m_iMagneticDipoleCenterIndex;
int m_iMagneticDipoleCenterType;
int m_iMagneticDipoleCenterIndex;
bool m_bPolymer;
};
......@@ -356,9 +362,9 @@ public:
void BuildName();
void Parse();
double m_fMinDist, m_fMaxDist;
unsigned char m_iCenterAtomType;
unsigned char m_iCenterAtomRealType;
unsigned char m_iCenterAtom;
int m_iCenterAtomType;
int m_iCenterAtomRealType;
int m_iCenterAtom;
CDF *m_pDensDF;
bool m_bDensityMass;
bool *m_pDensityMolSelect;
......
......@@ -128,7 +128,7 @@ CReferenceStructure::CReferenceStructure(int showMol, const char *basename, bool
mprintf("\n");
for(i = 0; i < 4; i++) {
// char buf[BUF_SIZE];
unsigned char parse[3];
int parse[3];
do
AskString_ND(" Enter the %d. atom (e.g. C7): ", &buf, i+1);
while(!ParseAtom(buf, showMol, parse[0], parse[1], parse[2]));
......@@ -2220,7 +2220,7 @@ CNormalCoordinateObservation::CNormalCoordinateObservation() {
mprintf("\n");
for(i = 0; i < 4; i++) {
// char buf[BUF_SIZE];
unsigned char parse[3];
int parse[3];
do
AskString_ND(" Enter the %d. atom (e.g. C7): ", &buf, i+1);
while(!ParseAtom(buf, m_iShowMol, parse[0], parse[1], parse[2]));
......
......@@ -43,12 +43,12 @@ CRegion::CRegion() {
_zmin = AskFloat(" Minimum z value in pm [0.0] ", 0.0);
_zmax = AskFloat(" Maximum z value in pm [%.1f] ", g_fBoxZ, g_fBoxZ);
try { _centerAtomTypes = new unsigned char[g_oaMolecules.GetSize()]; } catch(...) { _centerAtomTypes = NULL; }
if(_centerAtomTypes == NULL) NewException((double)g_oaMolecules.GetSize()*sizeof(unsigned char), __FILE__, __LINE__, __PRETTY_FUNCTION__);
try { _centerAtomRealTypes = new unsigned char[g_oaMolecules.GetSize()]; } catch(...) { _centerAtomRealTypes = NULL; }
if(_centerAtomRealTypes == NULL) NewException((double)g_oaMolecules.GetSize()*sizeof(unsigned char), __FILE__, __LINE__, __PRETTY_FUNCTION__);
try { _centerAtoms = new unsigned char[g_oaMolecules.GetSize()]; } catch(...) { _centerAtoms = NULL; }
if(_centerAtoms == NULL) NewException((double)g_oaMolecules.GetSize()*sizeof(unsigned char), __FILE__, __LINE__, __PRETTY_FUNCTION__);
try { _centerAtomTypes = new int[g_oaMolecules.GetSize()]; } catch(...) { _centerAtomTypes = NULL; }
if(_centerAtomTypes == NULL) NewException((double)g_oaMolecules.GetSize()*sizeof(int), __FILE__, __LINE__, __PRETTY_FUNCTION__);
try { _centerAtomRealTypes = new int[g_oaMolecules.GetSize()]; } catch(...) { _centerAtomRealTypes = NULL; }
if(_centerAtomRealTypes == NULL) NewException((double)g_oaMolecules.GetSize()*sizeof(int), __FILE__, __LINE__, __PRETTY_FUNCTION__);
try { _centerAtoms = new int[g_oaMolecules.GetSize()]; } catch(...) { _centerAtoms = NULL; }
if(_centerAtoms == NULL) NewException((double)g_oaMolecules.GetSize()*sizeof(int), __FILE__, __LINE__, __PRETTY_FUNCTION__);
int i;
mprintf("\n By default, the center of mass will be used to decide if a molecule is within the region.\n");
......
......@@ -36,9 +36,9 @@ public:
CRegion();
~CRegion();
unsigned char centerAtomType(int index) const { return _centerAtomTypes[index]; }
unsigned char centerAtomRealType(int index) const { return _centerAtomRealTypes[index]; }
unsigned char centerAtom(int index) const { return _centerAtoms[index]; }
int centerAtomType(int index) const { return _centerAtomTypes[index]; }
int centerAtomRealType(int index) const { return _centerAtomRealTypes[index]; }
int centerAtom(int index) const { return _centerAtoms[index]; }
bool isInRegion(const CxDVector3 &vector);
......@@ -50,9 +50,9 @@ private:
double _zmin;
double _zmax;
unsigned char *_centerAtomTypes;
unsigned char *_centerAtomRealTypes;
unsigned char *_centerAtoms;
int *_centerAtomTypes;
int *_centerAtomRealTypes;
int *_centerAtoms;
};
......
......@@ -1582,7 +1582,7 @@ CStructureFactor::CStructureFactor() {
}
mprintf("\n\n");
unsigned char ca, cb, cc;
int ca, cb, cc;
do {
AskString(" Change isotope for which atom? [done] ", &buf, "");
if (buf.GetLength() == 0)
......
......@@ -112,21 +112,28 @@ void CTetraPak::Parse()
mprintf("\n Performing sanity check...\n\n");
m_p3DF = new C3DF<VORI_FLOAT>();
if (g_TimeStep.m_pVolumetricData != NULL)
{
rx = g_TimeStep.m_pVolumetricData->m_iRes[0];
ry = g_TimeStep.m_pVolumetricData->m_iRes[1];
rz = g_TimeStep.m_pVolumetricData->m_iRes[2];
m_p3DF->m_fMaxVal[0] = g_TimeStep.m_pVolumetricData->m_fMaxVal[0];
m_p3DF->m_fMaxVal[1] = g_TimeStep.m_pVolumetricData->m_fMaxVal[1];
m_p3DF->m_fMaxVal[2] = g_TimeStep.m_pVolumetricData->m_fMaxVal[2];
mprintf(" Input trajectory contains volumetric data. Using grid of %d x %d x %d.\n",rx,ry,rz);
} else
{
rx = 100;
ry = 100;
rz = 100;
m_p3DF->m_fMaxVal[0] = g_fBoxX;
m_p3DF->m_fMaxVal[1] = g_fBoxY;
m_p3DF->m_fMaxVal[2] = g_fBoxZ;
mprintf(" Input trajectory does not contain volumetric data. Using grid of 100 x 100 x 100.\n");
}
m_p3DF = new C3DF<VORI_FLOAT>();
m_p3DF->m_iRes[0] = rx;
m_p3DF->m_iRes[1] = ry;
m_p3DF->m_iRes[2] = rz;
......@@ -142,9 +149,6 @@ void CTetraPak::Parse()
// m_p3DF->m_fMaxVal[0] = g_fCubeXStep * LEN_AU2PM * rx;
// m_p3DF->m_fMaxVal[1] = g_fCubeYStep * LEN_AU2PM * ry;
// m_p3DF->m_fMaxVal[2] = g_fCubeZStep * LEN_AU2PM * rz;
m_p3DF->m_fMaxVal[0] = g_TimeStep.m_pVolumetricData->m_fMaxVal[0];
m_p3DF->m_fMaxVal[1] = g_TimeStep.m_pVolumetricData->m_fMaxVal[1];
m_p3DF->m_fMaxVal[2] = g_TimeStep.m_pVolumetricData->m_fMaxVal[2];
m_p3DF->Create();
try { m_hitCount = new int[rx * ry * rz * m_iInterpolationFactorCube]; } catch (...) { m_hitCount = NULL; }
......
......@@ -301,6 +301,8 @@ void CTimeStep::RECURSION_ScanMolecules(int i, CxByteArray *ta, CSingleMolecule
try { ma = new CMolAtom(); } catch(...) { ma = NULL; }
if (ma == NULL) NewException((double)sizeof(CMolAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
g_oaMolAtoms[i] = ma;
ma->m_iOffset = i;
ma->m_iType = z;
sm->m_oaMolAtoms.Add(ma);
......@@ -310,6 +312,8 @@ void CTimeStep::RECURSION_ScanMolecules(int i, CxByteArray *ta, CSingleMolecule
try { ma = new CMolAtom(); } catch(...) { ma = NULL; }
if (ma == NULL) NewException((double)sizeof(CMolAtom),__FILE__,__LINE__,__PRETTY_FUNCTION__);
g_oaMolAtoms[i] = ma;
ma->m_iOffset = i;
ma->m_iType = sm->m_baAtomIndex.GetSize();
......@@ -559,10 +563,12 @@ bool CTimeStep::ScanMolecules()
ta.SetSize(g_iGesAtomCount);
g_laAtomSMIndex.SetSize(g_iGesAtomCount);
g_oaMolAtoms.SetSize(g_iGesAtomCount);
for (z=0;z<g_iGesAtomCount;z++)
{
ta[z] = 0;
g_laAtomSMIndex[z] = -1;
g_oaMolAtoms[z] = NULL;
}
g_iBondBlackListUsed = 0;
g_oaSingleMolecules.RemoveAll();
......
......@@ -1997,6 +1997,9 @@ bool ParseIntList(const char *s, CxIntArray *la)
i = -1;
i2 = -1;
q++;
} else {
eprintf("Error: Invalid character \"%c\" while parsing integer list.\n",*q);
return false;
}
// _end:
p = q;
......@@ -2014,6 +2017,82 @@ bool ParseIntList(const char *s, CxIntArray *la)
}
bool ParseIntList(const char *s, std::vector<int> &la)
{
BTIN;
const char *p, *q;
char buf[32];
int i, i2, z;
bool m;
i2 = -1;
p = s;
i = -1;
m = false;
while (*p != 0)
{
while ((*p == ' ') && (*p != 0))
p++;
q = p;
if (isdigit(*q))
{
while (isdigit(*q))
q++;
if (q-p >= 31)
{
eprintf("ParseIntList: Entry too long (%ld >= 31).\n",q-p);
return false;
}
memcpy(buf,p,q-p);
buf[q-p] = 0;
if (m)
i2 = atoi(buf);
else
i = atoi(buf);
} else if (*q == '-')
{
if (i == -1)
{
eprintf("Error: \"-\" without preceding number.\n");
BTOUT;
return false;
}
m = true;
q++;
} else if (*q == ',')
{
if (m)
{
if (i2 == -1)
abort();
for (z=i;z<=i2;z++)
la.push_back(z);
} else
la.push_back(i);
m = false;
i = -1;
i2 = -1;
q++;
} else {
eprintf("Error: Invalid character \"%c\" while parsing integer list.\n",*q);
return false;
}
// _end:
p = q;
}
if (m)
{
for (z=i;z<=i2;z++)
la.push_back(z);
} else if (i != -1)
la.push_back(i);
BTOUT;
return true;
}
bool ParseIntList(const char *s, CxWordArray *wa)
{
BTIN;
......@@ -2069,6 +2148,9 @@ bool ParseIntList(const char *s, CxWordArray *wa)
i = -1;
i2 = -1;
q++;
} else {
eprintf("Error: Invalid character \"%c\" while parsing integer list.\n",*q);
return false;
}
// _end:
p = q;
......
......@@ -34,6 +34,7 @@
#include <wchar.h>
#include <ctype.h>
#include <setjmp.h>
#include <vector>
//#include <assert.h>
......@@ -189,6 +190,7 @@ int mystricmp(const char *s1, const char *s2);
void RemoveDoubleBackslash(char *buf);
const char* TreeElement(const char *s);
bool ParseIntList(const char *s, CxIntArray *la);
bool ParseIntList(const char *s, std::vector<int> &la);
bool ParseIntList(const char *s, CxWordArray *wa);
void SortSingleMolAtomTypes();
void xAddAtom(const char *s);
......
......@@ -139,6 +139,8 @@ int main(int argc, const char *argv[])
AddElementData();
SortElements();
try { g_sExeName = new char[strlen(argv[0])+1]; } catch(...) { g_sExeName = NULL; }