-interstitial simulations
-************************
+parcas
+******
+more DOUBLECHECKs with PARCAS !!!!
-- more DOUBLECHECKs with PARCAS !!!!
+ * E_kin
+ * x/y/z(t) of both
+ * video of hex -> 100db
implement
*********
- clean up mdrun
- config sanity checks
- - introduce/improve fill command (multiple fills)
- anneal -> from current to T with rate R
- potentials:
- * tersoff fast ***
- * modifief tersoff/albe ***
- * stillinger weber ***
- * eam
- * edip
+ * tersoff fast
+ * meam
- optimize code!
todo:
- listen ! estimate time
- more in fast (also think about -> 'type')
- - algo! (though i don't believe!)
- inline
- - openmp (num_thread copies of neighbour_i)
- + pthreads (simultaneously!)
simulation runs
***************
-- cryst simulations: reasonable pctrl?
-- even higher temperatures
- tctrl only in outer regions
- only 1 atom per timestep
-- EXTENDED C-C cutoff
-- different sized SiC prec in Si (4:5! diff temperatures) ***
- melting exps (both, anneal + interface method)
- interstitials:
+ - sic ints (compare!)
- more interstitial combinations
- characterize interstitials by PCF, then inc temperature
#!/bin/bash
+# bulk chemical potentials
+musi=-4.63
+muc=-7.374
+music=-12.68
+
+# formation enthalpy
+dhf=0.68
+#dhf=-9.64
+
+# first method to calculate formation energy
file=`ls $1/atomic_conf_* | tail -1`
atom_cnt=`grep '# \[P\]' $file | awk '{ print $3 }'`
e0=`awk 'NR==2' $1/energy | awk '{ print $4 }'`
e1=`tail -n 1 $1/energy | awk '{ print $4 }'`
echo "$e0 $e1 $atom_cnt" | \
- awk '{ print ($2-$1)*$3" eV" }'
+ awk '{ print " "($2-$1)*$3" eV (simple)" }'
+
+# second method to calculate formation energy
+si_cnt=`grep ^Si $file | wc -l`
+c_cnt=`grep ^C $file | wc -l`
+ed=`tail -n 1 $1/energy | awk '{ print $3 }'`
+
+echo "$si_cnt $c_cnt $musi $muc $ed $music $dhf" | \
+ awk '{ print " "$5*($1+$2)-0.5*($1+$2)*$6-0.5*($1-$2)*($3-$4)-0.5*($1-$2)*$7 " eV (Albe, #Si=" $1 " #C=" $2 ") " }'
+echo "$si_cnt $c_cnt $ed $e0" | \
+ awk '{ print " " $3*($1+$2)-($1+$2)*$4 " eV (Gao, #Si=" $1 " #C=" $2 ")" }'
+
+
case STAGE_DISPLACE_ATOM:
psize=sizeof(t_displace_atom_params);
break;
+ case STAGE_DEL_ATOMS:
+ psize=sizeof(t_del_atoms_params);
+ break;
case STAGE_INSERT_ATOMS:
psize=sizeof(t_insert_atoms_params);
break;
t_set_temp_params stp;
t_set_timestep_params stsp;
t_fill_params fp;
+ t_del_atoms_params delp;
/* open config file */
fd=open(mdrun->cfile,O_RDONLY);
memset(&stp,0,sizeof(t_set_temp_params));
memset(&stsp,0,sizeof(t_set_timestep_params));
memset(&fp,0,sizeof(t_fill_params));
+ memset(&delp,0,sizeof(t_del_atoms_params));
// get command + args
wcnt=0;
dap.dz=atof(word[5]);
add_stage(mdrun,STAGE_DISPLACE_ATOM,&dap);
}
+ else if(!strncmp(word[1],"del_atoms",9)) {
+ delp.o.x=atof(word[2]);
+ delp.o.y=atof(word[3]);
+ delp.o.z=atof(word[4]);
+ delp.r=atof(word[5]);
+ add_stage(mdrun,STAGE_DEL_ATOMS,&delp);
+ }
else if(!strncmp(word[1],"ins_atoms",9)) {
iap.ins_steps=atoi(word[2]);
iap.ins_atoms=atoi(word[3]);
return 0;
}
+int del_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
+
+ t_stage *stage;
+ t_del_atoms_params *delp;
+ int i;
+ t_3dvec dist;
+
+ stage=mdrun->stage.current->data;
+ delp=stage->params;
+
+ for(i=0;i<moldyn->count;i++) {
+ v3_sub(&dist,&(delp->o),&(moldyn->atom[i].r));
+//printf("%d ----> %f %f %f = %f | %f\n",i,dist.x,dist.y,dist.z,v3_absolute_square(&dist),delp->r*delp->r);
+ if(v3_absolute_square(&dist)<=(delp->r*delp->r)) {
+ del_atom(moldyn,moldyn->atom[i].tag);
+ printf("%s atom deleted: %d %d %d\n",ME,
+ moldyn->atom[i].tag,moldyn->atom[i].element,
+ moldyn->atom[i].brand);
+ }
+ }
+
+ return 0;
+
+}
+
int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
t_insert_atoms_params *iap;
displace_atom(moldyn,mdrun);
change_stage=TRUE;
break;
+ case STAGE_DEL_ATOMS:
+ stage_print(" -> del atoms\n\n");
+ del_atoms(moldyn,mdrun);
+ change_stage=TRUE;
+ break;
case STAGE_INSERT_ATOMS:
stage_print(" -> insert atoms\n\n");
iap=stage->params;
#define STAGE_SET_TIMESTEP 0x08
#define STAGE_FILL 0x09
#define STAGE_THERMAL_INIT 0x10
+#define STAGE_DEL_ATOMS 0x11
typedef struct s_mdrun {
char cfile[128]; // config file
double dx,dy,dz;
} t_displace_atom_params;
+typedef struct s_del_atoms_params {
+ double r;
+ t_3dvec o;
+} t_del_atoms_params;
+
typedef struct s_insert_atoms_params {
u8 type;
double x0,y0,z0,x1,y1,z1;
t_atom *new,*old;
int cnt;
+#if defined LOWMEM_LISTS || defined PTHREADS
+ void *ptr;
+#endif
old=moldyn->atom;
free(old);
+#ifdef LOWMEM_LISTS
+ ptr=realloc(moldyn->lc.subcell->list,moldyn->count*sizeof(int));
+ if(!ptr) {
+ perror("[moldyn] list realloc (del atom)");
+ return -1;
+ }
+ moldyn->lc.subcell->list=ptr;
+ // update lists
+ link_cell_update(moldyn);
+#endif
+
+#ifdef PTHREADS
+ ptr=realloc(amutex,moldyn->count*sizeof(pthread_mutex_t));
+ if(!ptr) {
+ perror("[moldyn] mutex realloc (add atom)");
+ return -1;
+ }
+ amutex=ptr;
+ pthread_mutex_destroy(&(amutex[moldyn->count+1]));
+#endif
+
+
return 0;
}
if(e) {
if(!(moldyn->total_steps%e))
dprintf(moldyn->efd,
- "%f %f %f %f\n",
+ "%f %f %f %f %f %f\n",
moldyn->time,moldyn->ekin/energy_scale,
moldyn->energy/energy_scale,
- get_total_energy(moldyn)/energy_scale);
+ get_total_energy(moldyn)/energy_scale,
+ moldyn->ekin/EV,moldyn->energy/EV);
}
if(m) {
if(!(moldyn->total_steps%m)) {
ba=data;
/* increase total bond counter
- * ... double counting!
*/
- ba->tcnt+=2;
+ ba->tcnt+=1;
if(itom->brand==0)
ba->acnt[jtom->tag]+=1;
int bond_analyze(t_moldyn *moldyn,double *quality) {
- // by now: # bonds of type 'a-4b' and 'b-4a' / # bonds total
-
- int qcnt;
- int ccnt,cset;
+ int qcnt4;
+ int qcnt3;
+ int ccnt4;
+ int ccnt3;
+ int bcnt;
t_ba ba;
int i;
t_atom *atom;
memset(ba.bcnt,0,moldyn->count*sizeof(int));
ba.tcnt=0;
- qcnt=0;
- ccnt=0;
- cset=0;
+ qcnt4=0; qcnt3=0;
+ ccnt4=0; ccnt3=0;
+ bcnt=0;
atom=moldyn->atom;
for(i=0;i<moldyn->count;i++) {
if(atom[i].brand==0) {
if((ba.acnt[i]==0)&(ba.bcnt[i]==4))
- qcnt+=4;
+ qcnt4+=4;
+ if((ba.acnt[i]==0)&(ba.bcnt[i]==3))
+ qcnt3+=3;
}
else {
if((ba.acnt[i]==4)&(ba.bcnt[i]==0)) {
- qcnt+=4;
- ccnt+=1;
+ qcnt4+=4;
+ ccnt4+=1;
}
- cset+=1;
+ if((ba.acnt[i]==3)&(ba.bcnt[i]==0)) {
+ qcnt3+=4;
+ ccnt3+=1;
+ }
+ bcnt+=1;
}
}
- printf("[moldyn] bond analyze: c_cnt=%d | set=%d\n",ccnt,cset);
- printf("[moldyn] bond analyze: q_cnt=%d | tot=%d\n",qcnt,ba.tcnt);
-
if(quality) {
- quality[0]=1.0*ccnt/cset;
- quality[1]=1.0*qcnt/ba.tcnt;
+ quality[0]=1.0*ccnt4/bcnt;
+ quality[1]=1.0*ccnt3/bcnt;
}
else {
- printf("[moldyn] bond analyze: c_bnd_q=%f\n",1.0*qcnt/ba.tcnt);
- printf("[moldyn] bond analyze: tot_q=%f\n",1.0*qcnt/ba.tcnt);
+ printf("[moldyn] bond analyze: %f %f\n",
+ 1.0*ccnt4/bcnt,1.0*ccnt3/bcnt);
}
return 0;