예제 #1
0
    def test_POAV_angles(self):
        atoms = \
            generate_atoms(generator_class='SWNTGenerator', n=10, m=0, nz=2)
        # atoms.NNrc = 2.0
        atoms.assign_unique_ids()
        atoms.compute_POAVs()

        for i, atom in enumerate(atoms):
            print('atom{}: {}'.format(atom.id, atom))
            for POAV in ('POAV1', 'POAV2', 'POAVR'):
                if getattr(atom, POAV) is not None:
                    atom_POAV = getattr(atom, POAV)
                    sigma_pi_angles = np.degrees(atom_POAV.sigma_pi_angles)
                    assert_false(np.all(np.isclose(sigma_pi_angles,
                                                   3 * [np.nan],
                                                   equal_nan=True)))
                    print('atom{}.{}.sigma_pi_angles:\n{}'.format(
                        atom.id, POAV, sigma_pi_angles))

                    pyramidalization_angles = \
                        np.degrees(atom_POAV.pyramidalization_angles)
                    print('atom{}.{}.pyramidalization_angles:\n{}'.format(
                        atom.id, POAV, pyramidalization_angles))
                    assert_false(np.all(np.isclose(pyramidalization_angles,
                                                   3 * [np.nan],
                                                   equal_nan=True)))

                    misalignment_angles = \
                        np.degrees(atom_POAV.misalignment_angles)
                    print('atom{}.{}.misalignment_angles:\n{}\n'.format(
                        atom.id, POAV, misalignment_angles))
                    assert_false(np.all(np.isclose(misalignment_angles,
                                                   3 * [np.nan],
                                                   equal_nan=True)))
    def test_POAVs(self):
        atoms = \
            generate_atoms(generator_class='SWNTGenerator', n=5, m=0, nz=5)
        atoms.compute_POAVs()
        atoms.filter(atoms.coordination_numbers == 3)
        atom = atoms[10]
        assert_equals(atom.bonds.Nbonds, 3)
        for POAV in ('POAV1', 'POAV2', 'POAVR'):
            atom_POAV = getattr(atom, POAV)
            assert_is_instance(atom_POAV, getattr(sknano.core.atoms, POAV))

            sigma_pi_angles = np.degrees(atom_POAV.sigma_pi_angles)
            assert_false(
                np.all(
                    np.isclose(sigma_pi_angles, 3 * [np.nan], equal_nan=True)))
            pyramidalization_angles = \
                np.degrees(atom_POAV.pyramidalization_angles)
            assert_false(
                np.all(
                    np.isclose(pyramidalization_angles,
                               3 * [np.nan],
                               equal_nan=True)))
            misalignment_angles = \
                np.degrees(atom_POAV.misalignment_angles)
            assert_false(
                np.all(
                    np.isclose(misalignment_angles,
                               3 * [np.nan],
                               equal_nan=True)))
            print(getattr(atom, POAV))
예제 #3
0
    def test_POAVs(self):
        atoms = \
            generate_atoms(generator_class='SWNTGenerator', n=5, m=0, nz=5)
        atoms.compute_POAVs()
        atoms.filter(atoms.coordination_numbers == 3)
        atom = atoms[10]
        assert_equals(atom.bonds.Nbonds, 3)
        for POAV in ('POAV1', 'POAV2', 'POAVR'):
            atom_POAV = getattr(atom, POAV)
            assert_is_instance(atom_POAV, getattr(sknano.core.atoms, POAV))

            sigma_pi_angles = np.degrees(atom_POAV.sigma_pi_angles)
            assert_false(np.all(np.isclose(sigma_pi_angles, 3 * [np.nan],
                                           equal_nan=True)))
            pyramidalization_angles = \
                np.degrees(atom_POAV.pyramidalization_angles)
            assert_false(np.all(np.isclose(pyramidalization_angles,
                                           3 * [np.nan],
                                           equal_nan=True)))
            misalignment_angles = \
                np.degrees(atom_POAV.misalignment_angles)
            assert_false(np.all(np.isclose(misalignment_angles,
                                           3 * [np.nan],
                                           equal_nan=True)))
            print(getattr(atom, POAV))
 def test_structure_data(self):
     fname = resource_filename('sknano', 'data/nanotubes/1005_5cells.data')
     swnt = SWNTGenerator(n=10, m=5, nz=5)
     swnt_atoms = swnt.atoms
     swnt_atoms.compute_POAVs()
     data = DATAReader(fname)
     atoms = data.atoms
     atoms.compute_POAVs()
     assert_equals(swnt_atoms.Natoms, atoms.Natoms)
