Каталог файлов
Меню сайта


Категории каталога
Стаценко [9]
Теоретическое и прикладное материаловедение. Совместимость и коррозия.
Елманов [1]
Физические свойства твердых тел.
Назаров [2]
Яльцев [1]


Форма входа


Поиск по каталогу


Ссылки



Приветствую Вас, Гость · RSS 2026-06-20, 0:59 AM
Начало » Файлы » Лабы и все к ним... » Назаров

Лаба 1
[ Скачать с сервера (2.8 Kb) ]
program ock_in_space
implicit none
real :: x(10000), y(10000), z(10000)
integer n
common x,y,z,n
integer, parameter :: s=10
real, parameter :: ro=1.9
integer i,j,l,k
real a,r
real en_sis1, en_sis2
real energy_atom, potencial_morze
open (1, file='energy.txt')
a=2*ro/sqrt(3.0)
n=s*s*s+(s-1)*(s-1)*(s-1)
l=1
do i=1,s
do j=1,s
do k=1,s
z(l)=(i-1)*a
y(l)=(j-1)*a
x(l)=(k-1)*a
l=l+1
enddo
enddo
enddo
l=s*s*s+1
do i=1,s-1
do j=1,s-1
do k=1,s-1
z(l)=(2*(i-1)+1)*0.5*a
y(l)=(2*(j-1)+1)*0.5*a
x(l)=(2*(k-1)+1)*0.5*a
l=l+1
enddo
enddo
enddo
x(n+1)=5.5*a
y(n+1)=5*a ! s/2*a
z(n+1)=5.5*a
write (1,'(2x,29HЧисло атомов: ,I5)') n
write (1,'(2x,29HПараметр решетки: ,f10.4)') a
call energy_system(en_sis1)
write (1,'(2x,29HЗнергия системы без дефекта:,f10.4)') en_sis1
n=n+1
call energy_system(en_sis2)
write (1,'(2x,29HЗнергия системы c дефектом: ,f10.4)') en_sis2
write (1,'(2x,29HЗнергия образования дефекта:,f10.4)') en_sis2-en_sis1
write (1,*) '------------------------------------------------------------'
write (1,*) ' Номер атома | X | Y | Z | Энегрия атома'
write (1,*) '------------------------------------------------------------'
n=n-1
do i=1, n
write (1,'(5x,i4,5x,4f10.4)') i,x(i),y(i),z(i), energy_atom(x(i),y(i),z(i))
enddo
n=n+1
do i=1, n
write (1,'(5x,i4,5x,4f10.4)') i,x(i),y(i), z(i),energy_atom(x(i),y(i),z(i))
enddo
close(1)
open (2,file='potencial.xls')
r=1.0
do while (r<5)
write(2,*) r, potencial_morze(r)
r=r+0.005
enddo
close(2)
end program ock_in_space

real function potencial_morze(r)
real, intent(in) :: r
real, parameter :: e=0.65, lyamda=1.4, ro=1.9
real temp
temp=lyamda*(r-ro)
potencial_morze=e*(exp(-2*temp)-2*exp(-temp))
end function potencial_morze

real function energy_atom(x_at,y_at,z_at)
common x(10000),y(10000),z(10000),n
real, intent(in) :: x_at,y_at,z_at
integer i
real r
energy_atom=0.0
do i=1,n
r=sqrt((x(i)-x_at)*(x(i)-x_at)+(y(i)-y_at)*(y(i)-y_at)+(z(i)-z_at)*(z(i)-z_at))
if (r/=0) then
energy_atom=energy_atom+potencial_morze(r)
endif
enddo
end function energy_atom

subroutine energy_system(var)
common x(10000),y(10000),z(10000),n
real, intent(out) :: var
integer i,j
real f,g,h
var=0.0
do j=1,n-1
do i=j+1,n
f=x(j); g=y(j); h=z(j)
r=sqrt((x(i)-f)*(x(i)-f)+(y(i)-g)*(y(i)-g)+(z(i)-h)*(z(i)-h))
var=var+potencial_morze(r)
enddo
enddo
end subroutine energy_system

Категория: Назаров | Добавил: fx-05
Просмотров: 816 | Загрузок: 104 | Рейтинг: 0.0 |

Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Создать бесплатный сайт с uCoz