decompiled_code:
int __fastcall set_bend_bnd_params(__int64 a1, __int64 a2, __int64 a3, const char *a4, unsigned int a5, _DWORD *a6, _QWORD *a7, int *a8, __int64 a9, __int64 a10, __int64 a11, unsigned int a12)
{
unsigned int v13; // er12
_DWORD *v14; // rbp
__int64 v15; // rbx
int v16; // er8
int v17; // er12
__int64 v18; // rax
int v19; // er8
int v20; // er12
int v21; // ebp
__int64 v22; // rdx
__int64 v23; // r14
int v24; // eax
int v25; // eax
const char *v26; // r13
const char *v27; // rbp
bool v28; // zf
int v29; // eax
int v30; // eax
int v31; // er15
int v32; // eax
int v33; // ebx
__int64 v34; // rax
int v35; // eax
int v36; // eax
const char *v37; // r13
const char *v38; // r12
int v39; // eax
int v40; // eax
int v41; // eax
int v42; // er15
int v43; // eax
int v44; // ebx
__int64 v45; // rsi
__int64 v46; // rcx
__int64 v47; // rdi
__int64 v48; // rdx
int v49; // ecx
int v50; // eax
int v51; // eax
__int64 v52; // rax
__int64 v53; // rsi
__int64 v54; // rax
__int64 v55; // rsi
__int64 v56; // rax
__int64 v57; // rsi
int v58; // eax
__int64 v59; // rax
__int64 v60; // rsi
__int64 v61; // rax
__int64 v62; // rsi
const char *v63; // rsi
__int64 v64; // rbp
const char *v65; // rsi
__int64 v66; // rbp
int v67; // eax
int v68; // edx
__int64 v69; // rdx
__int64 v70; // rcx
int v71; // eax
int v72; // edx
__int64 v73; // rdi
__int64 v74; // rax
__int64 v75; // rsi
__int64 v76; // rax
__int64 v77; // rsi
int v79; // [rsp+0h] [rbp-98h]
int v80; // [rsp+4h] [rbp-94h]
int v81; // [rsp+8h] [rbp-90h]
int v82; // [rsp+8h] [rbp-90h]
int v83; // [rsp+8h] [rbp-90h]
int v84; // [rsp+8h] [rbp-90h]
int v85; // [rsp+8h] [rbp-90h]
int v86; // [rsp+10h] [rbp-88h]
int v87; // [rsp+14h] [rbp-84h]
int v88; // [rsp+14h] [rbp-84h]
int v89; // [rsp+14h] [rbp-84h]
int s2; // [rsp+18h] [rbp-80h]
char *s2a; // [rsp+18h] [rbp-80h]
char *s2b; // [rsp+18h] [rbp-80h]
char *v95; // [rsp+28h] [rbp-70h]
int v96; // [rsp+30h] [rbp-68h]
char *v97; // [rsp+30h] [rbp-68h]
__int64 v98; // [rsp+38h] [rbp-60h]
int v99; // [rsp+38h] [rbp-60h]
int v101; // [rsp+40h] [rbp-58h]
int v102; // [rsp+44h] [rbp-54h]
__int64 v103; // [rsp+48h] [rbp-50h]
int v104[15]; // [rsp+5Ch] [rbp-3Ch] BYREF

v13 = 1;
v14 = (_DWORD *)(a1 + 216);
v15 = a11;
do
{
if ( !*v14 && v14[1] == 1 )
keyword_miss(a1, a4, a3, v13);
++v13;
v14 += 53;
}
while ( v13 != 4 );
_isoc99_sscanf(a1 + 274, &LC0, v104);
v79 = v104[0];
if ( *(_DWORD *)(a11 + 64) < v104[0] || v104[0] < 0 )
keyarg_barf(a1, a4, a3, 1LL);
v81 = *(_DWORD *)(*(_QWORD *)(a11 + 8) + 4LL * v79);
if ( v81 > 0 )
v79 = *(_DWORD *)(*(_QWORD *)(a11 + 16) + 4LL * v79);
_isoc99_sscanf(a1 + 486, &LC0, v104);
v80 = v104[0];
if ( *(_DWORD *)(a11 + 64) < v104[0] || v104[0] < 0 )
keyarg_barf(a1, a4, a3, 2LL);
v87 = *(_DWORD *)(*(_QWORD *)(a11 + 8) + 4LL * v80);
if ( v87 > 0 )
v80 = *(_DWORD *)(*(_QWORD *)(a11 + 16) + 4LL * v80);
_isoc99_sscanf(a1 + 698, &LC0, v104);
v86 = v104[0];
if ( *(_DWORD *)(a11 + 64) < v104[0] || v104[0] < 0 )
keyarg_barf(a1, a4, a3, 3LL);
v16 = *(_DWORD *)(*(_QWORD *)(a11 + 8) + 4LL * v86);
if ( v16 > 0 )
v86 = *(_DWORD *)(*(_QWORD *)(a11 + 16) + 4LL * v86);
s2 = v16;
v17 = strcasecmp((const char *)(a1 + 1122), "con");
LODWORD(v18) = strcasecmp((const char *)(a1 + 1122), "off");
v19 = s2;
if ( v17 )
{
v20 = 3;
if ( (_DWORD)v18 )
{
v20 = 1;
LODWORD(v18) = strcasecmp((const char *)(a1 + 1122), "on");
v19 = s2;
if ( (_DWORD)v18 )
{
v20 = 0;
LODWORD(v18) = keyarg_barf(a1, a4, a3, 5LL);
v19 = s2;
}
}
}
else if ( (_DWORD)v18 )
{
LODWORD(v18) = (_DWORD)a6;
if ( (int)a6[1] > 1 )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
puts("Constraints not implemented under ");
puts(" path integral dynamics. ");
LABEL_79:
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
fflush(stdout);
exit(1);
}
v20 = 2;
}
else
{
v20 = 3;
}
v21 = v19 * v87 * v81;
if ( v21 != 1 )
return v18;
v22 = a7[24];
v23 = *(int *)(v22 + 4LL * (*a6 + v80));
v82 = *(_DWORD *)(v22 + 4LL * (*a6 + v86));
strcpy(*(char **)(a11 + 272), (const char *)(a7[6] + 50LL * *(int *)(v22 + 4LL * (v79 + *a6))));
strcpy((char *)(*(_QWORD *)(a11 + 272) + 50LL), (const char *)(a7[6] + 50 * v23));
strcpy((char *)(*(_QWORD *)(a11 + 272) + 100LL), (const char *)(a7[6] + 50LL * v82));
LODWORD(v18) = (unsigned int)strcpy((char *)(*(_QWORD *)(a11 + 272) + 150LL), (const char *)(a1 + 1334));
if ( v20 == 1 )
{
v24 = *(_DWORD *)(a11 + 256);
if ( *a8 >= v24 )
{
v51 = v24 + 100;
*(_DWORD *)(a11 + 256) = v51;
v52 = crealloc(*((_QWORD *)a8 + 4) + 4LL, 4LL * v51);
v53 = *(int *)(a11 + 256);
*((_QWORD *)a8 + 4) = v52 - 4;
v54 = crealloc(*((_QWORD *)a8 + 5) + 4LL, 4 * v53);
v55 = *(int *)(a11 + 256);
*((_QWORD *)a8 + 5) = v54 - 4;
v56 = crealloc(*((_QWORD *)a8 + 6) + 4LL, 4 * v55);
v57 = *(int *)(a11 + 256);
*((_QWORD *)a8 + 6) = v56 - 4;
*((_QWORD *)a8 + 7) = crealloc(*((_QWORD *)a8 + 7) + 4LL, 4 * v57) - 4;
}
v25 = a8[1];
v98 = *(_QWORD *)(a11 + 264);
v96 = *(_DWORD *)(a11 + 260);
v83 = v25;
v101 = v25 + 1;
if ( v25 > 0 )
{
v26 = *(const char **)(a11 + 272);
v88 = v25 + 1;
v27 = (const char *)(*(_QWORD *)(a11 + 264) + 300LL);
s2a = (char *)(v26 + 50);
v95 = (char *)(v26 + 150);
while ( 1 )
{
v31 = strcasecmp(v27 - 100, v26);
v32 = strcasecmp(v27 - 100, v26 + 100);
v33 = v32;
if ( v31 )
break;
if ( !strcasecmp(v27 - 50, s2a) )
{
if ( !strcasecmp(v27, v26 + 100) )
{
v28 = strcasecmp(v27 + 50, v95) == 0;
v29 = v88;
if ( v28 )
v29 = v20;
v88 = v29;
}
if ( !v33 )
goto LABEL_39;
}
LABEL_43:
v27 += 200;
if ( v83 == v20 )
{
v15 = a11;
if ( v88 <= v96 )
goto LABEL_81;
goto LABEL_85;
}
++v20;
}
if ( v32 || strcasecmp(v27 - 50, s2a) )
goto LABEL_43;
LABEL_39:
if ( !strcasecmp(v27, v26) )
{
v28 = strcasecmp(v27 + 50, v95) == 0;
v30 = v88;
if ( v28 )
v30 = v20;
v88 = v30;
}
goto LABEL_43;
}
if ( v101 > v96 )
{
v88 = v25 + 1;
LABEL_85:
*(_DWORD *)(v15 + 260) = v96 + 100;
*(_QWORD *)(v15 + 264) = crealloc(v98 + 200, 200LL * (v96 + 100)) - 200;
v101 = a8[1] + 1;
LABEL_81:
if ( v88 != v101 )
goto LABEL_82;
v98 = *(_QWORD *)(v15 + 264);
}
v63 = *(const char **)(v15 + 272);
a8[1] = v101;
v64 = 200LL * v101;
strcpy((char *)(v64 + v98), v63);
strcpy((char *)(v64 + *(_QWORD *)(v15 + 264) + 50), (const char *)(*(_QWORD *)(v15 + 272) + 50LL));
strcpy((char *)(v64 + *(_QWORD *)(v15 + 264) + 100), (const char *)(*(_QWORD *)(v15 + 272) + 100LL));
strcpy((char *)(*(_QWORD *)(v15 + 264) + v64 + 150), (const char *)(*(_QWORD *)(v15 + 272) + 150LL));
v88 = v101;
LABEL_82:
v49 = *a6 + v79;
v50 = *a8 + 1;
*a8 = v50;
*(_DWORD *)(*((_QWORD *)a8 + 4) + 4LL * v50) = v49;
*(_DWORD *)(*((_QWORD *)a8 + 5) + 4LL * *a8) = *a6 + v80;
*(_DWORD *)(*((_QWORD *)a8 + 6) + 4LL * *a8) = *a6 + v86;
v18 = *((_QWORD *)a8 + 7);
*(_DWORD *)(v18 + 4LL * *a8) = v88;
return v18;
}
if ( v20 != 2 )
{
if ( v20 == 3 )
{
v67 = *(_DWORD *)(a10 + 4);
v68 = *(_DWORD *)(a11 + 136);
if ( v67 >= v68 )
{
v72 = v68 + 100;
v73 = *(_QWORD *)(a10 + 32);
*(_DWORD *)(a11 + 136) = v72;
v74 = crealloc(v73 + 4, 4LL * v72);
v75 = *(int *)(a11 + 136);
*(_QWORD *)(a10 + 32) = v74 - 4;
v76 = crealloc(*(_QWORD *)(a10 + 40) + 4LL, 4 * v75);
v77 = *(int *)(a11 + 136);
*(_QWORD *)(a10 + 40) = v76 - 4;
v69 = crealloc(*(_QWORD *)(a10 + 48) + 4LL, 4 * v77) - 4;
v67 = *(_DWORD *)(a10 + 4);
*(_QWORD *)(a10 + 48) = v69;
}
else
{
v69 = *(_QWORD *)(a10 + 48);
}
v70 = *(_QWORD *)(a10 + 32);
v71 = v67 + 1;
*(_DWORD *)(a10 + 4) = v71;
*(_DWORD *)(v70 + 4LL * v71) = *a6 + v79;
*(_DWORD *)(*(_QWORD *)(a10 + 40) + 4LL * *(int *)(a10 + 4)) = *a6 + v80;
v18 = *(int *)(a10 + 4);
*(_DWORD *)(v69 + 4 * v18) = *a6 + v86;
}
return v18;
}
v34 = (int)(a12 + *(_DWORD *)(a7[12] + 4LL * (int)a5) - 1);
--*(_DWORD *)(a7[18] + 4 * v34);
*(_DWORD *)(a7[20] + 4 * v34) = 1;
v35 = *(_DWORD *)(a11 + 132);
if ( *(_DWORD *)(a9 + 8) >= v35 )
{
v58 = v35 + 100;
*(_DWORD *)(a11 + 132) = v58;
v59 = crealloc(*(_QWORD *)(a9 + 96) + 4LL, 4LL * v58);
v60 = *(int *)(a11 + 132);
*(_QWORD *)(a9 + 96) = v59 - 4;
v61 = crealloc(*(_QWORD *)(a9 + 104) + 4LL, 4 * v60);
v62 = *(int *)(a11 + 132);
*(_QWORD *)(a9 + 104) = v61 - 4;
*(_QWORD *)(a9 + 120) = crealloc(*(_QWORD *)(a9 + 120) + 4LL, 4 * v62) - 4;
}
v36 = *(_DWORD *)(a9 + 12);
v103 = *(_QWORD *)(a11 + 160);
v102 = *(_DWORD *)(a11 + 144);
v84 = v36;
v99 = v36 + 1;
if ( v36 > 0 )
{
v37 = *(const char **)(a11 + 168);
v89 = v36 + 1;
v38 = (const char *)(*(_QWORD *)(a11 + 160) + 300LL);
s2b = (char *)(v37 + 50);
v97 = (char *)(v37 + 150);
while ( 1 )
{
v42 = strcasecmp(v38 - 100, v37);
v43 = strcasecmp(v38 - 100, v37 + 100);
v44 = v43;
if ( !v42 )
break;
if ( v43 )
goto LABEL_67;
if ( !strcasecmp(v38 - 50, s2b) )
goto LABEL_63;
v41 = v21 + 1;
v38 += 200;
if ( v84 == v21 )
{
LABEL_73:
v15 = a11;
if ( v89 <= v102 )
goto LABEL_74;
goto LABEL_88;
}
LABEL_68:
v21 = v41;
}
if ( !strcasecmp(v38 - 50, s2b) )
{
if ( !strcasecmp(v38, v37 + 100) )
{
v28 = strcasecmp(v38 + 50, v97) == 0;
v39 = v89;
if ( v28 )
v39 = v21;
v89 = v39;
}
if ( !v44 )
{
LABEL_63:
if ( !strcasecmp(v38, v37) )
{
v28 = strcasecmp(v38 + 50, v97) == 0;
v40 = v89;
if ( v28 )
v40 = v21;
v89 = v40;
}
}
}
LABEL_67:
v41 = v21 + 1;
v38 += 200;
if ( v84 == v21 )
goto LABEL_73;
goto LABEL_68;
}
if ( v99 <= v102 )
goto LABEL_92;
v89 = v36 + 1;
LABEL_88:
*(_DWORD *)(v15 + 144) = v102 + 100;
*(_QWORD *)(v15 + 160) = crealloc(v103 + 200, 200LL * (v102 + 100)) - 200;
v99 = *(_DWORD *)(a9 + 12) + 1;
LABEL_74:
if ( v89 == v99 )
{
v103 = *(_QWORD *)(v15 + 160);
LABEL_92:
v65 = *(const char **)(v15 + 168);
*(_DWORD *)(a9 + 12) = v99;
v66 = 200LL * v99;
strcpy((char *)(v66 + v103), v65);
strcpy((char *)(v66 + *(_QWORD *)(v15 + 160) + 50), (const char *)(*(_QWORD *)(v15 + 168) + 50LL));
strcpy((char *)(v66 + *(_QWORD *)(v15 + 160) + 100), (const char *)(*(_QWORD *)(v15 + 168) + 100LL));
strcpy((char *)(*(_QWORD *)(v15 + 160) + v66 + 150), (const char *)(*(_QWORD *)(v15 + 168) + 150LL));
v89 = v99;
}
v45 = *(_QWORD *)(a9 + 96);
v85 = *(_DWORD *)(a9 + 8);
*(_DWORD *)(a9 + 8) = v85 + 1;
*(_DWORD *)(v45 + 4LL * (v85 + 1)) = *a6 + v79;
v46 = *(_QWORD *)(a9 + 104);
*(_DWORD *)(v46 + 4LL * *(int *)(a9 + 8)) = *a6 + v80;
v47 = *(_QWORD *)(a9 + 112);
*(_DWORD *)(v47 + 4LL * *(int *)(a9 + 8)) = *a6 + v86;
*(_DWORD *)(*(_QWORD *)(a9 + 120) + 4LL * *(int *)(a9 + 8)) = v89;
v48 = *(int *)(a9 + 8);
v18 = a7[32];
if ( *(_DWORD *)(v18 + 4LL * *(int *)(v45 + 4 * v48))
|| *(_DWORD *)(v18 + 4LL * *(int *)(v46 + 4 * v48))
|| (LODWORD(v18) = *(_DWORD *)(v18 + 4LL * *(int *)(v47 + 4 * v48)), (_DWORD)v18) )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
puts("Ghost atoms are not permitted in constrained bends");
printf("in molecule index %d in residue index %d in file %s\n", a5, a12, a4);
goto LABEL_79;
}
return v18;
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1, __int64 a2, __int64 a3, const char *a4, unsigned int a5, _DWORD *a6, _QWORD *a7, int *a8, __int64 a9, __int64 a10, __int64 a11, unsigned int a12)
{
unsigned int v13; // er12
_DWORD *v14; // rbp
__int64 v15; // rbx
int v16; // er8
int v17; // er12
__int64 v18; // rax
int v19; // er8
int v20; // er12
int v21; // ebp
__int64 v22; // rdx
__int64 v23; // r14
int v24; // eax
int v25; // eax
const char *v26; // r13
const char *v27; // rbp
bool v28; // zf
int v29; // eax
int v30; // eax
int v31; // er15
int v32; // eax
int v33; // ebx
__int64 v34; // rax
int v35; // eax
int v36; // eax
const char *v37; // r13
const char *v38; // r12
int v39; // eax
int v40; // eax
int v41; // eax
int v42; // er15
int v43; // eax
int v44; // ebx
__int64 v45; // rsi
__int64 v46; // rcx
__int64 v47; // rdi
__int64 v48; // rdx
int v49; // ecx
int v50; // eax
int v51; // eax
__int64 v52; // rax
__int64 v53; // rsi
__int64 v54; // rax
__int64 v55; // rsi
__int64 v56; // rax
__int64 v57; // rsi
int v58; // eax
__int64 v59; // rax
__int64 v60; // rsi
__int64 v61; // rax
__int64 v62; // rsi
const char *v63; // rsi
__int64 v64; // rbp
const char *v65; // rsi
__int64 v66; // rbp
int v67; // eax
int v68; // edx
__int64 v69; // rdx
__int64 v70; // rcx
int v71; // eax
int v72; // edx
__int64 v73; // rdi
__int64 v74; // rax
__int64 v75; // rsi
__int64 v76; // rax
__int64 v77; // rsi
int v79; // [rsp+0h] [rbp-98h]
int v80; // [rsp+4h] [rbp-94h]
int v81; // [rsp+8h] [rbp-90h]
int v82; // [rsp+8h] [rbp-90h]
int v83; // [rsp+8h] [rbp-90h]
int v84; // [rsp+8h] [rbp-90h]
int v85; // [rsp+8h] [rbp-90h]
int v86; // [rsp+10h] [rbp-88h]
int v87; // [rsp+14h] [rbp-84h]
int v88; // [rsp+14h] [rbp-84h]
int v89; // [rsp+14h] [rbp-84h]
int s2; // [rsp+18h] [rbp-80h]
char *s2a; // [rsp+18h] [rbp-80h]
char *s2b; // [rsp+18h] [rbp-80h]
char *v95; // [rsp+28h] [rbp-70h]
int v96; // [rsp+30h] [rbp-68h]
char *v97; // [rsp+30h] [rbp-68h]
__int64 v98; // [rsp+38h] [rbp-60h]
int v99; // [rsp+38h] [rbp-60h]
int v101; // [rsp+40h] [rbp-58h]
int v102; // [rsp+44h] [rbp-54h]
__int64 v103; // [rsp+48h] [rbp-50h]
int v104[15]; // [rsp+5Ch] [rbp-3Ch] BYREF

v13 = 1;
v14 = (_DWORD *)(a1 + 216);
v15 = a11;
do
{
if ( !*v14 && v14[1] == 1 )
keyword_miss(a1, a4, a3, v13);
++v13;
v14 += 53;
}
while ( v13 != 4 );
_isoc99_sscanf(a1 + 274, &LC0, v104);
v79 = v104[0];
if ( *(_DWORD *)(a11 + 64) < v104[0] || v104[0] < 0 )
keyarg_barf(a1, a4, a3, 1LL);
v81 = *(_DWORD *)(*(_QWORD *)(a11 + 8) + 4LL * v79);
if ( v81 > 0 )
v79 = *(_DWORD *)(*(_QWORD *)(a11 + 16) + 4LL * v79);
_isoc99_sscanf(a1 + 486, &LC0, v104);
v80 = v104[0];
if ( *(_DWORD *)(a11 + 64) < v104[0] || v104[0] < 0 )
keyarg_barf(a1, a4, a3, 2LL);
v87 = *(_DWORD *)(*(_QWORD *)(a11 + 8) + 4LL * v80);
if ( v87 > 0 )
v80 = *(_DWORD *)(*(_QWORD *)(a11 + 16) + 4LL * v80);
_isoc99_sscanf(a1 + 698, &LC0, v104);
v86 = v104[0];
if ( *(_DWORD *)(a11 + 64) < v104[0] || v104[0] < 0 )
keyarg_barf(a1, a4, a3, 3LL);
v16 = *(_DWORD *)(*(_QWORD *)(a11 + 8) + 4LL * v86);
if ( v16 > 0 )
v86 = *(_DWORD *)(*(_QWORD *)(a11 + 16) + 4LL * v86);
s2 = v16;
v17 = strcasecmp((const char *)(a1 + 1122), "con");
LODWORD(v18) = strcasecmp((const char *)(a1 + 1122), "off");
v19 = s2;
if ( v17 )
{
v20 = 3;
if ( (_DWORD)v18 )
{
v20 = 1;
LODWORD(v18) = strcasecmp((const char *)(a1 + 1122), "on");
v19 = s2;
if ( (_DWORD)v18 )
{
v20 = 0;
LODWORD(v18) = keyarg_barf(a1, a4, a3, 5LL);
v19 = s2;
}
}
}
else if ( (_DWORD)v18 )
{
LODWORD(v18) = (_DWORD)a6;
if ( (int)a6[1] > 1 )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
puts("Constraints not implemented under ");
puts(" path integral dynamics. ");
LABEL_79:
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
fflush(stdout);
exit(1);
}
v20 = 2;
}
else
{
v20 = 3;
}
v21 = v19 * v87 * v81;
if ( v21 != 1 )
return v18;
v22 = a7[24];
v23 = *(int *)(v22 + 4LL * (*a6 + v80));
v82 = *(_DWORD *)(v22 + 4LL * (*a6 + v86));
strcpy(*(char **)(a11 + 272), (const char *)(a7[6] + 50LL * *(int *)(v22 + 4LL * (v79 + *a6))));
strcpy((char *)(*(_QWORD *)(a11 + 272) + 50LL), (const char *)(a7[6] + 50 * v23));
strcpy((char *)(*(_QWORD *)(a11 + 272) + 100LL), (const char *)(a7[6] + 50LL * v82));
LODWORD(v18) = (unsigned int)strcpy((char *)(*(_QWORD *)(a11 + 272) + 150LL), (const char *)(a1 + 1334));
if ( v20 == 1 )
{
v24 = *(_DWORD *)(a11 + 256);
if ( *a8 >= v24 )
{
v51 = v24 + 100;
*(_DWORD *)(a11 + 256) = v51;
v52 = crealloc(*((_QWORD *)a8 + 4) + 4LL, 4LL * v51);
v53 = *(int *)(a11 + 256);
*((_QWORD *)a8 + 4) = v52 - 4;
v54 = crealloc(*((_QWORD *)a8 + 5) + 4LL, 4 * v53);
v55 = *(int *)(a11 + 256);
*((_QWORD *)a8 + 5) = v54 - 4;
v56 = crealloc(*((_QWORD *)a8 + 6) + 4LL, 4 * v55);
v57 = *(int *)(a11 + 256);
*((_QWORD *)a8 + 6) = v56 - 4;
*((_QWORD *)a8 + 7) = crealloc(*((_QWORD *)a8 + 7) + 4LL, 4 * v57) - 4;
}
v25 = a8[1];
v98 = *(_QWORD *)(a11 + 264);
v96 = *(_DWORD *)(a11 + 260);
v83 = v25;
v101 = v25 + 1;
if ( v25 > 0 )
{
v26 = *(const char **)(a11 + 272);
v88 = v25 + 1;
v27 = (const char *)(*(_QWORD *)(a11 + 264) + 300LL);
s2a = (char *)(v26 + 50);
v95 = (char *)(v26 + 150);
while ( 1 )
{
v31 = strcasecmp(v27 - 100, v26);
v32 = strcasecmp(v27 - 100, v26 + 100);
v33 = v32;
if ( v31 )
break;
if ( !strcasecmp(v27 - 50, s2a) )
{
if ( !strcasecmp(v27, v26 + 100) )
{
v28 = strcasecmp(v27 + 50, v95) == 0;
v29 = v88;
if ( v28 )
v29 = v20;
v88 = v29;
}
if ( !v33 )
goto LABEL_39;
}
LABEL_43:
v27 += 200;
if ( v83 == v20 )
{
v15 = a11;
if ( v88 <= v96 )
goto LABEL_81;
goto LABEL_85;
}
++v20;
}
if ( v32 || strcasecmp(v27 - 50, s2a) )
goto LABEL_43;
LABEL_39:
if ( !strcasecmp(v27, v26) )
{
v28 = strcasecmp(v27 + 50, v95) == 0;
v30 = v88;
if ( v28 )
v30 = v20;
v88 = v30;
}
goto LABEL_43;
}
if ( v101 > v96 )
{
v88 = v25 + 1;
LABEL_85:
*(_DWORD *)(v15 + 260) = v96 + 100;
*(_QWORD *)(v15 + 264) = crealloc(v98 + 200, 200LL * (v96 + 100)) - 200;
v101 = a8[1] + 1;
LABEL_81:
if ( v88 != v101 )
goto LABEL_82;
v98 = *(_QWORD *)(v15 + 264);
}
v63 = *(const char **)(v15 + 272);
a8[1] = v101;
v64 = 200LL * v101;
strcpy((char *)(v64 + v98), v63);
strcpy((char *)(v64 + *(_QWORD *)(v15 + 264) + 50), (const char *)(*(_QWORD *)(v15 + 272) + 50LL));
strcpy((char *)(v64 + *(_QWORD *)(v15 + 264) + 100), (const char *)(*(_QWORD *)(v15 + 272) + 100LL));
strcpy((char *)(*(_QWORD *)(v15 + 264) + v64 + 150), (const char *)(*(_QWORD *)(v15 + 272) + 150LL));
v88 = v101;
LABEL_82:
v49 = *a6 + v79;
v50 = *a8 + 1;
*a8 = v50;
*(_DWORD *)(*((_QWORD *)a8 + 4) + 4LL * v50) = v49;
*(_DWORD *)(*((_QWORD *)a8 + 5) + 4LL * *a8) = *a6 + v80;
*(_DWORD *)(*((_QWORD *)a8 + 6) + 4LL * *a8) = *a6 + v86;
v18 = *((_QWORD *)a8 + 7);
*(_DWORD *)(v18 + 4LL * *a8) = v88;
return v18;
}
if ( v20 != 2 )
{
if ( v20 == 3 )
{
v67 = *(_DWORD *)(a10 + 4);
v68 = *(_DWORD *)(a11 + 136);
if ( v67 >= v68 )
{
v72 = v68 + 100;
v73 = *(_QWORD *)(a10 + 32);
*(_DWORD *)(a11 + 136) = v72;
v74 = crealloc(v73 + 4, 4LL * v72);
v75 = *(int *)(a11 + 136);
*(_QWORD *)(a10 + 32) = v74 - 4;
v76 = crealloc(*(_QWORD *)(a10 + 40) + 4LL, 4 * v75);
v77 = *(int *)(a11 + 136);
*(_QWORD *)(a10 + 40) = v76 - 4;
v69 = crealloc(*(_QWORD *)(a10 + 48) + 4LL, 4 * v77) - 4;
v67 = *(_DWORD *)(a10 + 4);
*(_QWORD *)(a10 + 48) = v69;
}
else
{
v69 = *(_QWORD *)(a10 + 48);
}
v70 = *(_QWORD *)(a10 + 32);
v71 = v67 + 1;
*(_DWORD *)(a10 + 4) = v71;
*(_DWORD *)(v70 + 4LL * v71) = *a6 + v79;
*(_DWORD *)(*(_QWORD *)(a10 + 40) + 4LL * *(int *)(a10 + 4)) = *a6 + v80;
v18 = *(int *)(a10 + 4);
*(_DWORD *)(v69 + 4 * v18) = *a6 + v86;
}
return v18;
}
v34 = (int)(a12 + *(_DWORD *)(a7[12] + 4LL * (int)a5) - 1);
--*(_DWORD *)(a7[18] + 4 * v34);
*(_DWORD *)(a7[20] + 4 * v34) = 1;
v35 = *(_DWORD *)(a11 + 132);
if ( *(_DWORD *)(a9 + 8) >= v35 )
{
v58 = v35 + 100;
*(_DWORD *)(a11 + 132) = v58;
v59 = crealloc(*(_QWORD *)(a9 + 96) + 4LL, 4LL * v58);
v60 = *(int *)(a11 + 132);
*(_QWORD *)(a9 + 96) = v59 - 4;
v61 = crealloc(*(_QWORD *)(a9 + 104) + 4LL, 4 * v60);
v62 = *(int *)(a11 + 132);
*(_QWORD *)(a9 + 104) = v61 - 4;
*(_QWORD *)(a9 + 120) = crealloc(*(_QWORD *)(a9 + 120) + 4LL, 4 * v62) - 4;
}
v36 = *(_DWORD *)(a9 + 12);
v103 = *(_QWORD *)(a11 + 160);
v102 = *(_DWORD *)(a11 + 144);
v84 = v36;
v99 = v36 + 1;
if ( v36 > 0 )
{
v37 = *(const char **)(a11 + 168);
v89 = v36 + 1;
v38 = (const char *)(*(_QWORD *)(a11 + 160) + 300LL);
s2b = (char *)(v37 + 50);
v97 = (char *)(v37 + 150);
while ( 1 )
{
v42 = strcasecmp(v38 - 100, v37);
v43 = strcasecmp(v38 - 100, v37 + 100);
v44 = v43;
if ( !v42 )
break;
if ( v43 )
goto LABEL_67;
if ( !strcasecmp(v38 - 50, s2b) )
goto LABEL_63;
v41 = v21 + 1;
v38 += 200;
if ( v84 == v21 )
{
LABEL_73:
v15 = a11;
if ( v89 <= v102 )
goto LABEL_74;
goto LABEL_88;
}
LABEL_68:
v21 = v41;
}
if ( !strcasecmp(v38 - 50, s2b) )
{
if ( !strcasecmp(v38, v37 + 100) )
{
v28 = strcasecmp(v38 + 50, v97) == 0;
v39 = v89;
if ( v28 )
v39 = v21;
v89 = v39;
}
if ( !v44 )
{
LABEL_63:
if ( !strcasecmp(v38, v37) )
{
v28 = strcasecmp(v38 + 50, v97) == 0;
v40 = v89;
if ( v28 )
v40 = v21;
v89 = v40;
}
}
}
LABEL_67:
v41 = v21 + 1;
v38 += 200;
if ( v84 == v21 )
goto LABEL_73;
goto LABEL_68;
}
if ( v99 <= v102 )
goto LABEL_92;
v89 = v36 + 1;
LABEL_88:
*(_DWORD *)(v15 + 144) = v102 + 100;
*(_QWORD *)(v15 + 160) = crealloc(v103 + 200, 200LL * (v102 + 100)) - 200;
v99 = *(_DWORD *)(a9 + 12) + 1;
LABEL_74:
if ( v89 == v99 )
{
v103 = *(_QWORD *)(v15 + 160);
LABEL_92:
v65 = *(const char **)(v15 + 168);
*(_DWORD *)(a9 + 12) = v99;
v66 = 200LL * v99;
strcpy((char *)(v66 + v103), v65);
strcpy((char *)(v66 + *(_QWORD *)(v15 + 160) + 50), (const char *)(*(_QWORD *)(v15 + 168) + 50LL));
strcpy((char *)(v66 + *(_QWORD *)(v15 + 160) + 100), (const char *)(*(_QWORD *)(v15 + 168) + 100LL));
strcpy((char *)(*(_QWORD *)(v15 + 160) + v66 + 150), (const char *)(*(_QWORD *)(v15 + 168) + 150LL));
v89 = v99;
}
v45 = *(_QWORD *)(a9 + 96);
v85 = *(_DWORD *)(a9 + 8);
*(_DWORD *)(a9 + 8) = v85 + 1;
*(_DWORD *)(v45 + 4LL * (v85 + 1)) = *a6 + v79;
v46 = *(_QWORD *)(a9 + 104);
*(_DWORD *)(v46 + 4LL * *(int *)(a9 + 8)) = *a6 + v80;
v47 = *(_QWORD *)(a9 + 112);
*(_DWORD *)(v47 + 4LL * *(int *)(a9 + 8)) = *a6 + v86;
*(_DWORD *)(*(_QWORD *)(a9 + 120) + 4LL * *(int *)(a9 + 8)) = v89;
v48 = *(int *)(a9 + 8);
v18 = a7[32];
if ( *(_DWORD *)(v18 + 4LL * *(int *)(v45 + 4 * v48))
|| *(_DWORD *)(v18 + 4LL * *(int *)(v46 + 4 * v48))
|| (LODWORD(v18) = *(_DWORD *)(v18 + 4LL * *(int *)(v47 + 4 * v48)), (_DWORD)v18) )
{
puts("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@");
puts("Ghost atoms are not permitted in constrained bends");
printf("in molecule index %d in residue index %d in file %s\n", a5, a12, a4);
goto LABEL_79;
}
return v18;
}

