Fortran Formatting Computational Chemistry

Click For Summary
SUMMARY

The discussion centers on formatting output in Fortran for quantum chemistry calculations, specifically using the format specifier 'd4.2'. The user encounters an issue where the output displays stars (****) instead of the expected formatted number. The problem arises from the format specification, where the total length (z) must be greater than or equal to the number of decimals (d) plus 7. Additionally, the user seeks assistance in extracting specific data from an ASCII file, targeting the n-th row and n-th column.

PREREQUISITES
  • Understanding Fortran programming language syntax
  • Familiarity with Fortran I/O operations
  • Knowledge of format specifiers in Fortran
  • Basic file handling in Fortran
NEXT STEPS
  • Review Fortran format specifiers and their usage
  • Learn about Fortran's WRITE and READ statements
  • Explore methods for reading specific rows and columns from ASCII files in Fortran
  • Investigate debugging techniques for Fortran programs
USEFUL FOR

Fortran developers, computational chemists, and anyone involved in scientific programming requiring precise output formatting and data extraction techniques.

Morberticus
Messages
82
Reaction score
0
Hi,

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.

Thanks
 
Technology news on Phys.org
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 ***.
 
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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 26 ·
Replies
26
Views
4K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K