@@ -196,6 +196,56 @@ def __init__(
196196 )
197197
198198
199+ class NequIPTPP (TPProblem ):
200+ """
201+ Taken from nequip.nn.interaction_block.InteractionBlock:
202+ https://github.com/mir-group/nequip/blob/27d9d2182da918ab7be0017d8300e53278f5e00e/nequip/nn/interaction_block.py#L89-L116
203+ """
204+
205+ def __init__ (
206+ self ,
207+ feature_irreps_in : Irreps ,
208+ irreps_edge_attr : Irreps ,
209+ feature_irreps_out : Irreps ,
210+ label : Optional [str ] = None ,
211+ irrep_dtype = np .float32 ,
212+ weight_dtype = np .float32 ,
213+ ):
214+ feature_irreps_in = Irreps (feature_irreps_in )
215+ irreps_edge_attr = Irreps (irreps_edge_attr )
216+ feature_irreps_out = Irreps (feature_irreps_out )
217+
218+ irreps_mid = []
219+ instructions = []
220+ for i , (mul , ir_in ) in enumerate (feature_irreps_in ):
221+ for j , (_ , ir_edge ) in enumerate (irreps_edge_attr ):
222+ for ir_out in ir_in * ir_edge :
223+ if ir_out in feature_irreps_out :
224+ k = len (irreps_mid )
225+ irreps_mid .append ((mul , ir_out ))
226+ instructions .append ((i , j , k , "uvu" , True ))
227+
228+ irreps_mid = Irreps (irreps_mid )
229+ irreps_mid , p , _ = irreps_mid .sort ()
230+
231+ instructions = [
232+ (i_in1 , i_in2 , p [i_out ], mode , train )
233+ for i_in1 , i_in2 , i_out , mode , train in instructions
234+ ]
235+
236+ super ().__init__ (
237+ feature_irreps_in ,
238+ irreps_edge_attr ,
239+ irreps_mid ,
240+ instructions ,
241+ internal_weights = False ,
242+ shared_weights = False ,
243+ label = label ,
244+ irrep_dtype = irrep_dtype ,
245+ weight_dtype = weight_dtype ,
246+ )
247+
248+
199249FCTPP = FullyConnectedTPProblem
200250CTPP = ChannelwiseTPP
201251
@@ -347,6 +397,17 @@ def nequip_problems():
347397 ]
348398
349399
400+ # https://github.com/mir-group/nequip/blob/27d9d2182da918ab7be0017d8300e53278f5e00e/nequip/model/nequip_models.py#L30-L58
401+ def nequip_oam_problems ():
402+ sh = "1x0e+1x1o+1x2e+1x3o"
403+ hidden = "128x0e+64x1o+32x2e+32x3o"
404+ return [
405+ NequIPTPP ("32x0e" , sh , hidden , "nequip-oam-l-first-layer" ),
406+ NequIPTPP (hidden , sh , hidden , "nequip-oam-l-main-layers" ),
407+ NequIPTPP (hidden , sh , "128x0e" , "nequip-oam-l-last-layer" ),
408+ ]
409+
410+
350411# https://github.com/atomicarchitects/nequix/blob/main/configs/nequix-mp-1.yml
351412def nequix_problems ():
352413 return [
0 commit comments