original_code:
void set_bend_bnd_params(DICT_WORD intra_dict[],int num_intra_dict,
                         char *fun_key,char *file_name,int jmol_typ,
                         CLATOMS_INFO *clatoms_info,ATOMMAPS *atommaps,
                         BEND_BND *bend_bnd,BEND *bend,
                         NULL_INTER_PARSE *null_inter_parse,
                         BUILD_INTRA *build_intra, int iresidue,int ires_off)
{
  int num,index,ifound,igo;
  int itype1,itype2,itype3;
  int iatm_ind1,iatm_ind2,iatm_ind3;
  int imask1,imask2,imask3;
  int i,itype;
  for(i=1;i<=3;i++){
    if(intra_dict[i].iuset==0 && intra_dict[i].key_type==1){
      keyword_miss(intra_dict,file_name,fun_key,i);
    }
  }
  index = 1;
  sscanf(intra_dict[1].keyarg,"%d",&num);
  iatm_ind1 = num;
  if(iatm_ind1>build_intra->natmind_1res_now||iatm_ind1<0){
            keyarg_barf(intra_dict,file_name,fun_key,index);}
  imask1 = build_intra->mask_atm[iatm_ind1];
  if(imask1>0)iatm_ind1 = build_intra->index_atm[iatm_ind1];
  index = 2;
  sscanf(intra_dict[2].keyarg,"%d",&num);
  iatm_ind2 = num;
  if(iatm_ind2>build_intra->natmind_1res_now||iatm_ind2<0){
    keyarg_barf(intra_dict,file_name,fun_key,index);
  }
  imask2 = build_intra->mask_atm[iatm_ind2];
  if(imask2>0)iatm_ind2 = build_intra->index_atm[iatm_ind2];
  index = 3;
  sscanf(intra_dict[3].keyarg,"%d",&num);
  iatm_ind3 = num;
  if(iatm_ind3>build_intra->natmind_1res_now||iatm_ind3<0){
            keyarg_barf(intra_dict,file_name,fun_key,index);}
  imask3 = build_intra->mask_atm[iatm_ind3];
  if(imask3>0)iatm_ind3 = build_intra->index_atm[iatm_ind3];
  index = 5;
  ifound = 0;
  if(strcasecmp(intra_dict[5].keyarg,"on")==0) {ifound = 1;}
  if(strcasecmp(intra_dict[5].keyarg,"con")==0){ifound = 2;}
  if(strcasecmp(intra_dict[5].keyarg,"off")==0){ifound = 3;}
  if(ifound==0){
    keyarg_barf(intra_dict,file_name,fun_key,index);
  }
  if(ifound == 2 && clatoms_info->pi_beads>1){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("Constraints not implemented under  \n");
        printf(" path integral dynamics.            \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  igo = imask1*imask2*imask3;
  if(igo==1){
    itype1 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind1)];
    itype2 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind2)];
    itype3 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind3)];
    strcpy(build_intra->cbend_bnd_typ_now->atm1,atommaps->atm_typ[itype1]);
    strcpy(build_intra->cbend_bnd_typ_now->atm2,atommaps->atm_typ[itype2]);
    strcpy(build_intra->cbend_bnd_typ_now->atm3,atommaps->atm_typ[itype3]);
    strcpy(build_intra->cbend_bnd_typ_now->label,intra_dict[6].keyarg);
  }
  if(ifound==1&&igo==1){
    if(bend_bnd->num+1 > build_intra->nbend_bnd_max){
      build_intra->nbend_bnd_max += 100;
      bend_bnd->j1 =(int*)crealloc(&(bend_bnd->j1)[1],
                                   build_intra->nbend_bnd_max*sizeof(int))-1;
      bend_bnd->j2 =(int*)crealloc(&(bend_bnd->j2)[1],
                                   build_intra->nbend_bnd_max*sizeof(int))-1;
      bend_bnd->j3 =(int*)crealloc(&(bend_bnd->j3)[1],
                                   build_intra->nbend_bnd_max*sizeof(int))-1;
      bend_bnd->jtyp=(int*)crealloc(&(bend_bnd->jtyp)[1],
                                    build_intra->nbend_bnd_max*sizeof(int))-1;
    }
    itype = bend_bnd->ntyp+1;
    for(i=1;i<=bend_bnd->ntyp;i++){
      if((strcasecmp(build_intra->cbend_bnd_typ[i].atm1,
                     build_intra->cbend_bnd_typ_now->atm1)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm2,
                       build_intra->cbend_bnd_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm3,
                       build_intra->cbend_bnd_typ_now->atm3)==0)
  &&(strcasecmp(build_intra->cbend_bnd_typ[i].label,
         build_intra->cbend_bnd_typ_now->label)==0)) {itype=i;}
      if((strcasecmp(build_intra->cbend_bnd_typ[i].atm1,
                     build_intra->cbend_bnd_typ_now->atm3)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm2,
                       build_intra->cbend_bnd_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm3,
                       build_intra->cbend_bnd_typ_now->atm1)==0)
  &&(strcasecmp(build_intra->cbend_bnd_typ[i].label,
         build_intra->cbend_bnd_typ_now->label)==0)) {itype=i;}
    }
    if(itype>build_intra->nbend_bnd_typ_max){
      build_intra->nbend_bnd_typ_max += 100;
      build_intra->cbend_bnd_typ =
        (CBEND *) crealloc(&build_intra->cbend_bnd_typ[1],
                           build_intra->nbend_bnd_typ_max*sizeof(CBEND))-1;
    }
    if(itype==bend_bnd->ntyp+1){
      bend_bnd->ntyp++;
      strcpy(build_intra->cbend_bnd_typ[itype].atm1,
             build_intra->cbend_bnd_typ_now->atm1);
      strcpy(build_intra->cbend_bnd_typ[itype].atm2,
             build_intra->cbend_bnd_typ_now->atm2);
      strcpy(build_intra->cbend_bnd_typ[itype].atm3,
             build_intra->cbend_bnd_typ_now->atm3);
      strcpy(build_intra->cbend_bnd_typ[itype].label,
             build_intra->cbend_bnd_typ_now->label);
    }
    bend_bnd->num += 1;
    bend_bnd->j1[bend_bnd->num] = iatm_ind1 + clatoms_info->natm_tot;
    bend_bnd->j2[bend_bnd->num] = iatm_ind2 + clatoms_info->natm_tot;
    bend_bnd->j3[bend_bnd->num] = iatm_ind3 + clatoms_info->natm_tot;
    bend_bnd->jtyp[bend_bnd->num] = itype;
  }
  if(ifound==2&&igo==1){
    ires_off = atommaps->jres_jmol_typ_strt[jmol_typ]-1;
    atommaps->nfree_jres_jmol_typ[ires_off+iresidue] -= 1;
    atommaps->icons_jres_jmol_typ[ires_off+iresidue] = 1;
    if(bend->ncon+1 > build_intra->nbend_con_max){
      build_intra->nbend_con_max += 100;
      bend->j1_con = (int *)crealloc(&(bend->j1_con)[1],
         build_intra->nbend_con_max*sizeof(int))-1;
      bend->j2_con = (int *)crealloc(&(bend->j2_con)[1],
         build_intra->nbend_con_max*sizeof(int))-1;
      bend->jtyp_con=(int *)crealloc(&(bend->jtyp_con)[1],
         build_intra->nbend_con_max*sizeof(int))-1;
    }
    itype = (bend->ntyp_con)+1;
    for(i=1;i<=bend->ntyp_con;i++){
      if((strcasecmp(build_intra->cbend_typ_con[i].atm1,
       build_intra->cbend_typ_now->atm1)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm2,
         build_intra->cbend_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm3,
         build_intra->cbend_typ_now->atm3)==0)
  &&(strcasecmp(build_intra->cbend_typ_con[i].label,
         build_intra->cbend_typ_now->label)==0)){itype=i;}
      if((strcasecmp(build_intra->cbend_typ_con[i].atm1,
       build_intra->cbend_typ_now->atm3)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm2,
         build_intra->cbend_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm3,
         build_intra->cbend_typ_now->atm1)==0)
  &&(strcasecmp(build_intra->cbend_typ_con[i].label,
         build_intra->cbend_typ_now->label)==0)){itype=i;}
    }
    if(itype>build_intra->nbend_typ_con_max){
      build_intra->nbend_typ_con_max += 100;
      build_intra->cbend_typ_con = (CBEND *)
 crealloc(&(build_intra->cbend_typ_con[1]),
   build_intra->nbend_typ_con_max*sizeof(CBEND))-1;
    }
    if(itype==(bend->ntyp_con)+1){
      bend->ntyp_con+=1;
      strcpy(build_intra->cbend_typ_con[itype].atm1,
      build_intra->cbend_typ_now->atm1);
      strcpy(build_intra->cbend_typ_con[itype].atm2,
      build_intra->cbend_typ_now->atm2);
      strcpy(build_intra->cbend_typ_con[itype].atm3,
      build_intra->cbend_typ_now->atm3);
      strcpy(build_intra->cbend_typ_con[itype].label,
      build_intra->cbend_typ_now->label);
    }
    bend->ncon += 1;
    bend->j1_con[bend->ncon] = iatm_ind1 + clatoms_info->natm_tot;
    bend->j2_con[bend->ncon] = iatm_ind2 + clatoms_info->natm_tot;
    bend->j3_con[bend->ncon] = iatm_ind3 + clatoms_info->natm_tot;
    bend->jtyp_con[bend->ncon] = itype;
    if((atommaps->ighost_flag[bend->j1_con[bend->ncon]]!=0)||
       (atommaps->ighost_flag[bend->j2_con[bend->ncon]]!=0)||
       (atommaps->ighost_flag[bend->j3_con[bend->ncon]]!=0)){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("Ghost atoms are not permitted in constrained bends\n");
        printf("in molecule index %d in residue index %d in file %s\n",
                jmol_typ,iresidue,file_name);
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
    }
  }
  if(ifound==3&&igo==1){
    if(null_inter_parse->nbend_nul+1 > build_intra->nbend_nul_max){
      build_intra->nbend_nul_max += 100;
      null_inter_parse->jbend1_nul =
 (int *) crealloc(&(null_inter_parse->jbend1_nul)[1],
    build_intra->nbend_nul_max*sizeof(int))-1;
      null_inter_parse->jbend2_nul =
 (int *) crealloc(&(null_inter_parse->jbend2_nul)[1],
    build_intra->nbend_nul_max*sizeof(int))-1;
      null_inter_parse->jbend3_nul =
 (int *) crealloc(&(null_inter_parse->jbend3_nul)[1],
    build_intra->nbend_nul_max*sizeof(int))-1;
    }
    null_inter_parse->nbend_nul += 1;
    (null_inter_parse->jbend1_nul)[null_inter_parse->nbend_nul] =
                       iatm_ind1 + clatoms_info->natm_tot;
    (null_inter_parse->jbend2_nul)[null_inter_parse->nbend_nul] =
                              iatm_ind2 + clatoms_info->natm_tot;
    (null_inter_parse->jbend3_nul)[null_inter_parse->nbend_nul] =
                              iatm_ind3 + clatoms_info->natm_tot;
  }
}

