decompiled_code:
char *__fastcall set_atm_morph(__int64 a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9)
{
char *result; // rax
int v13; // ecx
__int64 v14; // r14
bool v15; // zf
int v16; // edx
int v17; // ebp
int v18; // ecx
__int64 v19; // rax
int v20; // er14
const char *v21; // r15
double v22; // xmm0_8
double v23; // xmm0_8
unsigned int v24; // edx
int v25; // esi
int v26; // edi
int v27; // ecx
_DWORD *v28; // rax
int v29; // edx
int v30; // eax
int v31; // ecx
__int64 v32; // rdx
int v33; // eax
__int64 v34; // r14
int v35; // edx
__int64 v36; // r14
int v37; // eax
int v38; // ecx
__int64 v39; // rdx
int v40; // eax
int v41; // ecx
__int64 v42; // rdx
int v43; // eax
int v45; // [rsp+Ch] [rbp-BCh]
int v46; // [rsp+Ch] [rbp-BCh]
int v48; // [rsp+18h] [rbp-B0h]
int v49; // [rsp+18h] [rbp-B0h]
unsigned int v50; // [rsp+18h] [rbp-B0h]
int src; // [rsp+20h] [rbp-A8h]
__int64 v52; // [rsp+28h] [rbp-A0h]
unsigned int v53; // [rsp+30h] [rbp-98h] BYREF
int v54; // [rsp+34h] [rbp-94h] BYREF
int v55; // [rsp+38h] [rbp-90h] BYREF
int v56; // [rsp+3Ch] [rbp-8Ch] BYREF
int v57; // [rsp+40h] [rbp-88h] BYREF
int v58; // [rsp+44h] [rbp-84h] BYREF
double v59; // [rsp+48h] [rbp-80h] BYREF
char v60[120]; // [rsp+50h] [rbp-78h] BYREF

_isoc99_sscanf(a1 + 486, &LC0, &v58);
result = (char *)v58;
if ( *(_DWORD *)(a7 + 40) < v58 || v58 <= 0 )
{
keyarg_barf(a1, a4, a3, 2LL);
result = (char *)v58;
}
if ( *(int *)(*(_QWORD *)(a7 + 8) + 4LL * (_QWORD)result) <= 0 )
return result;
v13 = 2;
v14 = *(int *)(*(_QWORD *)(a7 + 16) + 4LL * (_QWORD)result);
v15 = *(_DWORD *)(a1 + 640) == 1;
v58 = v14 + *(_DWORD *)a8;
if ( v15 )
{
_isoc99_sscanf(a1 + 698, &LC1, &v59);
v22 = v59;
if ( v59 <= 0.0 )
{
keyarg_barf(a1, a4, a3, 3LL);
v22 = v59;
}
v13 = 3;
v15 = *(_DWORD *)(a1 + 852) == 1;
*(double *)(*(_QWORD *)(a8 + 200) + 8LL * v58) = v22;
if ( !v15 )
{
LABEL_6:
if ( *(_DWORD *)(a1 + 1064) != 1 )
goto LABEL_7;
goto LABEL_43;
}
}
else if ( *(_DWORD *)(a1 + 852) != 1 )
{
goto LABEL_6;
}
v49 = v13;
_isoc99_sscanf(a1 + 910, &LC1, &v59);
v15 = *(_DWORD *)(a1 + 1064) == 1;
v13 = v49;
*(double *)(*(_QWORD *)(a8 + 208) + 8LL * v58) = v59;
if ( !v15 )
{
LABEL_7:
if ( *(_DWORD *)(a1 + 1276) != 1 )
goto LABEL_8;
LABEL_46:
_isoc99_sscanf(a1 + 1334, &LC1, &v59);
v15 = *(_DWORD *)(a1 + 1488) == 1;
*(double *)(*(_QWORD *)(a8 + 224) + 8LL * v58) = v59;
if ( !v15 )
goto LABEL_9;
goto LABEL_47;
}
LABEL_43:
v50 = v13;
_isoc99_sscanf(a1 + 1122, &LC1, &v59);
v23 = v59;
if ( v59 < 0.0 )
{
keyarg_barf(a1, a4, a3, v50);
v23 = v59;
}
v15 = *(_DWORD *)(a1 + 1276) == 1;
*(double *)(*(_QWORD *)(a8 + 216) + 8LL * v58) = v23;
if ( v15 )
goto LABEL_46;
LABEL_8:
if ( *(_DWORD *)(a1 + 1488) != 1 )
goto LABEL_9;
LABEL_47:
_isoc99_sscanf(a1 + 1546, &LC0, &v53);
v24 = v53;
*(_DWORD *)(*(_QWORD *)a7 + 316LL * (int)v14 + 292) = v53;
if ( v24 > 6 )
keyarg_barf(a1, a4, a3, 7LL);
LABEL_9:
if ( *(_DWORD *)(a1 + 1700) != 1 )
goto LABEL_10;
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 1758));
parse_improp(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), &v56, &v54, &v55, &v57);
v25 = v56;
v26 = v54;
v27 = v55;
v28 = (_DWORD *)(*(_QWORD *)a7 + 316LL * (int)v14);
v28[75] = v56 + 1;
v28[76] = v26 + 1;
v28[77] = v27 + 1;
v29 = v57;
v28[78] = v57 + 1;
v30 = v29 + v27 + v25 + v26;
if ( !v30 )
goto LABEL_72;
if ( v30 != 6 )
{
keyarg_barf(a1, a4, a3, 8LL);
v25 = v56;
v26 = v54;
v27 = v55;
v29 = v57;
v30 = v57 + v55 + v56 + v54;
LABEL_72:
if ( v30 != 6 )
goto LABEL_10;
}
if ( (unsigned int)(v27 - 1) > 2
|| (unsigned int)(v25 - 1) > 2
|| (unsigned int)(v26 - 1) > 2
|| v27 == v29
|| v26 == v29
|| v25 == v29
|| v26 == v27
|| v25 == v27
|| v25 == v26
|| (unsigned int)(v29 - 1) > 2 )
{
keyarg_barf(a1, a4, a3, 8LL);
}
if ( *(_DWORD *)(a1 + 1912) != 1 )
goto LABEL_11;
LABEL_10:
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 1970));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(*(_QWORD *)a7 + 316LL * (int)v14 + 50), v60);
v31 = v54;
v32 = *(_QWORD *)a7 + 316LL * (int)v14;
v33 = v55;
*(_DWORD *)(v32 + 256) = v54;
*(_DWORD *)(v32 + 276) = v33;
if ( (unsigned int)(v33 + 1) > 7 || (unsigned int)(v31 + 1) > 7 || !v60[0] )
{
keyarg_barf(a1, a4, a3, 8LL);
if ( *(_DWORD *)(a1 + 2124) != 1 )
goto LABEL_12;
}
else
{
LABEL_11:
if ( *(_DWORD *)(a1 + 2124) != 1 )
goto LABEL_12;
}
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 2182));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(*(_QWORD *)a7 + 316LL * (int)v14 + 100), v60);
v38 = v54;
v39 = *(_QWORD *)a7 + 316LL * (int)v14;
v40 = v55;
*(_DWORD *)(v39 + 260) = v54;
*(_DWORD *)(v39 + 280) = v40;
if ( (unsigned int)(v40 + 1) <= 7 && (unsigned int)(v38 + 1) <= 7 && v60[0] )
{
LABEL_12:
if ( *(_DWORD *)(a1 + 2336) != 1 )
goto LABEL_13;
goto LABEL_67;
}
keyarg_barf(a1, a4, a3, 10LL);
if ( *(_DWORD *)(a1 + 2336) != 1 )
goto LABEL_13;
LABEL_67:
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 2394));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(*(_QWORD *)a7 + 316LL * (int)v14 + 150), v60);
v41 = v54;
v42 = *(_QWORD *)a7 + 316LL * (int)v14;
v43 = v55;
*(_DWORD *)(v42 + 264) = v54;
*(_DWORD *)(v42 + 284) = v43;
if ( (unsigned int)(v43 + 1) <= 7 && (unsigned int)(v41 + 1) <= 7 && v60[0] )
{
LABEL_13:
if ( *(_DWORD *)(a1 + 2548) != 1 )
goto LABEL_14;
goto LABEL_58;
}
keyarg_barf(a1, a4, a3, 11LL);
if ( *(_DWORD *)(a1 + 2548) != 1 )
goto LABEL_14;
LABEL_58:
v34 = 316 * v14;
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 2606));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(v34 + *(_QWORD *)a7 + 200), v60);
v35 = v54;
v36 = *(_QWORD *)a7 + v34;
v37 = v55;
*(_DWORD *)(v36 + 268) = v54;
*(_DWORD *)(v36 + 288) = v37;
if ( (unsigned int)(v37 + 1) <= 7 && (unsigned int)(v35 + 1) <= 7 && v60[0] )
{
LABEL_14:
if ( *(_DWORD *)(a1 + 2760) == 1 )
goto LABEL_61;
LABEL_15:
if ( *(_DWORD *)(a1 + 2972) == 1 )
goto LABEL_62;
LABEL_16:
if ( *(_DWORD *)(a1 + 3184) != 1 )
goto LABEL_17;
goto LABEL_25;
}
keyarg_barf(a1, a4, a3, 12LL);
if ( *(_DWORD *)(a1 + 2760) != 1 )
goto LABEL_15;
LABEL_61:
_isoc99_sscanf(a1 + 2818, &LC0, &v53);
*(_DWORD *)(*(_QWORD *)(a8 + 176) + 4LL * v58) = v53;
if ( *(_DWORD *)(a1 + 2972) != 1 )
goto LABEL_16;
LABEL_62:
_isoc99_sscanf(a1 + 3030, &LC0, &v53);
*(_DWORD *)(*(_QWORD *)(a8 + 184) + 4LL * v58) = v53;
if ( *(_DWORD *)(a1 + 3184) != 1 )
goto LABEL_17;
LABEL_25:
if ( !strcasecmp((const char *)(a1 + 3242), "yes") )
*(_DWORD *)(*(_QWORD *)(a8 + 192) + 4LL * v58) = 1;
if ( !strcasecmp((const char *)(a1 + 3242), "no") )
*(_DWORD *)(*(_QWORD *)(a8 + 192) + 4LL * v58) = 0;
LABEL_17:
result = (char *)(a1 + 2548);
v16 = 0;
do
{
v16 += *(_DWORD *)result;
result += 212;
}
while ( (char *)(a1 + 3608) != result );
if ( v16 > 0 )
{
result = (char *)set_ghost(a9, a8, a6, a7, a1, a2, a4, a3, (unsigned int)v58);
v17 = *(_DWORD *)(a1 + 216);
if ( v17 != 1 )
return result;
}
else
{
v17 = *(_DWORD *)(a1 + 216);
if ( v17 != 1 )
return result;
}
v18 = *(_DWORD *)(a6 + 8);
v19 = *(_QWORD *)(a6 + 48);
src = *(_DWORD *)(a7 + 384);
v20 = v18 + 1;
v45 = v18;
v48 = v18 + 1;
if ( v18 <= 0 )
{
if ( v48 <= src )
goto LABEL_38;
v20 = v18 + 1;
v52 = v19 + 50;
goto LABEL_76;
}
v52 = v19 + 50;
v21 = (const char *)(v19 + 50);
while ( 1 )
{
v15 = strcasecmp((const char *)(a1 + 274), v21) == 0;
result = (char *)(unsigned int)(v17 + 1);
if ( v15 )
v20 = v17;
v21 += 50;
if ( v45 == v17 )
break;
++v17;
}
if ( v20 > src )
{
LABEL_76:
*(_DWORD *)(a7 + 384) = src + 100;
*(_QWORD *)(a6 + 48) = crealloc(v52, 50LL * (src + 100));
v46 = *(_DWORD *)(a6 + 8);
result = (char *)(unsigned int)(v46 + 1);
v48 = v46 + 1;
}
if ( v20 == v48 )
{
v19 = *(_QWORD *)(a6 + 48);
LABEL_38:
*(_DWORD *)(a6 + 8) = v48;
result = strcpy((char *)(v19 + 50LL * v48), (const char *)(a1 + 274));
}
return result;
}

