espressomd-users
[Top][All Lists]

## Re: [ESPResSo] bonds

 From: Mikheil Azatov Subject: Re: [ESPResSo] bonds Date: Wed, 30 Jun 2010 13:45:31 -0400

Thank you so much Dr. Axel Arnold for your response. I've been trying to make necessary changes to the code but I encountered a lot of questions while understanding how all the data parameters work. I would really appreciate if you could help me out with some of them.

This is the code that I was thinking to add to the force.c with some questions within the code and after.

for (c = 0; c < local_cells.n; c++) {

for (n = 0; n < dd.cell_inter[c].n_neighbors; n++) {
pairs = dd.cell_inter[c].nList[n].vList.pair;
np    = dd.cell_inter[c].nList[n].vList.n;

/* verlet list loop */
for(i=0; i<2*np; i+=2) {
p1 = pairs[i];                    /* pointer to particle 1 */
p2 = pairs[i+1];                  /* pointer to particle 2 */
dist2 = distance2vec(p1->r.p, p2->r.p, vec21);

angle = /* angle between paticle 1 particle 2 and third particle with id n_id */
/*Question: I'm not sure how to find the particle with let's say identity n_id ? */
/*Is it just local_particles[n_id]*/

/*now I'm adding the bond if the distance and angle are small enough*/
if (dist2<"bind_distance")&&( angle < "bind_angle" ){
int part= p1->p.identity; /*id of particle 1*/
/*Is the value of int part in local_change_bond the same as ID of the particle ?*/
int *bond;
*bond=bond_id(again from espresso file);
*bond=p1->p.identity;
*bond=p2->p.identity;
/*So as I understood bond should have id of the interaction, and the next entries should be the particles      that  are acatually interacting with each other*/

int delete=0
local_change_bond(int part, int *bond, int delete)
/*Then same for angle bond*/
/*Question: For angle bond as I understand we will have *bond as middle particle *bond left, bond, right ?*/

}
}
}

Questions:

1)How to access parameters from espresso file? For example let's say I have bind_distance(or bind_angle) in Espresso file. How I can I access them here ?

2)Should I add this part of code right before the init_forces in force calc ?

3)To make new code run, should I compile Espresso with new code in the different directory ?

4)Also it seems to me that this way I compare only the particles from neighbor cells of cell c and not within cell c itself. Is it right ? If so , how should I check the particles withing the cell ?

Thank you so much for your help,
Mike

Mikheil Azatov
University of Maryland

On Tue, Jun 29, 2010 at 11:24 AM, Axel Arnold wrote:
On Monday 28 June 2010 23:08:45 Mikheil Azatov wrote:
> Hi,
>
> This is probably not possible since I didn't find it in the manual but I
> wanted to make sure I'm not missing on anything. In my simulation I want a
> harmonic bond and bond-angle interaction to appear if two particles of
> different polymers get close to each other. Checking coordinates of each
> particle during each step of integration and setting bond manually this way
> takes a very long time in espresso(more than 100 times longer than without
> checking ). So I was wondering if there is any other way to do this?

The only way to do this is to implement it in C directly. The best place would
be probably at the beginning of the force calculation, force_calc in forces.c.
Using the domain decomposition Verlet lists, you can loop over all pairs of
particles on each processor, and if they meet your distance criterion,
manually add the bonds using local_change_bond from particle_data.c. Since the
Verlet lists on all CPUs contain each pair of particles at most once, there
should be no double insertion of bonds or so.

Will be a bit of coding, but nothing too serious. From looking at
calculate_verlet_ia from verlet.c and local_change_bond it should be easy to
figure out how you do the loop and find your bond partners.

Cheers,
Axel

--
JP Dr. Axel Arnold Tel: +49 711 685 67609