canonical_original_code:
void set_bend_bnd_params(struct dict_word intra_dict[], int num_intra_dict, char *fun_key, char *file_name, int jmol_typ, struct clatoms_info *clatoms_info, struct atommaps *atommaps, struct bend_bnd *bend_bnd, struct bend *bend, struct null_inter_parse *null_inter_parse, struct build_intra *build_intra, int iresidue, int ires_off)
{
  int num; int index; int ifound; int igo;
  int itype1; int itype2; int itype3;
  int iatm_ind1; int iatm_ind2; int iatm_ind3;
  int imask1; int imask2; int imask3;
  int i; int itype;
  for(i=1;i<=3;i++){
    if(intra_dict[i].iuset==0 && intra_dict[i].key_type==1){
      keyword_miss(intra_dict,file_name,fun_key,i);
    }
  }
  index = 1;
  sscanf(intra_dict[1].keyarg,"%d",&num);
  iatm_ind1 = num;
  if(iatm_ind1>build_intra->natmind_1res_now||iatm_ind1<0){
            keyarg_barf(intra_dict,file_name,fun_key,index);}
  imask1 = build_intra->mask_atm[iatm_ind1];
  if(imask1>0)iatm_ind1 = build_intra->index_atm[iatm_ind1];
  index = 2;
  sscanf(intra_dict[2].keyarg,"%d",&num);
  iatm_ind2 = num;
  if(iatm_ind2>build_intra->natmind_1res_now||iatm_ind2<0){
    keyarg_barf(intra_dict,file_name,fun_key,index);
  }
  imask2 = build_intra->mask_atm[iatm_ind2];
  if(imask2>0)iatm_ind2 = build_intra->index_atm[iatm_ind2];
  index = 3;
  sscanf(intra_dict[3].keyarg,"%d",&num);
  iatm_ind3 = num;
  if(iatm_ind3>build_intra->natmind_1res_now||iatm_ind3<0){
            keyarg_barf(intra_dict,file_name,fun_key,index);}
  imask3 = build_intra->mask_atm[iatm_ind3];
  if(imask3>0)iatm_ind3 = build_intra->index_atm[iatm_ind3];
  index = 5;
  ifound = 0;
  if(strcasecmp(intra_dict[5].keyarg,"on")==0) {ifound = 1;}
  if(strcasecmp(intra_dict[5].keyarg,"con")==0){ifound = 2;}
  if(strcasecmp(intra_dict[5].keyarg,"off")==0){ifound = 3;}
  if(ifound==0){
    keyarg_barf(intra_dict,file_name,fun_key,index);
  }
  if(ifound == 2 && clatoms_info->pi_beads>1){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("Constraints not implemented under  \n");
        printf(" path integral dynamics.            \n");
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
  }
  igo = imask1*imask2*imask3;
  if(igo==1){
    itype1 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind1)];
    itype2 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind2)];
    itype3 = atommaps->iatm_atm_typ[(clatoms_info->natm_tot+iatm_ind3)];
    strcpy(build_intra->cbend_bnd_typ_now->atm1,atommaps->atm_typ[itype1]);
    strcpy(build_intra->cbend_bnd_typ_now->atm2,atommaps->atm_typ[itype2]);
    strcpy(build_intra->cbend_bnd_typ_now->atm3,atommaps->atm_typ[itype3]);
    strcpy(build_intra->cbend_bnd_typ_now->label,intra_dict[6].keyarg);
  }
  if(ifound==1&&igo==1){
    if(bend_bnd->num+1 > build_intra->nbend_bnd_max){
      build_intra->nbend_bnd_max += 100;
      bend_bnd->j1 =(int *)crealloc(&(bend_bnd->j1)[1],
                                   build_intra->nbend_bnd_max*sizeof(int))-1;
      bend_bnd->j2 =(int *)crealloc(&(bend_bnd->j2)[1],
                                   build_intra->nbend_bnd_max*sizeof(int))-1;
      bend_bnd->j3 =(int *)crealloc(&(bend_bnd->j3)[1],
                                   build_intra->nbend_bnd_max*sizeof(int))-1;
      bend_bnd->jtyp=(int *)crealloc(&(bend_bnd->jtyp)[1],
                                    build_intra->nbend_bnd_max*sizeof(int))-1;
    }
    itype = bend_bnd->ntyp+1;
    for(i=1;i<=bend_bnd->ntyp;i++){
      if((strcasecmp(build_intra->cbend_bnd_typ[i].atm1,
                     build_intra->cbend_bnd_typ_now->atm1)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm2,
                       build_intra->cbend_bnd_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm3,
                       build_intra->cbend_bnd_typ_now->atm3)==0)
  &&(strcasecmp(build_intra->cbend_bnd_typ[i].label,
         build_intra->cbend_bnd_typ_now->label)==0)) {itype=i;}
      if((strcasecmp(build_intra->cbend_bnd_typ[i].atm1,
                     build_intra->cbend_bnd_typ_now->atm3)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm2,
                       build_intra->cbend_bnd_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_bnd_typ[i].atm3,
                       build_intra->cbend_bnd_typ_now->atm1)==0)
  &&(strcasecmp(build_intra->cbend_bnd_typ[i].label,
         build_intra->cbend_bnd_typ_now->label)==0)) {itype=i;}
    }
    if(itype>build_intra->nbend_bnd_typ_max){
      build_intra->nbend_bnd_typ_max += 100;
      build_intra->cbend_bnd_typ =
        (struct CBEND *) crealloc(&build_intra->cbend_bnd_typ[1],
                           build_intra->nbend_bnd_typ_max*sizeof(CBEND))-1;
    }
    if(itype==bend_bnd->ntyp+1){
      bend_bnd->ntyp++;
      strcpy(build_intra->cbend_bnd_typ[itype].atm1,
             build_intra->cbend_bnd_typ_now->atm1);
      strcpy(build_intra->cbend_bnd_typ[itype].atm2,
             build_intra->cbend_bnd_typ_now->atm2);
      strcpy(build_intra->cbend_bnd_typ[itype].atm3,
             build_intra->cbend_bnd_typ_now->atm3);
      strcpy(build_intra->cbend_bnd_typ[itype].label,
             build_intra->cbend_bnd_typ_now->label);
    }
    bend_bnd->num += 1;
    bend_bnd->j1[bend_bnd->num] = iatm_ind1 + clatoms_info->natm_tot;
    bend_bnd->j2[bend_bnd->num] = iatm_ind2 + clatoms_info->natm_tot;
    bend_bnd->j3[bend_bnd->num] = iatm_ind3 + clatoms_info->natm_tot;
    bend_bnd->jtyp[bend_bnd->num] = itype;
  }
  if(ifound==2&&igo==1){
    ires_off = atommaps->jres_jmol_typ_strt[jmol_typ]-1;
    atommaps->nfree_jres_jmol_typ[ires_off+iresidue] -= 1;
    atommaps->icons_jres_jmol_typ[ires_off+iresidue] = 1;
    if(bend->ncon+1 > build_intra->nbend_con_max){
      build_intra->nbend_con_max += 100;
      bend->j1_con = (int *)crealloc(&(bend->j1_con)[1],
         build_intra->nbend_con_max*sizeof(int))-1;
      bend->j2_con = (int *)crealloc(&(bend->j2_con)[1],
         build_intra->nbend_con_max*sizeof(int))-1;
      bend->jtyp_con=(int *)crealloc(&(bend->jtyp_con)[1],
         build_intra->nbend_con_max*sizeof(int))-1;
    }
    itype = (bend->ntyp_con)+1;
    for(i=1;i<=bend->ntyp_con;i++){
      if((strcasecmp(build_intra->cbend_typ_con[i].atm1,
       build_intra->cbend_typ_now->atm1)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm2,
         build_intra->cbend_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm3,
         build_intra->cbend_typ_now->atm3)==0)
  &&(strcasecmp(build_intra->cbend_typ_con[i].label,
         build_intra->cbend_typ_now->label)==0)){itype=i;}
      if((strcasecmp(build_intra->cbend_typ_con[i].atm1,
       build_intra->cbend_typ_now->atm3)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm2,
         build_intra->cbend_typ_now->atm2)==0)
         &&(strcasecmp(build_intra->cbend_typ_con[i].atm3,
         build_intra->cbend_typ_now->atm1)==0)
  &&(strcasecmp(build_intra->cbend_typ_con[i].label,
         build_intra->cbend_typ_now->label)==0)){itype=i;}
    }
    if(itype>build_intra->nbend_typ_con_max){
      build_intra->nbend_typ_con_max += 100;
      build_intra->cbend_typ_con = (struct CBEND *)
 crealloc(&(build_intra->cbend_typ_con[1]),
   build_intra->nbend_typ_con_max*sizeof(CBEND))-1;
    }
    if(itype==(bend->ntyp_con)+1){
      bend->ntyp_con+=1;
      strcpy(build_intra->cbend_typ_con[itype].atm1,
      build_intra->cbend_typ_now->atm1);
      strcpy(build_intra->cbend_typ_con[itype].atm2,
      build_intra->cbend_typ_now->atm2);
      strcpy(build_intra->cbend_typ_con[itype].atm3,
      build_intra->cbend_typ_now->atm3);
      strcpy(build_intra->cbend_typ_con[itype].label,
      build_intra->cbend_typ_now->label);
    }
    bend->ncon += 1;
    bend->j1_con[bend->ncon] = iatm_ind1 + clatoms_info->natm_tot;
    bend->j2_con[bend->ncon] = iatm_ind2 + clatoms_info->natm_tot;
    bend->j3_con[bend->ncon] = iatm_ind3 + clatoms_info->natm_tot;
    bend->jtyp_con[bend->ncon] = itype;
    if((atommaps->ighost_flag[bend->j1_con[bend->ncon]]!=0)||
       (atommaps->ighost_flag[bend->j2_con[bend->ncon]]!=0)||
       (atommaps->ighost_flag[bend->j3_con[bend->ncon]]!=0)){
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        printf("Ghost atoms are not permitted in constrained bends\n");
        printf("in molecule index %d in residue index %d in file %s\n",
                jmol_typ,iresidue,file_name);
        printf("@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@\n");
        fflush(stdout);
        exit(1);
    }
  }
  if(ifound==3&&igo==1){
    if(null_inter_parse->nbend_nul+1 > build_intra->nbend_nul_max){
      build_intra->nbend_nul_max += 100;
      null_inter_parse->jbend1_nul =
 (int *) crealloc(&(null_inter_parse->jbend1_nul)[1],
    build_intra->nbend_nul_max*sizeof(int))-1;
      null_inter_parse->jbend2_nul =
 (int *) crealloc(&(null_inter_parse->jbend2_nul)[1],
    build_intra->nbend_nul_max*sizeof(int))-1;
      null_inter_parse->jbend3_nul =
 (int *) crealloc(&(null_inter_parse->jbend3_nul)[1],
    build_intra->nbend_nul_max*sizeof(int))-1;
    }
    null_inter_parse->nbend_nul += 1;
    (null_inter_parse->jbend1_nul)[null_inter_parse->nbend_nul] =
                       iatm_ind1 + clatoms_info->natm_tot;
    (null_inter_parse->jbend2_nul)[null_inter_parse->nbend_nul] =
                              iatm_ind2 + clatoms_info->natm_tot;
    (null_inter_parse->jbend3_nul)[null_inter_parse->nbend_nul] =
                              iatm_ind3 + clatoms_info->natm_tot;
  }
}

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

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 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; } *

