equations.py
AI for Chemistry/code/chemprop_VP-main (1)/chemprop_VP-main/chemprop/models/equations.py
from chemprop.args import TrainArgs
from typing import Callable
import torch
def Tu(A:torch.FloatTensor,B:torch.FloatTensor,C:torch.FloatTensor,
D:torch.FloatTensor,E:torch.FloatTensor,T:torch.FloatTensor):
A,B,C,D,E,T=A.squeeze(),B.squeeze(),C.squeeze(),D.squeeze(),E.squeeze(),T.squeeze()
lnP = A+torch.div(B,T)-C*torch.log(T)-D*T
return lnP
def Antonine(A:torch.FloatTensor,B:torch.FloatTensor,C:torch.FloatTensor,
D:torch.FloatTensor,E:torch.FloatTensor,T:torch.FloatTensor):
A,B,C,D,E,T=A.squeeze(),B.squeeze(),C.squeeze(),D.squeeze(),E.squeeze(),T.squeeze()
lnP = A-torch.div(B,(C+T))
return lnP.unsqueeze(-1)
def Riedel(A:torch.FloatTensor,B:torch.FloatTensor,C:torch.FloatTensor,
D:torch.FloatTensor,E:torch.FloatTensor,T:torch.FloatTensor):
A,B,C,D,E,T=A.squeeze(),B.squeeze(),C.squeeze(),D.squeeze(),E.squeeze(),T.squeeze()
lnP = A-torch.div(B,T)+C*torch.log(T)+D*T.pow(6)
return lnP.unsqueeze(-1)
def Wagner25(A:torch.FloatTensor,B:torch.FloatTensor,C:torch.FloatTensor,
D:torch.FloatTensor,E:torch.FloatTensor,T:torch.FloatTensor):
A,B,C,D,E,T=A.squeeze(),B.squeeze(),C.squeeze(),D.squeeze(),E.squeeze(),T.squeeze()
tau=1-T
lnP = A+torch.div((B*tau+C*tau.pow(1.5)+D*tau.pow(2.5)+E*tau.pow(5)),T)
return lnP.unsqueeze(-1)
def get_equation(args:TrainArgs)->Callable[[torch.FloatTensor],torch.FloatTensor]:
"""Get the empirical equation embedded in the model."""
eqn=args.equation
if eqn == 'Tu':
return Tu
elif eqn =='Antonine':
return Antonine
elif eqn == 'Riedel':
return Riedel
elif eqn == 'Wagner25':
return Wagner25
else:
raise ValueError(f'Equation "{eqn}" is not supported.')
Articoli correlati
cosmo_to_s_profile_ver_1.1.1.py
cosmo_to_s_profile_ver_1.1.1.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/List-9/cosmo_to_s_profile_ver_1.1.1.py).
Leggi l'articolo →area.py
area.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/area_volume-org/area.py).
Leggi l'articolo →area_volume.py
area_volume.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/area_volume-org/area_volume.py).
Leggi l'articolo →volume.py
volume.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/area_volume-org/volume.py).
Leggi l'articolo →check_final_CID.py
check_final_CID.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/check/check_final_CID.py).
Leggi l'articolo →check_for_CID.py
check_for_CID.py — python source code from the AI for Chemistry learning materials (AI for Chemistry/2025_COSMO/data/s-profiles-all/check/check_for_CID.py).
Leggi l'articolo →