@@ -92,21 +92,25 @@ def get_UA_axes(self, data_container, index):
9292 moment_of_inertia: moment of inertia (3,)
9393 """
9494
95- index = int (index )
95+ index = int (index ) # bead index
9696
9797 # use the same customPI trans axes as the residue level
98- UAs = data_container .select_atoms ("mass 2 to 999" )
99- UA_masses = self .get_UA_masses (data_container .atoms )
100- center = data_container .atoms .center_of_mass (unwrap = True )
101- moment_of_inertia_tensor = self .get_moment_of_inertia_tensor (
102- center , UAs .positions , UA_masses , data_container .dimensions [:3 ]
103- )
104- trans_axes , _moment_of_inertia = self .get_custom_principal_axes (
105- moment_of_inertia_tensor
106- )
98+ heavy_atoms = data_container .select_atoms ("prop mass > 1.1" )
99+ if len (heavy_atoms ) > 1 :
100+ UA_masses = self .get_UA_masses (data_container .atoms )
101+ center = data_container .atoms .center_of_mass (unwrap = True )
102+ moment_of_inertia_tensor = self .get_moment_of_inertia_tensor (
103+ center , heavy_atoms .positions , UA_masses , data_container .dimensions [:3 ]
104+ )
105+ trans_axes , _moment_of_inertia = self .get_custom_principal_axes (
106+ moment_of_inertia_tensor
107+ )
108+ else :
109+ # use standard PA for UA not bonded to anything else
110+ make_whole (data_container .atoms )
111+ trans_axes = data_container .atoms .principal_axes ()
107112
108113 # look for heavy atoms in residue of interest
109- heavy_atoms = data_container .select_atoms ("prop mass > 1.1" )
110114 heavy_atom_indices = []
111115 for atom in heavy_atoms :
112116 heavy_atom_indices .append (atom .index )
0 commit comments