Skip to content

[WIP] ANI MBIS-volume Models - #663

Open
justoolmos wants to merge 10 commits into
mainfrom
justo_volume_models
Open

[WIP] ANI MBIS-volume Models#663
justoolmos wants to merge 10 commits into
mainfrom
justo_volume_models

Conversation

@justoolmos

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread torchani/volume_model/ANIv.py Outdated
Comment thread torchani/volume_model/ANIv.py Outdated

#energies += self.energy_networks(elem_idxs, aevs, atomic, ensemble_values)
volumes += self.volume_networks(elem_idxs, aevs, atomic = True, ensemble_values = False) #(BxN)
volumes = torch.nn.GELU(volumes) #gelu para remover sacar valores negativos

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

GELU actually allows negative values, although it is unlikely. I don't think this would be a problem in practice, but we can't say "we use gelu to get rid of negative values".

What about softplus? Maybe you could try softplus with a high beta parameter, or a sigmoid?

Alternatively we could do Vo + Vo * tanh(z/2), where Vo is the volume of the free atom?

@IgnacioJPickering IgnacioJPickering Nov 12, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As another alternative, you could just shift the GELU slightly upwards to avoid the negative dip (depending on the order of magnitude of the values for the volumes this may or may not be a good idea, for instance if the volumes are ~0.1 at the smallest, and the dip is ~1e-8 then its fine, but if the dip is comparable to the smallest volumes it may cause some issues)

@justoolmos justoolmos Nov 17, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think softplus with a high beta (something like 10) can work. I'll retrain the model.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let me know how it goes!

Comment thread torchani/volume_model/ANIv.py Outdated
Comment thread torchani/volume_model/train_model_ANIv.py Outdated
Comment on lines +41 to +42
aev_computer = torchani.aev.AEVComputer.like_2x()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Recommendation: use AEVComputer.like_2x(strategy="cuaev") that will be significantly faster (if you have the cuaev installed).

Also, I don't know how fast/slow this is to train, but do you think you could train one with AEVComputer.like_2x(radial_start=0.9, angular_start=0.9, cutoff=5.2, cutoff_fn="smooth", strategy="cuaev") ? That way we can couple it with 2xr.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll add a new model with those specs. Training with cuaev does work fine.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great!

@IgnacioJPickering

Copy link
Copy Markdown
Contributor

@justoolmos For some reason the tests are not triggering. Do you mind adding a dummy commit so I can confirm that the tests get triggered?

@IgnacioJPickering IgnacioJPickering changed the title Justo volume models [WIP] ANI MBIS-volume Models Nov 13, 2025
@IgnacioJPickering

IgnacioJPickering commented Nov 17, 2025

Copy link
Copy Markdown
Contributor

@justoolmos check out the PR #675 I added a model kind of like "ANImbis" but instead it is "ANImbisv", and can predict volumes I had to make a few modifications to the repo to make this happen, I think they are for the best.

You may want to merge that branch with your branch, so you already have this set up.
Unfortunately due to the way the repo is right now, this was a bit painful... hopefully in the future we can simplify.

Once your models are trained, we can just load the state_dict from your models into this model and predict the volumes. It does need some modification so that the volume networks have the correct activation function, but maybe that function can even be added to the SeparateScalarsNNPotential class, so it is simpler.

I also added the possibility of having a volume shifter.

The only thing that remains after that is hooking into the ani-amber interface.

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