def write_input(self, atoms, properties=None, system_changes=None): FileIOCalculator.write_input(self, atoms, properties, system_changes) p = self.parameters p.write(self.label + '.ase') p['label'] = self.label if self.pcpot: # also write point charge file and add things to input p['pcpot'] = self.pcpot write_orca(atoms, **p)
def write_input(self, atoms, properties=None, system_changes=None): FileIOCalculator.write_input(self, atoms, properties, system_changes) p = self.parameters p.initial_magmoms = atoms.get_initial_magnetic_moments().tolist() p.write(self.label + '.ase') del p['initial_magmoms'] f = open(self.label + '.inp', 'w') #FUDO| we'll construct a simple input line by default and everything special should be supplied under 'raw' input contrl_temp = '! %s %s' contrl = contrl_temp % (p.wfn, p.basis) cnadd = '' if p.xc is not 'HF': cnadd += ' %s' % p.xc contrl += cnadd contrl += '\n' if p.task == 'gradient': contrl += '!EnGrad\n' if 'mult' not in p: # Obtain multiplicity from magnetic momenta: tot_magmom = atoms.get_initial_magnetic_moments().sum() if tot_magmom < 0: mult = tot_magmom - 1 # fill minority bands else: mult = tot_magmom + 1 else: mult = p.mult f.write(contrl) if 'raw' in p: f.write(p.raw) #FUDO| assuming a neutral system if p.charge is not None: charge = p.charge else: charge = 0 write_orca(f, atoms, charge, mult) #-------orca also can use ECPs in principle, but I don't know how... #-------old NWChem input generation---------# #if p.ecp is not None: # basis += format_basis_set(p.ecp, 'ecp') #if p.so is not None: # basis += format_basis_set(p.so, 'so') #f.write(basis) ### for key in p.convergence: ### if p.convergence[key] is not None: ### if key == 'lshift': ### if p.convergence[key] <= 0.0: ### f.write(' convergence nolevelshifting\n') ### else: ### f.write(' convergence %s %s\n' % ### (key, p.convergence[key] / Hartree)) ### else: ### f.write(' convergence %s %s\n' % ### (key, p.convergence[key])) ### if p.smearing is not None: ### assert p.smearing[0].lower() == 'gaussian', p.smearing ### f.write(' smear %s\n' % (p.smearing[1] / Hartree)) ### ### if p.odft: ### f.write(' odft\n') # open shell aka spin polarized dft ### for key in sorted(p.keys()): ### if key in ['charge', 'geometry', 'basis', 'basispar', 'ecp', ### 'so', 'xc', 'spinorbit', 'convergence', 'smearing', ####FU| needed to add a key exception for bq, and charges... ### 'raw', 'mult', 'task', 'odft', 'bq', 'charges']: ####FU| ### continue ### f.write(u" {0} {1}\n".format(key, p[key])) ### f.write('end\n') #FU| for now we will implement external charges within the FFDATA/QUANPOL module, just without any parameters but charges defined if p.bq is not None: f.write('%%pointcharges "%s"' % (self.label + '.bq')) bqf = open(self.label + '.bq', 'w') bqf.write('%i\n' % len(p.bq)) for q in p.bq: bqf.write('%12.8f %12.8f %12.8f %12.8f\n' % (q[3], q[0], q[1], q[2])) #FU| careful in earlier NWChems this might be the wrong order: #FU| maybe it's better to put this into the raw input if p.charges is not None: if p.charges.find('ESP') > -1: print 'ESP or RESP charges not implemented for orca calculator' sys.exit(1) #FU| Mulliken and Lowdin charges are printed out by default #FU| and RESP is not implemented directly into orca, one would need an external program for that #FUDO| check, (R)ESP fits might actually be implemented into orca f.close()
def write_input(self, atoms, properties=None, system_changes=None): FileIOCalculator.write_input(self, atoms, properties, system_changes) p = self.parameters p.initial_magmoms = atoms.get_initial_magnetic_moments().tolist() p.write(self.label + '.ase') del p['initial_magmoms'] f = open(self.label + '.inp', 'w') #FUDO| we'll construct a simple input line by default and everything special should be supplied under 'raw' input contrl_temp = '! %s %s' contrl = contrl_temp %(p.wfn, p.basis) cnadd = '' if p.xc is not 'HF': cnadd += ' %s' %p.xc contrl += cnadd contrl += '\n' if p.task == 'gradient': contrl += '!EnGrad\n' if 'mult' not in p: # Obtain multiplicity from magnetic momenta: tot_magmom = atoms.get_initial_magnetic_moments().sum() if tot_magmom < 0: mult = tot_magmom - 1 # fill minority bands else: mult = tot_magmom + 1 else: mult = p.mult f.write(contrl) if 'raw' in p: f.write(p.raw) #FUDO| assuming a neutral system if p.charge is not None: charge = p.charge else: charge = 0 write_orca(f, atoms, charge, mult) #-------orca also can use ECPs in principle, but I don't know how... #-------old NWChem input generation---------# #if p.ecp is not None: # basis += format_basis_set(p.ecp, 'ecp') #if p.so is not None: # basis += format_basis_set(p.so, 'so') #f.write(basis) ### for key in p.convergence: ### if p.convergence[key] is not None: ### if key == 'lshift': ### if p.convergence[key] <= 0.0: ### f.write(' convergence nolevelshifting\n') ### else: ### f.write(' convergence %s %s\n' % ### (key, p.convergence[key] / Hartree)) ### else: ### f.write(' convergence %s %s\n' % ### (key, p.convergence[key])) ### if p.smearing is not None: ### assert p.smearing[0].lower() == 'gaussian', p.smearing ### f.write(' smear %s\n' % (p.smearing[1] / Hartree)) ### ### if p.odft: ### f.write(' odft\n') # open shell aka spin polarized dft ### for key in sorted(p.keys()): ### if key in ['charge', 'geometry', 'basis', 'basispar', 'ecp', ### 'so', 'xc', 'spinorbit', 'convergence', 'smearing', ####FU| needed to add a key exception for bq, and charges... ### 'raw', 'mult', 'task', 'odft', 'bq', 'charges']: ####FU| ### continue ### f.write(u" {0} {1}\n".format(key, p[key])) ### f.write('end\n') #FU| for now we will implement external charges within the FFDATA/QUANPOL module, just without any parameters but charges defined if p.bq is not None: f.write('%%pointcharges "%s"' %(self.label + '.bq')) bqf = open(self.label + '.bq', 'w') bqf.write('%i\n' %len(p.bq)) for q in p.bq: bqf.write('%12.8f %12.8f %12.8f %12.8f\n' %(q[3], q[0], q[1], q[2])) #FU| careful in earlier NWChems this might be the wrong order: #FU| maybe it's better to put this into the raw input if p.charges is not None: if p.charges.find('ESP') > -1: print 'ESP or RESP charges not implemented for orca calculator' sys.exit ( 1 ) #FU| Mulliken and Lowdin charges are printed out by default #FU| and RESP is not implemented directly into orca, one would need an external program for that #FUDO| check, (R)ESP fits might actually be implemented into orca f.close()