def test_decimal(self): struct = Structure.from_str( """Mg2 Al4 O8 1.0 5.003532 0.000000 2.888790 1.667844 4.717375 2.888790 0.000000 0.000000 5.777581 O Mg Al 8 2 4 direct 0.736371 0.736371 0.736371 O 0.263629 0.263629 0.709114 O 0.263629 0.709114 0.263629 O 0.709114 0.263629 0.263629 O 0.736371 0.290886 0.736371 O 0.290886 0.736371 0.736371 O 0.263629 0.263629 0.263629 O 0.736371 0.736371 0.290886 O 0.125000 0.125000 0.125000 Mg 0.875000 0.875000 0.875000 Mg 0.500000 0.500000 0.000000 Al 0.500000 0.500000 0.500000 Al 0.000000 0.500000 0.500000 Al 0.500000 0.000000 0.500000 Al""", fmt="poscar", ) bp = BuckinghamPotential(bush_lewis_flag="bush") gio = GulpIO() input = gio.buckingham_input(struct, ["relax conp"]) caller = GulpCaller() gout = caller.run(input)
def test_run(self): mgo_latt = [[4.212, 0, 0], [0, 4.212, 0], [0, 0, 4.212]] mgo_specie = ["Mg"] * 4 + ["O"] * 4 mgo_frac_cord = [ [0, 0, 0], [0.5, 0.5, 0], [0.5, 0, 0.5], [0, 0.5, 0.5], [0.5, 0, 0], [0, 0.5, 0], [0, 0, 0.5], [0.5, 0.5, 0.5], ] mgo_uc = Structure(mgo_latt, mgo_specie, mgo_frac_cord, True, True) gio = GulpIO() gin = gio.keyword_line("optimise", "conp") gin += gio.structure_lines(mgo_uc, symm_flg=False) # gin += self.gc.gulp_lib('catlow.lib') gin += "species\nMg core 2.00000\nO core 0.86902\nO shel -2.86902\n" gin += "buck\n" gin += "Mg core O shel 946.627 0.31813 0.00000 0.0 10.0\n" gin += "O shel O shel 22764.000 0.14900 27.87900 0.0 12.0\n" gin = gin gc = GulpCaller() """Some inherent checks are in the run_gulp function itself. They should be suffcient for raising errors.""" gout = gc.run(gin)
from pymatgen.command_line.gulp_caller import GulpIO from MDAnalysis import Universe gio = GulpIO() gio
def setUp(self): p = Poscar.from_file( os.path.join(PymatgenTest.TEST_FILES_DIR, "POSCAR.Al12O18"), check_for_POTCAR=False ) self.structure = p.structure self.gio = GulpIO()
with zopen(filen, "rt") as f: contents = f.read() energy = Gulp.get_energy(contents) if lave: contents = open(filen, 'r').readlines() for line in contents: if 'Total number atoms/shells' in line: num = int(re.findall('\d+', line)[0]) break else: num = 1 return energy / num if __name__ == '__main__': Gulp = GulpIO() num = int(sys.argv[1]) if num == 1: #write input file of gulp Cry_Str = Structure.from_file("POSCAR") with open('gulpinput', 'w') as f: f.write(Gulp.keyword_line('opti conj conp nosymmetry qok')) f.write(Gulp.keyword_line('switch_min bfgs gnorm 0.5\n')) gulpinput = Gulp.structure_lines(structure=Cry_Str, symm_flg=False) f.write(gulpinput) f.write(Gulp.keyword_line('maxcyc 500')) f.write(Gulp.keyword_line('library self_build.lib')) f.write(Gulp.keyword_line('dump every gulpopt'))
def setUp(self): p = Poscar.from_file(os.path.join(test_dir, 'POSCAR.Al12O18'), check_for_POTCAR=False) self.structure = p.structure self.gio = GulpIO()