@@ -1180,216 +1180,13 @@ def merge(
11801180 # Create the CLJNBPairs matrices.
11811181 ff = molecule0 .property (ff0 )
11821182
1183+ # Create the new intrascale matrices.
11831184 scale_factor_14 = _SireMM .CLJScaleFactor (
11841185 ff .electrostatic14_scale_factor (), ff .vdw14_scale_factor ()
11851186 )
11861187 clj_nb_pairs0 = _SireMM .CLJNBPairs (conn0 , scale_factor_14 )
11871188 clj_nb_pairs1 = _SireMM .CLJNBPairs (conn1 , scale_factor_14 )
11881189
1189- # Loop over all atoms unique to molecule0.
1190- for idx0 in atoms0_idx :
1191- # Map the index to its position in the merged molecule.
1192- idx0 = mol0_merged_mapping [idx0 ]
1193-
1194- # Loop over all atoms unique to molecule1.
1195- for idx1 in atoms1_idx :
1196- # Map the index to its position in the merged molecule.
1197- idx1 = mol1_merged_mapping [idx1 ]
1198-
1199- # Work out the connection type between the atoms, in molecule 0.
1200- conn_type0 = conn0 .connection_type (idx0 , idx1 )
1201-
1202- # The atoms aren't bonded.
1203- if conn_type0 == 0 :
1204- clj_scale_factor = _SireMM .CLJScaleFactor (1 , 1 )
1205- clj_nb_pairs0 .set (idx0 , idx1 , clj_scale_factor )
1206-
1207- # The atoms are part of a dihedral.
1208- elif conn_type0 == 4 :
1209- clj_scale_factor = _SireMM .CLJScaleFactor (
1210- ff .electrostatic14_scale_factor (), ff .vdw14_scale_factor ()
1211- )
1212- clj_nb_pairs0 .set (idx0 , idx1 , clj_scale_factor )
1213-
1214- # The atoms are bonded
1215- else :
1216- clj_scale_factor = _SireMM .CLJScaleFactor (0 , 0 )
1217- clj_nb_pairs0 .set (idx0 , idx1 , clj_scale_factor )
1218-
1219- # Work out the connection type between the atoms, in molecule 1.
1220- conn_type1 = conn1 .connection_type (idx0 , idx1 )
1221-
1222- # The atoms aren't bonded.
1223- if conn_type1 == 0 :
1224- clj_scale_factor = _SireMM .CLJScaleFactor (1 , 1 )
1225- clj_nb_pairs1 .set (idx0 , idx1 , clj_scale_factor )
1226-
1227- # The atoms are part of a dihedral.
1228- elif conn_type1 == 4 :
1229- clj_scale_factor = _SireMM .CLJScaleFactor (
1230- ff .electrostatic14_scale_factor (), ff .vdw14_scale_factor ()
1231- )
1232- clj_nb_pairs1 .set (idx0 , idx1 , clj_scale_factor )
1233-
1234- # The atoms are bonded
1235- else :
1236- clj_scale_factor = _SireMM .CLJScaleFactor (0 , 0 )
1237- clj_nb_pairs1 .set (idx0 , idx1 , clj_scale_factor )
1238-
1239- # Copy the intrascale from molecule1 into clj_nb_pairs0.
1240-
1241- # Perform a triangular loop over atoms from molecule1.
1242- if roi is None :
1243- iterlen = molecule1 .num_atoms ()
1244- iterrange = list (range (molecule1 .num_atoms ()))
1245- # When region of interest is defined, perfrom loop from these indices
1246- else :
1247- for roi_res in roi :
1248- # Get atom indices of ROI residue in molecule1
1249- molecule1_roi = molecule1 .residues ()[roi_res ]
1250- molecule1_roi_idx = [a .index () for a in molecule1_roi ]
1251- iterlen = len (molecule1_roi_idx )
1252- iterrange = molecule1_roi_idx
1253-
1254- for x in range (0 , iterlen ):
1255- # Convert to an AtomIdx.
1256- idx = iterrange [x ]
1257- idx = _SireMol .AtomIdx (idx )
1258-
1259- # Map the index to its position in the merged molecule.
1260- idx_map = mol1_merged_mapping [idx ]
1261-
1262- for y in range (x + 1 , iterlen ):
1263- idy = iterrange [y ]
1264- # Convert to an AtomIdx.
1265- idy = _SireMol .AtomIdx (idy )
1266-
1267- # Map the index to its position in the merged molecule.
1268- idy_map = mol1_merged_mapping [idy ]
1269-
1270- # Get the connection type between the atoms.
1271- conn_type = conn0 .connection_type (idx_map , idy_map )
1272-
1273- # The atoms aren't bonded.
1274- if conn_type == 0 :
1275- clj_scale_factor = _SireMM .CLJScaleFactor (1 , 1 )
1276- clj_nb_pairs0 .set (idx_map , idy_map , clj_scale_factor )
1277-
1278- # The atoms are part of a dihedral.
1279- elif conn_type == 4 :
1280- clj_scale_factor = _SireMM .CLJScaleFactor (
1281- ff .electrostatic14_scale_factor (), ff .vdw14_scale_factor ()
1282- )
1283- clj_nb_pairs0 .set (idx_map , idy_map , clj_scale_factor )
1284-
1285- # The atoms are bonded
1286- else :
1287- clj_scale_factor = _SireMM .CLJScaleFactor (0 , 0 )
1288- clj_nb_pairs0 .set (idx_map , idy_map , clj_scale_factor )
1289-
1290- # Now copy in all intrascale values from molecule0 into clj_nb_pairs0.
1291-
1292- # Work out the iteration length and range.
1293- if roi is None :
1294- iterlen = molecule0 .num_atoms ()
1295- iterrange = list (range (molecule0 .num_atoms ()))
1296- else :
1297- for roi_res in roi :
1298- # Get atom indices of ROI residue in molecule0.
1299- molecule0_roi = molecule0 .residues ()[roi_res ]
1300- molecule0_roi_idx = [a .index () for a in molecule0_roi ]
1301- iterlen = len (molecule0_roi_idx )
1302- iterrange = molecule0_roi_idx
1303-
1304- # Perform a triangular loop over atoms from molecule0.
1305- for x in range (0 , iterlen ):
1306- # Convert to an AtomIdx.
1307- idx = iterrange [x ]
1308- idx = _SireMol .AtomIdx (idx )
1309-
1310- # Map the index to its position in the merged molecule.
1311- idx_map = mol0_merged_mapping [idx ]
1312-
1313- for y in range (x + 1 , iterlen ):
1314- idy = iterrange [y ]
1315- # Convert to an AtomIdx.
1316- idy = _SireMol .AtomIdx (idy )
1317-
1318- # Map the index to its position in the merged molecule.
1319- idy_map = mol0_merged_mapping [idy ]
1320-
1321- # Get the connection type between the atoms.
1322- conn_type = conn0 .connection_type (idx_map , idy_map )
1323-
1324- # The atoms aren't bonded.
1325- if conn_type == 0 :
1326- clj_scale_factor = _SireMM .CLJScaleFactor (1 , 1 )
1327- clj_nb_pairs0 .set (idx_map , idy_map , clj_scale_factor )
1328-
1329- # The atoms are part of a dihedral.
1330- elif conn_type == 4 :
1331- clj_scale_factor = _SireMM .CLJScaleFactor (
1332- ff .electrostatic14_scale_factor (),
1333- ff .vdw14_scale_factor (),
1334- )
1335- clj_nb_pairs0 .set (idx_map , idy_map , clj_scale_factor )
1336-
1337- # The atoms are bonded
1338- else :
1339- clj_scale_factor = _SireMM .CLJScaleFactor (0 , 0 )
1340- clj_nb_pairs0 .set (idx_map , idy_map , clj_scale_factor )
1341-
1342- # Finally, copy the intrascale from molecule1 into clj_nb_pairs1.
1343-
1344- # Work out the iteration length and range.
1345- if roi is None :
1346- iterlen = molecule1 .num_atoms ()
1347- iterrange = list (range (molecule1 .num_atoms ()))
1348-
1349- else :
1350- for roi_res in roi :
1351- molecule1_roi = molecule1 .residues ()[roi_res ]
1352- molecule1_roi_idx = [a .index () for a in molecule1_roi ]
1353- iterlen = len (molecule1_roi_idx )
1354- iterrange = molecule1_roi_idx
1355-
1356- # Perform a triangular loop over atoms from molecule1.
1357- for x in range (0 , iterlen ):
1358- # Convert to an AtomIdx.
1359- idx = iterrange [x ]
1360- idx = _SireMol .AtomIdx (idx )
1361-
1362- # Map the index to its position in the merged molecule.
1363- idx = mol1_merged_mapping [idx ]
1364-
1365- for y in range (x + 1 , iterlen ):
1366- idy = iterrange [y ]
1367- # Convert to an AtomIdx.
1368- idy = _SireMol .AtomIdx (idy )
1369-
1370- # Map the index to its position in the merged molecule.
1371- idy = mol1_merged_mapping [idy ]
1372-
1373- # Get the connection type between the atoms.
1374- conn_type = conn1 .connection_type (idx , idy )
1375-
1376- if conn_type == 0 :
1377- clj_scale_factor = _SireMM .CLJScaleFactor (1 , 1 )
1378- clj_nb_pairs1 .set (idx , idy , clj_scale_factor )
1379-
1380- # The atoms are part of a dihedral.
1381- elif conn_type == 4 :
1382- clj_scale_factor = _SireMM .CLJScaleFactor (
1383- ff .electrostatic14_scale_factor (),
1384- ff .vdw14_scale_factor (),
1385- )
1386- clj_nb_pairs1 .set (idx , idy , clj_scale_factor )
1387-
1388- # The atoms are bonded
1389- else :
1390- clj_scale_factor = _SireMM .CLJScaleFactor (0 , 0 )
1391- clj_nb_pairs1 .set (idx , idy , clj_scale_factor )
1392-
13931190 # Store the two molecular components.
13941191 edit_mol .set_property ("molecule0" , molecule0 )
13951192 edit_mol .set_property ("molecule1" , molecule1 )
0 commit comments