canonical_decompiled_code:
char *__fastcall func0(__int64 a1, unsigned int a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9)
{
char *result; // rax
int v13; // ecx
__int64 v14; // r14
bool v15; // zf
int v16; // edx
int v17; // ebp
int v18; // ecx
__int64 v19; // rax
int v20; // er14
const char *v21; // r15
double v22; // xmm0_8
double v23; // xmm0_8
unsigned int v24; // edx
int v25; // esi
int v26; // edi
int v27; // ecx
_DWORD *v28; // rax
int v29; // edx
int v30; // eax
int v31; // ecx
__int64 v32; // rdx
int v33; // eax
__int64 v34; // r14
int v35; // edx
__int64 v36; // r14
int v37; // eax
int v38; // ecx
__int64 v39; // rdx
int v40; // eax
int v41; // ecx
__int64 v42; // rdx
int v43; // eax
int v45; // [rsp+Ch] [rbp-BCh]
int v46; // [rsp+Ch] [rbp-BCh]
int v48; // [rsp+18h] [rbp-B0h]
int v49; // [rsp+18h] [rbp-B0h]
unsigned int v50; // [rsp+18h] [rbp-B0h]
int src; // [rsp+20h] [rbp-A8h]
__int64 v52; // [rsp+28h] [rbp-A0h]
unsigned int v53; // [rsp+30h] [rbp-98h] BYREF
int v54; // [rsp+34h] [rbp-94h] BYREF
int v55; // [rsp+38h] [rbp-90h] BYREF
int v56; // [rsp+3Ch] [rbp-8Ch] BYREF
int v57; // [rsp+40h] [rbp-88h] BYREF
int v58; // [rsp+44h] [rbp-84h] BYREF
double v59; // [rsp+48h] [rbp-80h] BYREF
char v60[120]; // [rsp+50h] [rbp-78h] BYREF

_isoc99_sscanf(a1 + 486, &LC0, &v58);
result = (char *)v58;
if ( *(_DWORD *)(a7 + 40) < v58 || v58 <= 0 )
{
keyarg_barf(a1, a4, a3, 2LL);
result = (char *)v58;
}
if ( *(int *)(*(_QWORD *)(a7 + 8) + 4LL * (_QWORD)result) <= 0 )
return result;
v13 = 2;
v14 = *(int *)(*(_QWORD *)(a7 + 16) + 4LL * (_QWORD)result);
v15 = *(_DWORD *)(a1 + 640) == 1;
v58 = v14 + *(_DWORD *)a8;
if ( v15 )
{
_isoc99_sscanf(a1 + 698, &LC1, &v59);
v22 = v59;
if ( v59 <= 0.0 )
{
keyarg_barf(a1, a4, a3, 3LL);
v22 = v59;
}
v13 = 3;
v15 = *(_DWORD *)(a1 + 852) == 1;
*(double *)(*(_QWORD *)(a8 + 200) + 8LL * v58) = v22;
if ( !v15 )
{
LABEL_6:
if ( *(_DWORD *)(a1 + 1064) != 1 )
goto LABEL_7;
goto LABEL_43;
}
}
else if ( *(_DWORD *)(a1 + 852) != 1 )
{
goto LABEL_6;
}
v49 = v13;
_isoc99_sscanf(a1 + 910, &LC1, &v59);
v15 = *(_DWORD *)(a1 + 1064) == 1;
v13 = v49;
*(double *)(*(_QWORD *)(a8 + 208) + 8LL * v58) = v59;
if ( !v15 )
{
LABEL_7:
if ( *(_DWORD *)(a1 + 1276) != 1 )
goto LABEL_8;
LABEL_46:
_isoc99_sscanf(a1 + 1334, &LC1, &v59);
v15 = *(_DWORD *)(a1 + 1488) == 1;
*(double *)(*(_QWORD *)(a8 + 224) + 8LL * v58) = v59;
if ( !v15 )
goto LABEL_9;
goto LABEL_47;
}
LABEL_43:
v50 = v13;
_isoc99_sscanf(a1 + 1122, &LC1, &v59);
v23 = v59;
if ( v59 < 0.0 )
{
keyarg_barf(a1, a4, a3, v50);
v23 = v59;
}
v15 = *(_DWORD *)(a1 + 1276) == 1;
*(double *)(*(_QWORD *)(a8 + 216) + 8LL * v58) = v23;
if ( v15 )
goto LABEL_46;
LABEL_8:
if ( *(_DWORD *)(a1 + 1488) != 1 )
goto LABEL_9;
LABEL_47:
_isoc99_sscanf(a1 + 1546, &LC0, &v53);
v24 = v53;
*(_DWORD *)(*(_QWORD *)a7 + 316LL * (int)v14 + 292) = v53;
if ( v24 > 6 )
keyarg_barf(a1, a4, a3, 7LL);
LABEL_9:
if ( *(_DWORD *)(a1 + 1700) != 1 )
goto LABEL_10;
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 1758));
parse_improp(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), &v56, &v54, &v55, &v57);
v25 = v56;
v26 = v54;
v27 = v55;
v28 = (_DWORD *)(*(_QWORD *)a7 + 316LL * (int)v14);
v28[75] = v56 + 1;
v28[76] = v26 + 1;
v28[77] = v27 + 1;
v29 = v57;
v28[78] = v57 + 1;
v30 = v29 + v27 + v25 + v26;
if ( !v30 )
goto LABEL_72;
if ( v30 != 6 )
{
keyarg_barf(a1, a4, a3, 8LL);
v25 = v56;
v26 = v54;
v27 = v55;
v29 = v57;
v30 = v57 + v55 + v56 + v54;
LABEL_72:
if ( v30 != 6 )
goto LABEL_10;
}
if ( (unsigned int)(v27 - 1) > 2
|| (unsigned int)(v25 - 1) > 2
|| (unsigned int)(v26 - 1) > 2
|| v27 == v29
|| v26 == v29
|| v25 == v29
|| v26 == v27
|| v25 == v27
|| v25 == v26
|| (unsigned int)(v29 - 1) > 2 )
{
keyarg_barf(a1, a4, a3, 8LL);
}
if ( *(_DWORD *)(a1 + 1912) != 1 )
goto LABEL_11;
LABEL_10:
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 1970));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(*(_QWORD *)a7 + 316LL * (int)v14 + 50), v60);
v31 = v54;
v32 = *(_QWORD *)a7 + 316LL * (int)v14;
v33 = v55;
*(_DWORD *)(v32 + 256) = v54;
*(_DWORD *)(v32 + 276) = v33;
if ( (unsigned int)(v33 + 1) > 7 || (unsigned int)(v31 + 1) > 7 || !v60[0] )
{
keyarg_barf(a1, a4, a3, 8LL);
if ( *(_DWORD *)(a1 + 2124) != 1 )
goto LABEL_12;
}
else
{
LABEL_11:
if ( *(_DWORD *)(a1 + 2124) != 1 )
goto LABEL_12;
}
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 2182));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(*(_QWORD *)a7 + 316LL * (int)v14 + 100), v60);
v38 = v54;
v39 = *(_QWORD *)a7 + 316LL * (int)v14;
v40 = v55;
*(_DWORD *)(v39 + 260) = v54;
*(_DWORD *)(v39 + 280) = v40;
if ( (unsigned int)(v40 + 1) <= 7 && (unsigned int)(v38 + 1) <= 7 && v60[0] )
{
LABEL_12:
if ( *(_DWORD *)(a1 + 2336) != 1 )
goto LABEL_13;
goto LABEL_67;
}
keyarg_barf(a1, a4, a3, 10LL);
if ( *(_DWORD *)(a1 + 2336) != 1 )
goto LABEL_13;
LABEL_67:
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 2394));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(*(_QWORD *)a7 + 316LL * (int)v14 + 150), v60);
v41 = v54;
v42 = *(_QWORD *)a7 + 316LL * (int)v14;
v43 = v55;
*(_DWORD *)(v42 + 264) = v54;
*(_DWORD *)(v42 + 284) = v43;
if ( (unsigned int)(v43 + 1) <= 7 && (unsigned int)(v41 + 1) <= 7 && v60[0] )
{
LABEL_13:
if ( *(_DWORD *)(a1 + 2548) != 1 )
goto LABEL_14;
goto LABEL_58;
}
keyarg_barf(a1, a4, a3, 11LL);
if ( *(_DWORD *)(a1 + 2548) != 1 )
goto LABEL_14;
LABEL_58:
v34 = 316 * v14;
strcpy(*(char **)(a7 + 392), (const char *)(a1 + 2606));
parse_bond_site(*(_QWORD *)(a7 + 392), *(_QWORD *)(a7 + 400), v60, &v54, &v55);
strcpy((char *)(v34 + *(_QWORD *)a7 + 200), v60);
v35 = v54;
v36 = *(_QWORD *)a7 + v34;
v37 = v55;
*(_DWORD *)(v36 + 268) = v54;
*(_DWORD *)(v36 + 288) = v37;
if ( (unsigned int)(v37 + 1) <= 7 && (unsigned int)(v35 + 1) <= 7 && v60[0] )
{
LABEL_14:
if ( *(_DWORD *)(a1 + 2760) == 1 )
goto LABEL_61;
LABEL_15:
if ( *(_DWORD *)(a1 + 2972) == 1 )
goto LABEL_62;
LABEL_16:
if ( *(_DWORD *)(a1 + 3184) != 1 )
goto LABEL_17;
goto LABEL_25;
}
keyarg_barf(a1, a4, a3, 12LL);
if ( *(_DWORD *)(a1 + 2760) != 1 )
goto LABEL_15;
LABEL_61:
_isoc99_sscanf(a1 + 2818, &LC0, &v53);
*(_DWORD *)(*(_QWORD *)(a8 + 176) + 4LL * v58) = v53;
if ( *(_DWORD *)(a1 + 2972) != 1 )
goto LABEL_16;
LABEL_62:
_isoc99_sscanf(a1 + 3030, &LC0, &v53);
*(_DWORD *)(*(_QWORD *)(a8 + 184) + 4LL * v58) = v53;
if ( *(_DWORD *)(a1 + 3184) != 1 )
goto LABEL_17;
LABEL_25:
if ( !strcasecmp((const char *)(a1 + 3242), "yes") )
*(_DWORD *)(*(_QWORD *)(a8 + 192) + 4LL * v58) = 1;
if ( !strcasecmp((const char *)(a1 + 3242), "no") )
*(_DWORD *)(*(_QWORD *)(a8 + 192) + 4LL * v58) = 0;
LABEL_17:
result = (char *)(a1 + 2548);
v16 = 0;
do
{
v16 += *(_DWORD *)result;
result += 212;
}
while ( (char *)(a1 + 3608) != result );
if ( v16 > 0 )
{
result = (char *)set_ghost(a9, a8, a6, a7, a1, a2, a4, a3, (unsigned int)v58);
v17 = *(_DWORD *)(a1 + 216);
if ( v17 != 1 )
return result;
}
else
{
v17 = *(_DWORD *)(a1 + 216);
if ( v17 != 1 )
return result;
}
v18 = *(_DWORD *)(a6 + 8);
v19 = *(_QWORD *)(a6 + 48);
src = *(_DWORD *)(a7 + 384);
v20 = v18 + 1;
v45 = v18;
v48 = v18 + 1;
if ( v18 <= 0 )
{
if ( v48 <= src )
goto LABEL_38;
v20 = v18 + 1;
v52 = v19 + 50;
goto LABEL_76;
}
v52 = v19 + 50;
v21 = (const char *)(v19 + 50);
while ( 1 )
{
v15 = strcasecmp((const char *)(a1 + 274), v21) == 0;
result = (char *)(unsigned int)(v17 + 1);
if ( v15 )
v20 = v17;
v21 += 50;
if ( v45 == v17 )
break;
++v17;
}
if ( v20 > src )
{
LABEL_76:
*(_DWORD *)(a7 + 384) = src + 100;
*(_QWORD *)(a6 + 48) = crealloc(v52, 50LL * (src + 100));
v46 = *(_DWORD *)(a6 + 8);
result = (char *)(unsigned int)(v46 + 1);
v48 = v46 + 1;
}
if ( v20 == v48 )
{
v19 = *(_QWORD *)(a6 + 48);
LABEL_38:
*(_DWORD *)(a6 + 8) = v48;
result = strcpy((char *)(v19 + 50LL * v48), (const char *)(a1 + 274));
}
return result;
}

