Skip to content

Conversation

@johannes-spies
Copy link

Add a new fix that uses a model to predict future positions and momenta.

Copy link
Member

Choose a reason for hiding this comment

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

Can you remove directory from git?


kokkosable = 1;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
atomKK = (AtomKokkos *) atom;
Copy link
Member

Choose a reason for hiding this comment

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

why this change?


#ifdef FIX_CLASS
// clang-format off
FixStyle(flashmd,FixFlashMD);
Copy link
Member

Choose a reason for hiding this comment

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

So as mentioned already I don't think we should call this fix flashmd, unless we want to use FlashMD as the name for the generic method of generating positions and not the specific model. I also feel like this should contain metatomic in the name, like the pair style.

Couple of ideas: fix metatomic_pm, fix metatomic_pos_vel, fix metatomic_ml_dyn. I don't really love any of these though, so we should keep thinking about it!


namespace LAMMPS_NS {
class MetatomicSystemAdaptor;
class PairMetatomicData;
Copy link
Member

Choose a reason for hiding this comment

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

This should be a separate FixFlashMDData/Fix<WhateverNameWeEndUpWith>Data class, so we can evolve the two parts separately.

Comment on lines +38 to +43
std::vector<torch::DeviceType> available_devices();
void pick_device(torch::Device* device, const char* requested);
void initial_integrate(int) override;
void init_list(int id, NeighList *ptr) override;

protected:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
std::vector<torch::DeviceType> available_devices();
void pick_device(torch::Device* device, const char* requested);
void initial_integrate(int) override;
void init_list(int id, NeighList *ptr) override;
protected:
void initial_integrate(int) override;
void init_list(int id, NeighList *ptr) override;
protected:
std::vector<torch::DeviceType> available_devices();
void pick_device(torch::Device* device, const char* requested);

just to make it clear which functions are part of the fix API or not

double *mass = atom->mass;
int *type = atom->type;
int *mask = atom->mask;
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (igroup == atom->firstgroup) nlocal = atom->nfirst;
if (igroup == atom->firstgroup) {
nlocal = atom->nfirst;
}

int nghost = atom->nghost;
int nall = nlocal + nghost;

double *mass = atom->mass;
Copy link
Member

Choose a reason for hiding this comment

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

what's the difference between rmass and mass?


auto properties = metatensor_torch::LabelsHolder::single()->to(mta_data->device);
auto block = torch::make_intrusive<metatensor_torch::TensorBlockHolder>(
// TODO: is there a way to check what dtype the model expects for input data?
Copy link
Member

Choose a reason for hiding this comment

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

yes, model->capabilities().dtype

);
mta_data->evaluation_options->set_selected_atoms(selected_atoms);

// call the model to get delta-positions and updated momenta
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// call the model to get delta-positions and updated momenta
// call the model to get new positions and momenta

Comment on lines +505 to +507
v[i][0] = momenta[i][0].item<double>();
v[i][1] = momenta[i][1].item<double>();
v[i][2] = momenta[i][2].item<double>();
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't these be divided by the masses?

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.

4 participants