Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array of dot positions

Status
Not open for further replies.

NikolaStarcevic

Programmer
Jun 6, 2017
8
RS
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).
 
 http://files.engineering.com/getfile.aspx?folder=93b2d0d3-3110-4464-9a4c-d81d70016c92&file=Untitled.jpg
Hi,

So what's the business case for this exersize? It certainly sounds to me like a classroom problem.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Dots are positions of atoms in face centered cubic crystal structure, but in certain directions.
Part of code that I copy/paste is [100] direction, and one I need is [111] direction.
But I already did it myself.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top