/* * jjmodel * * Ancient Josephson junction model generating program, slightly updated. * latest change 9/27/98 -- purge gets() * * S. R. Whiteley (stevew@srware.com) * * Usage: Answer the questions and get a Jspice3/WRspice model. Parameters * are based on the HYPRES process. * * To build: cc -o jjmodel jjmodel.c -lm * * This is freeware -- use without restriction. */ #include #include #include double C = 33.1; /* fF/square micron at 1A/square cm */ double VM = 30; /* icrit * r0 in milivolts */ double VG = 2.8; /* gap voltage in millivolts */ double DELV = .08; /* gap spread in millivolts */ double ICON = 10; double ICR = 1.7; /* crit current * normal resistance */ int RTYPE = 1; int CCT = 1; int main() { char s[80]; int i; double x = 0, y = 0, a, ic, j; FILE *fp, *fopen(); printf("Josephson junction SPICE model generating program\n\n"); printf("Enter critical current density in amps per square cm : "); j = atof(fgets(s, 80, stdin)); while (j <= 0.0 || j > 1e6) { printf("\nerror: critical current density is out of bounds,\ please reenter : "); j = atof(fgets(s, 80, stdin)); } for (;;) { printf("\nEnter junction area in square microns (one number) \ or junction size\nin microns (two numbers separated by space) : "); i = sscanf(fgets(s, 80, stdin),"%lf %lf", &x, &y); switch (i) { case 1: a = x; break; case 2: a = x*y; break; default: printf("error: bogus input\n"); continue; } if (a > 0 && a < 1e7) break; printf("error: out of bounds\n"); } ic = j*a*1.0e-5; fp = fopen("jjmodel.out", "w"); if (!fp) { fprintf(stderr, "Can't open \"jjmodel.out\".\n"); return (1); } fprintf(fp, ".model XXXXX jj(rtype=%d, cct=%d, icon=%gm, vg=%gm, delv=%gm,\ \n+ icrit=%gm, r0=%g, rn=%g, cap=%gp)\n", RTYPE, CCT, ICON, VG, DELV, ic, VM/ic, VG/ic/ICR, C*a*(1+.05*log10(j))*1.0e-3); fprintf(fp, "*Nb %g A/cm2 area = %g square microns (generated by JJMODEL)\n", j, a); fclose(fp); printf("\nModel created in file jjmodel.out. Parasitic capacitance outside\ of the\njunction area is not included.\n"); return (0); }