Browse Source

omit suffix for identity assembly operators

dsehnal 3 years ago
parent
commit
333ee85fdb
2 changed files with 6 additions and 5 deletions
  1. 5 4
      src/mol-math/geometry/symmetry-operator.ts
  2. 1 1
      src/mol-theme/color/chain-id.ts

+ 5 - 4
src/mol-math/geometry/symmetry-operator.ts

@@ -57,19 +57,20 @@ namespace SymmetryOperator {
         const _hkl = hkl ? Vec3.clone(hkl) : Vec3();
         spgrOp = defaults(spgrOp, -1);
         ncsId = ncsId || -1;
-        const suffix = getSuffix(info);
-        if (Mat4.isIdentity(matrix)) return { name, assembly, matrix, inverse: Mat4.identity(), isIdentity: true, hkl: _hkl, spgrOp, ncsId, suffix };
+        const isIdentity = Mat4.isIdentity(matrix);
+        const suffix = getSuffix(info, isIdentity);
+        if (isIdentity) return { name, assembly, matrix, inverse: Mat4.identity(), isIdentity: true, hkl: _hkl, spgrOp, ncsId, suffix };
         if (!Mat4.isRotationAndTranslation(matrix, RotationTranslationEpsilon)) {
             console.warn(`Symmetry operator (${name}) should be a composition of rotation and translation.`);
         }
         return { name, assembly, matrix, inverse: Mat4.invert(Mat4(), matrix), isIdentity: false, hkl: _hkl, spgrOp, ncsId, suffix };
     }
 
-    function getSuffix(info?: CreateInfo) {
+    function getSuffix(info?: CreateInfo, isIdentity?: boolean) {
         if (!info) return '';
 
         if (info.assembly) {
-            return `_${info.assembly.operId}`;
+            return isIdentity ? '' : `_${info.assembly.operId}`;
         }
 
         if (typeof info.spgrOp !== 'undefined' && typeof info.hkl !== 'undefined' && info.spgrOp !== -1) {

+ 1 - 1
src/mol-theme/color/chain-id.ts

@@ -62,7 +62,7 @@ function getAsymIdSerialMap(structure: Structure, type: AsymIdType) {
         const offset = (type === 'auth' ? asymIdOffset?.auth : asymIdOffset?.label) || 0;
         let count = 0;
         m.properties.structAsymMap.forEach(({ auth_id }, label_id) => {
-            const asymId = type === 'auth' ? auth_id : label_id;
+            const asymId = type === 'auth' && auth_id ? auth_id : label_id;
             const k = structure.models.length > 1
                 ? getKey(m, asymId)
                 : asymId;