Commit ecd93ef4 authored by David Rohr's avatar David Rohr
Browse files

fix reading of model file

parent 860031e3
......@@ -65,10 +65,10 @@ int bioem_RefMap::readRefMaps(bioem_param& param, const char* filemap)
while (!input.eof())
{
input.getline(line,512);
char tmpVals[100] = {' '};
input.getline(line,511);
char tmpVals[100] = {0};
strncpy (tmpVals,line,100);
strncpy (tmpVals,line,99);
sscanf (tmpVals,"%99c",mapname);
// Check for last line
......@@ -105,12 +105,12 @@ int bioem_RefMap::readRefMaps(bioem_param& param, const char* filemap)
exit(1);
}
char line[512] = {' '};
char tmpLine[512] = {' '};
char line[512] = {0};
char tmpLine[512] = {0};
while (!input.eof())
{
input.getline(line, 512);
input.getline(line, 511);
strncpy(tmpLine, line, strlen(line));
char *token = strtok(tmpLine, " ");
......@@ -143,7 +143,7 @@ int bioem_RefMap::readRefMaps(bioem_param& param, const char* filemap)
int i, j;
float z;
char tmpVals[36] = {' '};
char tmpVals[36] = {0};
strncpy (tmpVals, line, 8);
sscanf (tmpVals, "%d", &i);
......
......@@ -48,8 +48,8 @@ int bioem_model::readModel(const char* filemodel)
exit(0);
}
char line[512] = {' '};
char tmpLine[512] = {' '};
char line[512] = {0};
char tmpLine[512] = {0};
int numres = 0;
NormDen = 0.0;
......@@ -57,7 +57,7 @@ int bioem_model::readModel(const char* filemodel)
// for eachline in the file
while (!input.eof())
{
input.getline(line, 512);
input.getline(line, 511);
strncpy(tmpLine, line, strlen(line));
char *token = strtok(tmpLine, " ");
......@@ -78,12 +78,12 @@ int bioem_model::readModel(const char* filemodel)
47 - 54 Real(8.3) z Orthogonal coordinates for Z in
*/
char name[5] = {"PPP"};
char resName[3] = {' '};
char name[5] = {0};
char resName[4] = {0};
float x = 0.0;
float y = 0.0;
float z = 0.0;
char tmp[6] = {' '};
char tmp[6] = {0};
// parse name
strncpy(tmp, line + 12, 4);
......@@ -94,7 +94,7 @@ int bioem_model::readModel(const char* filemodel)
sscanf (tmp, "%s", resName);
// parse x, y, z
char tmpVals[36] = {' '};
char tmpVals[36] = {0};
strncpy (tmpVals, line + 30, 8);
sscanf (tmpVals, "%f", &x);
......@@ -213,25 +213,25 @@ myfloat_t bioem_model::getAminoAcidRad(char *name)
myfloat_t iaa = 0;
if(std::strcmp(name, "CYS") == 0)iaa = 2.75;
if(std::strcmp(name, "PHE") == 0)iaa = 3.2;
if(std::strcmp(name, "LEU") == 0)iaa = 3.1;
if(std::strcmp(name, "TRP") == 0)iaa = 3.4;
if(std::strcmp(name, "VAL") == 0)iaa = 2.95;
if(std::strcmp(name, "ILE") == 0)iaa = 3.1;
if(std::strcmp(name, "MET") == 0)iaa = 3.1;
if(std::strcmp(name, "HIS") == 0)iaa = 3.05;
if(std::strcmp(name, "TYR") == 0)iaa = 3.25;
if(std::strcmp(name, "ALA") == 0)iaa = 2.5;
if(std::strcmp(name, "GLY") == 0)iaa = 2.25;
if(std::strcmp(name, "PRO") == 0)iaa = 2.8;
if(std::strcmp(name, "ASN") == 0)iaa = 2.85;
if(std::strcmp(name, "THR") == 0)iaa = 2.8;
if(std::strcmp(name, "SER") == 0)iaa = 2.6;
if(std::strcmp(name, "ARG") == 0)iaa = 3.3;
if(std::strcmp(name, "GLN") == 0)iaa = 3.0;
if(std::strcmp(name, "ASP") == 0)iaa = 2.8;
if(std::strcmp(name, "LYS") == 0)iaa = 3.2;
if(std::strcmp(name, "GLU") == 0)iaa = 2.95;
else if(std::strcmp(name, "PHE") == 0)iaa = 3.2;
else if(std::strcmp(name, "LEU") == 0)iaa = 3.1;
else if(std::strcmp(name, "TRP") == 0)iaa = 3.4;
else if(std::strcmp(name, "VAL") == 0)iaa = 2.95;
else if(std::strcmp(name, "ILE") == 0)iaa = 3.1;
else if(std::strcmp(name, "MET") == 0)iaa = 3.1;
else if(std::strcmp(name, "HIS") == 0)iaa = 3.05;
else if(std::strcmp(name, "TYR") == 0)iaa = 3.25;
else if(std::strcmp(name, "ALA") == 0)iaa = 2.5;
else if(std::strcmp(name, "GLY") == 0)iaa = 2.25;
else if(std::strcmp(name, "PRO") == 0)iaa = 2.8;
else if(std::strcmp(name, "ASN") == 0)iaa = 2.85;
else if(std::strcmp(name, "THR") == 0)iaa = 2.8;
else if(std::strcmp(name, "SER") == 0)iaa = 2.6;
else if(std::strcmp(name, "ARG") == 0)iaa = 3.3;
else if(std::strcmp(name, "GLN") == 0)iaa = 3.0;
else if(std::strcmp(name, "ASP") == 0)iaa = 2.8;
else if(std::strcmp(name, "LYS") == 0)iaa = 3.2;
else if(std::strcmp(name, "GLU") == 0)iaa = 2.95;
if(iaa == 0)
{
......@@ -248,25 +248,25 @@ myfloat_t bioem_model::getAminoAcidDensity(char *name)
myfloat_t iaa = 0.0;
if(std::strcmp(name, "CYS") == 0)iaa = 64.0;
if(std::strcmp(name, "PHE") == 0)iaa = 88.0;
if(std::strcmp(name, "LEU") == 0)iaa = 72.0;
if(std::strcmp(name, "TRP") == 0)iaa = 108.0;
if(std::strcmp(name, "VAL") == 0)iaa = 64.0;
if(std::strcmp(name, "ILE") == 0)iaa = 72.0;
if(std::strcmp(name, "MET") == 0)iaa = 80.0;
if(std::strcmp(name, "HIS") == 0)iaa = 82.0;
if(std::strcmp(name, "TYR") == 0)iaa = 96.0;
if(std::strcmp(name, "ALA") == 0)iaa = 48.0;
if(std::strcmp(name, "GLY") == 0)iaa = 40.0;
if(std::strcmp(name, "PRO") == 0)iaa = 62.0;
if(std::strcmp(name, "ASN") == 0)iaa = 66.0;
if(std::strcmp(name, "THR") == 0)iaa = 64.0;
if(std::strcmp(name, "SER") == 0)iaa = 56.0;
if(std::strcmp(name, "ARG") == 0)iaa = 93.0;
if(std::strcmp(name, "GLN") == 0)iaa = 78.0;
if(std::strcmp(name, "ASP") == 0)iaa = 59.0;
if(std::strcmp(name, "LYS") == 0)iaa = 79.0;
if(std::strcmp(name, "GLU") == 0)iaa = 53.0;
else if(std::strcmp(name, "PHE") == 0)iaa = 88.0;
else if(std::strcmp(name, "LEU") == 0)iaa = 72.0;
else if(std::strcmp(name, "TRP") == 0)iaa = 108.0;
else if(std::strcmp(name, "VAL") == 0)iaa = 64.0;
else if(std::strcmp(name, "ILE") == 0)iaa = 72.0;
else if(std::strcmp(name, "MET") == 0)iaa = 80.0;
else if(std::strcmp(name, "HIS") == 0)iaa = 82.0;
else if(std::strcmp(name, "TYR") == 0)iaa = 96.0;
else if(std::strcmp(name, "ALA") == 0)iaa = 48.0;
else if(std::strcmp(name, "GLY") == 0)iaa = 40.0;
else if(std::strcmp(name, "PRO") == 0)iaa = 62.0;
else if(std::strcmp(name, "ASN") == 0)iaa = 66.0;
else if(std::strcmp(name, "THR") == 0)iaa = 64.0;
else if(std::strcmp(name, "SER") == 0)iaa = 56.0;
else if(std::strcmp(name, "ARG") == 0)iaa = 93.0;
else if(std::strcmp(name, "GLN") == 0)iaa = 78.0;
else if(std::strcmp(name, "ASP") == 0)iaa = 59.0;
else if(std::strcmp(name, "LYS") == 0)iaa = 79.0;
else if(std::strcmp(name, "GLU") == 0)iaa = 53.0;
if(iaa == 0.0)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment