luigibonati / mlcolvar

A unified framework for machine learning collective variables for enhanced sampling simulations
MIT License
89 stars 24 forks source link

Switch from functional to class losses #43

Closed andrrizzi closed 1 year ago

andrrizzi commented 1 year ago

Description

Changes the CV classes to use by default a loss function object.

It is still possible to assign loss_fn to a (lambda) function, although I had to override __setattr__ to work around some weird PyTorch magic (hopefully the comments I left in the code makes it clear).

Status

codecov[bot] commented 1 year ago

Codecov Report

Merging #43 (969634a) into lightning (39902dc) will not change coverage. The diff coverage is 0.00%.

luigibonati commented 1 year ago

thank you @andrrizzi! this sounds good to me, shall we merge it?

andrrizzi commented 1 year ago

Great, thanks! Merging then.