Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DPD an Integrator instead of a Potential #34

Open
RaulPPelaez opened this issue Mar 6, 2024 · 2 comments · May be fixed by #35
Open

Make DPD an Integrator instead of a Potential #34

RaulPPelaez opened this issue Mar 6, 2024 · 2 comments · May be fixed by #35

Comments

@RaulPPelaez
Copy link
Owner

RaulPPelaez commented Mar 6, 2024

Currently, DPD is encoded as a Potential that must be used in conjunction with VerletNVE. This can be confusing to the user and its awkward to explain. For instance, if you need DPD you need to include "VerletNVE.cuh":

#include<uammd.cuh>
#include<Integrator/VerletNVE.cuh>
#include<Interactor/PairForces.cuh>
#include<Interactor/Potential/DPD.cuh>
using namespace uammd;
//A function that creates and returns a DPD integrator
auto createIntegratorDPD(UAMMD sim){
  Potential::DPD::Parameters par;
  par.temperature = sim.par.temperature;
  //The cut off for the weight function
  par.cutOff = sim.par.cutOff;
  //The friction coefficient
  par.gamma = sim.par.friction;
  //The strength of the weight function
  par.A = sim.par.strength;
  par.dt = sim.par.dt;
  auto dpd = make_shared<Potential::DPD>(dpd);
  //From the example in PairForces
  auto interactor = createPairForcesWithPotential(sim, dpd);
  //From the example in the MD section
  // particle velocities should not be initialized
  // by VerletNVE (initVelocities=false)
  using NVE = VerletNVE;
  NVE::Parameters params;
  params.dt = par.dt;
  params.initVelocities=false;
  verlet = make_shared<NVE>(pd,  params);
  verlet->addInteractor(interactor);
  return verlet;
}

It would be great if instead one could

#include<uammd.cuh>
#include<Integrator/DPD.cuh>
using namespace uammd;
//A function that creates and returns a DPD integrator
auto createIntegratorDPD(UAMMD sim){
  DPDIntegrator::Parameters par;
  par.temperature = sim.par.temperature;
  //The cut off for the weight function
  par.cutOff = sim.par.cutOff;
  //The friction coefficient
  par.gamma = sim.par.friction;
  //The strength of the weight function
  par.A = sim.par.strength;
  par.dt = sim.par.dt;
  par.initVelocities=false;
  dpd = make_shared<DPDIntegrator>(pd,  params);
  return dpd;
}

This would also make it easier to improve/change the algorithm specifically for DPD should the need arise.

@RaulPPelaez
Copy link
Owner Author

cc @PabloIbannez @PabloPalaciosAlonso could you step in here?

@PabloPalaciosAlonso
Copy link
Contributor

Sure, I can do it

@RaulPPelaez RaulPPelaez linked a pull request Mar 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants