def doit(cfgpath, range, count): cfg = QcfpConfig.from_yaml_file(str(cfgpath)) vcfg = VoltageConfig() vcfg.range = range vcfg.count = count vcfg.stark_field_magnitudes = np.linspace(vcfg.range[0], vcfg.range[1], vcfg.count).tolist() with open('voltagecfg.yaml', 'w') as f: vcfg.to_yaml(stream=f) path = str(pathlib.Path(cfgpath).with_suffix('')) for i, m in enumerate(vcfg.stark_field_magnitudes): p = path + '-{:03d}.yaml'.format(i) with open(p, 'w') as f: vec = np.array(cfg.stark_field_vector) vec /= np.linalg.norm(vec) cfg.stark_field_vector = (m * vec).tolist() cfg.to_yaml(stream=f)
def doit(cfgpath, index, range, count): cfg = QcfpConfig.from_yaml_file(str(cfgpath)) if cfg.nsites < index: raise ValueError('index too large for system hamiltonian size') scfg = SitePositionConfig() scfg.range = range scfg.count = count site_energy = cfg.system_hamiltonian[index][index] scfg.site_energies = (site_energy + np.linspace(scfg.range[0], scfg.range[1], scfg.count)).tolist() with open('site_energy_config.yaml', 'w') as f: scfg.to_yaml(stream=f) path = str(pathlib.Path(cfgpath).with_suffix('')) for i, m in enumerate(scfg.site_energies): p = path + '-{:03d}.yaml'.format(i) with open(p, 'w') as f: cfg.system_hamiltonian[i][i] = m cfg.to_yaml(stream=f)
# setup checkpoint TMPDIR = Path(TMPDIR).absolute() SCRATCHDIR = Path(SCRATCHDIR).absolute() OUTPUTDIR = Path(OUTPUTDIR).absolute() #TMPDIR = PurePosixPath('/dev/shm/simulations/17-03-28/') #TMPDIR = PurePosixPath('C:/aloukian-project/17-03-22') #SCRATCHDIR = PurePosixPath('/home/aloukian/simulations/17-03-28/') #SCRATCHDIR = TMPDIR #OUTPUTDIR = SCRATCHDIR print('TMPDIR: ', TMPDIR) print('SCRATCHDIR: ', SCRATCHDIR) print('OUTPUTDIR: ', OUTPUTDIR) metacfg = SimulationCheckpoint() cfg = QcfpConfig() # meta info cfg.simulation_id = 0 cfg.simulation_group = 'Ji-dimer-mu-uncoupled' cfg.simulation_type = 'pump-probe' cfg.simulation_code = 'excitons-2d' #cfg.simulation_type = 'absorption' #cfg.simulation_code = 'excitons-abs' cfg.full_output = False cfg.analytic_orientational_averaging = False cfg.return_axes = False metacfg.tmpdir = str(TMPDIR) metacfg.scratchdir = str(SCRATCHDIR) metacfg.outputdir = str(OUTPUTDIR)
from pyqcfp.runqcfp import QcfpConfig import pathlib import sys path = pathlib.Path(sys.argv[1]) cfg = QcfpConfig.from_yaml_file(str(path)) cfg.simulation_type = 'absorption' cfg.simulation_code = 'excitons-abs' linearpath = str(path.with_suffix('').name + '-linear.yaml') with open(linearpath, 'w') as f: cfg.to_yaml(stream=f)
from pyqcfp.runqcfp import QcfpConfig cfg = QcfpConfig.from_yaml_file('template-cfg.yaml') cfg.simulation_type = 'absorption' cfg.simulation_code = 'excitons-abs' with open('template-cfg.yaml', 'w') as f: cfg.to_yaml(stream=f)