[Tutor] Incorporate an Integer as part of a Label
S. P. Molnar
s.molnar at sbcglobal.net
Fri Jan 13 13:39:28 EST 2017
I am a very new python pseudo-programmer (Fortran II was my first
language eons ago) and have encountered a problem that is giving me fits
(google is no help).
I have written a python program that takes the output from a quantum
chemistry program, carries out some calculations and saves two files a
figure as a png file and the spectrum of the molecule as a csv file.
The problem that I am having is incorporating the numerical designator
of the molecule in the names of the files.
I've managed to figure out how to input the numerical designator:
name_1 = input("Enter Molecule Number: ")
name_1 =str(name_1)
print('Name 1 = ',name_1)
name = name_1 + '.out.abs.dat'
data_1 = np.loadtxt(name, skiprows=0)
As there are two different output files involved with each orca
calculation I go through the above lines again for the second file with
the dame numerical integer input.
The problem is how do I get teh numerical molecule designator into the
label I want to use for the two results of the Python calculation?
plt.title("Absorption Spectrum (<number>)")
plt.savefig('<number>.png', bboxinches='tight')
and
with open('<number>.csv', 'w') as f:
where <number> is the integer molefule number designator that is the
only input for the calculation.
Thanks in advance.
--
Stephen P. Molnar, Ph.D. Life is a fuzzy set
www.Molecular-Modeling.net Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1
More information about the Tutor
mailing list