Skip to content

Evaporation dependent perturbed Lennard Jones potential#127

Draft
mayukh33 wants to merge 18 commits into
mainfrom
feature/perturbedLJevap
Draft

Evaporation dependent perturbed Lennard Jones potential#127
mayukh33 wants to merge 18 commits into
mainfrom
feature/perturbedLJevap

Conversation

@mayukh33

@mayukh33 mayukh33 commented May 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@mayukh33
mayukh33 marked this pull request as draft May 7, 2026 15:52
@mphoward

mphoward commented May 7, 2026

Copy link
Copy Markdown
Collaborator

FYI: every time you push a commit, the actions will take a very long time to run so I recommend only doing that when you have a complete set of changes that you want tested and/or reviewed. For example, this commit will not actually test any of your code because you've only added header files.

@mayukh33
mayukh33 requested a review from mphoward May 14, 2026 08:11
Comment thread src/export_PerturbedLennardJonesEvap.cc Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go at the bottom of the PerturbedLennardJonesEvap.cc file, it doesn't need to be separate.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here for the GPU version.

Comment thread src/pair.py
Comment on lines +471 to +476
self._attraction_scale_factor_data = numpy.asarray(
attraction_scale_factor_data, dtype=numpy.float64
)
self._attraction_scale_factor_shape = numpy.asarray(
attraction_scale_factor_shape, dtype=numpy.uint32
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not positive since the arguments of this aren't documented, but can't you get the shape of the scale factor data from the array, rather than storing a separate array?

Comment thread src/PerturbedLennardJonesEvap.cc Outdated
Comment on lines +27 to +29
lj1(params.epsilon_x_4 * params.sigma_6 * params.sigma_6),
lj2(params.epsilon_x_4 * params.sigma_6), rcutsq(rcut * rcut), rwcasq(params.rwcasq),
sigma_6(params.sigma_6), m_energy_shift(energy_shift), m_variant(variant)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way this class is being constructed is quite confusing because of the mix of the parameter struct. Is it meant to operate on all particles in the system with the same sigma and epsilon? If yes, you would be better off just passing epsilon and sigma to the class, and packing them up into a struct later if it's really needed (it probably isn't).

Also, things like lj1, lj2, rcutsq, rwcasq, and sigma_6 are temporary variables that should be computed before they are needed not as class members.

Comment thread src/PerturbedLennardJonesEvap.cc Outdated
Comment on lines +120 to +128
auto clamp_scaled_y = [](Scalar y, Scalar height, Scalar ylo)
{
const Scalar s = (y - ylo) / (height - ylo);
if (!(s > Scalar(0.0)))
return Scalar(0.0);
if (s > Scalar(1.0))
return Scalar(1.0);
return s;
};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code really need to be a lambda function? It's only used once.

Comment thread src/PerturbedLennardJonesEvap.h Outdated
namespace azplugins
{

struct PairParametersPerturbedLennardJonesEvap

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above about constructor. I think this parameter type is probably not needed unless you want to be able to set different epsilon and sigma for different pairs of particles.

Comment thread src/PerturbedLennardJonesEvap.h Outdated
Comment on lines +93 to +96
Scalar scaleTime(uint64_t timestep) const
{
return Scalar(static_cast<Scalar>(timestep) / m_time_scale_factor);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this used and does it really need to be part of the public API of the class? It looks like it could be one line of code somewhere.

Comment thread src/PerturbedLennardJonesEvap.h Outdated
Comment on lines +103 to +111
Scalar getEpsilon() const
{
return epsilon_x_4 / Scalar(4.0);
}

Scalar getSigma() const
{
return std::pow(sigma_6, Scalar(1.0) / Scalar(6.0));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can become simple getters / setters on epsilon and sigma if there is only one value.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comments as for CPU code apply to this file.

Comment thread src/variant.py
from hoomd.azplugins import _azplugins


class VariantInterpolated(_azplugins.VariantInterpolated, hoomd.variant.Variant):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by the double inheritance pattern here, and I'm not sure if what it is doing is right. Did you get this from somewhere else in HOOMD?

@mayukh33 mayukh33 Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, scalar.py in the variant directory of HOOMD uses the same pattern.

@mayukh33
mayukh33 requested a review from mphoward July 7, 2026 08:09
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 this pull request may close these issues.

2 participants