Exemplo n.º 1
0
    def __init__(self, filename):
        """
        Constructor.

        filename -- filename to get info from, either Gaussian (out, g03) or netCDF file (nc)
        """
        self.file = filename
        if os.path.exists(filename):
            ext = filename.split('.')[-1]
            self.complex = filename.split('.')[-2]
            #print ext
            if ext == 'nc':
                self.type = 'nc'
                # read directly from nc to avoid calculation
                #self.data = netCDF(filename,'r')
                self.data = Jacapo.read_atoms(filename)
            elif ext == 'out' or ext == 'g03' or ext == 'log':
                gout = Gaussian(filename)
                gout.logger.setLevel(logging.ERROR)
                self.type = 'gau'
                self.data = gout.parse()
        else:
            raise Exception, 'File is not of identifiable format'
Exemplo n.º 2
0
    mol = 'NH3'
    atoms = Atoms(mol, positions=molecules.data[mol]['positions'])

    sg = SYMMOL(atoms)
    print(sg.get_point_group())
    print(sg.get_moments_of_inertia())
    print(atoms.get_moments_of_inertia())
    print(sg.get_symmetry_operators())

if __name__ == '__main__':
    from ase.calculators.jacapo import Jacapo
    from optparse import OptionParser

    parser = OptionParser(usage='symmol.py ncfile', version='0.1')

    parser.add_option('-f', nargs=0, help='print full output')

    parser.add_option('-o', nargs=1, help='save output in filename')

    options, args = parser.parse_args()

    for ncfile in args:

        sy = SYMMOL(Jacapo.read_atoms(ncfile), outfile=options.o)

        print('Point group = ', sy.get_point_group())
        print('Moments of inertia = ', sy.get_moments_of_inertia())
        print('Symmetry operators = ', sy.get_symmetry_operators())
        if options.f is not None:
            print(sy)
Exemplo n.º 3
0
        cmd = 'bader -p all_atom %s' % (self.densityfile)
        print(cmd)
        os.system(cmd)

    def write_all_bader(self):
        '''
        -p all_bader Write all Bader volumes (containing charge above
        threshold of 0.0001) to a file. The charge distribution in
        each volume is written to a separate file, named
        Bvolxxxx.dat. It will either be of a CHGCAR format or a CUBE
        file format, depending on the format of the initial charge
        density file. These files can be quite large, so this option
        should be used with caution.
        '''
        cmd = 'bader -p all_bader %s' % (self.densityfile)
        print(cmd)
        os.system(cmd)


if __name__ == '__main__':

    from ase.calculators.jacapo import Jacapo

    atoms = Jacapo.read_atoms('ethylene.nc')

    b = Bader(atoms)

    print(b.get_bader_charges())
    print(b.get_bader_volumes())
    b.write_atom_volume([3, 4])
Exemplo n.º 4
0
        return string.join(self.output)

    def get_space_group(self):
        regexp = re.compile('^Space Group')

        for line in self.output:
            if regexp.search(line):
                return line


if __name__ == '__main__':
    from ase.calculators.jacapo import Jacapo
    from optparse import OptionParser

    parser = OptionParser(usage='findsym.py ncfile', version='0.1')

    parser.add_option('-f', nargs=0, help='print full output')

    parser.add_option('-o', nargs=1, help='save output in filename')

    options, args = parser.parse_args()

    for ncfile in args:

        sg = FINDSYM(Jacapo.read_atoms(ncfile), outfile=options.o)

        print(sg.get_space_group())

        if options.f is not None:
            print(sg)
Exemplo n.º 5
0
        '''
        cmd = 'bader -p all_atom %s' % (self.densityfile)
        print cmd
        os.system(cmd)

    def write_all_bader(self):
        '''
        -p all_bader Write all Bader volumes (containing charge above
        threshold of 0.0001) to a file. The charge distribution in
        each volume is written to a separate file, named
        Bvolxxxx.dat. It will either be of a CHGCAR format or a CUBE
        file format, depending on the format of the initial charge
        density file. These files can be quite large, so this option
        should be used with caution.
        '''
        cmd = 'bader -p all_bader %s' % (self.densityfile)
        print cmd
        os.system(cmd)
        
if __name__ == '__main__':

    from ase.calculators.jacapo import Jacapo

    atoms = Jacapo.read_atoms('ethylene.nc')

    b = Bader(atoms)

    print b.get_bader_charges()
    print b.get_bader_volumes()
    b.write_atom_volume([3, 4])
Exemplo n.º 6
0
            index += 5

            symmetry_operators.append(temparray)
            taus.append(array(temptau))

        return symmetry_operators, taus


if __name__ == '__main__':
    from ase.calculators.jacapo import Jacapo
    from optparse import OptionParser

    parser = OptionParser(usage='sgroup.py ncfile', version='0.1')

    parser.add_option('-f', nargs=0, help='print full output')

    parser.add_option('-o', nargs=1, help='save output in filename')

    options, args = parser.parse_args()

    #print options

    for ncfile in args:

        sg = SGROUP(Jacapo.read_atoms(ncfile), outfile=options.o)

        print(sg.get_space_group())

        if options.f is not None:
            print(sg)