espressomd-users
[Top][All Lists]
Advanced

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

Re: [ESPResSo-users] Using two different Lennard-Jones potentials for sa


From: Henri Menke
Subject: Re: [ESPResSo-users] Using two different Lennard-Jones potentials for same particles
Date: Tue, 06 Mar 2018 09:32:30 +1300

On Mon, 2018-03-05 at 19:46 +0100, David Sean wrote:> I may be late in the game 
here, but could one not exploit the
> LENNARD_JONES_GENERIC feature (provided the exponents 6 and 12 are
> chosen) to obtain two LJ interactions with different parameters ?

Yes, one could definitely do that.  It is even mentioned explicitly in the
manual: “[...] the normal LJ potential is recovered for b1=b2=4, e1=12 and
e2=6.” http://espressomd.org/html/doc/inter_non-bonded.html#generic-lennard-jone
s-interaction

That should actually be the preferred method here as the performance will be 
astronomically better than for tabulated.

Thank you, David!

> David
> 
> 2018-03-03 4:50 GMT+01:00 Henri Menke <address@hidden>:
> > 
> > Hi Reza,
> > 
> > Sorry to hear that it doesn't work.  I must have remembered it incorrectly.
> > 
> > In the tabulated interaction the parameters 'energy' and 'force' take
> > arrays,
> > i.e. you have to read in the files 'potential.dat' and 'force.dat'
> > first.  On
> > the other hand you don't even need to save them as files in this case at all
> > because you can compute the arrays using numpy on the fly.
> > 
> > The Lennard-Jones interaction with the parameters
> > 
> >     system.non_bonded_inter[0,0].lennard_jones.set_params(
> >         epsilon=0.1, sigma=0.1, cutoff=1.0, shift=0.0)
> > 
> > can be reproduced with a tabulated potential of the form
> > 
> >     import numpy as np
> > 
> >     epsilon = 0.1
> >     sigma = 0.1
> >     def V(r):
> >         return 4*epsilon*((sigma/r)**12 - (sigma/r)**6)
> >     def F(r):
> >         return -48*epsilon*((sigma/r)**12 - .5*(sigma/r)**6)/r
> > 
> >     rmin, rmax = 1e-16, 1.0
> >     r = np.linspace(rmin,rmax,10000)
> > 
> >     system.non_bonded_inter[0,0].tabulated.set_params(
> >         min=rmin, max=rmax, energy=V(r), force=F(r))
> > 
> > If you need to include shifts and offsets, just modify the functions V(r)
> > and
> > F(r) according to the documentation at
> > http://espressomd.org/html/doc/inter_non-bonded.html#lennard-jones-interacti
> > on
> > 
> > Kind regards,
> > Henri
> > 
> > On Fri, 2018-03-02 at 23:54 +0330, Mohammadreza Niknam Hamidabad wrote:
> > > 
> > > Hello all,
> > > 
> > > I did this for using two different LJ potential for same particles:
> > > 
> > > system.non_bonded_inter[1, 2].lennard_jones.set_params(
> > >     epsilon=ep1, sigma=1.0,
> > >     cutoff=1.1225, shift="auto", offset=0.0, min=0.0)
> > > 
> > > system.non_bonded_inter[2, 1].lennard_jones.set_params(
> > >     epsilon=ep2, sigma=1.0,
> > >     cutoff=2.5, shift="auto", offset=0.0, min=1.1225)
> > > 
> > > then I used :
> > > 
> > > print (system.non_bonded_inter[1,2].lennard_jones.get_params())
> > > print (system.non_bonded_inter[2,1].lennard_jones.get_params())
> > > 
> > > and I got the same things and this trick didn't work for me (the second
> > > potential overwrites the first one) so I tried writing a tabulated
> > > interaction
> > > for them sth like this:
> > > 
> > > system.non_bonded_inter[1, 2].tabulated.set_params(min=0, max=2.5002,
> > > energy='potential.dat', force='force.dat')
> > > 
> > > Then I got this error: TypeError: a float is required
> > > Could you help me with this tabulated interaction? I've attached force.dat
> > > and
> > > potential.dat.
> > > Is it possible I use just one file with couple of columns in it for force
> > > and
> > > potential? Could you help me with its format?
> > > 
> > > And the other thing, I use visualization_opengl for visualizing my
> > > constraints. It's very good But is it possible I can do the same thing
> > > with
> > > VMD. I think in Tcl version, ESPResSo had this feature.
> > > I know you guys are so busy I appreciate any help you can provide. Thank
> > > you
> > > so much for your time.
> > > 
> > > Best regards,
> > > Reza
> > > 
> > > 
> > > On Tue, Feb 27, 2018 at 3:12 AM, Henri Menke <address@hidden> wrote:
> > > > 
> > > > Hi Reza,
> > > > 
> > > > In your current interaction setup the second one will overwrite the
> > > > first.
> > > > But
> > > > you can work around it by simply reversing the numbers in the second
> > > > call.
> > > > 
> > > > system.non_bonded_inter[1, 2].lennard_jones.set_params(
> > > >     epsilon=ep1, sigma=1.0,
> > > >     cutoff=1.1225, shift="auto", offset=0.0, min=0.0)
> > > > 
> > > > system.non_bonded_inter[2, 1].lennard_jones.set_params(
> > > >     epsilon=ep2, sigma=1.0,
> > > >     cutoff=2.5, shift="auto", offset=0.0, min=1.1225)
> > > > 
> > > > The compiler error is not reproducible for me on Ubuntu 16.04 with
> > > > libraries
> > > > and
> > > > tools from the official repositories.  Do you happen to have a version
> > > > of
> > > > FFTW3
> > > > which you compiled yourself?  In that case it could be that you
> > > > originally
> > > > built
> > > > it without the -fPIC flag but after a system updated (or whatever) your
> > > > linker
> > > > is now enforcing position independent executables to mitigate recent
> > > > Intel
> > > > processor security bugs.
> > > > https://en.wikipedia.org/wiki/Position-independent_code
> > > > 
> > > > Currently the ESPResSo build system does not have a switch to disable
> > > > algorithms
> > > > using FFTW3 because they are an integral part of ESPResSo's feature set.
> > > > You
> > > > could try removing the FFTW3 paths from the CMake configurations file by
> > > > hand or
> > > > using the ccmake command line tool.
> > > > 
> > > > Kind regards,
> > > > Henri
> > > > 
> > > > On Tue, 2018-02-27 at 01:36 +0330, Mohammadreza Niknam Hamidabad wrote:
> > > > > 
> > > > > Hello all,
> > > > > 
> > > > > I'm working on behavior of some proteins and I need to use two
> > > > > different
> > > > LJ
> > > > > 
> > > > > potentials for the same types. some thing like this:
> > > > > 
> > > > > system.non_bonded_inter[1, 2].lennard_jones.set_params(
> > > > >     epsilon=ep1, sigma=1.0,
> > > > >     cutoff=1.1225, shift="auto", offset=0.0, min=0.0)
> > > > > 
> > > > > system.non_bonded_inter[1, 2].lennard_jones.set_params(
> > > > >     epsilon=ep2, sigma=1.0,
> > > > >     cutoff=2.5, shift="auto", offset=0.0, min=1.1225)
> > > > > 
> > > > > Is it possible? Does the second potential overwrite the first one? If
> > > > > not,
> > > > > except tabulated interaction, you guys have any suggestion?
> > > > > 
> > > > > Also I want to compile newer development version, but every time I
> > > > encounter
> > > > > 
> > > > > some errors about fftw3 and recompile with -fPIC.
> > > > > 
> > > > > Do you know how can I solve it? or how can I turn off and disable
> > > > > fftw3?
> > > > (I
> > > > > 
> > > > > don't need any algorithm for electrostatics or p3m)
> > > > > I couldn't find options for make command in installation process to
> > > > disable
> > > > > 
> > > > > it:
> > > > > mkdir build
> > > > > cd build
> > > > > cmake ..
> > > > > make
> > > > > 
> > > > > Best regards,
> > > > > Reza
> > > > > 
> > > > > 



reply via email to

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