00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "bmb.h"
00012
00013 void BMBFrame::initparser()
00014 {
00015 MDPARALLELFrame::initparser();
00016 }
00017
00018 int BMBFrame::exec(char *name)
00019 {
00020 if(MDPARALLELFrame::exec(name)==0) return 0;
00021
00022 bindcommand(name,"dope_Yttria",dope_Yttria());
00023 return -1;
00024 }
00025
00026 void BMBFrame::Alloc()
00027 {
00028 MDPARALLELFrame::Alloc();
00029 }
00030
00031 void BMBFrame::initvars()
00032 {
00033 MDPARALLELFrame::initvars();
00034 }
00035
00036 void BMBFrame::calcprop()
00037 {
00038 MDPARALLELFrame::calcprop();
00039 }
00040
00041 void BMBFrame::born_meyer_buckingham()
00042 {
00043 int i,j,ipt,jpt,isp,jsp,k;
00044 double U,r,r2,ri6, cx1,cx2,x,xcube;
00045 Vector3 sij, rij, fij;
00046
00047 DUMP(HIG"Lennard Jones"NOR);
00048
00049 refreshneighborlist();
00050
00051 BMB_Rc = Ewald_Rcut;
00052
00053 _EPOT=0;
00054
00055 for(i=0;i<_NP;i++)
00056 {_F[i].clear(); _EPOT_IND[i]=0;}
00057 _VIRIAL.clear();
00058
00059 for(ipt=0;ipt<_NP;ipt++)
00060 {
00061
00062 if(fixed[ipt]==-1) continue;
00063
00064 for(j=0;j<nn[ipt];j++)
00065 {
00066 jpt=nindex[ipt][j];
00067
00068 if(fixed[jpt]==-1) continue;
00069
00070 if(ipt>jpt) continue;
00071
00072 sij=_SR[jpt]-_SR[ipt];
00073 sij.subint();
00074 rij=_H*sij;
00075 r2=rij.norm2();
00076 r=sqrt(r2);
00077 if(r<=BMB_Rc)
00078 {
00079 ri6=1./(r2*r2*r2);
00080
00081
00082 if(r>(BMB_Rc-1.0))
00083 {
00084 x=r-BMB_Rc+1.0;
00085 xcube=CUBE(x);
00086 cx1=SQR(1.0-xcube*x);
00087 cx2=8.0*(1.0-xcube*x)*xcube;
00088 }
00089 else
00090 {
00091 cx1=1.0;
00092 cx2=0.0;
00093 }
00094
00095
00096 isp=species[ipt];
00097 jsp=species[jpt];
00098 k=isp+jsp;
00099
00100
00101 U=(-BMB_POT[k][0]*ri6+BMB_POT[k][1]*exp(-BMB_POT[k][2]*r))*cx1;
00102
00103
00104 fij=rij*(((-6.0*BMB_POT[k][0]*ri6/r+BMB_POT[k][1]*BMB_POT[k][2]
00105 *exp(-BMB_POT[k][2]*r))*cx1+U*cx2)/r);
00106
00107 _F[ipt]-=fij;
00108 _F[jpt]+=fij;
00109 _EPOT_IND[ipt]+=U*0.5;
00110 _EPOT_IND[jpt]+=U*0.5;
00111 _EPOT+=U;
00112 _VIRIAL.addnvv(1.,fij,rij);
00113 }
00114 }
00115 }
00116 }
00117
00118 void BMBFrame::born_meyer_buckingham_Ewald()
00119 {
00120 int i;
00121
00122 born_meyer_buckingham();
00123
00124
00125 if(Ewald_CE_or_PME==0){CE();}
00126
00127 else{PME();}
00128
00129
00130 _EPOT += _EPOT_Ewald;
00131 _VIRIAL += _VIRIAL_Ewald;
00132 for(i=0;i<_NP;i++)
00133 {
00134 _F[i]+=_F_Ewald[i];
00135 _EPOT_IND[i]+=_EPOT_IND_Ewald[i];
00136 }
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 }
00158
00159 void BMBFrame::potential()
00160 {
00161 born_meyer_buckingham_Ewald();
00162 }
00163
00164 void BMBFrame::dope_Yttria()
00165 {
00166
00167 int Y_count,V_count,Max_Y,Max_V;
00168 int N_cat,N_an,N_cat_set,N_an_set;
00169 int I_cat_1,I_cat_2,I_an_1,I_an_2;
00170 double yttriaconc, F_vac, rand_temp;
00171
00172
00173 yttriaconc = input[0];
00174
00175 if(yttriaconc==0.0){WARNING("DOPEYTTRIA : YTTRIA CONCENTRATION IS NOT SPECIFIED"); return;}
00176 N_cat = _NP/12*4;
00177 N_an = _NP/12*8;
00178 F_vac = yttriaconc/(2.0+2.0*yttriaconc);
00179 Max_V = (int) floor(F_vac*((double)N_an)+0.5);
00180 Max_Y = Max_V * 2;
00181 Y_count=0;
00182 V_count=0;
00183 INFO("------------------------------------------------------------------------------");
00184 INFO("------------------------------------------------------------------------------");
00185 INFO(" Doping Yttria [PL]");
00186 INFO(" Substitute Zirconium with Yttrium and Create Oxygen Vacancies");
00187 INFO("------------------------------------------------------------------------------");
00188 INFO(" Total Number of Atomic Sites = "<<(_NP+Max_V));
00189 INFO(" Total Number of Cation Sites = "<<N_cat);
00190 INFO(" Total Number of Anion Sites = "<<N_an);
00191 INFO(" Vacancy Fraction = "<<F_vac);
00192 INFO("------------------------------------------------------------------------------");
00193 INFO(" Total Number of Zirconiums = "<<(N_cat-Max_Y));
00194 INFO(" Total Number of Oxygens = "<<N_an-Max_V);
00195 INFO(" Total Number of Yttriums = "<<Max_Y);
00196 INFO(" Total Number of Vacancies = "<<Max_V);
00197 INFO("------------------------------------------------------------------------------");
00198 INFO("------------------------------------------------------------------------------");
00199
00200
00201 while(Y_count<Max_Y)
00202 {
00203
00204 rand_temp = ((double)drand48());
00205 if(rand_temp!=1.0)
00206 {
00207
00208 I_cat_1 = (int) floor(((double)N_cat)*rand_temp);
00209 N_an_set = I_cat_1/4;
00210 I_cat_2 = I_cat_1+8*N_an_set;
00211
00212
00213 if(species[I_cat_2]==0)
00214 {
00215 species[I_cat_2]=3;
00216 Y_count++;
00217 }
00218 }
00219 }
00220
00221 freeallatoms();
00222
00223
00224 while(V_count<Max_V)
00225 {
00226
00227 rand_temp = ((double)drand48());
00228 if(rand_temp!=1.0)
00229 {
00230
00231 I_an_1 = (int) floor(((double)N_an)*rand_temp);
00232 N_cat_set = I_an_1/8+1;
00233 I_an_2 = I_an_1+4*N_cat_set;
00234
00235 if(species[I_an_2]==1)
00236 {
00237 fixed[I_an_2]=1;
00238 V_count++;
00239 }
00240 }
00241 }
00242
00243
00244 if (input[1] == -1 )
00245 markremovefixedatoms();
00246 else
00247 {
00248 removefixedatoms();
00249 }
00250 }
00251
00252 #ifdef _TEST
00253
00254
00255 class BMBFrame sim;
00256
00257
00258 #include "main.cpp"
00259
00260 #endif//_TEST
00261