Necesito un programador que convierta mi codigo en C a lenguaje FORTRAN. Ya lo tengo avanzado|

Closed Posted 1 year ago Paid on delivery
Closed Paid on delivery

En la universidad me han pedido que convierta un código en C a lenguaje fortran. Tengo un poco avanzado, el codigo no es extenso, aqui lo comparto (este esta en C):

#include <stdlib.h>

#include <stdio.h>

#include <math.h>

#define EPS 0.001

#define NMAX 20

#define H 0.001

#define SIGMA 20

#define EPSILON 0.001

#define GAS 20

#define RMENOS 0.001

#define RMAS 20

#define NAME 0.001

float sum_par (int n, float mu){//Calcula las sumas parciales

int i,j,k;

float aux,sum=0;

for(i=-n;i<=n;i++)

for(j=-n;j<=n;j++)

for(k=-n;k<=n;k++){

aux=(float)i*i+j*j+k*k+i*j+i*k+j*k;

if(aux)

sum+=pow((float)aux,-0.5*mu);

}

return sum;

}

float suma(float mu){

int n=1;

float sum,aux,eps=[login to view URL];

aux=sum_par(1,mu);

while(eps>EPS){

n++;

if(n==NMAX){

printf("Demasiadas iteracciones en la funcion suma \n");

exit(1);

}

sum=sum_par(n,mu);

eps=fabs(sum-aux);

aux=sum;

}

return sum;

}

float u(float e, float s, float a_6, float a_12, float r){

float aux6, aux12;

if(abs(r)<1.e-3){

printf("Seleccione un valor mayor para %f\n" ,r);

exit(1);

}

aux6=pow(s/r,6.);

aux12=aux6*aux6;

return (2.*e*(a_12*aux12-a_6*aux6));

}

float min (float e, float s, float a_6, float a_12, float a, float b){

float r1,r2,eps;

int n=0;

eps=b-a;

r1=a+eps/3;

r2=a+2.*eps/3.;

while(eps>EPS){

n++;

if(n==NMAX){

printf("Demasiadas iteraciones en la funcion min \n");

exit(1);

}

if(u(e,s,a_6,a_12,r1)>u(e,s,a_6,a_12,r2)) a=r1;

else b=r2;

eps = b-a;

r1=a+eps/3.;

r2=a+2.*eps/3.;

}

return (a+eps/2.);

}

void main (void){

float a_6, a_12, s=SIGMA, e=EPSILON, rmin, u_c, b_0,d2;

FILE *out;

out=fopen(NAME,"w");

a_6=suma(6.);

a_12=suma(12.);

rmin=min(e,s,a_6,a_12,RMENOS,RMAS);

u_c=u(e,s,a_6,a_12,rmin);

d2=u(e,s,a_6,a_12,rmin+H)+u(e,s,a_6,a_12,rmin-H)-2.*u_c;

d2/=H*H;

b_0=sqrt(2.)*d2/(9.*rmin);

fprintf(out,"Gas noble ..............................%s\n", GAS);

fprintf(out,"Separacion equilibrio...................%4.3f Amstrongs\n",rmin);

fprintf(out,"Energia de cohesion por atomo...........%5.4f eV\n",u_c);

fprintf(out,"Modulo de comprension...................");

fprintf(out,"%5.4f 10%c(10) din/cm%c2\n\n",160*b_0,94,94);

fclose(out);

}

C Programming C++ Programming Software Architecture C# Programming Fortran

Project ID: #33453014

About the project

1 proposal Remote project Active 1 year ago

1 freelancer is bidding on average $20 for this job

MaksimKholin

Hi! Nice to see your article! I've carefully seen and analyzed your requirement. I really interested in your task. I received a degree the master of information science and had experience and skill to satisfy you. I’m More

$20 USD in 1 day
(7 Reviews)
3.4