Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran Formatting Computational Chemistry

  1. Jul 27, 2010 #1

    I require specific formatting for a quantum chemistry calculation. But for some reason I can't seem to write using formatting. I have checked tutorials, but to no avail. Here is my toy program:

    program test_format
    implicit none

    real :: m

    write(*,*) 'Enter a number'
    read(*,*) m
    write(*,fmt='(d4.2)') m

    end program test_format

    After the user inputs a number, the program simply outputs stars: ****.

    Any help would be greatly appreciated.

  2. jcsd
  3. Jul 27, 2010 #2


    User Avatar
    Science Advisor

    in the format Dz.d, the number d is the number of decimals after the point, the number z is the total length of the number, including the exponent, sign etc. Hence z>=d+7. If not, you get ***.
  4. Aug 3, 2010 #3
    I have a problem, here's what the,
    should be from ascii file to extract data that is the n-th row and n-th column
    I do not know how. Could someone help me.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook