« home

elementari Examples

JSON for molecule benzene

{
  "@module": "pymatgen.core.structure",
  "@class": "Molecule",
  "charge": 0,
  "spin_multiplicity": 1,
  "sites": [
    {
      "name": "C",
      "species": [
        {
          "element": "C",
          "occu": 1
        }
      ],
      "xyz": [
        0,
        1.40272,
        0
      ],
      "properties": {}
    },
    {
      "name": "H",
      "species": [
        {
          "element": "H",
          "occu": 1
        }
      ],
      "xyz": [
        0,
        2.49029,
        0
      ],
      "properties": {}
    },
    {
      "name": "C",
      "species": [
        {
          "element": "C",
          "occu": 1
        }
      ],
      "xyz": [
        -1.21479,
        0.70136,
        0
      ],
      "properties": {}
    },
    {
      "name": "H",
      "species": [
        {
          "element": "H",
          "occu": 1
        }
      ],
      "xyz": [
        -2.15666,
        1.24515,
        0
      ],
      "properties": {}
    },
    {
      "name": "C",
      "species": [
        {
          "element": "C",
          "occu": 1
        }
      ],
      "xyz": [
        -1.21479,
        -0.70136,
        0
      ],
      "properties": {}
    },
    {
      "name": "H",
      "species": [
        {
          "element": "H",
          "occu": 1
        }
      ],
      "xyz": [
        -2.15666,
        -1.24515,
        0
      ],
      "properties": {}
    },
    {
      "name": "C",
      "species": [
        {
          "element": "C",
          "occu": 1
        }
      ],
      "xyz": [
        0,
        -1.40272,
        0
      ],
      "properties": {}
    },
    {
      "name": "H",
      "species": [
        {
          "element": "H",
          "occu": 1
        }
      ],
      "xyz": [
        0,
        -2.49029,
        0
      ],
      "properties": {}
    },
    {
      "name": "C",
      "species": [
        {
          "element": "C",
          "occu": 1
        }
      ],
      "xyz": [
        1.21479,
        -0.70136,
        0
      ],
      "properties": {}
    },
    {
      "name": "H",
      "species": [
        {
          "element": "H",
          "occu": 1
        }
      ],
      "xyz": [
        2.15666,
        -1.24515,
        0
      ],
      "properties": {}
    },
    {
      "name": "C",
      "species": [
        {
          "element": "C",
          "occu": 1
        }
      ],
      "xyz": [
        1.21479,
        0.70136,
        0
      ],
      "properties": {}
    },
    {
      "name": "H",
      "species": [
        {
          "element": "H",
          "occu": 1
        }
      ],
      "xyz": [
        2.15666,
        1.24515,
        0
      ],
      "properties": {}
    }
  ],
  "name": "benzene"
}

benzene

Carbon
Hydrogen

Drop a JSON file onto the canvas to load a new structure.

Click on an atom to make it active. Then hover another atom to get its distance to the active atom.

Hold shift or cmd or ctrl and drag to pan the scene.

Show



<script>
  import { Structure } from '$lib'
  import { molecules } from '$site'
  import Select from 'svelte-multiselect'

  let name = `benzene`
  $: molecule = molecules.find((struct) => struct.name === name) || {}
</script>

<form>
  <label for="select">Select a molecule:</label>
  <Select
    id="select"
    options={molecules.map((mol) => mol.name)}
    selected={[name]}
    bind:value={name}
    maxSelect={1}
    minSelect={1}
  />

  <details>
    <summary>JSON for molecule {name}</summary>
    <pre>
    <code>
    {JSON.stringify(molecule, null, 2)}
    </code>
  </pre>
  </details>
</form>

<h3 align='center'>{name}</h3>
<Structure structure={molecule} bonding_strategy="max_dist" bonding_options={{max_bond_dist: 2}} />