Re: efficient way to apply time-dependent electric field

From: Jim Phillips (
Date: Thu Sep 04 2014 - 11:18:00 CDT

Sorry about the missing docs. From ComputeEField.C:

void ComputeEField::doForce(FullAtom* p, Results* r) {

   SimParameters *simParams = Node::Object()->simParameters;
   Vector eField = simParams->eField;
   // Calculate the angular frequency in 1/fs.
   BigReal omega = TWOPI * simParams->eFieldFreq / 1000.;
   BigReal phi = PI/180.* simParams->eFieldPhase;
   BigReal t = patch->flags.step * simParams->dt;
   Vector eField1 = cos(omega * t - phi) * eField;

You could easily modify this code to apply whatever time-dependent field
you want. If you have a slowly-varying field you can change eField
between run commands.


On Thu, 4 Sep 2014, Azadeh Alavi wrote:

> Hello everyone
> I intend to apply time-dependent external electric field to my system. I
> have used the Tcl Boundary forces for this purpose, however, the
> simulations run very slowly (nearly 3 times). So I tried to use the
> 'eFieldOn' command with a specified 'eFieldFreq' option, which runs pretty
> fast.
> In the user's guide there is not any explanation about eFieldFreq or
> eFieldFreq in the External Electric Field section but when you apply
> eFieldOn, they appear in the log file although they might be zero if you
> apply a constant electric field. So my question is whether it is an
> efficient way to apply such time-varying electric field. Also, I do not
> know which mathematical function it uses to change the electric field with
> time (Sin(wt), Cos(wt) or other). I have tried this field on a system of
> two ions in water and it seems that an alternating electric field is
> applying, but I am quite sure about using it yet.
> Your help would be greatly appreciated.
> Thank you very much.
> Best regards,
> Azadeh

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:22:49 CST