Dear list participants,
I need to include 9 to 10 lines at the begining of several text files.
Each file have a name with sequential numbers containing molecule's cartesian coordinates:
example
molecule 1 molecule 2 etc
file1_1.txt file2_1.txt
file1_2.txt file2_2.txt
.......... .......
.......... .......
file1_50.txt .......
file2_130.txt
As you can see in this example, the directory of molecule 1 has 50 files, dir of molecule 2 has 180 files, etc
All the files have cartesian coordinates (x,y,z) presented as the example below:
--------------------------------------
C 0.000000 0.000000 0.000000
S 1.544083 0.000000 0.000000
S -1.544083 0.000000 0.000000
--------------------------------------
The objective is to use a Perl script that includes 9 or more comand lines at the begining of each file.
This text (that are the calculation program lines) is the same for all the files for all molecules.
The last line ends with an "*" .
Complete example of the final file:
-------------------------------------
#*******MolID=CS2
!B3LYP TZVP TightSCF
!Opt
!NumFreq
!SemiDirect
%freq
Increment 0.001
end
!XYZFile
* xyz 0 1
C 0.000000 0.000000 0.000000
S 1.544083 0.000000 0.000000
S -1.544083 0.000000 0.000000
*
-------------------------------------
This is a simple example. The real files have molecules with 50 to 100 atoms presenting
in some cases more than 300 conformations. Inother words, a manual input of the text file can easily
represent 3000 or more files. This is unfeasible. A Perl script would make this calculations possible.
Can somebody help me in providing this script in Perl (for linux)?
Thank you
Best regards
Bruno
PS.: I found a Perl script that writes the text at the end of a text file but you have to run it file per file.
This does not meet my requirements.