standalone I-TASSER : refinement fails if datadir path is long

standalone I-TASSER was constantly crashing on me near the end with the following error (once for each model):
read pdb file err, total atoms 0
FORTRAN STOP

I traced it back to :

in runI-TASSER.pl :
`$libdir/I-TASSERmod/EMrefinement.pl $datadir $refdir closc$i\.pdb combo$i\.pdb $seqname $usrname`;

than in EMrefinement.pl :
system("$libdir/HAAD $datadir/emmc$refname");

Turns out if datadir is very long, HAAD fails. This long path bug may also have some adverse effect elsewhere. It may be appropriate to specify the maximum path length for datadir in the README2.1.txt.

Based on my local testing, the maximum length for datadir is 83 characters. HAAD uses the file emmcclosc1.pdb to generate emmcclosc1.pdb.h (all protons). If we add the 16 characters of emmcclosc1.pdb.h, it looks like the maximum string in HAAD (and maybe elsewhere) in 99 characters.

If datadir is 84 characters, the output file is emmcclosc1.pdb. (last character is removed from output file)

If datadir is 85 characters, the output file is emmcclosc1.pdb (and actually overwrites the input file)

If datadir is 86 characters, the output file is emmcclosc1.pd

...

example :

tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678> pwd ; ls
/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678
emmcclosc1.pdb
tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678> /smg/data/i-tasser/I-TASSER2.1/abs/mybin/HAAD /tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678/emmcclosc1.pdb
tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678> ls
emmcclosc1.pdb emmcclosc1.pdb.h

tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789> pwd ; ls /tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789
emmcclosc1.pdb
tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789> /smg/data/i-tasser/I-TASSER2.1/abs/mybin/HAAD /tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/emmcclosc1.pdb
tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789> ls
emmcclosc1.pdb emmcclosc1.pdb.

tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678901234> pwd ; ls /tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678901234
emmcclosc1.pdb
tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678901234> /smg/data/i-tasser/I-TASSER2.1/abs/mybin/HAAD /tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678901234/emmcclosc1.pdb
read pdb file err, total atoms 0
FORTRAN STOP
tui3:/tmp/123456789/123456789/123456789/123456789/123456789/123456789/123456789/12345678901234> ls
emmcclosc1 emmcclosc1.pdb