Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def eneyne_ne_qcschemamols():
eneyne = qcel.molparse.to_schema(qcel.molparse.from_string(seneyne)['qm'], dtype=2)
mA = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[:7]))['qm'], dtype=2)
mB = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[-4:]))['qm'], dtype=2)
ne = qcel.molparse.to_schema(qcel.molparse.from_string(sne)['qm'], dtype=2)
mAgB = qcel.molparse.from_string(seneyne)['qm']
mAgB['real'] = [(iat < mAgB['fragment_separators'][0])
for iat in range(len(mAgB['elem']))] # works b/c chgmult doesn't need refiguring
mAgB = qcel.molparse.to_schema(mAgB, dtype=2)
gAmB = qcel.molparse.from_string(seneyne)['qm']
gAmB['real'] = [(iat >= gAmB['fragment_separators'][0]) for iat in range(len(gAmB['elem']))]
gAmB = qcel.molparse.to_schema(gAmB, dtype=2)
mols = {
'eneyne': {
'dimer': eneyne,
'mA': mA,
'mB': mB,
def eneyne_ne_qcschemamols():
eneyne = qcel.molparse.to_schema(qcel.molparse.from_string(seneyne)['qm'], dtype=2)
mA = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[:7]))['qm'], dtype=2)
mB = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[-4:]))['qm'], dtype=2)
ne = qcel.molparse.to_schema(qcel.molparse.from_string(sne)['qm'], dtype=2)
mAgB = qcel.molparse.from_string(seneyne)['qm']
mAgB['real'] = [(iat < mAgB['fragment_separators'][0])
for iat in range(len(mAgB['elem']))] # works b/c chgmult doesn't need refiguring
mAgB = qcel.molparse.to_schema(mAgB, dtype=2)
gAmB = qcel.molparse.from_string(seneyne)['qm']
gAmB['real'] = [(iat >= gAmB['fragment_separators'][0]) for iat in range(len(gAmB['elem']))]
gAmB = qcel.molparse.to_schema(gAmB, dtype=2)
mols = {
'eneyne': {
'dimer': eneyne,
'mA': mA,
'mB': mB,
'mAgB': mAgB,
'gAmB': gAmB,
},
'ne': {
'atom': ne,
}
}
return mols
def eneyne_ne_qcschemamols():
eneyne = qcel.molparse.to_schema(qcel.molparse.from_string(seneyne)['qm'], dtype=2)
mA = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[:7]))['qm'], dtype=2)
mB = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[-4:]))['qm'], dtype=2)
ne = qcel.molparse.to_schema(qcel.molparse.from_string(sne)['qm'], dtype=2)
mAgB = qcel.molparse.from_string(seneyne)['qm']
mAgB['real'] = [(iat < mAgB['fragment_separators'][0])
for iat in range(len(mAgB['elem']))] # works b/c chgmult doesn't need refiguring
mAgB = qcel.molparse.to_schema(mAgB, dtype=2)
gAmB = qcel.molparse.from_string(seneyne)['qm']
gAmB['real'] = [(iat >= gAmB['fragment_separators'][0]) for iat in range(len(gAmB['elem']))]
gAmB = qcel.molparse.to_schema(gAmB, dtype=2)
mols = {
'eneyne': {
'dimer': eneyne,
'mA': mA,
'mB': mB,
'mAgB': mAgB,
def eneyne_ne_qcschemamols():
eneyne = qcel.molparse.to_schema(qcel.molparse.from_string(seneyne)['qm'], dtype=2)
mA = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[:7]))['qm'], dtype=2)
mB = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[-4:]))['qm'], dtype=2)
ne = qcel.molparse.to_schema(qcel.molparse.from_string(sne)['qm'], dtype=2)
mAgB = qcel.molparse.from_string(seneyne)['qm']
mAgB['real'] = [(iat < mAgB['fragment_separators'][0])
for iat in range(len(mAgB['elem']))] # works b/c chgmult doesn't need refiguring
mAgB = qcel.molparse.to_schema(mAgB, dtype=2)
gAmB = qcel.molparse.from_string(seneyne)['qm']
gAmB['real'] = [(iat >= gAmB['fragment_separators'][0]) for iat in range(len(gAmB['elem']))]
gAmB = qcel.molparse.to_schema(gAmB, dtype=2)
mols = {
'eneyne': {
'dimer': eneyne,
'mA': mA,
def eneyne_ne_qcschemamols():
eneyne = qcel.molparse.to_schema(qcel.molparse.from_string(seneyne)['qm'], dtype=2)
mA = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[:7]))['qm'], dtype=2)
mB = qcel.molparse.to_schema(qcel.molparse.from_string('\n'.join(seneyne.splitlines()[-4:]))['qm'], dtype=2)
ne = qcel.molparse.to_schema(qcel.molparse.from_string(sne)['qm'], dtype=2)
mAgB = qcel.molparse.from_string(seneyne)['qm']
mAgB['real'] = [(iat < mAgB['fragment_separators'][0])
for iat in range(len(mAgB['elem']))] # works b/c chgmult doesn't need refiguring
mAgB = qcel.molparse.to_schema(mAgB, dtype=2)
gAmB = qcel.molparse.from_string(seneyne)['qm']
gAmB['real'] = [(iat >= gAmB['fragment_separators'][0]) for iat in range(len(gAmB['elem']))]
gAmB = qcel.molparse.to_schema(gAmB, dtype=2)
mols = {
'eneyne': {
'dimer': eneyne,
'mA': mA,
'mB': mB,
'mAgB': mAgB,
+ r'\s*$', outtext, re.MULTILINE | re.IGNORECASE)
if mobj:
logger.debug('matched geom')
# dinky molecule w/ charge and multiplicity
if mobj.group(1) == 'angstroms':
molxyz = '%d \n%d %d tag\n' % (len(mobj.group(2).splitlines()), out_charge, out_mult
) # unit = angstrom
for line in mobj.group(2).splitlines():
lline = line.split()
molxyz += '%s %16s %16s %16s\n' % (lline[-5], lline[-3], lline[-2], lline[-1])
# Jiyoung was collecting charge (-4)? see if this is ok for ghosts
# Tag , X, Y, Z
psivar_coord = Molecule(validate=False,
**qcel.molparse.to_schema(qcel.molparse.from_string(
molxyz, dtype='xyz+', fix_com=True, fix_orientation=True)["qm"],
dtype=2))
else: # unit = a.u.
molxyz = '%d au\n%d %d tag\n' % (len(mobj.group(2).splitlines()), out_charge, out_mult)
for line in mobj.group(2).splitlines():
lline = line.split()
molxyz += '%s %16s %16s %16s\n' % (int(float(lline[-4])), lline[-3], lline[-2], lline[-1])
# Tag , X, Y, Z
psivar_coord = Molecule(validate=False,
**qcel.molparse.to_schema(qcel.molparse.from_string(
molxyz, dtype='xyz+', fix_com=True, fix_orientation=True)["qm"],
dtype=2))
# Process gradient
mobj = re.search(
**qcel.molparse.to_schema(qcel.molparse.from_string(molxyz,
dtype='xyz+',
fix_com=True,
fix_orientation=True)["qm"],
dtype=2))
mobj = re.search(
r'^\s+' + r'@GETXYZ-I, 1 atoms read from ZMAT.' + r'\s*' +
r'^\s+' + r'[0-9]+\s+([A-Z]+)\s+[0-9]+\s+' + NUMBER + r'\s*',
outtext, re.MULTILINE)
if mobj:
print('matched atom')
# Dinky Molecule
molxyz = '1 bohr\n\n%s 0.0 0.0 0.0\n' % (mobj.group(1))
psivar_coord = Molecule(validate=False,
**qcel.molparse.to_schema(qcel.molparse.from_string(molxyz,
dtype='xyz+',
fix_com=True,
fix_orientation=True)["qm"],
dtype=2))
# Process error codes
mobj = re.search(
r'^\s*' + r'--executable ' + r'(\w+)' + r' finished with status' + r'\s+' + r'([1-9][0-9]*)',
outtext, re.MULTILINE)
if mobj:
print('matched error')
# psivar['CFOUR ERROR CODE'] = mobj.group(2)
if int(mobj.group(2)) != 0:
error += '--executable {} finished with status {}'.format(mobj.group(1), mobj.group(2))
# fmt: on
uno_cutoff=uno_cutoff,
)
ageom, amass, aelem, aelez, _ = solution.align_system(cgeom, cmass, celem, celez, cuniq, reverse=False)
adict = from_arrays(
geom=ageom,
mass=amass,
elem=aelem,
elez=aelez,
units="Bohr",
molecular_charge=concern_mol.molecular_charge,
molecular_multiplicity=concern_mol.molecular_multiplicity,
fix_com=True,
fix_orientation=True,
)
amol = Molecule(validate=False, **to_schema(adict, dtype=2))
# TODO -- can probably do more with fragments in amol now that
# Mol is something with non-contig frags. frags now discarded.
assert compare_values(
concern_mol.nuclear_repulsion_energy(),
amol.nuclear_repulsion_energy(),
"Q: concern_mol-->returned_mol NRE uncorrupted",
atol=1.0e-4,
quiet=(verbose > 1),
)
if mols_align:
assert compare_values(
ref_mol.nuclear_repulsion_energy(),
amol.nuclear_repulsion_energy(),
"Q: concern_mol-->returned_mol NRE matches ref_mol",