[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo] Implementation of full DPD algorithm in Espresso ?

From: Marek Maly
Subject: Re: [ESPResSo] Implementation of full DPD algorithm in Espresso ?
Date: Mon, 29 Mar 2010 12:45:53 +0200
User-agent: Opera Mail/10.10 (Win32)

Dear Christoph,

thank you very much for your complex response.

My problem is that I am really under big time press so
I already found temporary solution.

I simply modified already existing  "Soft-sphere interaction" resp.

"soft_sphere.h" as cheapest way as  possible.

Namely functions:

MDINLINE double soft_force_r(double a, double n, double r )
MDINLINE double soft_energy_r(double a, double n, double r)

For those who are interested I attached modified header file.

I kept there all the original parameters (to prevent me from errors regarding mismatch of func. prototypes in different files).

I call it in script like this:

inter 0 0 soft-sphere $a_00 2 $Rc 0

where $a_00 has now meaning of the repulsive DPD parameter, second parameter (here 2) can be chosen arbitrary (is not used inside redefined functions anymore), $Rc is DPD cutoff and should be set to 1 (Rc is in DPD unit of the length) and the last parameter (original r_offset) should be 0 for DPD redefinition.

if I combine it with

thermostat dpd $T $gamma $Rc

if works perfectly ( I compared to Energies, pressure from my own old DPD software ).

Anyway thank you for the detailed description of adding of the new functions into existing Espresso code !
I will use it surely in the future.

Anyway thanks to all developers for this very nice software. I am new here but anyway it seems that I already
fell in love with Espresso :))

Best wishes,


Dne Mon, 29 Mar 2010 10:45:40 +0200 Christoph Junghans <address@hidden> napsal/-a:

Am 27.03.2010 16:18, schrieb Marek Maly:
The soft conservative DPD force/potential is unfortunately not
implemented. Am I right ?
You are right. I thought about implementing it one day...

If I am right I would like to know how to use/modify Espresso to be able
to carry out full DPD
simulation (including DPD conservative force).
Implementing the conservative DPD part is not difficult. Just use a simple non-bonded interaction (like ljgen) as template.

One way is probably to use DPD thermostat together with tabulated DPD
potential/force but this is
a little bit uncomfortable solution.
And slow....

The second way is to implement conservative DPD force/potential directly
into Espresso code like Leonnard-Jones, Morse etc.

Espresso developers probably has no interest here ? but I can try it by
my self (I have experience with C/C++ however I am pretty new in TCL).
I can learn from implementations of the other potentials in Espresso but
I would be grateful for some info, about the list of all files which
I have to create or modify in order to implement successfully this new

Maybe the easiest way could be also just proper redefinition of some of
the already existing potential (Soft-sphere for example), just to prevent
me from the problems with compilation of Espresso with new code files.
But again I need to know all the files (.h,.c,.tcl) which I have to
modify .
I would call the conservative DPD part nb_harmonic, because it is basically like a spring, but non-bonded.

How to create a new non-bonded interaction?

-Add new interaction parameters to IA_parameters struct in interaction_data.h -Add these parameters to initialize_ia_params and copy_ia_params in interaction_data.c
-Add interaction cutoff to calc_maximal_cutoff in interaction_data.c
-Add a check if interataction is on to checkIfInteraction in interaction_data.c -Create a new .c,.h file with the following 4 functions (see ljgen.c as example):
int printYYYIAToResult(Tcl_Interp *interp, int i, int j);

int YYY_parser(Tcl_Interp * interp,
                int part_type_a, int part_type_b,
                int argc, char ** argv);

void add_YYY_pair_force(Particle *p1, Particle *p2,
                         IA_parameters,*ia_params,double d[3],
                         double dist, double force[3]);

double YYY_pair_energy(Particle *p1, Particle *p2,
                          IA_parameters *ia_params, double d[3],
                          double dist);

where YYY stands for the new interaction name (e.g. ljgen).

-Add printYYYIAToResult to printNonbondedIAToResult in interaction_data.c
-Add YYY_parser to inter_parse_non_bonded in interaction_data.c
-Add add_YYY_pair_force to calc_non_bonded_pair_force_parts in pressure.h (!!!)
-Add YYY_pair_energy to calc_non_bonded_pair_energy in energy.h
-Add the new .h, .c file to Espresso_bin_SOURCES in and run
-Compile and TEST

-Put all new code in '#ifdef YYY' blocks
-Add YYY to compilation_callback in config.c
-Add YYY to config-sample.h
-Create a patch using
cvs diff -u (CVS VERSION) or
diff -Naur original_Espresso_dir your_Espresso_dir (release version)
-Send it to us

I think that's it. If you need any help just ask again.
If you send us the patch and we are happy to include the code in our next release.



Thank you very much in advance for your help !

Best wishes,


Tato zpráva byla vytvořena převratným poštovním klientem Opery:

Attachment: soft_sphere.h
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]