예제 #5
0
 def test_structure_data(self):
     fname = resource_filename('sknano', 'data/nanotubes/1005_5cells.data')
     swnt = SWNTGenerator(n=10, m=5, nz=5)
     swnt_atoms = swnt.atoms
     swnt_atoms.compute_POAVs()
     data = DATAReader(fname)
     atoms = data.atoms
     atoms.compute_POAVs()
     assert_equals(swnt_atoms.Natoms, atoms.Natoms)
    def test_atom_bonds(self):
        atoms = \
            generate_atoms(generator_class='SWNTGenerator', n=10, m=5, nz=1)
        atoms.kNN = 3
        atoms.NNrc = 2.0
        atoms.compute_POAVs()
        bonds = atoms.bonds
        assert_equal(len(bonds), atoms.coordination_numbers.sum())
        assert_equal(bonds.Nbonds, atoms.coordination_numbers.sum())

        for i, atom in enumerate(atoms):
            if atom.bonds.Nbonds > 1:
                print('atom.bonds.angles:\n'
                      '{}'.format(np.degrees(atom.bonds.angles)))
                for j, bond in enumerate(atom.bonds):
                    assert_true(np.allclose(bond.vector,
                                            atom.bonds.vectors[j]))
                    assert_equal(bond.length, atom.bonds.lengths[j])
예제 #7
0
    def test_atom_bonds(self):
        atoms = \
            generate_atoms(generator_class='SWNTGenerator', n=10, m=5, nz=1)
        atoms.kNN = 3
        atoms.NNrc = 2.0
        atoms.compute_POAVs()
        bonds = atoms.bonds
        assert_equal(len(bonds), atoms.coordination_numbers.sum())
        assert_equal(bonds.Nbonds, atoms.coordination_numbers.sum())

        for i, atom in enumerate(atoms):
            if atom.bonds.Nbonds > 1:
                print('atom.bonds.angles:\n'
                      '{}'.format(np.degrees(atom.bonds.angles)))
                for j, bond in enumerate(atom.bonds):
                    assert_true(np.allclose(bond.vector,
                                            atom.bonds.vectors[j]))
                    assert_equal(bond.length, atom.bonds.lengths[j])
    def test_POAV_angles(self):
        atoms = \
            generate_atoms(generator_class='SWNTGenerator', n=10, m=0, nz=2)
        # atoms.NNrc = 2.0
        atoms.assign_unique_ids()
        atoms.compute_POAVs()

        for i, atom in enumerate(atoms):
            print('atom{}: {}'.format(atom.id, atom))
            for POAV in ('POAV1', 'POAV2', 'POAVR'):
                if getattr(atom, POAV) is not None:
                    atom_POAV = getattr(atom, POAV)
                    sigma_pi_angles = np.degrees(atom_POAV.sigma_pi_angles)
                    assert_false(
                        np.all(
                            np.isclose(sigma_pi_angles,
                                       3 * [np.nan],
                                       equal_nan=True)))
                    print('atom{}.{}.sigma_pi_angles:\n{}'.format(
                        atom.id, POAV, sigma_pi_angles))

                    pyramidalization_angles = \
                        np.degrees(atom_POAV.pyramidalization_angles)
                    print('atom{}.{}.pyramidalization_angles:\n{}'.format(
                        atom.id, POAV, pyramidalization_angles))
                    assert_false(
                        np.all(
                            np.isclose(pyramidalization_angles,
                                       3 * [np.nan],
                                       equal_nan=True)))

                    misalignment_angles = \
                        np.degrees(atom_POAV.misalignment_angles)
                    print('atom{}.{}.misalignment_angles:\n{}\n'.format(
                        atom.id, POAV, misalignment_angles))
                    assert_false(
                        np.all(
                            np.isclose(misalignment_angles,
                                       3 * [np.nan],
                                       equal_nan=True)))