original_code:
void set_atm_morph(DICT_WORD *atm_dict,int num_atm_dict,
                   char *fun_key,char *filename,
                   int jmol_typ,ATOMMAPS *atommaps,
                   BUILD_INTRA *build_intra,CLATOMS_INFO *clatoms_info,
                   GHOST_ATOMS *ghost_atoms)
{
  NAME site;
  int i,num,num2,num3,imask,index,isum,num1,num4;
  double dnum;
  int itype,iatm_ind,iatm_ind_sm,iii;
  sscanf(atm_dict[2].keyarg,"%d",&iatm_ind);
  index = 2;
  if((iatm_ind>build_intra->natm_1res_pure_now) || (iatm_ind <1)){
      keyarg_barf(atm_dict,filename,fun_key,index);
  }
  imask = build_intra->mask_atm[iatm_ind];
  if(imask>0){
    iatm_ind = build_intra->index_atm[iatm_ind];
    iatm_ind_sm = iatm_ind;
    iatm_ind = iatm_ind + clatoms_info->natm_tot;
    if(atm_dict[3].iuset==1){
      sscanf(atm_dict[3].keyarg,"%lg",&dnum);
      index = 3;
      if(dnum<=0.0){
        keyarg_barf(atm_dict,filename,fun_key,index);}
        clatoms_info->mass[iatm_ind] = dnum;
    }
    if(atm_dict[4].iuset==1){
      sscanf(atm_dict[4].keyarg,"%lg",&dnum);
      clatoms_info->q[iatm_ind] = dnum;
    }
    if(atm_dict[5].iuset==1){
      sscanf(atm_dict[5].keyarg,"%lg",&dnum);
      if(dnum<0.0){
        keyarg_barf(atm_dict,filename,fun_key,index);}
      clatoms_info->alp_pol[iatm_ind] = dnum;
    }
    if(atm_dict[6].iuset==1){
      sscanf(atm_dict[6].keyarg,"%lg",&dnum);
      clatoms_info->b_neut[iatm_ind] = dnum;
    }
    if(atm_dict[7].iuset==1){
      sscanf(atm_dict[7].keyarg,"%d",&num);
      build_intra->bond_site[iatm_ind_sm].valence = num;
      index = 7;
      if(num<0||num>6){
        keyarg_barf(atm_dict,filename,fun_key,index);
      }
    }
    if(atm_dict[8].iuset==1){
     strcpy(build_intra->strip1,atm_dict[8].keyarg);
     parse_improp(build_intra->strip1,build_intra->strip2,&num1,&num2,&num3,
                                                                      &num4);
     build_intra->bond_site[iatm_ind_sm].improper_ind[1]=num1+1;
     build_intra->bond_site[iatm_ind_sm].improper_ind[2]=num2+1;
     build_intra->bond_site[iatm_ind_sm].improper_ind[3]=num3+1;
     build_intra->bond_site[iatm_ind_sm].improper_ind[4]=num4+1;
     index = 8;
     if((num1+num2+num3+num4)!=0&&(num1+num2+num3+num4)!=6){
       keyarg_barf(atm_dict,filename,fun_key,index);}
     if((num1+num2+num3+num4)==6){
      if(num1<=0||num1>3||num2<=0||num2>3||num3<=0||num3>3||num4<=0||num4>3||
         num1==num2||num1==num3||num2==num3||num1==num4||num2==num4||
         num3==num4){
       keyarg_barf(atm_dict,filename,fun_key,index);}}
    }
    if(atm_dict[9].iuset==1){
      strcpy(build_intra->strip1,atm_dict[9].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[1],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[1] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[1] = num3;
      index = 8;
     if(strlen(site)==0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[10].iuset==1){
      strcpy(build_intra->strip1,atm_dict[10].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[2],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[2] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[2] = num3;
      index = 10;
     if(strlen(site)==0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[11].iuset==1){
      strcpy(build_intra->strip1,atm_dict[11].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[3],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[3] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[3] = num3;
      index = 11;
     if(strlen(site)==0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[12].iuset==1){
      strcpy(build_intra->strip1,atm_dict[12].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[4],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[4] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[4] = num3;
      index = 12;
     if(strlen(site)<=0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[13].iuset==1){
      sscanf(atm_dict[13].keyarg,"%d",&num);
      clatoms_info->cp_vlnc_up[iatm_ind] = num;
    }
    if(atm_dict[14].iuset==1){
      sscanf(atm_dict[14].keyarg,"%d",&num);
      clatoms_info->cp_vlnc_dn[iatm_ind] = num;
    }
    if(atm_dict[15].iuset==1){
     if(strcasecmp(atm_dict[15].keyarg,"yes")==0){
       clatoms_info->cp_atm_flag[iatm_ind] = 1;
     }
     if(strcasecmp(atm_dict[15].keyarg,"no")==0){
       clatoms_info->cp_atm_flag[iatm_ind] = 0;
     }
    }
    isum = 0;
    for(i=1;i<=5;i++){isum+=atm_dict[(i+11)].iuset;}
    if(isum>0){
     set_ghost(ghost_atoms,clatoms_info,atommaps,build_intra,atm_dict,
               num_atm_dict,
               filename,fun_key,iatm_ind);
    }
    itype = atommaps->iatm_atm_typ[iatm_ind + (clatoms_info->natm_tot)];
    if(atm_dict[1].iuset==1){
      itype = atommaps->natm_typ + 1;
      for(i=1;i<=atommaps->natm_typ;i++){
        if(strcasecmp(atm_dict[1].keyarg,atommaps->atm_typ[i])==0)itype=i;
      }
      if(itype>build_intra->natm_typ_max){
        build_intra->natm_typ_max+=100;
        atommaps->atm_typ = (NAME *)
          crealloc(&(atommaps->atm_typ[1]),
                   (build_intra->natm_typ_max)*sizeof(NAME));
      }
      if(itype==atommaps->natm_typ+1){
        atommaps->natm_typ+=1;
        strcpy(atommaps->atm_typ[itype],atm_dict[1].keyarg);
      }
    }
    }
}

canonical_original_code:
void set_atm_morph(struct dict_word *atm_dict, int num_atm_dict, char *fun_key, char *filename, int jmol_typ, struct atommaps *atommaps, struct build_intra *build_intra, struct clatoms_info *clatoms_info, struct ghost_atoms *ghost_atoms)
{
  char site[50];
  int i; int num; int num2; int num3; int imask; int index; int isum; int num1; int num4;
  double dnum;
  int itype; int iatm_ind; int iatm_ind_sm; int iii;
  sscanf(atm_dict[2].keyarg,"%d",&iatm_ind);
  index = 2;
  if((iatm_ind>build_intra->natm_1res_pure_now) || (iatm_ind <1)){
      keyarg_barf(atm_dict,filename,fun_key,index);
  }
  imask = build_intra->mask_atm[iatm_ind];
  if(imask>0){
    iatm_ind = build_intra->index_atm[iatm_ind];
    iatm_ind_sm = iatm_ind;
    iatm_ind = iatm_ind + clatoms_info->natm_tot;
    if(atm_dict[3].iuset==1){
      sscanf(atm_dict[3].keyarg,"%lg",&dnum);
      index = 3;
      if(dnum<=0.0){
        keyarg_barf(atm_dict,filename,fun_key,index);}
        clatoms_info->mass[iatm_ind] = dnum;
    }
    if(atm_dict[4].iuset==1){
      sscanf(atm_dict[4].keyarg,"%lg",&dnum);
      clatoms_info->q[iatm_ind] = dnum;
    }
    if(atm_dict[5].iuset==1){
      sscanf(atm_dict[5].keyarg,"%lg",&dnum);
      if(dnum<0.0){
        keyarg_barf(atm_dict,filename,fun_key,index);}
      clatoms_info->alp_pol[iatm_ind] = dnum;
    }
    if(atm_dict[6].iuset==1){
      sscanf(atm_dict[6].keyarg,"%lg",&dnum);
      clatoms_info->b_neut[iatm_ind] = dnum;
    }
    if(atm_dict[7].iuset==1){
      sscanf(atm_dict[7].keyarg,"%d",&num);
      build_intra->bond_site[iatm_ind_sm].valence = num;
      index = 7;
      if(num<0||num>6){
        keyarg_barf(atm_dict,filename,fun_key,index);
      }
    }
    if(atm_dict[8].iuset==1){
     strcpy(build_intra->strip1,atm_dict[8].keyarg);
     parse_improp(build_intra->strip1,build_intra->strip2,&num1,&num2,&num3,
                                                                      &num4);
     build_intra->bond_site[iatm_ind_sm].improper_ind[1]=num1+1;
     build_intra->bond_site[iatm_ind_sm].improper_ind[2]=num2+1;
     build_intra->bond_site[iatm_ind_sm].improper_ind[3]=num3+1;
     build_intra->bond_site[iatm_ind_sm].improper_ind[4]=num4+1;
     index = 8;
     if((num1+num2+num3+num4)!=0&&(num1+num2+num3+num4)!=6){
       keyarg_barf(atm_dict,filename,fun_key,index);}
     if((num1+num2+num3+num4)==6){
      if(num1<=0||num1>3||num2<=0||num2>3||num3<=0||num3>3||num4<=0||num4>3||
         num1==num2||num1==num3||num2==num3||num1==num4||num2==num4||
         num3==num4){
       keyarg_barf(atm_dict,filename,fun_key,index);}}
    }
    if(atm_dict[9].iuset==1){
      strcpy(build_intra->strip1,atm_dict[9].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[1],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[1] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[1] = num3;
      index = 8;
     if(strlen(site)==0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[10].iuset==1){
      strcpy(build_intra->strip1,atm_dict[10].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[2],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[2] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[2] = num3;
      index = 10;
     if(strlen(site)==0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[11].iuset==1){
      strcpy(build_intra->strip1,atm_dict[11].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[3],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[3] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[3] = num3;
      index = 11;
     if(strlen(site)==0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[12].iuset==1){
      strcpy(build_intra->strip1,atm_dict[12].keyarg);
      parse_bond_site(build_intra->strip1,build_intra->strip2,
                      site,&num2,&num3);
      strcpy(build_intra->bond_site[iatm_ind_sm].bond_site_name[4],site);
      build_intra->bond_site[iatm_ind_sm].branch_1[4] = num2;
      build_intra->bond_site[iatm_ind_sm].branch_2[4] = num3;
      index = 12;
     if(strlen(site)<=0||num2<-1||num3<-1||num2>6||num3>6){
        keyarg_barf(atm_dict,filename,fun_key,index);}
    }
    if(atm_dict[13].iuset==1){
      sscanf(atm_dict[13].keyarg,"%d",&num);
      clatoms_info->cp_vlnc_up[iatm_ind] = num;
    }
    if(atm_dict[14].iuset==1){
      sscanf(atm_dict[14].keyarg,"%d",&num);
      clatoms_info->cp_vlnc_dn[iatm_ind] = num;
    }
    if(atm_dict[15].iuset==1){
     if(strcasecmp(atm_dict[15].keyarg,"yes")==0){
       clatoms_info->cp_atm_flag[iatm_ind] = 1;
     }
     if(strcasecmp(atm_dict[15].keyarg,"no")==0){
       clatoms_info->cp_atm_flag[iatm_ind] = 0;
     }
    }
    isum = 0;
    for(i=1;i<=5;i++){isum+=atm_dict[(i+11)].iuset;}
    if(isum>0){
     set_ghost(ghost_atoms,clatoms_info,atommaps,build_intra,atm_dict,
               num_atm_dict,
               filename,fun_key,iatm_ind);
    }
    itype = atommaps->iatm_atm_typ[iatm_ind + (clatoms_info->natm_tot)];
    if(atm_dict[1].iuset==1){
      itype = atommaps->natm_typ + 1;
      for(i=1;i<=atommaps->natm_typ;i++){
        if(strcasecmp(atm_dict[1].keyarg,atommaps->atm_typ[i])==0)itype=i;
      }
      if(itype>build_intra->natm_typ_max){
        build_intra->natm_typ_max+=100;
        atommaps->atm_typ = (char (*)[50])
          crealloc(&(atommaps->atm_typ[1]),
                   (build_intra->natm_typ_max)*sizeof(NAME));
      }
      if(itype==atommaps->natm_typ+1){
        atommaps->natm_typ+=1;
        strcpy(atommaps->atm_typ[itype],atm_dict[1].keyarg);
      }
    }
    }
}

variable_types: struct dict_word { int iflag; char keyword[50]; char error_mes[100]; } *

variable_types:
filename
char *

variable_types: struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; } *

variable_types: struct build_intra { struct bond_site { char bond_site_name[5][50]; int branch_1[5]; int branch_2[5]; int valence; int improper_ind[5]; } *bond_site; int *mask_atm; int *index_atm; int *iatm_ind_chk; int *ires_ind_chk; int natm_1res_pure_now; int natm_tot_max; int nfreeze_max; int nfreeze_now; int natm_1res_now; int natm_1res_max; int natmind_1res_now; int natmind_1res_max; int nghost_now; int nghost_tot_max; int nbond_pow_max; int nbond_con_max; int nbond_nul_max; int nbond_typ_pow_max; int nbond_typ_con_max; struct CBOND { char atm1[50]; } *cbond_typ_pow; struct CBOND *cbond_typ_con; struct CBOND *cbond_typ_now; int nbend_pow_max; int nbend_con_max; int nbend_nul_max; int nbend_typ_pow_max; int nbend_typ_con_max; struct CBEND { char atm1[50]; } *cbend_typ_pow; struct CBEND *cbend_typ_con; struct CBEND *cbend_typ_now; int ntors_pow_max; int ntors_con_max; int ntors_nul_max; int ntors_typ_pow_max; int ntors_typ_con_max; struct CTORS { char atm1[50]; } *ctors_typ_pow; struct CTORS *ctors_typ_con; struct CTORS *ctors_typ_now; int nonfo_max; int nonfo_nul_max; int nonfo_typ_max; struct CBOND *confo_typ; struct CBOND *confo_typ_now; int nbend_bnd_max; int nbend_bnd_typ_max; struct CBEND *cbend_bnd_typ; struct CBEND *cbend_bnd_typ_now; int ngrp_33_max; int ngrp_watt_33_max; int ngrp_21_max; int ngrp_43_max; int ngrp_23_max; int ngrp_46_max; int ngrp_typ_21_max; int ngrp_typ_43_max; int ngrp_typ_33_max; int ngrp_typ_watt_33_max; int ngrp_typ_23_max; int ngrp_typ_46_max; struct CGRP_CONS { char atm1[50]; } *cgrp_typ_now; struct CGRP_CONS *cgrp_typ_21; struct CGRP_CONS *cgrp_typ_43; struct CGRP_CONS *cgrp_typ_33; struct CGRP_CONS *cgrp_typ_watt_33; struct CGRP_CONS *cgrp_typ_23; struct CGRP_CONS *cgrp_typ_46; int natm_typ_max; int nres_typ_max; char *strip1; int *ibend_bnd_typ_pure; int *ibend_bnd_typ_map; } *

variable_types: struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; } *

variable_types: struct ghost_atoms { int nghost_tot; int natm_comp_max; int nghost_mall; int nghost_old; int ncomp_mall; int ncomp_old; int *ighost_map; int *natm_comp; int **iatm_comp; double **coef; } *

variable_types:
site
char [50]

variable_types: i int

variable_types: num int

variable_types: imask int

variable_types: index int

variable_types: isum int

variable_types: dnum double

variable_types: itype int

user_defined_types: struct build_intra { struct bond_site *bond_site; int *mask_atm; int *index_atm; int *iatm_ind_chk; int *ires_ind_chk; int natm_1res_pure_now; int natm_tot_max; int nfreeze_max; int nfreeze_now; int natm_1res_now; int natm_1res_max; int natmind_1res_now; int natmind_1res_max; int nghost_now; int nghost_tot_max; int nbond_pow_max; int nbond_con_max; int nbond_nul_max; int nbond_typ_pow_max; int nbond_typ_con_max; struct CBOND *cbond_typ_pow; struct CBOND *cbond_typ_con; struct CBOND *cbond_typ_now; int nbend_pow_max; int nbend_con_max; int nbend_nul_max; int nbend_typ_pow_max; int nbend_typ_con_max; struct CBEND *cbend_typ_pow; struct CBEND *cbend_typ_con; struct CBEND *cbend_typ_now; int ntors_pow_max; int ntors_con_max; int ntors_nul_max; int ntors_typ_pow_max; int ntors_typ_con_max; struct CTORS *ctors_typ_pow; struct CTORS *ctors_typ_con; struct CTORS *ctors_typ_now; int nonfo_max; int nonfo_nul_max; int nonfo_typ_max; struct CBOND *confo_typ; struct CBOND *confo_typ_now; int nbend_bnd_max; int nbend_bnd_typ_max; struct CBEND *cbend_bnd_typ; struct CBEND *cbend_bnd_typ_now; int ngrp_33_max; int ngrp_watt_33_max; int ngrp_21_max; int ngrp_43_max; int ngrp_23_max; int ngrp_46_max; int ngrp_typ_21_max; int ngrp_typ_43_max; int ngrp_typ_33_max; int ngrp_typ_watt_33_max; int ngrp_typ_23_max; int ngrp_typ_46_max; struct CGRP_CONS *cgrp_typ_now; struct CGRP_CONS *cgrp_typ_21; struct CGRP_CONS *cgrp_typ_43; struct CGRP_CONS *cgrp_typ_33; struct CGRP_CONS *cgrp_typ_watt_33; struct CGRP_CONS *cgrp_typ_23; struct CGRP_CONS *cgrp_typ_46; int natm_typ_max; int nres_typ_max; char *strip1; int *ibend_bnd_typ_pure; int *ibend_bnd_typ_map; }


repo: TuckermanGroup/PINY

decompiled_code:
void __fastcall box_force_iso(double a1, double a2, __int64 a3, double *a4, double *a5, double *a6, int a7)
{
double v7; // xmm0_8

v7 = a5[1] + a5[5] + a5[9] - a1 * 3.0 * a2;
*a4 = v7;
if ( a7 == 1 )
*a4 = v7 + a6[1] + a6[5] + a6[9];
}

original_code:
void box_force_iso(double *fgmat_p,double *f_lnv_p,double *pvten,
                        double *pvten_inc,
                        double pext, double vol, int iconstrnt)
   {
int iii;
   *f_lnv_p = (pvten[1]+pvten[5]+pvten[9])-3.0*pext*vol;
   if(iconstrnt==1){
      *f_lnv_p += (pvten_inc[1] + pvten_inc[5] + pvten_inc[9]);
   }
}

canonical_original_code:
void box_force_iso(double *fgmat_p, double *f_lnv_p, double *pvten, double *pvten_inc, double pext, double vol, int iconstrnt)
   {
int iii;
   *f_lnv_p = (pvten[1]+pvten[5]+pvten[9])-3.0*pext*vol;
   if(iconstrnt==1){
      *f_lnv_p += (pvten_inc[1] + pvten_inc[5] + pvten_inc[9]);
   }
}

variable_types:
pvten
double *

variable_types: pext double

variable_types: vol double

variable_types: iconstrnt int

variable_types: iii int

return_type: void


original_code:
void box_force_flex(double *fgmat_p, double *pvten,double *pvten_inc,
                    double pext, double stens_ext, int iconstrnt, CELL *cell)
   {
  int i;
  double vol = cell->vol;
  double area = cell->area;
  double *hmat = cell->hmat;
  int iperd = cell->iperd;
  int hmat_cons_typ = cell->hmat_cons_typ;
  int hmat_int_typ = cell->hmat_int_typ;
  area = hmat[1]*hmat[5] - hmat[2]*hmat[4];
  for(i=1;i<=9;i++){fgmat_p[i]=pvten[i];}
  if(iconstrnt==1){for(i=1;i<=9;i++){fgmat_p[i]+=pvten_inc[i];}}
  fgmat_p[1]-= (pext*vol - stens_ext*area);
  fgmat_p[5]-= (pext*vol - stens_ext*area);
  fgmat_p[9]-= (pext*vol - stens_ext*area);
  constr_cell_mat(iperd,hmat_cons_typ,hmat_int_typ,fgmat_p);
   }

canonical_original_code:
void box_force_flex(double *fgmat_p, double *pvten, double *pvten_inc, double pext, double stens_ext, int iconstrnt, struct cell *cell)
   {
  int i;
  double vol = cell->vol;
  double area = cell->area;
  double *hmat = cell->hmat;
  int iperd = cell->iperd;
  int hmat_cons_typ = cell->hmat_cons_typ;
  int hmat_int_typ = cell->hmat_int_typ;
  area = hmat[1]*hmat[5] - hmat[2]*hmat[4];
  for(i=1;i<=9;i++){fgmat_p[i]=pvten[i];}
  if(iconstrnt==1){for(i=1;i<=9;i++){fgmat_p[i]+=pvten_inc[i];}}
  fgmat_p[1]-= (pext*vol - stens_ext*area);
  fgmat_p[5]-= (pext*vol - stens_ext*area);
  fgmat_p[9]-= (pext*vol - stens_ext*area);
  constr_cell_mat(iperd,hmat_cons_typ,hmat_int_typ,fgmat_p);
   }

variable_types: struct cell { int iperd; int intra_perds; int cubic_box_flag; int hmat_int_typ; int hmat_cons_typ; int imov_cp_box; double vol; double vol_cp; double vol0; double area; double alpha_conv_dual; double *hmat; double *hmat_ewd; double *hmat_cp; double *cp_box_center; double *cp_box_center_rel; double *cp_vbox_center; double *cp_fbox_center; } *

variable_types: area double

variable_types:
hmat
double *

variable_types: iperd int


original_code:
void energy_control_final(CLASS *class, BONDED *bonded,
                          GENERAL_DATA *general_data)
   {
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
  int i,iii,igloc,iver_get,ip,iup,j,igo;
  double *fx, *fy, *fz, temp;
  double *fxt, *fyt, *fzt;
  double *fxtemp = class->ewd_scr.x;
  double *fytemp = class->ewd_scr.y;
  double *fztemp = class->ewd_scr.z;
  int nfreeze = class->atommaps.nfreeze;
  int *freeze_map = class->atommaps.freeze_map;
  int pimd_freez_typ = class->atommaps.pimd_freez_typ;
  int nfree = class->clatoms_info.nfree;
  int pi_beads = class->clatoms_info.pi_beads;
  int pi_beads_proc = class->clatoms_info.pi_beads_proc;
  int pi_beads_proc_st= class->clatoms_info.pi_beads_proc_st;
  int *recv_count_atm = class->class_comm_forc_pkg.recv_count_atm;
  int myatm_start = class->clatoms_info.myatm_start;
  int myatm_end = class->clatoms_info.myatm_end;
  int np_beads = class->communicate.np_beads;
  int np_states = class->communicate.np_states;
  int np_tot = class->communicate.np;
  int np_forc = class->communicate.np_forc;
  int myid = class->communicate.myid_forc;
  int myid_state = class->communicate.myid_state;
  int myid_bead = class->communicate.myid_bead;
  int comm_forc = class->communicate.comm_forc;
  int world = class->communicate.world;
  int comm_beads = class->communicate.comm_beads;
  int iget_full_inter = class->energy_ctrl.iget_full_inter;
  int iget_res_inter = class->energy_ctrl.iget_res_inter;
  double *pvten_temp = general_data->ptens.pvten_tmp;
  double *pvten_tot = general_data->ptens.pvten_tot;
  double *pvten = general_data->ptens.pvten;
  double t_ext = general_data->statepoint.t_ext;
  double volume = general_data->cell.vol;
  int hmat_int_typ = general_data->cell.hmat_int_typ;
  int npt_i = general_data->ensopts.npt_i;
  int npt_f = general_data->ensopts.npt_f;
  int pimd_on;
  pimd_on = general_data->simopts.pimd
                        +general_data->simopts.debug_pimd
                        +general_data->simopts.cp_pimd
                        +general_data->simopts.cp_wave_pimd
                        +general_data->simopts.cp_wave_min_pimd
                        +general_data->simopts.debug_cp_pimd;
  ("energy control final");
  iver_get = 0;
  if( (pimd_on==1) && (iget_full_inter==1) ){iver_get = 1;}
  if(iget_full_inter==1){
    general_data->stat_avg.press_kin = (nfree*t_ext)/(3.0*315777.0*volume);
  }
  if(np_tot > 1){
    if((np_beads>1)||((pimd_on==1)&&(np_states>1||np_forc>1))){
      for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
      Allreduce(&(pvten_tot[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,world);
      for(i=1;i<=9;i++){pvten_tot[i] = pvten_temp[i];}
      if(np_states>1||np_forc>1){
        for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
        Allreduce(&(pvten[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,world);
        for(i=1;i<=9;i++){pvten[i] = pvten_temp[i];}
      }else{
        if(myid_state==0){
          for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
          Allreduce(&(pvten[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,
                                                              comm_beads);
          for(i=1;i<=9;i++){pvten[i] = pvten_temp[i];}
        }
      }
    }else{
      if( (np_forc>1) || (np_states>1) ){
        for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
        Allreduce(&(pvten[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,world);
        for(i=1;i<=9;i++){pvten[i] = pvten_temp[i];}
      }
    }
  }
  if(myid_state == 0 || np_forc > 0){
    if(npt_i==1){
     box_force_iso(general_data->par_rahman.fgmat_p,
                 &(general_data->baro.f_lnv_p),
                   general_data->ptens.pvten,general_data->ptens.pvten_inc,
                   general_data->statepoint.pext,general_data->cell.vol,
                   bonded->constrnt.iconstrnt);
    }
    if(npt_f==1){
      box_force_flex(general_data->par_rahman.fgmat_p,
                     general_data->ptens.pvten,general_data->ptens.pvten_inc,
                     general_data->statepoint.pext,
                     general_data->statepoint.stens_ext,
                     bonded->constrnt.iconstrnt,&(general_data->cell));
    }
  }
  if(myid_state == 0 || np_forc > 0){
    for(ip=1;ip<=pi_beads_proc;ip++){
      distrib_ghost_force(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                          &(class->ghost_atoms),iver_get);
    }
  }
  if(myid_state == 0 || np_forc > 1){
    if(nfreeze > 0) {
      iup = 1; igo=0;
      if(pimd_freez_typ==2){iup=pi_beads_proc;igo=1;}
      if(pimd_freez_typ==1 && pi_beads_proc_st==1){igo=1;}
      if(igo==1){
        for(ip=1;ip<=iup;ip++){
          fx = class->clatoms_pos[ip].fx;
          fy = class->clatoms_pos[ip].fy;
          fz = class->clatoms_pos[ip].fz;
          if(pi_beads > 1) {
             fxt = class->clatoms_pos[ip].fxt;
             fyt = class->clatoms_pos[ip].fyt;
             fzt = class->clatoms_pos[ip].fzt;
          }
          for(i=1;i <= nfreeze;i++){
            igloc = freeze_map[i];
            fx[igloc] = 0.0;
            fy[igloc] = 0.0;
            fz[igloc] = 0.0;
            if(pi_beads > 1) {
               fxt[igloc] = 0.0;
               fyt[igloc] = 0.0;
               fzt[igloc] = 0.0;
            }
          }
        }
      }
    }
  }
  if( (iget_full_inter+iget_res_inter)>=1){
    if(np_forc>1&&pimd_on==0){
      for(ip=1;ip<=pi_beads_proc;ip++){
        fx = class->clatoms_pos[ip].fx;
        fy = class->clatoms_pos[ip].fy;
        fz = class->clatoms_pos[ip].fz;
        Reduce_scatter(&fx[1],&fxtemp[myatm_start],&recv_count_atm[1],
                       MPI_DOUBLE,MPI_SUM,comm_forc);
        Reduce_scatter(&fy[1],&fytemp[myatm_start],&recv_count_atm[1],
                       MPI_DOUBLE,MPI_SUM,comm_forc);
        Reduce_scatter(&fz[1],&fztemp[myatm_start],&recv_count_atm[1],
                       MPI_DOUBLE,MPI_SUM,comm_forc);
        for(i=myatm_start;i<=myatm_end;i++){
          fx[i] = fxtemp[i];
          fy[i] = fytemp[i];
          fz[i] = fztemp[i];
        }
      }
    }
  }
  ("energy control final");
   }

canonical_original_code:
void energy_control_final(struct class *class, struct bonded *bonded, struct general_data *general_data)
   {
  int MPI_INT = 1;
  int MPI_DOUBLE = 1;
  int MPI_CHAR = 1;
  int MPI_MAX = 1;
  int MPI_SUM = 1;
  int MPI_ANY_TAG = 1;
  int MPI_ANY_SOURCE = 1;
  int *MPI_BOTTOM = {0};
  int i; int iii; int igloc; int iver_get; int ip; int iup; int j; int igo;
  double *fx; double *fy; double *fz; double temp;
  double *fxt; double *fyt; double *fzt;
  double *fxtemp = class->ewd_scr.x;
  double *fytemp = class->ewd_scr.y;
  double *fztemp = class->ewd_scr.z;
  int nfreeze = class->atommaps.nfreeze;
  int *freeze_map = class->atommaps.freeze_map;
  int pimd_freez_typ = class->atommaps.pimd_freez_typ;
  int nfree = class->clatoms_info.nfree;
  int pi_beads = class->clatoms_info.pi_beads;
  int pi_beads_proc = class->clatoms_info.pi_beads_proc;
  int pi_beads_proc_st = class->clatoms_info.pi_beads_proc_st;
  int *recv_count_atm = class->class_comm_forc_pkg.recv_count_atm;
  int myatm_start = class->clatoms_info.myatm_start;
  int myatm_end = class->clatoms_info.myatm_end;
  int np_beads = class->communicate.np_beads;
  int np_states = class->communicate.np_states;
  int np_tot = class->communicate.np;
  int np_forc = class->communicate.np_forc;
  int myid = class->communicate.myid_forc;
  int myid_state = class->communicate.myid_state;
  int myid_bead = class->communicate.myid_bead;
  int comm_forc = class->communicate.comm_forc;
  int world = class->communicate.world;
  int comm_beads = class->communicate.comm_beads;
  int iget_full_inter = class->energy_ctrl.iget_full_inter;
  int iget_res_inter = class->energy_ctrl.iget_res_inter;
  double *pvten_temp = general_data->ptens.pvten_tmp;
  double *pvten_tot = general_data->ptens.pvten_tot;
  double *pvten = general_data->ptens.pvten;
  double t_ext = general_data->statepoint.t_ext;
  double volume = general_data->cell.vol;
  int hmat_int_typ = general_data->cell.hmat_int_typ;
  int npt_i = general_data->ensopts.npt_i;
  int npt_f = general_data->ensopts.npt_f;
  int pimd_on;
  pimd_on = general_data->simopts.pimd
                        +general_data->simopts.debug_pimd
                        +general_data->simopts.cp_pimd
                        +general_data->simopts.cp_wave_pimd
                        +general_data->simopts.cp_wave_min_pimd
                        +general_data->simopts.debug_cp_pimd;
  ("energy control final");
  iver_get = 0;
  if( (pimd_on==1) && (iget_full_inter==1) ){iver_get = 1;}
  if(iget_full_inter==1){
    general_data->stat_avg.press_kin = (nfree*t_ext)/(3.0*315777.0*volume);
  }
  if(np_tot > 1){
    if((np_beads>1)||((pimd_on==1)&&(np_states>1||np_forc>1))){
      for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
      Allreduce(&(pvten_tot[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,world);
      for(i=1;i<=9;i++){pvten_tot[i] = pvten_temp[i];}
      if(np_states>1||np_forc>1){
        for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
        Allreduce(&(pvten[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,world);
        for(i=1;i<=9;i++){pvten[i] = pvten_temp[i];}
      }else{
        if(myid_state==0){
          for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
          Allreduce(&(pvten[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,
                                                              comm_beads);
          for(i=1;i<=9;i++){pvten[i] = pvten_temp[i];}
        }
      }
    }else{
      if( (np_forc>1) || (np_states>1) ){
        for(i=1;i<=9;i++){pvten_temp[i]=0.0;}
        Allreduce(&(pvten[1]),&(pvten_temp[1]),9,MPI_DOUBLE,MPI_SUM,0,world);
        for(i=1;i<=9;i++){pvten[i] = pvten_temp[i];}
      }
    }
  }
  if(myid_state == 0 || np_forc > 0){
    if(npt_i==1){
     box_force_iso(general_data->par_rahman.fgmat_p,
                 &(general_data->baro.f_lnv_p),
                   general_data->ptens.pvten,general_data->ptens.pvten_inc,
                   general_data->statepoint.pext,general_data->cell.vol,
                   bonded->constrnt.iconstrnt);
    }
    if(npt_f==1){
      box_force_flex(general_data->par_rahman.fgmat_p,
                     general_data->ptens.pvten,general_data->ptens.pvten_inc,
                     general_data->statepoint.pext,
                     general_data->statepoint.stens_ext,
                     bonded->constrnt.iconstrnt,&(general_data->cell));
    }
  }
  if(myid_state == 0 || np_forc > 0){
    for(ip=1;ip<=pi_beads_proc;ip++){
      distrib_ghost_force(&(class->clatoms_info),&(class->clatoms_pos[ip]),
                          &(class->ghost_atoms),iver_get);
    }
  }
  if(myid_state == 0 || np_forc > 1){
    if(nfreeze > 0) {
      iup = 1; igo=0;
      if(pimd_freez_typ==2){iup=pi_beads_proc;igo=1;}
      if(pimd_freez_typ==1 && pi_beads_proc_st==1){igo=1;}
      if(igo==1){
        for(ip=1;ip<=iup;ip++){
          fx = class->clatoms_pos[ip].fx;
          fy = class->clatoms_pos[ip].fy;
          fz = class->clatoms_pos[ip].fz;
          if(pi_beads > 1) {
             fxt = class->clatoms_pos[ip].fxt;
             fyt = class->clatoms_pos[ip].fyt;
             fzt = class->clatoms_pos[ip].fzt;
          }
          for(i=1;i <= nfreeze;i++){
            igloc = freeze_map[i];
            fx[igloc] = 0.0;
            fy[igloc] = 0.0;
            fz[igloc] = 0.0;
            if(pi_beads > 1) {
               fxt[igloc] = 0.0;
               fyt[igloc] = 0.0;
               fzt[igloc] = 0.0;
            }
          }
        }
      }
    }
  }
  if( (iget_full_inter+iget_res_inter)>=1){
    if(np_forc>1&&pimd_on==0){
      for(ip=1;ip<=pi_beads_proc;ip++){
        fx = class->clatoms_pos[ip].fx;
        fy = class->clatoms_pos[ip].fy;
        fz = class->clatoms_pos[ip].fz;
        Reduce_scatter(&fx[1],&fxtemp[myatm_start],&recv_count_atm[1],
                       MPI_DOUBLE,MPI_SUM,comm_forc);
        Reduce_scatter(&fy[1],&fytemp[myatm_start],&recv_count_atm[1],
                       MPI_DOUBLE,MPI_SUM,comm_forc);
        Reduce_scatter(&fz[1],&fztemp[myatm_start],&recv_count_atm[1],
                       MPI_DOUBLE,MPI_SUM,comm_forc);
        for(i=myatm_start;i<=myatm_end;i++){
          fx[i] = fxtemp[i];
          fy[i] = fytemp[i];
          fz[i] = fztemp[i];
        }
      }
    }
  }
  ("energy control final");
   }

variable_types: struct class { struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; } clatoms_info; struct clatoms_tran { int pi_beads_proc; int pi_atm_proc; int pi_atm_proc_use; int pi_proc_rem; int nwork; int *sendcounts; int *senddspls; int *ifax; double *rat1_stag; double *path_eig; double *work; double *work3; double *x_trans; double *x_temp; double *xt_temp; } clatoms_tran; struct clatoms_pos { double *mass; double *x; double *vx; double *fx; double *fxt; double *fxm; double *hess_xx; } *clatoms_pos; struct ghost_atoms { int nghost_tot; int natm_comp_max; int nghost_mall; int nghost_old; int ncomp_mall; int ncomp_old; int *ighost_map; int *natm_comp; int **iatm_comp; double **coef; } ghost_atoms; struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; } atommaps; struct therm_info { int num_nhc; int len_nhc; int nres_nhc; int nyosh_nhc; int therm_typ; int num_nhc_proc; int num_nhc_share; int mytherm_start; double dt_nhc; int *inhc_x; int *itherm_nshare; double *ditherm_nshare_i; int *map_share; double *text_nhc; double *wdti; double **mass_nhc; } therm_info_class; struct therm_info therm_info_bead; struct therm_pos { double **x_nhc; double x_nhc_tot; } therm_class; struct therm_pos *therm_bead; struct vel_samp_class { int ivel_smpl_on; int ivel_scale_on; int nvx_smpl; int nvx_scale; int nvnhc_smpl; int iseed; double qseed; } vel_samp_class; struct energy_ctrl { int pme_on; int int_res_ter; int isep_vvdw; int iswit_vdw; int block_std_on; int iget_pe_real_inter_freq; int iget_pe_real_inter; int itime; int iget_full_inter; int iget_full_intra; int iget_full_pimd; } energy_ctrl; struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist { int iver_init; int iver_fill; int nolst_ver_update; int jver_pad; int nmem_min_lst; int nver_lst; int nver_lst_res; int nver_lst_now; int nver_lst_now_res; int *nter; int *jter; int *jver_off; int *nter_res; int *jter_res; int *jver_off_res; double mem_safe; } verlist; struct lnklist { int ilnk_init; int lnk_for_odd; int ncell_div_avg; int lnk_excl_safe; int lnk_vol_safe; int ncell_a; int natm_cell_max; int lnk_list_dim; int nshft_lnk; int nshft_lnk_res; double vol_lnk_map; double rcut_max; int *lnk_list; int *ishft_a; int *iexl_chk; int *ishft_a_res; int *iexl_chk_res; int *natm_cell; double *shft_wght; double *shft_wght_res; double *hmat_lnk; } lnklist; struct brnch_root { int nbrnch_tot; int nroot_tot; int natm_add_tot; int nbrnch_root_max; double brnch_root_dist_max; double cutdif_min_brnch_root; double cutdif_min_brnch_brnch; double cutdif_min_brnch_root_res; double cutdif_min_brnch_brnch_res; double r2_nocheck_dist; double r2_nocheck_dist_res; double cutskin_bb_min; double cutskin_bb_min_res; int *brnch_atm_list; int *brnch_atm_root; int *root_atm_list; int *root_atm_map; int *brnch_atm_map; int *nbrnch_of_root_big; int *nbrnch_of_root; int **ibrnch_of_root; int *natm_add; int *iatm_add; int *iatm_add_off; } brnch_root; } nbr_list; struct interact { int nsplin; int iswit_vdw; int dielectric_opt; int ishave_opt; int nter_typ; int nsplin_tot; int ninter_mall; int nsplin_mall_tot; int *inter_map_index; double dielectric_rheal; double dielectric_cut; double dielectric_eps; double brnch_root_skin; double skin; double brnch_root_cut; double rheal_res; double pten_inter_guess; double pten_kin_guess; double clong; double clong_res; double spread_now; double spread_lnk; double brnch_root_skin_lnk; double cutoff_max; double *cutoff; double *cutoff_res; double *cutti; double *cutskin; double *cutskin_res; double *cutskin_root; double *cutskin_root_res; double *vcut_coul; double *rmin_spl; double *dr_spl; double *cv0; double *cdv0; double *cv0_c; double *cdv0_c; } interact; struct int_scr { double v_lnv; double *x; double *vx; double *gx; double **x_nhc; double *vgmat; double *x_vol_nhc; double *sc; double *sc_temp; double *atm_kin; double *step_up; struct therm_scr { double *sc; double *atm_kin; } *therm_scr; } int_scr; struct ewd_scr { double *q; double *x; double *fx; double *heli; double *cossc; double *fx2; double *temp; double *helr_now; } ewd_scr; struct for_scr { int nlen; int nsplin_t; int num_brk; int intact; double wght_lnk; double wght_ter; double wght_ter_res; double wght_tra; double wght_tra_res; double wght_pimd; int *j_indext; int *i_indext2; int *j_lnk; int *j_index; int *num_brk_i; int *iexcl; int *index_atm; } for_scr; double tot_memory; struct part_mesh { int pme_on; int kmax_pme; int n_interp; int pme_res_on; int kmax_pme_res; int n_interp_res; int pme_para_opt; int nlen_pme; int nktot_pme; int ngrid_a; int nktot_pme_res; int ngrid_a_res; int ninterp_mall; int ninterp_tot_mall; int *iatemp; int *nc; int **igrid_a; int **igrid_now; double ecut; double ecut_res; double *bweight_tot_res; double *bweight_tot; double *qgrid; double *qgrid_scr; double *qgrid_tmp_real; double *qgrid_tmp_imag; double *frac_a; double *aj; double **ua; double **mn_a; double **dmn_a; double **qgrid_now; } part_mesh; struct surface { int isurf_on; int natm_typ; int nsplin_surf; int nsplin_tot; double zheal; double surface_height; double *surface_pot; double *surface_forc; double *zcut_off; double *dz_spl; double *dzi_spl; double *zmin_spl; char surface_type[50]; } surface; struct communicate { int np_beads; int myid; int myid_bead_forc; int myid_bead; int myid_bead_prime; int myid_state; int myid_forc; int myid_forc_source; int myid_forc_target; int world; int comm_beads; int comm_beads_forc; int comm_states; int comm_forc; int comm_forc_source; int comm_forc_target; int comm_faux; } communicate; struct class_comm_forc_pkg { int num_proc; int myid; int myatm_start; int mytherm_start; int *displs_atm; int *displs_therm; int comm; int world; double dbl_num_proc; struct class_plimpton_ind { int num_proc_source; int num_proc_target; int myid_source; int myid_target; int natoms_tot; int *index_src; int *index_src_even; int *index_src_odd; int *index_trg; int *index_trg_even; int *index_trg_odd; int *displs_atm_trg; int *displs_atm_src; int *src_odd_end; int *src_even_end; int *trg_odd_end; int *trg_even_end; int *src_odd_begin; int *src_even_begin; int *trg_odd_begin; int *trg_even_begin; int my_src_odd_counts; int my_src_even_counts; int my_trg_odd_counts; int my_trg_even_counts; int *my_src_odd; int *my_src_even; int *my_trg_odd; int *my_trg_even; int **jmax; int *jmin; int **imax; int source; int target; } plimpton_ind; } class_comm_forc_pkg; } *

variable_types: struct bonded { struct bond { int npow; int ntyp_pow; int ncon; int ntyp_con; int nbond_pow_mall; int nbond_typ_pow_mall; int nbond_con_mall; int nbond_typ_con_mall; int block_pow_on; int ncon_tot; int ncon_max; int nblock_pow; int nblock_con; int *j1_pow; int *jtyp_pow; int *j1_con; int *jtyp_con; int *iblock_pow_size; int *iblock_pow_conflict_1; int *iblock_con_size; int *iblock_con_conflict_1; double *eq_pow; double *eq_pow_res; double *c_0; double *dc_0; double *al_con; double *eq_con; } bond; struct grp_bond_con { int num_33; int num_21; int num_43; int ntyp_33; int num_23; int ntyp_23; int num_46; int ntyp_46; int max_iter; int ngrp_21_mall; int ngrp_33_mall; int ngrp_43_mall; int ngrp_23_mall; int ngrp_46_mall; int ngrp_typ_21_mall; int ngrp_typ_33_mall; int ngrp_typ_43_mall; int ngrp_typ_23_mall; int ngrp_typ_46_mall; int num_21_tot; double tol; int *j1_33; int *j1_21; int *j2_43; int *jtyp_33; int *j1_23; int *jtyp_23; int *j1_46; int *jtyp_46; double **al_33; double **al_23; double **al_21; double **eq_21; double **al_46; int ncons_gather_tot; int ncons_gather; int ncons_gather_max; int *ind_gather_fwd; int *ind_gather_bck; int *ind_gather_scr; } grp_bond_con; struct grp_bond_watts { int num_33; int num_33_tot; int ntyp_33; int ngrp_33_mall; int ngrp_typ_33_mall; int *j1_33; int *jtyp_33; double *cos_thet0_2; double **eq_33; double **c_0_33; double **c_4_33; double **dc_0_33; double **dc_4_33; } grp_bond_watts; struct constrnt { int iconstrnt; int iroll; int max_iter; double tolshake; double tolratl; } constrnt; struct bond_free { int num; int j1; int npow; int nhist; double fk; double eq; double del; double rmin; double rmax; char *file; double *hist; } bond_free; struct bend { int npow; int ntyp_pow; int ncon; int ntyp_con; int nbend_pow_mall; int nbend_typ_pow_mall; int nbend_con_mall; int nbend_typ_con_mall; int block_pow_on; int ncon_tot; int nblock_pow; int nblock_con; int *j1_pow; int *jtyp_pow; int *j1_con; int *jtyp_con; int *iblock_pow_size; int *iblock_pow_conflict_1; int *iblock_pow_conflict_3; int *iblock_con_size; int *iblock_con_conflict_1; int *iblock_con_conflict_3; double *eq_pow; double *c_0; double *s_0; double *dc_0; double *ds_0; double *al_con; double *eq_con; } bend; struct bend_free { int num; int j1; int npow; int nhist; double fk; double eq; double del; char *file; double *hist; } bend_free; struct bend_bnd { int num; int ntyp; int nbend_bnd_mall; int nbend_bnd_typ_mall; int block_on; int nblock; int *j1; int *jtyp; int *iblock_size; int *iblock_conflict_1; int *iblock_conflict_3; double *eq_bond; double *eq_bend; double *cbond_0; double *dcbond_0; double *cbend_0; double *sbend_0; double *dcbend_0; double *dsbend_0; } bend_bnd; struct tors { int npow; int ntyp_pow; int nimpr; int ncon; int ntyp_con; int ntors_pow_mall; int ntors_typ_pow_mall; int ntors_con_mall; int ntors_typ_con_mall; int block_pow_on; int block_con_on; int ncon_tot; int nblock_pow; int nblock_con; int *j1_pow; int *jtyp_pow; int *j1_con; int *jtyp_con; int *iblock_pow_size; int *iblock_pow_conflict_1; int *iblock_pow_conflict_3; int *iblock_con_size; int *iblock_con_conflict_1; int *iblock_con_conflict_3; double *c_0; double *s_0; double *dc_0; double *ds_0; double *eq_pow; double *al_con; double *eq_con; } tors; struct tors_free { int num; int npow; int nhist; int j1[3]; double fk; double eq[3]; double del; char *file; double *hist; double **hist_2d; } tors_free; struct rbar_sig_free { int nfree; int nhist_bar; int iopt; int *j1; double fk_bar; double fk_sigma; double eq_bar; double eq_sigma; double del_bar; double rmin; double smin; double rnfree; double **hist; double **hist_rn; char *file; } rbar_sig_free; struct onfo { int num; int ntyp; int nonfo_mall; int nonfo_typ_mall; int block_on; int nblock; int *j1; int *jtyp; int *iblock_size; int *iblock_conflict_1; double *feps; double *s6; double *sc; } onfo; struct ecor { int nsplin; int num; int block_on; int nblock; int nktot_res; int necor_mall; double alp_ewd; double ecut; double rmin_spl; double rmax_spl; double dr_spl; int *j1; int *iblock_size; int *iblock_conflict_1; double *cv0; } ecor; struct excl { int nlst; int nlst_root; int num_cp; int *num; int *j; int *j_off; int *j1_cp; } excl; struct intra_scr { int nlen; double wght_ter; double wght_ter_res; double wght_tra; double wght_tra_res; double int_res_inter; int *iatm_typ; int *jatm_typ; double *vpot; double *p11; double *p21; double *p31; double *x1; double *x2; double *x3; double *x4; double *x5; double *x6; double *x7; double *x8; double *fx1; double *fx2; double *fx3; double *fx4; double *dx12; double *dx13; double *dx23; double *dx42; double *dx43; double *dx56; double *dx57; double *dx67; double *dx86; double *dx87; double *c_0; double *dc_0; double *ds_0; double *s_0; double *eq; double *m1; double *vx1; double *vx2; double *sc_1; double *sc; double *q1; double *rmin; double *dri; double *vcut_coul; double *del_r; double *swit; double *cutoff_res; } intra_scr; } *

variable_types: struct general_data { struct simopts { int md; int pimd; int minimize; int cp; int cp_pimd; int cp_wave; int cp_wave_pimd; int cp_wave_min_pimd; int cp_min; int cp_wave_min; int debug; int debug_pimd; int debug_cp; int debug_cp_pimd; int pi_beads; int pi_md_typ; int initial_spread_opt; int anneal_opt; double ann_rate; double ann_start_temp; double ann_target_temp; } simopts; struct minopts { int min_std; int min_cg; int min_diis; int diis_hist_len; int cp_min_std; int cp_min_cg; int cp_min_diis; int cp_diis_hist_len; int cp_cg_line_min_len; int min_atm_com_fix_opt; double tol_coef; double tol_atom; } minopts; struct ensopts { int nve; } ensopts; struct filenames { char *iname; char *dname; char *dnamec; char *cpname; char *ksname; char *elfname; char *cvname; char *ccname; char *cpparname; char *centname; char *forcename; int low_lim_par; int high_lim_par; int iwrite_screen; int iwrite_inst; int iwrite_dump; int iwrite_kseigs; int iwrite_confv; int iwrite_confp; int iwrite_par_confp; int iwrite_confc; int iwrite_path_cent; int ifile_open; int iwrite_conf_binary; int iwrite_units; int iwrite_atm_for; int iwrite_elf; } filenames; struct statepoint { double pext; } statepoint; struct cell { int iperd; int intra_perds; int cubic_box_flag; int hmat_int_typ; int hmat_cons_typ; int imov_cp_box; double vol; double vol_cp; double vol0; double area; double alpha_conv_dual; double *hmat; double *hmat_ewd; double *hmat_cp; double *cp_box_center; double *cp_box_center_rel; double *cp_vbox_center; double *cp_fbox_center; } cell; struct timeinfo { int ntime; int ix_respa; int int_res_ter; int nres_ter; int int_res_tor; int int_res_pimd; int iget_pe_real_inter_freq; int exit_flag; double dt; } timeinfo; struct baro { int len_nhc; double x_lnv; double v_lnv_glob; double v_lnv_g; double f_lnv_p; double vol; double mass_lnv; double c2_lnv; double roll_scv; double roll_scg; double roll_scg0; double x_lnv_o; double v_lnv_g_wght; double area; double *x_vol_nhc; double *f_vol_nhc; double *hmato; } baro; struct par_rahman { double vol; double mass_hm; double c1_hm; double roll_scg; double roll_scg0; double area; double *vgmat; double *vgmat_glob; double *fgmat_p; double *roll_mtv; double *roll_mtvv; double *vtemps; double *vexpdt; double *vtempx; double *hmat_t; double *fv1; double *vgmat_g_wght; } par_rahman; struct ptens { double *tvten; double *pvten; double *pvten_inc; double *pvten_tmp_res; double *pvten_inc_t1; double *pvten_inc_a; double *pvten_inc_old; double *count_inc; double *pvten_inc_glob; double *pvten_mode; } ptens; struct stat_avg { int nexclt; int iter_shake; int iswit_vdw; int itime_update; int iter_shake_cp; int write_cp_atm_flag; double vintert; double vintrat; double vsurft; double vbondt; double vbend_bndt; double vbend_bnd_bond; double vbondt_watts; double vreal; double vvdw; double vlong; double vbond_free; double vbar_free; double kinet; double kinet_v; double vol; double kinet_nhc; double kinet_nhc_bead; double aikinet_nhc_bead; double akinet_nhc_bead; double vpot_v; double vpotnhc; double aiter_shake; double iter_23; double aiter_23; double aiter_21; double iter_23r; double aiter_23r; double aiter_21r; double acella; double aicella; double acellab; double aicellab; double apress; double press_inter; double apress_inter; double apress_intra; double press_kin; double apress_kin; double econv0; double cp_kconv0; double cpu1; double updates; double kinet_cp_up; double kinet_cp_dn; double kinet_cp; double kinet_nhc_cp; double vpotnhc_cp; double cp_ehart; double cp_eext; double cp_exc; double cp_muxc; double cp_eke; double cp_enl; double aiter_shake_cp; double maxfc; double pi_ke_prim; double api_ke_prim; double aipi_ke_prim; double kin_harm; double *apten; double fc_mag_up; double fc_max_up; double fatm_max; double count_diag_srot; double econv_now; double isokconv; } stat_avg; struct ewald { int nsplin_g; int nktot; int nktot_res; int nktot_mall; int nktot_res_mall; int nkc_max; int nkb_max; double alp_ewd; double self_erf; double ecut; double ecut_clus; double alp_clus; double gs_max; int *kastr; int *ibrk1; int *kastr_res; int *ibrk1_res; double *clus_corr_r; double *clus_corr_r_res; double *cvgs_2d0; double *vgc_1d_y; } ewald; struct para_fft_pkg3d { int nktot; int ncoef_use; int nfft_size; int nfft; int igeneric_opt; int scale_opt; int len_ifax; int nwork1; double ecut; int comm; int num_proc; int *map_proc; int *recv_counts_rho; int *recv_counts_coef; int *map_pme_dn; int *recvcounts_pme_dn; int *sendcounts_pme_dn; int *map_pme_up; int *recvcounts_pme_up; int *sendcounts_pme_up; int ndata_kc; int nkf3; int str_fft_kc_proc; int ska_fft_kc_proc; int skb_fft_kc_proc; int *sendcounts_fft_kc; int *recvcounts_fft_kc; int *sum_fft_kc_proc; int nka_fft_kc; int *ka_fft_kc; int *ifax_c_f; double *work_1c_f; double *work_1c_r; int ndata_kb; int nkf2; int str_fft_kb_proc; int ska_fft_kb_proc; int skc_fft_kb_proc; int *ska_fft_kb_proc_all; int *skc_fft_kb_proc_all; int *sendcounts_fft_kb; int *recvcounts_fft_kb; int *sum_fft_kb_proc; int *ifax_b_f; double *work_1b_f; double *work_1b_r; int ndata_ka; int nkf1; int str_fft_ka_proc; int skb_fft_ka_proc; int skc_fft_ka_proc; int *skb_fft_ka_proc_all; int *skc_fft_ka_proc_all; int *sendcounts_fft_ka; int *recvcounts_fft_ka; int *ifax_a_f; double *work_1a_f; double *work_1a_r; int *send_counts_row_big_small; int *recv_counts_row_big_small; int *sdispls_row_big_small; int *rdispls_row_big_small; int *send_counts_dual_map; int *recv_counts_dual_map; int *sdispls_dual_map; int *rdispls_dual_map; int *send_counts_row_big_small_upack; int *recv_counts_row_big_small_upack; int *sdispls_row_big_small_upack; int *rdispls_row_big_small_upack; int *send_counts_dual_map_upack; int *recv_counts_dual_map_upack; int *sdispls_dual_map_upack; int *rdispls_dual_map_upack; int *send_counts_ioff_big_small; int *recv_counts_ioff_big_small; int *sdispls_ioff_big_small; int *rdispls_ioff_big_small; } pme_fft_pkg; struct para_fft_pkg3d pme_res_fft_pkg; int error_check_on; } *

variable_types: igloc int

variable_types: ip int

variable_types: iup int

variable_types: j int

variable_types: igo int

variable_types:
fx
double *

variable_types:
fy
double *

variable_types:
fz
double *

variable_types: temp double

variable_types:
fxt
double *

variable_types:
fyt
double *

variable_types:
fzt
double *

variable_types:
fxtemp
double *

variable_types:
fytemp
double *

variable_types:
fztemp
double *

variable_types: nfreeze int

variable_types: nfree int

variable_types: myid int

variable_types: world int

variable_types: volume double

user_defined_types: struct class { struct clatoms_info clatoms_info; struct clatoms_tran clatoms_tran; struct clatoms_pos *clatoms_pos; struct ghost_atoms ghost_atoms; struct atommaps atommaps; struct therm_info therm_info_class; struct therm_info therm_info_bead; struct therm_pos therm_class; struct therm_pos *therm_bead; struct vel_samp_class vel_samp_class; struct energy_ctrl energy_ctrl; struct nbr_list nbr_list; struct interact interact; struct int_scr int_scr; struct ewd_scr ewd_scr; struct for_scr for_scr; double tot_memory; struct part_mesh part_mesh; struct surface surface; struct communicate communicate; struct class_comm_forc_pkg class_comm_forc_pkg; }

user_defined_types: struct bonded { struct bond bond; struct grp_bond_con grp_bond_con; struct grp_bond_watts grp_bond_watts; struct constrnt constrnt; struct bond_free bond_free; struct bend bend; struct bend_free bend_free; struct bend_bnd bend_bnd; struct tors tors; struct tors_free tors_free; struct rbar_sig_free rbar_sig_free; struct onfo onfo; struct ecor ecor; struct excl excl; struct intra_scr intra_scr; }

user_defined_types: struct general_data { struct simopts simopts; struct minopts minopts; struct ensopts ensopts; struct filenames filenames; struct statepoint statepoint; struct cell cell; struct timeinfo timeinfo; struct baro baro; struct par_rahman par_rahman; struct ptens ptens; struct stat_avg stat_avg; struct ewald ewald; struct para_fft_pkg3d pme_fft_pkg; struct para_fft_pkg3d pme_res_fft_pkg; int error_check_on; }

user_defined_types: struct nbr_list { int iver; int ilnk; int nolst; int brnch_root_list_opt; double *x0; struct verlist verlist; struct lnklist lnklist; struct brnch_root brnch_root; }

user_defined_types: struct int_scr { double v_lnv; double *x; double *vx; double *gx; double **x_nhc; double *vgmat; double *x_vol_nhc; double *sc; double *sc_temp; double *atm_kin; double *step_up; struct therm_scr *therm_scr; }

user_defined_types: struct class_comm_forc_pkg { int num_proc; int myid; int myatm_start; int mytherm_start; int *displs_atm; int *displs_therm; int comm; int world; double dbl_num_proc; struct class_plimpton_ind plimpton_ind; }


original_code:
void set_ghost(GHOST_ATOMS *ghost_atoms,CLATOMS_INFO *clatoms_info,
               ATOMMAPS *atommaps,
               BUILD_INTRA *build_intra,DICT_WORD *atm_dict,
               int num_atm_dict,
               char *filename,char *fun_key,int iatm_ind)
{
   int nstrip=5,imask;
   int numg[6],index,i;
   double anumg[6];
   int nghost_old,ncomp_old,nghost;
   int nghost_new,ncomp_new,ncomp,iii;
   ncomp = 0;index=16;
   for(i=1;i<=nstrip;i++){
     if(atm_dict[index].iuset==0){break;}
      ncomp = i;
      strcpy(build_intra->strip1,atm_dict[index].keyarg);
      parse_ghost(build_intra->strip1,build_intra->strip2,&numg[i],&anumg[i]);
      index++;
   }
   index = 16;
   for(i=1;i<=ncomp;i++){
      if((numg[i]<=0)||(numg[i]>build_intra->natmind_1res_now)){
                     keyarg_barf(atm_dict,filename,fun_key,index);}
      imask = build_intra->mask_atm[numg[i]];
      if(imask==0){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have managed to nuke one of the atoms making \n");
        printf("up a ghost atom without nuking the ghost atom, \n");
        printf("itself, in residue file  %s\n",filename);
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
      }
      numg[i] = build_intra->index_atm[numg[i]];
      if(numg[i]>build_intra->natm_1res_now||numg[i]<0){
             keyarg_barf(atm_dict,filename,fun_key,index);}
      numg[i] += clatoms_info->natm_tot;
      index++;
   }
   if(ncomp>0){
       ghost_atoms->nghost_tot++;
       build_intra->nghost_now++;
       nghost = ghost_atoms->nghost_tot;
       if(nghost > build_intra->nghost_tot_max){
           nghost_old = build_intra->nghost_tot_max;
           ncomp_old = 5;
           build_intra->nghost_tot_max+=100;
           nghost_new = build_intra->nghost_tot_max;
           ncomp_new = 5;
           ghost_atoms->ighost_map = (int *) crealloc(
                                     &(ghost_atoms->ighost_map)[1],
                                       nghost_new*sizeof(int))-1;
           ghost_atoms->natm_comp = (int *) crealloc(
                                     &(ghost_atoms->natm_comp)[1],
                                       nghost_new*sizeof(int))-1;
           ghost_atoms->ighost_map = (int *) crealloc(
                                   &(ghost_atoms->ighost_map)[1],
                                     nghost_new*sizeof(int))-1;
           ghost_atoms->iatm_comp = creall_int_mat(ghost_atoms->iatm_comp,
                                                    1,ncomp_old,1,nghost_old,
                                                    1,ncomp_new,1,nghost_new);
           ghost_atoms->coef = creall_mat(ghost_atoms->coef,
                                                1,ncomp_old,1,nghost_old,
                                                1,ncomp_new,1,nghost_new);
        }
   }
   if(ncomp>5){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have managed to use too many ghost_defs!!!\n");
        printf("Technical support was too tired to do the  \n");
        printf("heinous work necessary to support an arbitray number.\n");
        printf("Wait for the next upgrade you power tool.      \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
   }
   if(ncomp>0){
     atommaps->ighost_flag[iatm_ind] = nghost;
     ghost_atoms->natm_comp_max = (((ghost_atoms->natm_comp_max)>(ncomp))?(ghost_atoms->natm_comp_max):(ncomp));
     ghost_atoms->ighost_map[nghost] = iatm_ind;
     ghost_atoms->natm_comp[nghost] = ncomp;
     for(i=1;i<=ncomp;i++){
       ghost_atoms->iatm_comp[i][nghost] = numg[i];
       ghost_atoms->coef[i][nghost] = anumg[i];
     }
   }
}

canonical_original_code:
void set_ghost(struct ghost_atoms *ghost_atoms, struct clatoms_info *clatoms_info, struct atommaps *atommaps, struct build_intra *build_intra, struct dict_word *atm_dict, int num_atm_dict, char *filename, char *fun_key, int iatm_ind)
{
   int nstrip = 5; int imask;
   int numg[6]; int index; int i;
   double anumg[6];
   int nghost_old; int ncomp_old; int nghost;
   int nghost_new; int ncomp_new; int ncomp; int iii;
   ncomp = 0;index=16;
   for(i=1;i<=nstrip;i++){
     if(atm_dict[index].iuset==0){break;}
      ncomp = i;
      strcpy(build_intra->strip1,atm_dict[index].keyarg);
      parse_ghost(build_intra->strip1,build_intra->strip2,&numg[i],&anumg[i]);
      index++;
   }
   index = 16;
   for(i=1;i<=ncomp;i++){
      if((numg[i]<=0)||(numg[i]>build_intra->natmind_1res_now)){
                     keyarg_barf(atm_dict,filename,fun_key,index);}
      imask = build_intra->mask_atm[numg[i]];
      if(imask==0){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have managed to nuke one of the atoms making \n");
        printf("up a ghost atom without nuking the ghost atom, \n");
        printf("itself, in residue file  %s\n",filename);
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
      }
      numg[i] = build_intra->index_atm[numg[i]];
      if(numg[i]>build_intra->natm_1res_now||numg[i]<0){
             keyarg_barf(atm_dict,filename,fun_key,index);}
      numg[i] += clatoms_info->natm_tot;
      index++;
   }
   if(ncomp>0){
       ghost_atoms->nghost_tot++;
       build_intra->nghost_now++;
       nghost = ghost_atoms->nghost_tot;
       if(nghost > build_intra->nghost_tot_max){
           nghost_old = build_intra->nghost_tot_max;
           ncomp_old = 5;
           build_intra->nghost_tot_max+=100;
           nghost_new = build_intra->nghost_tot_max;
           ncomp_new = 5;
           ghost_atoms->ighost_map = (int *) crealloc(
                                     &(ghost_atoms->ighost_map)[1],
                                       nghost_new*sizeof(int))-1;
           ghost_atoms->natm_comp = (int *) crealloc(
                                     &(ghost_atoms->natm_comp)[1],
                                       nghost_new*sizeof(int))-1;
           ghost_atoms->ighost_map = (int *) crealloc(
                                   &(ghost_atoms->ighost_map)[1],
                                     nghost_new*sizeof(int))-1;
           ghost_atoms->iatm_comp = creall_int_mat(ghost_atoms->iatm_comp,
                                                    1,ncomp_old,1,nghost_old,
                                                    1,ncomp_new,1,nghost_new);
           ghost_atoms->coef = creall_mat(ghost_atoms->coef,
                                                1,ncomp_old,1,nghost_old,
                                                1,ncomp_new,1,nghost_new);
        }
   }
   if(ncomp>5){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("You have managed to use too many ghost_defs!!!\n");
        printf("Technical support was too tired to do the  \n");
        printf("heinous work necessary to support an arbitray number.\n");
        printf("Wait for the next upgrade you power tool.      \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
   }
   if(ncomp>0){
     atommaps->ighost_flag[iatm_ind] = nghost;
     ghost_atoms->natm_comp_max = (((ghost_atoms->natm_comp_max)>(ncomp))?(ghost_atoms->natm_comp_max):(ncomp));
     ghost_atoms->ighost_map[nghost] = iatm_ind;
     ghost_atoms->natm_comp[nghost] = ncomp;
     for(i=1;i<=ncomp;i++){
       ghost_atoms->iatm_comp[i][nghost] = numg[i];
       ghost_atoms->coef[i][nghost] = anumg[i];
     }
   }
}

variable_types: struct ghost_atoms { int nghost_tot; int natm_comp_max; int nghost_mall; int nghost_old; int ncomp_mall; int ncomp_old; int *ighost_map; int *natm_comp; int **iatm_comp; double **coef; } *

variable_types: struct clatoms_info { int natm_tot; int pi_beads; int pi_beads_proc; int pi_beads_proc_st; int pi_beads_proc_end; int nfree; int nfree_pimd; int nchrg; int pi_beads_full_ter; int pi_beads_res_ter; int pi_beads_full_tra; int pi_beads_res_tra; int cg_reset_flag; int natm_mall; int nchrg_mall; int hess_calc; int natm_proc; int N_H2; int i_H2_start; int nab_initio; int myatm_start; double gamma_adb; double wght_pimd; double pi_temperature; double pi_beads_full_ter_wght; double pi_beads_res_ter_wght; double pi_beads_full_tra_wght; double pi_beads_res_tra_wght; double rcut_spread; double mass_sc_fact; int *ip_lab; int *ichrg; int *cp_vlnc_up; int *cp_atm_flag; double *mass; double *q; double *alp_pol; double *b_neut; double *roll_sc; double *text_atm; double *text_mol; double *xold; double *prekf; double *xmod; double alp_ewd; } *

variable_types: struct atommaps { int nmol_typ; int nres_typ; int natm_typ; int nfreeze; int nfreeze_mall; int natm_typ_mall; int nres_typ_max; int nres_max; int nres_tot; int nres_sum; int pimd_freez_typ; char (*atm_typ)[50]; char (*res_typ)[50]; char (*mol_typ)[50]; int *nmol_jmol_typ; int *nres_1mol_jmol_typ; int *jatm_jmol_typ_strt; int *jres_jmol_typ_strt; int *ires_typ_jres_jmol_typ; int *jatm_jres_1mol_jmol_typ_strt; int *natm_1mol_jmol_typ; int *natm_jres_jmol_typ; int *nfree_1mol_jmol_typ; int *nfree_jres_jmol_typ; int *icons_jmol_typ; int *icons_jres_jmol_typ; int *natm_jmol_typ; int *iatm_mol_typ; int *iatm_res_typ; int *iatm_atm_typ; int *iatm_atm_typ_nl; int *iatm_atm_typ_nl_rev; int *imap_atm_typ_nl; int *imap_atm_typ_nl_gh; int *iatm_mol_num; int *iatm_proc_num; int *iatm_res_num; int *ighost_flag; int *freeze_flag; int *freeze_map; int *atom_label; int *cp_atm_lst; } *

variable_types: struct build_intra { struct bond_site { char bond_site_name[5][50]; int branch_1[5]; int branch_2[5]; int valence; int improper_ind[5]; } *bond_site; int *mask_atm; int *index_atm; int *iatm_ind_chk; int *ires_ind_chk; int natm_1res_pure_now; int natm_tot_max; int nfreeze_max; int nfreeze_now; int natm_1res_now; int natm_1res_max; int natmind_1res_now; int natmind_1res_max; int nghost_now; int nghost_tot_max; int nbond_pow_max; int nbond_con_max; int nbond_nul_max; int nbond_typ_pow_max; int nbond_typ_con_max; struct CBOND { char atm1[50]; } *cbond_typ_pow; struct CBOND *cbond_typ_con; struct CBOND *cbond_typ_now; int nbend_pow_max; int nbend_con_max; int nbend_nul_max; int nbend_typ_pow_max; int nbend_typ_con_max; struct CBEND { char atm1[50]; } *cbend_typ_pow; struct CBEND *cbend_typ_con; struct CBEND *cbend_typ_now; int ntors_pow_max; int ntors_con_max; int ntors_nul_max; int ntors_typ_pow_max; int ntors_typ_con_max; struct CTORS { char atm1[50]; } *ctors_typ_pow; struct CTORS *ctors_typ_con; struct CTORS *ctors_typ_now; int nonfo_max; int nonfo_nul_max; int nonfo_typ_max; struct CBOND *confo_typ; struct CBOND *confo_typ_now; int nbend_bnd_max; int nbend_bnd_typ_max; struct CBEND *cbend_bnd_typ; struct CBEND *cbend_bnd_typ_now; int ngrp_33_max; int ngrp_watt_33_max; int ngrp_21_max; int ngrp_43_max; int ngrp_23_max; int ngrp_46_max; int ngrp_typ_21_max; int ngrp_typ_43_max; int ngrp_typ_33_max; int ngrp_typ_watt_33_max; int ngrp_typ_23_max; int ngrp_typ_46_max; struct CGRP_CONS { char atm1[50]; } *cgrp_typ_now; struct CGRP_CONS *cgrp_typ_21; struct CGRP_CONS *cgrp_typ_43; struct CGRP_CONS *cgrp_typ_33; struct CGRP_CONS *cgrp_typ_watt_33; struct CGRP_CONS *cgrp_typ_23; struct CGRP_CONS *cgrp_typ_46; int natm_typ_max; int nres_typ_max; char *strip1; int *ibend_bnd_typ_pure; int *ibend_bnd_typ_map; } *

variable_types: struct dict_word { int iflag; char keyword[50]; char error_mes[100]; } *

variable_types:
filename
char *

variable_types: nstrip int

variable_types: imask int

variable_types:
numg
int [6]

variable_types: index int

variable_types: i int

variable_types:
anumg
double [6]

variable_types: nghost int

variable_types: ncomp int

variable_types: iii int