NikolaStarcevic
Programmer
Hello,
I am new to fortran. I have a task to do.
I have code for making grid of positions (X and Y coordinates) with two DO loops:
PROGRAM Dot_Coordinates
IMPLICIT NONE
INTEGER :: IMAX,IMIN,JMAX,JMIN, NN, MM, I, J, K, A1, M
INTEGER, DIMENSION (500) :: XX,YY
OPEN(11,FILE='Dot_Positions.dat',STATUS='UNKNOWN')
A1=1D0
IMAX=3 ! imax =3....
IMIN=-(2*IMAX-1)
IMAX=2*IMAX
JMAX=3 ! Jmax = 3
JMIN=-(2*JMAX-1)
JMAX=2*JMAX
K=1
DO 52 I=1,IMAX
MM=IMIN+2*(I-1)
DO 52 J=1,JMAX
NN=JMIN+2*(J-1)
XX(K)=MM*A1
YY(K)=NN*A1
WRITE(11,*) XX(K),YY(K)
K=K+1
52 CONTINUE
END PROGRAM Dot_Coordinates
When I open this file in OriginPro and plot it it give 36 dots in corner of squares.
I have to change this code the way that dot coordinates are not in corners of squares, but in corners of rhombus.
Picture is in attachment. Red dot is centre of coordinate system (0,0), and angles of rhombus are alpha=60 and beta=120 degree (its made of two equilateral triangles).
I am new to fortran. I have a task to do.
I have code for making grid of positions (X and Y coordinates) with two DO loops:
PROGRAM Dot_Coordinates
IMPLICIT NONE
INTEGER :: IMAX,IMIN,JMAX,JMIN, NN, MM, I, J, K, A1, M
INTEGER, DIMENSION (500) :: XX,YY
OPEN(11,FILE='Dot_Positions.dat',STATUS='UNKNOWN')
A1=1D0
IMAX=3 ! imax =3....
IMIN=-(2*IMAX-1)
IMAX=2*IMAX
JMAX=3 ! Jmax = 3
JMIN=-(2*JMAX-1)
JMAX=2*JMAX
K=1
DO 52 I=1,IMAX
MM=IMIN+2*(I-1)
DO 52 J=1,JMAX
NN=JMIN+2*(J-1)
XX(K)=MM*A1
YY(K)=NN*A1
WRITE(11,*) XX(K),YY(K)
K=K+1
52 CONTINUE
END PROGRAM Dot_Coordinates
When I open this file in OriginPro and plot it it give 36 dots in corner of squares.
I have to change this code the way that dot coordinates are not in corners of squares, but in corners of rhombus.
Picture is in attachment. Red dot is centre of coordinate system (0,0), and angles of rhombus are alpha=60 and beta=120 degree (its made of two equilateral triangles).