- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to compile a main program (replica2.f90) with 5 INCLUDE files. Here are the commands I tried:
ifort -cpp mc_st.f90 molecules.f90 orientation.f90 forward_n1n1p1_rep.f90 reverse_n1n1p1_rep.f90
ifort replica2.f90
mc_st.f90 is my global variables file. The others are parts of separated subroutines called by the main program. I have successfully run this on my laptop with Microsoft Visual Studio, but it took forever to complete. I am trying to use a supercomputer to compile my code instead, but apparently it didn't work. Here are the error messages:
----------------------------------------------------------------
mc_st.f90, molecules.f90, orientation.f90, forward_n1n1p1_rep.f90, reverse_n1n1p1_rep.f90: error #5082: Syntax error, found END-OF-FILE when expecting one of: <LABEL> <END-OF-STATEMENT> ; BLOCK BLOCKDATA PROGRAM MODULE TYPE BYTE CHARACTER ...
molecules.f90(32): error #6410: This name has not been declared as an array or a function. [NB]
Nb(i,1) = num_mol(i)*l_side*l_side ! number of molecules of H
orientation.f90(11): error #6353: A RETURN statement is invalid in the main program.
RETURN
orientation.f90(13): warning #6043: This Hollerith or character constant is too long and cannot be used in the current numeric context. ['Silica']
ELSE IF (Molecule_type(new_type).EQ.'Silica') THEN
orientation.f90(1056): error #6353: A RETURN statement is invalid in the main program.
IF (t.LT.50.0) RETURN
orientation.f90(2): error #6591: An automatic object is invalid in a main program. [E_NEW]
DIMENSION :: e_new(3,natoms),q_new(3,ncgs),orient1(3,natoms),orient2(3,ncgs),di_ang_new(2),random(3)
orientation.f90(2): error #6219: A specification expression object must be a dummy argument, a COMMON block object, or an object accessible through host or use association [NATOMS]
DIMENSION :: e_new(3,natoms),q_new(3,ncgs),orient1(3,natoms),orient2(3,ncgs),di_ang_new(2),random(3)
........[Many other similar errors].......
----------------------------------------------------------------
It appears that:
1. The structures of all the INCLUDE files are wrong (I know for module, it starts with MODULE <name> and ends with END MODULE <name>, but I don't know the format for INCLUDE file).
2. My main program couldn't include the global variables file
3. I don't even know what "error #6591: An automatic object is invalid in a main program." means.
Could someone please help me with a correct (and preferably optimized) ifort command for my codes? I am really new to this.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For INCLUDE files you should not be naming them in your compile command. This may be the simplest part. If any of those files are named in INCLUDE statements, just leave them off the ifort command. You may not have noticed that Visual Studio didn't compile them separately. MODULE files do need to be compiled (and before any sources that USE those modules.)
-cpp is not a correct option. -fpp is to enable the preprocessor. -c means compile-only (no link).
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For INCLUDE files you should not be naming them in your compile command. This may be the simplest part. If any of those files are named in INCLUDE statements, just leave them off the ifort command. You may not have noticed that Visual Studio didn't compile them separately. MODULE files do need to be compiled (and before any sources that USE those modules.)
-cpp is not a correct option. -fpp is to enable the preprocessor. -c means compile-only (no link).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much. It works wonderfully. No more errors. Job is done in 15 sec.
But I have another dummy question: on my laptop, I get a couple of *.data output files. Now I only have an a.out file. Could you kindly tell me how to get my desired output files?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to run your program for it to produce output files, assuming that it is programmed to do that:
$ ./a.out $ ls -l *.data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a.out is the default name for an executable on Linux. If you want a different name you would specify it with the -o option, for example:
ifort -o myprog file1.f90 file2.f90 ./myprog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much. My program runs smoothly now. I appreciate your prompt reply!!!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page