Commit a8307cfc authored by Andrei Sobolev's avatar Andrei Sobolev
Browse files

Brillouin zone viewer fixes

parent cc88b039
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ export default class BZViewOptionsDropDown extends DropDownMenu{
    this.REC_LATTICE_AXES_OPTION = 'show-lattice-vectors-parameters'

    this.addOption(this.REC_UNIT_CELL_OPTION, 'Show reciprocal cell', true)
    this.addOption(this.REC_CART_AXES_OPTION, 'Show Cartesian axes', true)
    this.addOption(this.REC_CART_AXES_OPTION, 'Show Cartesian axes', false)
    this.addOption(this.REC_LATTICE_AXES_OPTION, 'Show reciprocal axes', true)
  }

+8 −1
Original line number Diff line number Diff line
@@ -72,6 +72,12 @@ export default class BZViewer {
    transpose33(invert33(data)).forEach(v => {
      recCell.push(multiplyScalar(v,2.0 * Math.PI))
    })
    // Scale up small BZs (large supercells) so arrows stay proportional to the cell
    const minLen = Math.min(...recCell.map(v => Math.sqrt(v[0]**2 + v[1]**2 + v[2]**2)))
    if (minLen < 1.0) {
      const displayScale = 1.0 / minLen
      recCell = recCell.map(v => v.map(c => c * displayScale))
    }
    this.recCell = util.createBasisVectors(recCell)
    // console.log('this.recCell',this.recCell);
    this.root = new THREE.Group()
@@ -91,7 +97,7 @@ export default class BZViewer {
    // this.bz = new THREE.Geometry()
    this.latticeVectors = this.createLatticeVectors(this.recCell)
    this.recCartAxes = this.createRecCartAxes()
    // this.recCartAxes.visible = false
    this.recCartAxes.visible = false
    this.root.add(this.latticeVectors)
    this.root.add(this.recCartAxes)
    // this.bz_vertices = this.request_bz_vertices(recCell)
@@ -291,6 +297,7 @@ export default class BZViewer {
    // this.viewerControls.appendChild(this.heading)
    this.hostElement.appendChild(this.viewerControls);
    this.viewerControls.className = 'viewing-controls'
    this.viewerControls.addEventListener('pointerdown', e => e.stopPropagation())

    this.viewOptionsDropdown = new BZViewOptionsDropDown()//this)
    this.viewerControls.appendChild(this.viewOptionsDropdown.e)