Programming :: Calling Multiple Files In FORTRAN90
Oct 29, 2010
I have written FORTRAN code to calculate density profile. This code will open two files ( topology and x,y,z trajectory). The trajectory file contains XYZ data coordinates for multiple frames (about 20 or 100 frames for instance). One frame contains 20736 data.
Previously this code was written to open ONLY one input XYZ data file and do the calculation and would dump the results in separate file and it was running without problem. Recently my data file get bigger in size, so I decided to break the single XYZ data file into few small parts.
Now I have modified the code so that it calls the parts of the XYZ data files ( eg: maltoTHERMO_10Frames.traj, maltoTHERMO_20Frames.traj,... and so on) and do the calculation and dump the results in the same result output file. I have tested this code just with openning the XYZ coordinates and printing into another file to see wheather it collecting the data sequently and it was working fine.
This code supposedly read the x coordinate data and calculate distance and put a count accoding the criteria in the approperiate bins. But when I let the code to do the calculation it stop and shows error. (I have indicated as !** in the code). If I enable this line, it shows error but if I disable this line, than the code do collect only the XYZ coordinates.
The code is as below:
Code:
module all_parameter
integer,parameter :: MAXATOM=20736!CHANGE
integer,parameter :: midwater=1500
integer,parameter :: TOTALFRAMES=20
[Code]....
View 8 Replies
ADVERTISEMENT
Apr 11, 2011
I feel like there should be a cleaner way of doing this. I have one file, for example "a.cpp", calling a function from another file, "b.cpp". Currently I have it set up so that header for "b", "b.h", has the declaration of its functions. And then I'm just including "b.h" in "a.cpp". Do I have to include the "b" header file in "a" to be able to call a function from "b"? Or is there a better way I could be doing this? Like doing something different at compile?
View 7 Replies
View Related
May 5, 2010
I am trying to play with calling text files in C. What I have is a text file with 4 columns of numbers I need to average 2 of them. I have started and hit a wall. I have the following so far:
[Code]....
I still need to figure out how to read the data in. I have been reading on this for a few hours and its not clicking. How does the program know which columns with names to call. the data is organized: ID, Day, Speed, Temp.
View 6 Replies
View Related
Apr 17, 2009
I use a mencoder line to convert .avi to .mpg (dvd player compatible), it works well but i can only do one file at the time. It requires giving the input and output directories and the files name. I tried using (*.avi *.mpg in the command) on the directory but it just add up all the .avi and convert them into one huge .mpg. My goal is to have a script that would convert all the .avi files from a directory to the same amount of .mpg and also keep the naming of those files. Here is what i work with on single files:
Code:
mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup
-srate 48000 -af lavcresample=48000
-lavcopts
[code]....
View 3 Replies
View Related
Nov 12, 2010
I feel kind of embarrassed posting here, but this is technically a scripting sub-forum. Here is the problem. I have a folder with various files which include .txt files as well
How can i redirect same content to each of the .txt files in the folder?
I have tried
Code: $ echo "hello" > *.txt
-bash: !": event not found Code: also cat ~/otherdir/test.txt > *.txt
-bash: *.txt: ambiguous redirect Can anyone help me with this?Ok i solved it
Code: #! /bin/bash
for file in *.txt
do
echo "Text that needs to be written" > $file
done
View 2 Replies
View Related
Dec 30, 2010
I want grep multiple files:
let abc.1.abc.2,abc.3,abc.4
I use grep <pattern> abc.* to read the files. But here grep read files in the order of 1,2,3,4 . I want to to grep the files in reverse order like 1st the abc.4 file will be read and abc.1 file will be last.
Is this possible ?
View 3 Replies
View Related
Jan 12, 2011
how i could compile for example: a tutorial file of cantera open source files. when i do :g++ example.cpp -o examplei get huge errors such as the header files are not here,...please tell me how i could compile it. ofcourse i have configured the full opensources and i see in /usr/local/cantera/binthat the files are there but i still can not compile and execute any cpp file.
View 2 Replies
View Related
May 19, 2010
My query is i have a.sql , b.sql , c.sql files which needs to be executed using "$ db2 -tvf a.sql"; "$ db2 -tvf b.sql"; "$db2 -tvf c.sql" , script with which i can execute all these sql files in a single shot.
View 4 Replies
View Related
Mar 17, 2011
I have a folder which includes bunch of folders each having data files in them. [ Folder A has F1, F2 F3 ..... F1000 folders in it, and F1, F2, F3 ... each has about 10 different files named FILE 1, FILE2, FILE3 .... in them.
I am interested in File 1 of each Folder, because that contains the data I need in it. More specifically, that File1 s have a line "ANSWER=..." in them, and i need to get that value of the ANSWER from each file. So doing it by hand is so hard, so I need to write a script that will scan all folders and give me a list of values of eache ANSWERs.
View 4 Replies
View Related
Apr 15, 2010
I am looking for the quickest way to do multiple searches for different files.Here is the scenario: I want to search for various icons one by one in a script. Preference is for the gnome icon theme.
The echo piped into grep part seems to take a long time. Is there a quicker way of doing this?I do not want to use slocate, sqlite or the like since that will require admin privileges to update the database and/or extra dependencies.
View 5 Replies
View Related
Mar 13, 2011
compiling and linking using gcc: What does a file name with a suffix '.a' represent? If I have multiple .c and .h files, how can I link them together? How can I create the .a file?
View 6 Replies
View Related
May 18, 2009
I am working with DM355 target board. Here we record. The video coming from IP cameras. Now I have to write c program for copying. The recorded avi files with date and time to NAS server using scp. I wrote a script to copy single file to NAS server.
#!/bin/bash
DATE=$(date +%Y%m%d_%H_%M_%S)
mv Camera1.avi Camera1_$DATE.avi
scp Camera1_$DATE.avi root@192.168.1.4:/root/test/
mv Camera1_$DATE.avi Camera1.av
But I have to write c program for copying multiple avi files with Date and Time to NAS server.
View 5 Replies
View Related
Mar 2, 2010
I want to change some HTML in my files (80+ so I prefer not to do this by hand). I got a script to replace a string in files, however the HTML I want to replace contains an enter (and tab of 4 spaces) (explanation below) Does someone know how I could update my HTML by using a function in Linux?
I also found sed but don't know how to use it with the enter (linenumbers will not work because they variate)...
[Code].....
View 2 Replies
View Related
Oct 20, 2010
I'm trying to change a group of cpp files to one shared lib. I have created a shared lib with a single file. I then did this with a group of files. The difference in what I'm doing is that before with the single file, .a, was added into a single .o file. Now I'm trying to add it to my main.cpp file which is NOT a .o file. I'm now getting these compiler errors from the main.cpp where is doesn't seem to recognize the semaphores.Example Error: undefined reference to `sem_wait'If I were not to use the share libs this compiles and runs as I expected it to.Something tells me this is a compiler flag issue, at least I hope it is
View 1 Replies
View Related
Aug 12, 2010
If I remove all the template stuff, it works.
whats going on here?
View 2 Replies
View Related
May 26, 2011
I've been hitting my head against a wall for awhile with this one:As the last part of some data analysis I performing I would to construct a matrix from a series of different files. These files have the format:
file 1 file 2 file 3
AAAAA .1 AAAAA .1 BBBBB .1
BBBBB .2 BBBBB .1 CCCCC .9
[code]...
View 6 Replies
View Related
Jan 26, 2011
I have wrote a 1 line command that parses a file, locates the IP Address in the file and then trims the output the way I want it, and then sorts numerically and by uniqueness and then >> appends to output.txt
I can get all the IP's into 1 file "output.txt", but what I am really looking for is some type of way to create a text file, for each IP it finds labeled xxx.xxx.xxx.xxx.txt and also put that ip address into that file..
xxx.xxx.xxx.xxx = the ip address it finds
View 14 Replies
View Related
Aug 25, 2010
I've been trying to sort this out for several hours and I?m totally lost? I?ve been searching around, but haven?t found the solution to my problem. I have a directory with 100 files. I need to copy 10 lines of each files (let?s say from line 45 to 55) into one unique file. So I guess I could use sed ?w, but I didn?t manage to write the right script. I also tried using a loop to create 100 different files, each one with the 10 lines) to concatenate them later on. But I only got 1 file, not 100.
View 12 Replies
View Related
May 9, 2011
bash script to give sensible names to a large number of photos. I hope to be able to run a script with an argument which will become the filename followed by a number beginning at 1.
Code:
./file_rename.sh Summer2009_
Summer2009_0001
Summer2009_0002
Summer2009_0003
[Code]....
View 1 Replies
View Related
Feb 8, 2011
I'm playing around with a bash script to pass files to a program (such as VLC). I thought something like this would work:
vlc $( ls | sed 's/ /\ /g' | tr '
' ' ' )
ls shows the files in the current directory, then sed changes spaces to " " (to escape them) and finally tr removes the line breaks. I end up changing:
01 - Music Track.mp3
02 - Another Track.mp3
to
01 - Music Track.mp3 02 - Another Track.mp3
"vlc 01 - Music Track.mp3 02 - Another Track.mp3" works if I type it manually but my script reports a problem with `-'
It seems it's not escaping the spaces.
View 4 Replies
View Related
Oct 3, 2009
i have lots of files with dots insde file name for example:
document.1.is.bigger.doc
resume.version12.doc
10.photo.www.cnn.com.jpg
i want to rename all files in that directory to be the same (with same extention) but convert dots to underscore "_"
how can i do that on bash script / php.
View 6 Replies
View Related
Mar 6, 2011
I have this cool bash script that I worked hard on. But it broke down when it can across files that had non-English characters. Another small problem was getting it to descend into a directory. If it renamed a directory it would not descend into that dir to rename the other files. I would have to run the script twice on the same directory.
Here is the script:
Code:
find -type d -o -regextype egrep -iregex '(.*.ogg|.*.mp3|.*.wav)' | while read s
do
rename -v 'y/A-Z/a-z/' "$s"
done
find -type d -o -regextype egrep -iregex '(.*.ogg|.*.mp3|.*.wav)' | while read n
do
rename -v 's/ /_/g' "$n"
done
A French name like this:
Code:
Chateau De Sable (imagine accents above the letter a)
became this:
Code:
ch303242tea_de_sable
This is not what I wanted.
Why would the script not descend into a directory after it was renamed?
View 7 Replies
View Related
Mar 21, 2011
Code:
anisha@linux-uitj:~/junk> ls -R
.:
include src
./include:
template0.h template0.h~ template0.h.gch
[code]....
View 11 Replies
View Related
Oct 26, 2010
To redirect standard output to multiple files:
Code:
echo Test | tee file1 file2
My problem is that the word "Test" still displays to the screen? I want same effect as:
Code:
echo Test > file1
but with multiple file redirection.
View 3 Replies
View Related
Dec 17, 2009
I have 3 c++ files, classdef.h (header file with class definition), methods.cpp (class methods) and program.cpp - the program itself. Both .cpp files have
Code:
#include "classdef.h"
in files. How I can link the files together and compile them in one executable program? I am using Geany IDE for coding.
View 4 Replies
View Related
Nov 11, 2009
I have a large file 'NS0923.csv' with data like the following. There are two records in this multi-record sample.
Code:
E60898,4578910,03/06/09,BEN BOYD RD,61,82,,,127,3,,52000.3046.001,3155,4.00,,PLT,1356,1.00,05/06/09,Y,Y,0551
,,,,,,,,,,,,4057,1.00,CLEAN CAR SHARE SIGN,LAB,0551,1.00,,,,
[code]....
2. I still have to create a file 'transaction.csv' that should retrieve data from $13 - $15 with the identifying column $1. Required output:
Code:
E60898,4057,1.00,CLEAN CAR SHARE SIGN
3. And finally another file 'quantity.csv'. Retrieving data from $16 - $18 with identifier $1. Required output:
Code:
E60898,PLT,1356,1.00
E60898,LAB,0551,1.00
E60898,LAB,3065,1.00
[code]....
View 10 Replies
View Related
Jun 4, 2010
I have a question about calling an asm function from C....It doesn't work unless I create an asm variable to hold the value of the function in....Why?Here's the code that doesn't work...
asmfile.s - version one Code: .section .data
mydata: .ascii "this is the message!
.equ mylen, . - mydata
[code]...
View 2 Replies
View Related
Feb 7, 2011
I am doing a web site program and what I need is to call a C program in the PHP cloud.Do u think it would be possible? The web site would get the user input from PHP UI and pass to the C program , the C program would process the function with the user input and output the a PHP page.
View 2 Replies
View Related
Jun 5, 2009
I want to remove duplicate or multiple similar lines from multiple files. I.e. if I have four files file1.txt file2.txt file3.txt and file4.txt and would like to find and remove similar lines from all these files keeping only one line from these similar lines. I only that uniq can be used to remove similar lines from a sorted file.
View 9 Replies
View Related
Aug 13, 2010
I want to call c exe from java source code and i want to interact with the c program during it's execution, i am able to send the parameters to c program but i am not able to interact with it.
View 3 Replies
View Related