variable_types: 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; } *

variable_types: struct null_inter_parse { int nbond_nul; int ntors_nul; int *jbond1_nul; int *jbend1_nul; int *jtors1_nul; int *jonfo1_nul; } *

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: iresidue int

variable_types: num int

variable_types: index int

variable_types: ifound int

variable_types: igo int

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

original_code:
void min_CG(CLASS *class,BONDED *bonded,GENERAL_DATA *general_data,int ireset)
{
    int i,ipart,ifirst=1;
    int natm_tot;
    double dt,tol_glob,dt22,dt2;
    double dtsm,dtsm2;
    double gamma;
    double fovlap_old;
    static double fovlap;
    double *zeta;
   int min_atm_com_fix_opt = general_data->minopts.min_atm_com_fix_opt;
   double *clatoms_x = class->clatoms_pos[1].x;
   double *clatoms_y = class->clatoms_pos[1].y;
   double *clatoms_z = class->clatoms_pos[1].z;
   double *clatoms_vx = class->clatoms_pos[1].vx;
   double *clatoms_vy = class->clatoms_pos[1].vy;
   double *clatoms_vz = class->clatoms_pos[1].vz;
   double *clatoms_fx = class->clatoms_pos[1].fx;
   double *clatoms_fy = class->clatoms_pos[1].fy;
   double *clatoms_fz = class->clatoms_pos[1].fz;
   double *chx = class->clatoms_pos[1].vx;
   double *chy = class->clatoms_pos[1].vy;
   double *chz = class->clatoms_pos[1].vz;
   double *clatoms_mass = class->clatoms_info.mass;
   double *clatoms_xold = class->clatoms_info.xold;
   double *clatoms_yold = class->clatoms_info.yold;
   double *clatoms_zold = class->clatoms_info.zold;
    (class->energy_ctrl.int_res_tra) = 0;
    (class->energy_ctrl.int_res_ter) = 0;
    dt = (general_data->timeinfo.dt);
    dt2 = dt/2.0;
    dt22 = dt*dt/2.0;
    dtsm = .01;
    dtsm2 = dtsm/2.0;
    general_data->stat_avg.iter_shake = 0;
    general_data->stat_avg.iter_ratl = 0;
    natm_tot = class->clatoms_info.natm_tot;
    zeta = (double *) cmalloc(natm_tot*sizeof(double))-1;
   if(ireset == 1){
     for(i=1;i<=natm_tot; i++){
      chx[i] = 0.0;
      chy[i] = 0.0;
      chz[i] = 0.0;
     }
     gamma = 0.0;
     fovlap = 1.0;
    }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_xold[ipart] = clatoms_x[ipart];
      clatoms_yold[ipart] = clatoms_y[ipart];
      clatoms_zold[ipart] = clatoms_z[ipart];
              }
    (class->energy_ctrl.iget_full_inter)= 1;
    (class->energy_ctrl.iget_res_inter) = 0;
    (class->energy_ctrl.iget_full_intra)= 1;
    (class->energy_ctrl.iget_res_intra) = 0;
    energy_control(class,bonded,general_data);
    if(min_atm_com_fix_opt==1){
       proj_com_out(class->clatoms_info.natm_tot,
                    clatoms_fx,clatoms_fy,clatoms_fz);
    }
   if((bonded->constrnt.iconstrnt)==1){
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      (clatoms_vx)[ipart] += (clatoms_fx)[ipart]*dtsm2/((clatoms_mass)[ipart]);
      (clatoms_vy)[ipart] += (clatoms_fy)[ipart]*dtsm2/((clatoms_mass)[ipart]);
      (clatoms_vz)[ipart] += (clatoms_fz)[ipart]*dtsm2/((clatoms_mass)[ipart]);
    }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_x[ipart] += clatoms_vx[ipart]*dtsm;
      clatoms_y[ipart] += clatoms_vy[ipart]*dtsm;
      clatoms_z[ipart] += clatoms_vz[ipart]*dtsm;
    }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_vx[ipart] = 0.0;
      clatoms_vy[ipart] = 0.0;
      clatoms_vz[ipart] = 0.0;
    }
    init_constraint(bonded,&(general_data->ptens));
    (bonded->constrnt.iroll) = 0;
     shake_control(bonded,&(class->clatoms_info),&(class->clatoms_pos[1]),
                  &(general_data->cell),&(general_data->ptens),
                  &(general_data->statepoint),
                  &(general_data->baro),&(general_data->par_rahman),
                  &(general_data->stat_avg),dt,&tol_glob,ifirst,
                  &(class->class_comm_forc_pkg),&(class->ewd_scr));
   for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_fx[ipart] += clatoms_vx[ipart]*clatoms_mass[ipart]/dtsm2;
      clatoms_fy[ipart] += clatoms_vy[ipart]*clatoms_mass[ipart]/dtsm2;
      clatoms_fz[ipart] += clatoms_vz[ipart]*clatoms_mass[ipart]/dtsm2;
              }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_x[ipart] = clatoms_xold[ipart];
      clatoms_y[ipart] = clatoms_yold[ipart];
      clatoms_z[ipart] = clatoms_zold[ipart];
    }
   }
   fovlap_old = fovlap;
   fovlap = 0.0;
   for(i=1;i<=natm_tot;i++){
    fovlap += clatoms_fx[i]*clatoms_fx[i]
            + clatoms_fy[i]*clatoms_fy[i]
            + clatoms_fz[i]*clatoms_fz[i];
   }
   if(ireset != 1) {gamma = fovlap/fovlap_old;}
     for(i=1;i<=natm_tot; i++){
      chx[i] = clatoms_fx[i] + gamma*chx[i];
      chy[i] = clatoms_fy[i] + gamma*chy[i];
      chz[i] = clatoms_fz[i] + gamma*chz[i];
     }
   for(i=1;i<=natm_tot;i++) {
    zeta[i] = dt/clatoms_mass[i];
   }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_x[ipart] = clatoms_xold[ipart] + zeta[ipart]*chx[ipart];
      clatoms_y[ipart] = clatoms_yold[ipart] + zeta[ipart]*chy[ipart];
      clatoms_z[ipart] = clatoms_zold[ipart] + zeta[ipart]*chz[ipart];
              }
    if((bonded->constrnt.iconstrnt)==1){
         (bonded->constrnt.iroll) = 0;
         init_constraint(bonded,&(general_data->ptens));
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_vx[ipart] = 0.0;
      clatoms_vy[ipart] = 0.0;
      clatoms_vz[ipart] = 0.0;
              }
         shake_control(bonded,&(class->clatoms_info),&(class->clatoms_pos[1]),
                      &(general_data->cell),&(general_data->ptens),
                      &(general_data->statepoint),
                      &(general_data->baro),&(general_data->par_rahman),
                      &(general_data->stat_avg),dt,&tol_glob,ifirst,
                      &(class->class_comm_forc_pkg),&(class->ewd_scr));
           }
   get_ghost_pos(&(class->clatoms_info),&(class->clatoms_pos[1]),
                 &(class->ghost_atoms));
    (class->energy_ctrl.iget_full_inter)= 1;
    (class->energy_ctrl.iget_res_inter) = 0;
    (class->energy_ctrl.iget_full_intra)= 1;
    (class->energy_ctrl.iget_res_intra) = 0;
    energy_control(class,bonded,general_data);
   cfree(&(zeta[1]));
               }

