How to use the pyscal.crystal_structures function in pyscal

To help you get started, we’ve selected a few pyscal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github srmnitc / pyscal / tests / test_q12.py View on Github external
def test_q_12():
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [4, 4, 4])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    sys.find_neighbors(method = 'voronoi')

    sys.calculate_q(12, averaged=True)
    q = sys.get_qvals(12, averaged=True)
    assert np.round(np.mean(np.array(q)), decimals=2) == 0.38
github srmnitc / pyscal / tests / test_nucsize.py View on Github external
def test_system_nucsize_fraction():
    #create some atoms
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [2, 2, 2])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    #test that atoms are set properly
    assert len(sys.atoms) == 16

    #now calculate nucsize
    sys.find_neighbors(method='cutoff', cutoff=3.63)
    assert 16 == sys.find_solids(bonds=0.8, threshold=0.5, avgthreshold=0.6, cluster=True)
github srmnitc / pyscal / tests / test_basic_system.py View on Github external
def test_system_atom_access():
    #create some atoms
    atoms, boxdims = pcs.make_crystal('bcc')
    sys = pc.System()
    sys.box = boxdims
    sys.atoms = atoms

    #fetch an atom
    xoxo = sys.get_atom(0)
    assert xoxo.pos == [0, 0, 0]

    #change pos pf ayom
    xoxo.pos = [1.1, 2.1, 3.1]
    sys.set_atom(xoxo)

    atom = sys.get_atom(0)
    assert atom.pos == [1.1, 2.1, 3.1]
    #sys.atoms = atoms
github srmnitc / pyscal / tests / test_chiparams.py View on Github external
def test_chiparamshcp():
    atoms, box = pcs.make_crystal('hcp', repetitions=[3,3,3], lattice_constant=4)
    sys = pc.System()
    sys.atoms = atoms
    sys.box = box
    sys.find_neighbors(method='cutoff', cutoff=0)
    sys.calculate_chiparams()
    atoms = sys.atoms
    chip = atoms[2].chiparams
    assert chip ==  [3, 0, 6, 0, 21, 12, 0, 24, 0]
github srmnitc / pyscal / tests / test_pickling.py View on Github external
def test_pickle_system():

    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [1, 1, 1])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims
    sys.find_neighbors(method = 'voronoi')

    #test write and read system
    sys.to_pickle('tests/sy.npy')

    #now read the pickled system
    psys = pc.System()
    psys.from_pickle('tests/sy.npy')

    #now get atoms and a random number of atom
    satoms = sys.atoms
    patoms = psys.atoms
github srmnitc / pyscal / tests / test_adaptive.py View on Github external
def test_neighbors_adaptive():
    #create some atoms
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [6, 6, 6])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    #then lets find neighbors
    #SANN algo test
    sys.find_neighbors(method = 'cutoff', cutoff='adaptive')
    #any atom should have 8 neighbors
    atoms = sys.atoms
    assert atoms[0].coordination == 14
github srmnitc / pyscal / tests / test_neighbors.py View on Github external
def test_neighbors_system():
    #create some atoms
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [6, 6, 6])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    #test that atoms are set properly
    assert len(sys.atoms) == 432

    #then lets find neighbors
    #cutoff method - first shell only
    sys.find_neighbors(method = 'cutoff', cutoff=0.867)
    #any atom should have 8 neighbors
    atoms = sys.atoms
    assert atoms[0].coordination == 8

    sys.reset_neighbors()
github srmnitc / pyscal / tests / test_adaptive.py View on Github external
def test_neighbors_sann():
    #create some atoms
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [6, 6, 6])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims


    #then lets find neighbors
    #SANN algo test
    sys.find_neighbors(method = 'cutoff', cutoff='sann')
    #any atom should have 8 neighbors
    atoms = sys.atoms
    assert atoms[0].coordination == 14

    sys.find_neighbors(method = 'cutoff', cutoff='sann', threshold=1)
    #any atom should have 8 neighbors
    atoms = sys.atoms
    assert atoms[0].coordination == 14
github srmnitc / pyscal / tests / test_q6.py View on Github external
def test_q_6():
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [4, 4, 4])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    sys.find_neighbors(method = 'voronoi')

    sys.calculate_q(6, averaged=True)
    q = sys.get_qvals(6, averaged=True)
    assert np.round(np.mean(np.array(q)), decimals=2) == 0.57
github srmnitc / pyscal / tests / test_voronoi.py View on Github external
def test_voro_props():
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [2, 2, 2])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims


    sys.find_neighbors(method = 'voronoi')
    sys.calculate_vorovector()
    atoms = sys.atoms
    atom = atoms[0]
    v = atom.vorovector
    assert v == [0,6,0,8]