Can I Use the Lucy Subprogram in Starlink Project for Fortran Routines?

In summary, the conversation discusses the use of a subprogram from the Starlink Project - Lucy in the library KAPPA - which is already installed and compiled. The user is trying to call it from their Fortran routine and asks for instructions on how to compile the file using gfortran. The conversation then provides steps for running the subprograms and the location of the compiled lucy file and source code. It also mentions that the subroutine may not be intended for standalone use and may require additional work to use it in a separate program.
  • #1
faeriewhisper
5
0
Hello!
I'm trying to use a subprogram from the Starlink Project - Lucy in the library KAPPA - that is already installed and compiled. The idea is to be able to call it from my fortran routine.

Something like this:
Code:
PROGRAM ex
 
INTEGER i
REAL in(10),psf(10),out(10)
 
DO i =1,10
  in(i) = rand()
  psf(i) = rand()
ENDDO

lucy in psf out

WRITE(*,*)out

END

Is that possible?
If so, how should I compile the file (using gfortran)?

After downloading and unpacking the Starlink package you write in the terminal:

$ export STARLINK_DIR=$HOME/Astronomy/Software/star-2015A
$ source $STARLINK_DIR/etc/profile

After that you can run the subprograms by typing:
$ kappa
$ lucy

The compiled lucy file can be found here: $HOME/Astronomy/Software/star-2015A/bin/kappa/lucy

The source file lucy.f can be found here: https://github.com/Starlink/starlink/blob/master/applications/kappa/libkappa/lucy.f

Many thanks in advance!
 
Technology news on Phys.org
  • #2
You would have to use
Fortran:
call lucy (status)
But the subroutine lucy doesn't take in any other argument than that status, so I don't see how you can pass data to and from your own program.

After a quick look at the source code, it doesn't appear that the subroutine was intended to be used on its own. I think it would take quite some work to disentangle it from the main program.
 

FAQ: Can I Use the Lucy Subprogram in Starlink Project for Fortran Routines?

What is Fortran and what is it used for?

Fortran is a high-level programming language developed in the 1950s for scientific and engineering computations. It stands for "Formula Translation" and is primarily used for numerical and scientific computing, such as simulations and data analysis.

How do I get started with learning Fortran?

There are many resources available online for learning Fortran, including tutorials, books, and online courses. It is recommended to start with a basic understanding of programming concepts and then move on to learning the syntax and features of Fortran.

What are the main features of Fortran?

Fortran is known for its efficient handling of mathematical operations, its built-in functions for handling arrays and matrices, and its ability to easily interface with other languages and systems. It also has a rich set of control structures and data types.

Is Fortran still used in modern scientific computing?

Yes, Fortran is still widely used in scientific and engineering fields, particularly in areas where performance and numerical accuracy are critical. Many legacy codes are written in Fortran, and it is also a popular choice for new projects, especially in the high-performance computing community.

Can I use Fortran for other types of programming?

While Fortran was originally designed for scientific and engineering computations, it can also be used for general-purpose programming. However, it may not have all the features and libraries available in other languages that are specifically designed for non-scientific applications.

Back
Top