canonical_original_code:
void min_CG(struct class *class, struct bonded *bonded, struct general_data *general_data, int ireset)
{
    int i; int ipart; int ifirst = 1;
    int natm_tot;
    double dt; double tol_glob; double dt22; double dt2;
    double dtsm; double dtsm2;
    double gamma;
    double fovlap_old;
    static double fovlap;
    double *zeta;
   int min_atm_com_fix_opt = general_data->minopts.min_atm_com_fix_opt;
   double *clatoms_x = class->clatoms_pos[1].x;
   double *clatoms_y = class->clatoms_pos[1].y;
   double *clatoms_z = class->clatoms_pos[1].z;
   double *clatoms_vx = class->clatoms_pos[1].vx;
   double *clatoms_vy = class->clatoms_pos[1].vy;
   double *clatoms_vz = class->clatoms_pos[1].vz;
   double *clatoms_fx = class->clatoms_pos[1].fx;
   double *clatoms_fy = class->clatoms_pos[1].fy;
   double *clatoms_fz = class->clatoms_pos[1].fz;
   double *chx = class->clatoms_pos[1].vx;
   double *chy = class->clatoms_pos[1].vy;
   double *chz = class->clatoms_pos[1].vz;
   double *clatoms_mass = class->clatoms_info.mass;
   double *clatoms_xold = class->clatoms_info.xold;
   double *clatoms_yold = class->clatoms_info.yold;
   double *clatoms_zold = class->clatoms_info.zold;
    (class->energy_ctrl.int_res_tra) = 0;
    (class->energy_ctrl.int_res_ter) = 0;
    dt = (general_data->timeinfo.dt);
    dt2 = dt/2.0;
    dt22 = dt*dt/2.0;
    dtsm = .01;
    dtsm2 = dtsm/2.0;
    general_data->stat_avg.iter_shake = 0;
    general_data->stat_avg.iter_ratl = 0;
    natm_tot = class->clatoms_info.natm_tot;
    zeta = (double *) cmalloc(natm_tot*sizeof(double))-1;
   if(ireset == 1){
     for(i=1;i<=natm_tot; i++){
      chx[i] = 0.0;
      chy[i] = 0.0;
      chz[i] = 0.0;
     }
     gamma = 0.0;
     fovlap = 1.0;
    }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_xold[ipart] = clatoms_x[ipart];
      clatoms_yold[ipart] = clatoms_y[ipart];
      clatoms_zold[ipart] = clatoms_z[ipart];
              }
    (class->energy_ctrl.iget_full_inter)= 1;
    (class->energy_ctrl.iget_res_inter) = 0;
    (class->energy_ctrl.iget_full_intra)= 1;
    (class->energy_ctrl.iget_res_intra) = 0;
    energy_control(class,bonded,general_data);
    if(min_atm_com_fix_opt==1){
       proj_com_out(class->clatoms_info.natm_tot,
                    clatoms_fx,clatoms_fy,clatoms_fz);
    }
   if((bonded->constrnt.iconstrnt)==1){
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      (clatoms_vx)[ipart] += (clatoms_fx)[ipart]*dtsm2/((clatoms_mass)[ipart]);
      (clatoms_vy)[ipart] += (clatoms_fy)[ipart]*dtsm2/((clatoms_mass)[ipart]);
      (clatoms_vz)[ipart] += (clatoms_fz)[ipart]*dtsm2/((clatoms_mass)[ipart]);
    }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_x[ipart] += clatoms_vx[ipart]*dtsm;
      clatoms_y[ipart] += clatoms_vy[ipart]*dtsm;
      clatoms_z[ipart] += clatoms_vz[ipart]*dtsm;
    }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_vx[ipart] = 0.0;
      clatoms_vy[ipart] = 0.0;
      clatoms_vz[ipart] = 0.0;
    }
    init_constraint(bonded,&(general_data->ptens));
    (bonded->constrnt.iroll) = 0;
     shake_control(bonded,&(class->clatoms_info),&(class->clatoms_pos[1]),
                  &(general_data->cell),&(general_data->ptens),
                  &(general_data->statepoint),
                  &(general_data->baro),&(general_data->par_rahman),
                  &(general_data->stat_avg),dt,&tol_glob,ifirst,
                  &(class->class_comm_forc_pkg),&(class->ewd_scr));
   for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_fx[ipart] += clatoms_vx[ipart]*clatoms_mass[ipart]/dtsm2;
      clatoms_fy[ipart] += clatoms_vy[ipart]*clatoms_mass[ipart]/dtsm2;
      clatoms_fz[ipart] += clatoms_vz[ipart]*clatoms_mass[ipart]/dtsm2;
              }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_x[ipart] = clatoms_xold[ipart];
      clatoms_y[ipart] = clatoms_yold[ipart];
      clatoms_z[ipart] = clatoms_zold[ipart];
    }
   }
   fovlap_old = fovlap;
   fovlap = 0.0;
   for(i=1;i<=natm_tot;i++){
    fovlap += clatoms_fx[i]*clatoms_fx[i]
            + clatoms_fy[i]*clatoms_fy[i]
            + clatoms_fz[i]*clatoms_fz[i];
   }
   if(ireset != 1) {gamma = fovlap/fovlap_old;}
     for(i=1;i<=natm_tot; i++){
      chx[i] = clatoms_fx[i] + gamma*chx[i];
      chy[i] = clatoms_fy[i] + gamma*chy[i];
      chz[i] = clatoms_fz[i] + gamma*chz[i];
     }
   for(i=1;i<=natm_tot;i++) {
    zeta[i] = dt/clatoms_mass[i];
   }
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_x[ipart] = clatoms_xold[ipart] + zeta[ipart]*chx[ipart];
      clatoms_y[ipart] = clatoms_yold[ipart] + zeta[ipart]*chy[ipart];
      clatoms_z[ipart] = clatoms_zold[ipart] + zeta[ipart]*chz[ipart];
              }
    if((bonded->constrnt.iconstrnt)==1){
         (bonded->constrnt.iroll) = 0;
         init_constraint(bonded,&(general_data->ptens));
    for(ipart=1;ipart<=(class->clatoms_info.natm_tot);ipart++){
      clatoms_vx[ipart] = 0.0;
      clatoms_vy[ipart] = 0.0;
      clatoms_vz[ipart] = 0.0;
              }
         shake_control(bonded,&(class->clatoms_info),&(class->clatoms_pos[1]),
                      &(general_data->cell),&(general_data->ptens),
                      &(general_data->statepoint),
                      &(general_data->baro),&(general_data->par_rahman),
                      &(general_data->stat_avg),dt,&tol_glob,ifirst,
                      &(class->class_comm_forc_pkg),&(class->ewd_scr));
           }
   get_ghost_pos(&(class->clatoms_info),&(class->clatoms_pos[1]),
                 &(class->ghost_atoms));
    (class->energy_ctrl.iget_full_inter)= 1;
    (class->energy_ctrl.iget_res_inter) = 0;
    (class->energy_ctrl.iget_full_intra)= 1;
    (class->energy_ctrl.iget_res_intra) = 0;
    energy_control(class,bonded,general_data);
   cfree(&(zeta[1]));
               }

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: ireset int

