SGI has the following problem

if (logical) then

DOES NOT work

rather you want to use

if (logical .eq. .true.) then

...


perl -ne '++$ct; if ($_=~/^[cC\*]/ || $_!~/[\s\t]+if\s+\(\s*[a-z\-\_]*\s*\)/i) {print; } else { $_=~s/IF (\(\S+*)\)/$1 \.EQ\. \.TRUE\./)/; print "$_"; ' phd.f >> new-phd.f