Fix log file parameter in calculator for spec
The 'txt' keyword of the calculator is working for spec. This option is still not working for phagen due to stdout descriptor hardcoded in the Fortran code of phagen. Will fix it later.
This commit is contained in:
parent
e45373926b
commit
5982a56cd7
|
@ -17,7 +17,7 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/calculator.py
|
# Source file : src/msspec/calculator.py
|
||||||
# Last modified: Thu, 13 Mar 2025 11:20:31 +0100
|
# Last modified: Mon, 23 Jun 2025 13:58:23 +0200
|
||||||
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes.fr>
|
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes.fr>
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,13 +113,14 @@ class _MSCALCULATOR(Calculator):
|
||||||
def __init__(self, spectroscopy='PED', algorithm='expansion',
|
def __init__(self, spectroscopy='PED', algorithm='expansion',
|
||||||
polarization=None, dichroism=None, spinpol=False,
|
polarization=None, dichroism=None, spinpol=False,
|
||||||
folder='./calc', txt='-', **kwargs):
|
folder='./calc', txt='-', **kwargs):
|
||||||
|
self.txt = txt
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
if isinstance(txt, str) and txt != '-':
|
#if isinstance(txt, str) and txt != '-':
|
||||||
stdout = open(txt, 'w')
|
# stdout = open(txt, 'w')
|
||||||
#elif isinstance(txt, buffer):
|
#elif isinstance(txt, buffer):
|
||||||
# stdout = txt
|
# stdout = txt
|
||||||
elif txt == None:
|
#elif txt == None:
|
||||||
stdout = open('/dev/null', 'a')
|
# stdout = open('/dev/null', 'a')
|
||||||
#set_log_output(stdout)
|
#set_log_output(stdout)
|
||||||
########################################################################
|
########################################################################
|
||||||
LOGGER.debug('Initialization of %s', self.__class__.__name__)
|
LOGGER.debug('Initialization of %s', self.__class__.__name__)
|
||||||
|
@ -172,6 +173,7 @@ class _MSCALCULATOR(Calculator):
|
||||||
self.global_parameters, self.phagen_parameters, self.spec_parameters)
|
self.global_parameters, self.phagen_parameters, self.spec_parameters)
|
||||||
|
|
||||||
# initialize all parameters with defaults values
|
# initialize all parameters with defaults values
|
||||||
|
self.spec_parameters.output_log = txt
|
||||||
LOGGER.info("Set default values =========================================")
|
LOGGER.info("Set default values =========================================")
|
||||||
for p in (list(self.global_parameters) +
|
for p in (list(self.global_parameters) +
|
||||||
list(self.muffintin_parameters) +
|
list(self.muffintin_parameters) +
|
||||||
|
|
|
@ -922,6 +922,9 @@ C
|
||||||
READ(ICOM,34) OUTFILE2,IUO2
|
READ(ICOM,34) OUTFILE2,IUO2
|
||||||
READ(ICOM,34) OUTFILE3,IUO3
|
READ(ICOM,34) OUTFILE3,IUO3
|
||||||
READ(ICOM,34) OUTFILE4,IUO4
|
READ(ICOM,34) OUTFILE4,IUO4
|
||||||
|
IF(.NOT.(OUTFILE1.EQ.'-')) THEN
|
||||||
|
OPEN(UNIT=IUO1, FILE=OUTFILE1, STATUS='UNKNOWN')
|
||||||
|
ENDIF
|
||||||
C
|
C
|
||||||
IUSCR=MAX0(ICOM,IUI2,IUI3,IUI4,IUI5,IUI6,IUI7,IUI8,IUI9,IUO1,IUO2,
|
IUSCR=MAX0(ICOM,IUI2,IUI3,IUI4,IUI5,IUI6,IUI7,IUI8,IUI9,IUO1,IUO2,
|
||||||
&IUO3,IUO4)+1
|
&IUO3,IUO4)+1
|
||||||
|
|
Loading…
Reference in New Issue