variable_types: i int

variable_types: ipart int

variable_types: ifirst int

variable_types: dt double

variable_types: dtsm double

variable_types: gamma double

variable_types: fovlap double

variable_types:
zeta
double *

variable_types:
chx
double *

variable_types:
chy
double *

variable_types:
chz
double *

return_type: void

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 rbar_sig_free(CLATOMS_INFO *clatoms_info,CLATOMS_POS *clatoms_pos,
                   RBAR_SIG_FREE *rbar_sig_free,CELL *cell,
                   INTRA_SCR *intra_scr,PTENS *ptens, double *vbar_free,
                   ENERGY_CTRL *energy_ctrl,int np_forc)
   {
  int ibond,ibig,ibig1,ioff,iend,nnow;
  double r122;
  double pre;
  int iii;
  int ibin_bar,ibin_sig,ibin;
  double const1,const3,const4,r_bar,sigma,rr0_bar;
  double rr0_sig;
  double r2_bar;
  double *intra_scr_x1 = intra_scr->x1;
  double *intra_scr_y1 = intra_scr->y1;
  double *intra_scr_z1 = intra_scr->z1;
  double *intra_scr_x2 = intra_scr->x2;
  double *intra_scr_y2 = intra_scr->y2;
  double *intra_scr_z2 = intra_scr->z2;
  double *intra_scr_fx1 = intra_scr->fx1;
  double *intra_scr_fy1 = intra_scr->fy1;
  double *intra_scr_fz1 = intra_scr->fz1;
  double *intra_scr_dx12 = intra_scr->dx12;
  double *intra_scr_dy12 = intra_scr->dy12;
  double *intra_scr_dz12 = intra_scr->dz12;
  double *intra_scr_vpot = intra_scr->vpot;
  double *intra_scr_eq = intra_scr->eq;
  double *intra_scr_p11 = intra_scr->p11;
  double *intra_scr_p22 = intra_scr->p22;
  double *intra_scr_p33 = intra_scr->p33;
  double *intra_scr_p21 = intra_scr->p21;
  double *intra_scr_p12 = intra_scr->p12;
  double *intra_scr_p31 = intra_scr->p31;
  double *intra_scr_p13 = intra_scr->p13;
  double *intra_scr_p32 = intra_scr->p32;
  double *intra_scr_p23 = intra_scr->p23;
  double *intra_scr_r = intra_scr->r;
  double *intra_scr_r2 = intra_scr->r3;
  int pi_beads = clatoms_info->pi_beads;
  double *clatoms_x = clatoms_pos->x;
  double *clatoms_y = clatoms_pos->y;
  double *clatoms_z = clatoms_pos->z;
  double *clatoms_pos_fx = clatoms_pos->fx;
  double *clatoms_pos_fy = clatoms_pos->fy;
  double *clatoms_pos_fz = clatoms_pos->fz;
  double *clatoms_fxt = clatoms_pos->fxt;
  double *clatoms_fyt = clatoms_pos->fyt;
  double *clatoms_fzt = clatoms_pos->fzt;
  double *ptens_pvten_tmp = ptens->pvten_tmp;
  double *ptens_pvten = ptens->pvten;
  double *ptens_pvten_tot = ptens->pvten_tot;
  int nfree = rbar_sig_free->nfree;
  double rnfree = rbar_sig_free->rnfree;
  double eq_bar = rbar_sig_free->eq_bar;
  double eq_sigma = rbar_sig_free->eq_sigma;
  double fk_bar = rbar_sig_free->fk_bar;
  double fk_sigma = rbar_sig_free->fk_sigma;
  int nhist_bar = rbar_sig_free->nhist_bar;
  int nhist_sig = rbar_sig_free->nhist_sig;
  double smin = rbar_sig_free->smin;
  double smax = rbar_sig_free->smax;
  double rmin = rbar_sig_free->rmin;
  double rmax = rbar_sig_free->rmax;
  double del_bar = rbar_sig_free->del_bar;
  double del_sig = rbar_sig_free->del_sig;
  double **hist = rbar_sig_free->hist;
  double **hist_rn = rbar_sig_free->hist_rn;
  int *j1 = rbar_sig_free->j1;
  int *j2 = rbar_sig_free->j2;
  int energy_ctrl_iget_full_inter = energy_ctrl->iget_full_inter;
  int intra_perds = cell->intra_perds;
  int iperd = cell->iperd;
  double wfor = intra_scr->wght_tra_res;
   for(ibond=1;ibond<=nfree;ibond++){
      intra_scr_x1[ibond] = clatoms_x[j1[ibond]];
      intra_scr_y1[ibond] = clatoms_y[j1[ibond]];
      intra_scr_z1[ibond] = clatoms_z[j1[ibond]];
      intra_scr_x2[ibond] = clatoms_x[j2[ibond]];
      intra_scr_y2[ibond] = clatoms_y[j2[ibond]];
      intra_scr_z2[ibond] = clatoms_z[j2[ibond]];
   }
   for(ibond=1;ibond<=nfree;ibond++){
      intra_scr_dx12[ibond] = intra_scr_x1[ibond] - intra_scr_x2[ibond];
      intra_scr_dy12[ibond] = intra_scr_y1[ibond] - intra_scr_y2[ibond];
      intra_scr_dz12[ibond] = intra_scr_z1[ibond] - intra_scr_z2[ibond];
   }
   if(intra_perds == 1) {
     period(nfree,intra_scr_dx12,intra_scr_dy12,intra_scr_dz12,cell);
   }
   r_bar = 0.0;
   r2_bar = 0.0;
   for(ibond=1;ibond<=nfree;ibond++){
      r122 = (intra_scr_dx12[ibond]*intra_scr_dx12[ibond]
                            +intra_scr_dy12[ibond]*intra_scr_dy12[ibond]
                            +intra_scr_dz12[ibond]*intra_scr_dz12[ibond]);
      intra_scr_r[ibond] = sqrt(r122);
      r_bar += intra_scr_r[ibond];
      r2_bar += r122;
   }
   r_bar /= rnfree;
   r2_bar /= rnfree;
   sigma = sqrt(fabs(r2_bar-r_bar*r_bar));
   rr0_bar = (r_bar - eq_bar);
   *vbar_free = 0.5*fk_bar*rr0_bar*rr0_bar;
   rr0_sig = (sigma - eq_sigma);
   *vbar_free += 0.5*fk_sigma*rr0_sig*rr0_sig;
   if(energy_ctrl_iget_full_inter==1){
     ibin_sig = (sigma-smin)/del_sig + 1.0;
     ibin_sig = (((nhist_sig)<(ibin_sig))?(nhist_sig):(ibin_sig));
     ibin_sig = (((1)>(ibin_sig))?(1):(ibin_sig));
     ibin_bar = (r_bar-rmin)/del_bar + 1.0;
     ibin_bar = (((nhist_bar)<(ibin_bar))?(nhist_bar):(ibin_bar));
     ibin_bar = (((1)>(ibin_bar))?(1):(ibin_bar));
     hist[ibin_bar][ibin_sig] += 1.0;
     for(ibond=1;ibond<=nfree;ibond++){
        ibin = (intra_scr_r[ibond]-rmin)/del_bar + 1.0;
        ibin = (((nhist_bar)<(ibin))?(nhist_bar):(ibin));
        ibin = (((1)>(ibin_bar))?(1):(ibin_bar));
        hist_rn[ibond][ibin] += 1.0;
     }
   }
   const3 = -fk_bar*(r_bar-eq_bar)/rnfree;
   const4 = -fk_sigma*(sigma-eq_sigma)/(sigma*rnfree);
   for(ibond=1;ibond<=nfree;ibond++){
      const1 = (intra_scr_r[ibond]-r_bar)*const4;
      pre = (const1+const3)/intra_scr_r[ibond];
      intra_scr_fx1[ibond] = intra_scr_dx12[ibond]*pre;
      intra_scr_fy1[ibond] = intra_scr_dy12[ibond]*pre;
      intra_scr_fz1[ibond] = intra_scr_dz12[ibond]*pre;
     }
  if(iperd == 2 || iperd == 3) {
    for(ibond=1;ibond<=nfree;ibond++){
      intra_scr_p11[ibond] = intra_scr_dx12[ibond]*intra_scr_fx1[ibond];
      intra_scr_p22[ibond] = intra_scr_dy12[ibond]*intra_scr_fy1[ibond];
      intra_scr_p33[ibond] = intra_scr_dz12[ibond]*intra_scr_fz1[ibond];
      intra_scr_p12[ibond] = intra_scr_dx12[ibond]*intra_scr_fy1[ibond];
      intra_scr_p21[ibond] = intra_scr_dy12[ibond]*intra_scr_fx1[ibond];
     }
     for(ibond=1;ibond<=nfree;ibond++){
       ptens_pvten[1] += intra_scr_p11[ibond]*wfor;
       ptens_pvten[5] += intra_scr_p22[ibond]*wfor;
       ptens_pvten[9] += intra_scr_p33[ibond]*wfor;
       ptens_pvten[2] += intra_scr_p12[ibond]*wfor;
       ptens_pvten[4] += intra_scr_p21[ibond]*wfor;
       ptens_pvten_tot[1] += intra_scr_p11[ibond];
       ptens_pvten_tot[5] += intra_scr_p22[ibond];
       ptens_pvten_tot[9] += intra_scr_p33[ibond];
       ptens_pvten_tot[2] += intra_scr_p12[ibond];
       ptens_pvten_tot[4] += intra_scr_p21[ibond];
     }
   }
   if(iperd == 3) {
     for(ibond=1;ibond<=nfree;ibond++){
       intra_scr_p13[ibond] = intra_scr_dx12[ibond]*intra_scr_fz1[ibond];
       intra_scr_p31[ibond] = intra_scr_dz12[ibond]*intra_scr_fx1[ibond];
       intra_scr_p23[ibond] = intra_scr_dy12[ibond]*intra_scr_fz1[ibond];
       intra_scr_p32[ibond] = intra_scr_dz12[ibond]*intra_scr_fy1[ibond];
     }
     for(ibond=1;ibond<=nfree;ibond++){
       ptens_pvten[3] += intra_scr_p13[ibond]*wfor;
       ptens_pvten[7] += intra_scr_p31[ibond]*wfor;
       ptens_pvten[6] += intra_scr_p23[ibond]*wfor;
       ptens_pvten[8] += intra_scr_p32[ibond]*wfor;
       ptens_pvten_tot[3] += intra_scr_p13[ibond];
       ptens_pvten_tot[7] += intra_scr_p31[ibond];
       ptens_pvten_tot[6] += intra_scr_p23[ibond];
       ptens_pvten_tot[8] += intra_scr_p32[ibond];
     }
   }
   for(ibond=1;ibond<=nfree;ibond++){
     clatoms_pos_fx[j1[ibond]] += intra_scr_fx1[ibond]*wfor;
     clatoms_pos_fy[j1[ibond]] += intra_scr_fy1[ibond]*wfor;
     clatoms_pos_fz[j1[ibond]] += intra_scr_fz1[ibond]*wfor;
     clatoms_pos_fx[j2[ibond]] += -intra_scr_fx1[ibond]*wfor;
     clatoms_pos_fy[j2[ibond]] += -intra_scr_fy1[ibond]*wfor;
     clatoms_pos_fz[j2[ibond]] += -intra_scr_fz1[ibond]*wfor;
   }
     }

