case STAGE_DEL_ATOMS:
psize=sizeof(t_del_atoms_params);
break;
+ case STAGE_MODIFY_ATOMS:
+ psize=sizeof(t_modify_atoms_params);
+ break;
case STAGE_INSERT_ATOMS:
psize=sizeof(t_insert_atoms_params);
break;
int i,o;
t_displace_atom_params dap;
+ t_modify_atoms_params map;
t_insert_atoms_params iap;
t_insert_mixed_atoms_params imp;
t_continue_params cp;
// reset
memset(&iap,0,sizeof(t_insert_atoms_params));
+ memset(&map,0,sizeof(t_modify_atoms_params));
memset(&imp,0,sizeof(t_insert_mixed_atoms_params));
memset(&cp,0,sizeof(t_continue_params));
memset(&ap,0,sizeof(t_anneal_params));
delp.r=atof(word[5]);
add_stage(mdrun,STAGE_DEL_ATOMS,&delp);
}
+ else if(!strncmp(word[1],"mod_atoms",8)) {
+ i=2;
+ while(i<wcnt) {
+ if(!strncmp(word[i],"t",1)) {
+ map.tag=atoi(word[++i]);
+ i+=1;
+ }
+ if(!strncmp(word[i],"ekin",5)) {
+ map.ekin.x=atof(word[++i])*EV;
+ map.ekin.y=atof(word[++i])*EV;
+ map.ekin.z=atof(word[++i])*EV;
+ i+=1;
+ }
+ }
+ add_stage(mdrun,STAGE_MODIFY_ATOMS,&map);
+ }
else if(!strncmp(word[1],"ins_atoms",9)) {
iap.ins_steps=atoi(word[2]);
iap.ins_atoms=atoi(word[3]);
}
return 0;
+}
+
+int modify_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
+
+ t_modify_atoms_params *map;
+ t_stage *stage;
+ t_atom *atom;
+ t_3dvec v;
+ int i;
+
+ atom=moldyn->atom;
+ stage=mdrun->stage.current->data;
+ map=stage->params;
+ v.x=0.0; v.y=0.0; v.z=0.0;
+
+ for(i=0;i<moldyn->count;i++) {
+ if(atom[i].tag==map->tag) {
+ v.x=sqrt(2.0*fabs(map->ekin.x)/atom[i].mass);
+ if(map->ekin.x<0.0)
+ v.x=-v.x;
+ v.y=sqrt(2.0*fabs(map->ekin.y)/atom[i].mass);
+ if(map->ekin.y<0.0)
+ v.y=-v.y;
+ v.z=sqrt(2.0*fabs(map->ekin.z)/atom[i].mass);
+ if(map->ekin.z<0.0)
+ v.z=-v.z;
+ v3_copy(&(atom[i].v),&v);
+ printf("%s atom modified: v = (%f %f %f)\n",
+ ME,v.x,v.y,v.z);
+ }
+ }
+ return 0;
}
int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
printf("%s atom inserted (%d/%d): %f %f %f\n",
ME,(iap->cnt_steps+1)*iap->ins_atoms,
iap->ins_steps*iap->ins_atoms,r.x,r.y,r.z);
- printf(" -> d2 = %f/%f\n",dmin,iap->cr*iap->cr);
+ printf(" attributes: ");
+ if(iap->attr&ATOM_ATTR_VB)
+ printf("b ");
+ if(iap->attr&ATOM_ATTR_HB)
+ printf("h ");
+ if(iap->attr&ATOM_ATTR_VA)
+ printf("v ");
+ if(iap->attr&ATOM_ATTR_FP)
+ printf("f ");
+ if(iap->attr&ATOM_ATTR_1BP)
+ printf("1 ");
+ if(iap->attr&ATOM_ATTR_2BP)
+ printf("2 ");
+ if(iap->attr&ATOM_ATTR_3BP)
+ printf("3 ");
+ printf("\n");
+ printf(" d2 = %f/%f\n",dmin,iap->cr*iap->cr);
cnt+=1;
}
del_atoms(moldyn,mdrun);
change_stage=TRUE;
break;
+ case STAGE_MODIFY_ATOMS:
+ stage_print(" -> modify atoms\n\n");
+ modify_atoms(moldyn,mdrun);
+ change_stage=TRUE;
+ break;
case STAGE_INSERT_ATOMS:
stage_print(" -> insert atoms\n\n");
iap=stage->params;