Skip to content
Snippets Groups Projects
Select Git revision
  • e3d31ff714c973a922ef7d58b89c78ea09d29e79
  • master default protected
  • devel
  • hruska-feature-clients-api
  • malostik-#5066-deduplicate-idea-ids
  • warden-postgresql-port
  • hruska-feature-#6799-filter-keys
  • hruska-feature-5066-duplicateIdeaID
  • warden-client-3.0-beta3
  • warden-server-3.0-beta3
  • warden-client-2.2-final
  • warden-server-2.2-final
  • warden-client-3.0-beta2
  • warden-server-3.0-beta2
  • warden-client-2.2
  • warden-server-2.2-patch3
  • warden-client-3.0-beta1
  • warden-server-3.0-beta1
  • warden-server-2.2-patch1
  • warden-client-3.0-beta0
  • warden-server-3.0-beta0
  • warden-server-2.2
  • warden-server-2.1-patch1
  • warden-client-2.1
  • warden-server-2.1
  • warden-server-2.1-beta6
  • warden-server-2.1-beta5
  • warden-server-2.1-beta4
28 results

warden-server-2.2-alpha2.tar.gz.sig

Blame
  • symmetry.ts 1.64 KiB
    /**
     * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author David Sehnal <david.sehnal@gmail.com>
     */
    
    import { SymmetryOperator } from 'mol-math/geometry/symmetry-operator'
    import { arrayFind } from 'mol-data/util'
    import { Query } from '../../query'
    import { Model } from '../../model'
    
    /** Determine an atom set and a list of operators that should be applied to that set  */
    export interface OperatorGroup {
        readonly selector: Query,
        readonly operators: ReadonlyArray<SymmetryOperator>
    }
    
    export type OperatorGroups = ReadonlyArray<OperatorGroup>
    
    export class Assembly {
        readonly id: string;
        readonly details: string;
    
        private _operators: OperatorGroups;
        get operatorGroups(): OperatorGroups {
            if (this._operators) return this._operators;
            this._operators = this.operatorsProvider();
            return this._operators;
        }
    
        constructor(id: string, details: string, private operatorsProvider: () => OperatorGroups) {
            this.id = id;
            this.details = details;
        }
    }
    
    export namespace Assembly {
        export function create(id: string, details: string, operatorsProvider: () => OperatorGroups): Assembly {
            return new Assembly(id, details, operatorsProvider);
        }
    }
    
    interface Symmetry {
        readonly assemblies: ReadonlyArray<Assembly>,
    }
    
    namespace Symmetry {
        export const Empty: Symmetry = { assemblies: [] };
    
        export function findAssembly(model: Model, id: string): Assembly | undefined {
            const _id = id.toLocaleLowerCase();
            return arrayFind(model.symmetry.assemblies, a => a.id.toLowerCase() === _id);
        }
    }
    
    export default Symmetry