canonical_original_code:
void rbar_sig_free(struct clatoms_info *clatoms_info, struct clatoms_pos *clatoms_pos, struct rbar_sig_free *rbar_sig_free, struct cell *cell, struct intra_scr *intra_scr, struct ptens *ptens, double *vbar_free, struct energy_ctrl *energy_ctrl, int np_forc)
   {
  int ibond; int ibig; int ibig1; int ioff; int iend; int nnow;
  double r122;
  double pre;
  int iii;
  int ibin_bar; int ibin_sig; int ibin;
  double const1; double const3; double const4; double r_bar; double sigma; double rr0_bar;
  double rr0_sig;
  double r2_bar;
  double *intra_scr_x1 = intra_scr->x1;
  double *intra_scr_y1 = intra_scr->y1;
  double *intra_scr_z1 = intra_scr->z1;
  double *intra_scr_x2 = intra_scr->x2;
  double *intra_scr_y2 = intra_scr->y2;
  double *intra_scr_z2 = intra_scr->z2;
  double *intra_scr_fx1 = intra_scr->fx1;
  double *intra_scr_fy1 = intra_scr->fy1;
  double *intra_scr_fz1 = intra_scr->fz1;
  double *intra_scr_dx12 = intra_scr->dx12;
  double *intra_scr_dy12 = intra_scr->dy12;
  double *intra_scr_dz12 = intra_scr->dz12;
  double *intra_scr_vpot = intra_scr->vpot;
  double *intra_scr_eq = intra_scr->eq;
  double *intra_scr_p11 = intra_scr->p11;
  double *intra_scr_p22 = intra_scr->p22;
  double *intra_scr_p33 = intra_scr->p33;
  double *intra_scr_p21 = intra_scr->p21;
  double *intra_scr_p12 = intra_scr->p12;
  double *intra_scr_p31 = intra_scr->p31;
  double *intra_scr_p13 = intra_scr->p13;
  double *intra_scr_p32 = intra_scr->p32;
  double *intra_scr_p23 = intra_scr->p23;
  double *intra_scr_r = intra_scr->r;
  double *intra_scr_r2 = intra_scr->r3;
  int pi_beads = clatoms_info->pi_beads;
  double *clatoms_x = clatoms_pos->x;
  double *clatoms_y = clatoms_pos->y;
  double *clatoms_z = clatoms_pos->z;
  double *clatoms_pos_fx = clatoms_pos->fx;
  double *clatoms_pos_fy = clatoms_pos->fy;
  double *clatoms_pos_fz = clatoms_pos->fz;
  double *clatoms_fxt = clatoms_pos->fxt;
  double *clatoms_fyt = clatoms_pos->fyt;
  double *clatoms_fzt = clatoms_pos->fzt;
  double *ptens_pvten_tmp = ptens->pvten_tmp;
  double *ptens_pvten = ptens->pvten;
  double *ptens_pvten_tot = ptens->pvten_tot;
  int nfree = rbar_sig_free->nfree;
  double rnfree = rbar_sig_free->rnfree;
  double eq_bar = rbar_sig_free->eq_bar;
  double eq_sigma = rbar_sig_free->eq_sigma;
  double fk_bar = rbar_sig_free->fk_bar;
  double fk_sigma = rbar_sig_free->fk_sigma;
  int nhist_bar = rbar_sig_free->nhist_bar;
  int nhist_sig = rbar_sig_free->nhist_sig;
  double smin = rbar_sig_free->smin;
  double smax = rbar_sig_free->smax;
  double rmin = rbar_sig_free->rmin;
  double rmax = rbar_sig_free->rmax;
  double del_bar = rbar_sig_free->del_bar;
  double del_sig = rbar_sig_free->del_sig;
  double **hist = rbar_sig_free->hist;
  double **hist_rn = rbar_sig_free->hist_rn;
  int *j1 = rbar_sig_free->j1;
  int *j2 = rbar_sig_free->j2;
  int energy_ctrl_iget_full_inter = energy_ctrl->iget_full_inter;
  int intra_perds = cell->intra_perds;
  int iperd = cell->iperd;
  double wfor = intra_scr->wght_tra_res;
   for(ibond=1;ibond<=nfree;ibond++){
      intra_scr_x1[ibond] = clatoms_x[j1[ibond]];
      intra_scr_y1[ibond] = clatoms_y[j1[ibond]];
      intra_scr_z1[ibond] = clatoms_z[j1[ibond]];
      intra_scr_x2[ibond] = clatoms_x[j2[ibond]];
      intra_scr_y2[ibond] = clatoms_y[j2[ibond]];
      intra_scr_z2[ibond] = clatoms_z[j2[ibond]];
   }
   for(ibond=1;ibond<=nfree;ibond++){
      intra_scr_dx12[ibond] = intra_scr_x1[ibond] - intra_scr_x2[ibond];
      intra_scr_dy12[ibond] = intra_scr_y1[ibond] - intra_scr_y2[ibond];
      intra_scr_dz12[ibond] = intra_scr_z1[ibond] - intra_scr_z2[ibond];
   }
   if(intra_perds == 1) {
     period(nfree,intra_scr_dx12,intra_scr_dy12,intra_scr_dz12,cell);
   }
   r_bar = 0.0;
   r2_bar = 0.0;
   for(ibond=1;ibond<=nfree;ibond++){
      r122 = (intra_scr_dx12[ibond]*intra_scr_dx12[ibond]
                            +intra_scr_dy12[ibond]*intra_scr_dy12[ibond]
                            +intra_scr_dz12[ibond]*intra_scr_dz12[ibond]);
      intra_scr_r[ibond] = sqrt(r122);
      r_bar += intra_scr_r[ibond];
      r2_bar += r122;
   }
   r_bar /= rnfree;
   r2_bar /= rnfree;
   sigma = sqrt(fabs(r2_bar-r_bar*r_bar));
   rr0_bar = (r_bar - eq_bar);
   *vbar_free = 0.5*fk_bar*rr0_bar*rr0_bar;
   rr0_sig = (sigma - eq_sigma);
   *vbar_free += 0.5*fk_sigma*rr0_sig*rr0_sig;
   if(energy_ctrl_iget_full_inter==1){
     ibin_sig = (sigma-smin)/del_sig + 1.0;
     ibin_sig = (((nhist_sig)<(ibin_sig))?(nhist_sig):(ibin_sig));
     ibin_sig = (((1)>(ibin_sig))?(1):(ibin_sig));
     ibin_bar = (r_bar-rmin)/del_bar + 1.0;
     ibin_bar = (((nhist_bar)<(ibin_bar))?(nhist_bar):(ibin_bar));
     ibin_bar = (((1)>(ibin_bar))?(1):(ibin_bar));
     hist[ibin_bar][ibin_sig] += 1.0;
     for(ibond=1;ibond<=nfree;ibond++){
        ibin = (intra_scr_r[ibond]-rmin)/del_bar + 1.0;
        ibin = (((nhist_bar)<(ibin))?(nhist_bar):(ibin));
        ibin = (((1)>(ibin_bar))?(1):(ibin_bar));
        hist_rn[ibond][ibin] += 1.0;
     }
   }
   const3 = -fk_bar*(r_bar-eq_bar)/rnfree;
   const4 = -fk_sigma*(sigma-eq_sigma)/(sigma*rnfree);
   for(ibond=1;ibond<=nfree;ibond++){
      const1 = (intra_scr_r[ibond]-r_bar)*const4;
      pre = (const1+const3)/intra_scr_r[ibond];
      intra_scr_fx1[ibond] = intra_scr_dx12[ibond]*pre;
      intra_scr_fy1[ibond] = intra_scr_dy12[ibond]*pre;
      intra_scr_fz1[ibond] = intra_scr_dz12[ibond]*pre;
     }
  if(iperd == 2 || iperd == 3) {
    for(ibond=1;ibond<=nfree;ibond++){
      intra_scr_p11[ibond] = intra_scr_dx12[ibond]*intra_scr_fx1[ibond];
      intra_scr_p22[ibond] = intra_scr_dy12[ibond]*intra_scr_fy1[ibond];
      intra_scr_p33[ibond] = intra_scr_dz12[ibond]*intra_scr_fz1[ibond];
      intra_scr_p12[ibond] = intra_scr_dx12[ibond]*intra_scr_fy1[ibond];
      intra_scr_p21[ibond] = intra_scr_dy12[ibond]*intra_scr_fx1[ibond];
     }
     for(ibond=1;ibond<=nfree;ibond++){
       ptens_pvten[1] += intra_scr_p11[ibond]*wfor;
       ptens_pvten[5] += intra_scr_p22[ibond]*wfor;
       ptens_pvten[9] += intra_scr_p33[ibond]*wfor;
       ptens_pvten[2] += intra_scr_p12[ibond]*wfor;
       ptens_pvten[4] += intra_scr_p21[ibond]*wfor;
       ptens_pvten_tot[1] += intra_scr_p11[ibond];
       ptens_pvten_tot[5] += intra_scr_p22[ibond];
       ptens_pvten_tot[9] += intra_scr_p33[ibond];
       ptens_pvten_tot[2] += intra_scr_p12[ibond];
       ptens_pvten_tot[4] += intra_scr_p21[ibond];
     }
   }
   if(iperd == 3) {
     for(ibond=1;ibond<=nfree;ibond++){
       intra_scr_p13[ibond] = intra_scr_dx12[ibond]*intra_scr_fz1[ibond];
       intra_scr_p31[ibond] = intra_scr_dz12[ibond]*intra_scr_fx1[ibond];
       intra_scr_p23[ibond] = intra_scr_dy12[ibond]*intra_scr_fz1[ibond];
       intra_scr_p32[ibond] = intra_scr_dz12[ibond]*intra_scr_fy1[ibond];
     }
     for(ibond=1;ibond<=nfree;ibond++){
       ptens_pvten[3] += intra_scr_p13[ibond]*wfor;
       ptens_pvten[7] += intra_scr_p31[ibond]*wfor;
       ptens_pvten[6] += intra_scr_p23[ibond]*wfor;
       ptens_pvten[8] += intra_scr_p32[ibond]*wfor;
       ptens_pvten_tot[3] += intra_scr_p13[ibond];
       ptens_pvten_tot[7] += intra_scr_p31[ibond];
       ptens_pvten_tot[6] += intra_scr_p23[ibond];
       ptens_pvten_tot[8] += intra_scr_p32[ibond];
     }
   }
   for(ibond=1;ibond<=nfree;ibond++){
     clatoms_pos_fx[j1[ibond]] += intra_scr_fx1[ibond]*wfor;
     clatoms_pos_fy[j1[ibond]] += intra_scr_fy1[ibond]*wfor;
     clatoms_pos_fz[j1[ibond]] += intra_scr_fz1[ibond]*wfor;
     clatoms_pos_fx[j2[ibond]] += -intra_scr_fx1[ibond]*wfor;
     clatoms_pos_fy[j2[ibond]] += -intra_scr_fy1[ibond]*wfor;
     clatoms_pos_fz[j2[ibond]] += -intra_scr_fz1[ibond]*wfor;
   }
     }

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 clatoms_pos { double *mass; double *x; double *vx; double *fx; double *fxt; double *fxm; double *hess_xx; } *

variable_types: 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; } *

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: 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; } *

variable_types: 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; } *

variable_types: 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; } *

variable_types: ibond int

variable_types: ibig int

variable_types: ioff int

variable_types: iend int

variable_types: nnow int

variable_types: pre double

variable_types: iii int

variable_types: ibin int

variable_types: sigma double

variable_types: nfree int

variable_types: rnfree double

variable_types: smin double

variable_types: smax double

variable_types: rmin double

variable_types: rmax double

variable_types:
hist
double **

variable_types: iperd int

variable_types: wfor double