overwrite(newStructure, rescanAtoms = true, fromWorker = false) {
        ({name: structure.name = "", atoms: structure.atoms = [], bonds: structure.bonds = [],
            potentials: structure.potentials = new Map()} = newStructure);
        if (rescanAtoms !== false) {
            atomSet = new Set(structure.atoms.map(atom => atom.el));
            let atomList = this.getAtomList();
            let pairList = [];
            for (let [i, el] of atomList.entries()) {
                pairList.push(...atomList.slice(i).map(elem => el + elem));
            }
            // Add extra-graph pairs
            pairList.push(...pairList.map(pair => `x-${pair}`));
            pairSet = new Set(pairList);
        }
        this.trigger("updateStructure", rescanAtoms !== false);
        if (fromWorker !== true) {
            syncWorker();
        }
    }
/**
     * Completely overwrites the `structure` object. Call this method when a new file is opened,
     * or when the structure needs to be updated according the result of a worker calculations
     * @param {Object} newStructure
     * @param {Boolean} [rescanAtoms] Pass `false` to prevent `atomSet` and `pairSet` update.
     * By default they are updated as well
     * @param {Boolean} [fromWorker] For internal use. Pass `true` to prevent notifying the worker
     */
Completely overwrites the `structure` object.
Completely overwrites the ` structure ` object .
overwrite(newStructure, rescanAtoms = true, fromWorker = false) {
        ({name: structure.name = "", atoms: structure.atoms = [], bonds: structure.bonds = [],
            potentials: structure.potentials = new Map()} = newStructure);
        if (rescanAtoms !== false) {
            atomSet = new Set(structure.atoms.map(atom => atom.el));
            let atomList = this.getAtomList();
            let pairList = [];
            for (let [i, el] of atomList.entries()) {
                pairList.push(...atomList.slice(i).map(elem => el + elem));
            }
            pairList.push(...pairList.map(pair => `x-${pair}`));
            pairSet = new Set(pairList);
        }
        this.trigger("updateStructure", rescanAtoms !== false);
        if (fromWorker !== true) {
            syncWorker();
        }
    }
overwrite ( newStructure , rescanAtoms = true , fromWorker = false ) { ( { name : structure . name = "" , atoms : structure . atoms = [ ] , bonds : structure . bonds = [ ] , potentials : structure . potentials = new Map ( ) } = newStructure ) ; if ( rescanAtoms !== false ) { atomSet = new Set ( structure . atoms . map ( atom => atom . el ) ) ; let atomList = this . getAtomList ( ) ; let pairList = [ ] ; for ( let [ i , el ] of atomList . entries ( ) ) { pairList . push ( ... atomList . slice ( i ) . map ( elem => el + elem ) ) ; } pairList . push ( ... pairList . map ( pair => ` ${ pair } ` ) ) ; pairSet = new Set ( pairList ) ; } this . trigger ( "updateStructure" , rescanAtoms !== false ) ; if ( fromWorker !== true ) { syncWorker ( ) ; } }
Completely overwrites the `structure` object.
Completely overwrites the ` structure ` object .
// Add extra-graph pairs