From abada72d3b21051063b24fa0503f53b7d63f032a Mon Sep 17 00:00:00 2001 From: John Vinson Date: Tue, 2 Jul 2024 11:35:19 -0700 Subject: [PATCH] Some detection for when oncvpsp.x is not the OCEAN-modified version for issue #329 --- OPF/opf.pl | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/OPF/opf.pl b/OPF/opf.pl index 74aaa7a6..56eef181 100644 --- a/OPF/opf.pl +++ b/OPF/opf.pl @@ -757,26 +757,37 @@ print OUT "$spdf[0] $spdf[1] $spdf[2] $spdf[3]\n"; print OUT "$spdf[0] $spdf[1] $spdf[2] $spdf[3]\n"; + close OUT; my $log = $psplist{"$znucl"} . ".log"; - system("$ENV{'OCEAN_BIN'}/oncvpsp.x < $oncvpspInputFile > $log") == 0 or die; - move( "ocean.mod", "ppot" ) or die; + system("$ENV{'OCEAN_BIN'}/oncvpsp.x < $oncvpspInputFile > $log") == 0 + or die "Failed to run oncvpsp.x. Check logfile OPF/$log\n\$!"; + unless( move( "ocean.mod", "ppot" ) ) + { + open IN, "<", $log or die "It appears oncvpsp.x has not run correctly\n"; + my $correctONCVPSP = 0; + while( my $line = ) + { + if( $line =~ m/OCEAN/ ) + { + $correctONCVPSP = 1; + last; + } + } + close IN; + die "oncvpsp.x did not finish correctly. Check the logfile OPF/$log\n" if( $correctONCVPSP ); + die "Incorrect version of oncvpsp.x installed. Make sure you have the OCEAN-modified version\n"; + } +# move( "ocean.mod", "ppot" ) or die; open HFIN, ">hfin1" or die; print HFIN "initgrid\n"; print HFIN "$znucl $grid\n"; -# print HFIN "fakel\n0 $lmax\n"; print HFIN "ppload\n"; print HFIN "mkcorcon\nscreencore\nmkcorcon\ncalcso\nquit\n"; close HFIN; -# open HFIN, ">hfin2" or die; -# print HFIN "initgrid\n"; -# print HFIN "$znucl $grid\n"; -# print HFIN "ppload\nmkcorcon\ncalcso\nquit\n"; -# close HFIN; - print "Running hfk.x\n"; @@ -1140,11 +1151,27 @@ sub runONCV print OUT "$spdf[0] $spdf[1] $spdf[2] $spdf[3]\n"; print OUT "$spdf[0] $spdf[1] $spdf[2] $spdf[3]\n"; - + close OUT; my $log = $pspFile . ".log"; system("$ENV{'OCEAN_BIN'}/oncvpsp.x < $oncvpspInputFile > $log") == 0 or die; - move( "ocean.mod", "ppot" ) or die; + unless( move( "ocean.mod", "ppot" ) ) + { + open IN, "<", $log or die "It appears oncvpsp.x has not run correctly\n"; + my $correctONCVPSP = 0; + while( my $line = ) + { + if( $line =~ m/OCEAN/ ) + { + $correctONCVPSP = 1; + last; + } + } + close IN; + die "oncvpsp.x did not finish correctly. Check the logfile OPF/$log\n" if( $correctONCVPSP ); + die "Incorrect version of oncvpsp.x installed. Make sure you have the OCEAN-modified version\n"; + } +# move( "ocean.mod", "ppot" ) or die; open HFIN, ">hfin1" or die; print HFIN "initgrid\n";