-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into xml_writer
- Loading branch information
Showing
19 changed files
with
4,935 additions
and
134 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from lxml import etree | ||
import pdb | ||
root = etree.fromstring(open('oplsaa_with_silica.xml', 'r').read()) | ||
atomtypes = root[0] | ||
bondforce = root[1] | ||
anglforce = root[2] | ||
rbtorsion = root[3] | ||
periodictorsion = root[4] | ||
nonbonded = root[5] | ||
all_atomtypes = [] | ||
for xml_line in atomtypes: | ||
all_atomtypes.append(xml_line.attrib['name']) | ||
|
||
all_atomtypes = set(all_atomtypes) | ||
|
||
# Modify overrides to only include valid overrides | ||
for xml_line in atomtypes: | ||
overrides = xml_line.attrib.get('overrides', '') | ||
overrides_list = overrides.split(',') | ||
remove_overrides = [] | ||
new_overrides = [] | ||
if len(overrides) > 0: | ||
new_overrides = [a for a in overrides_list if a in all_atomtypes] | ||
xml_line.attrib['overrides'] = ','.join(a for a in new_overrides) | ||
|
||
|
||
# Trim rbtorsions | ||
to_remove = [] | ||
for xml_line in rbtorsion: | ||
possible_types = [a for a in xml_line.attrib if 'type' in a] | ||
torsion_types = {val for k, val in xml_line.attrib.items() if 'type' in k} | ||
#torsion_types = {xml_line.attrib['type1'], xml_line.attrib['type2'], | ||
#xml_line.attrib['type3'], xml_line.attrib['type4']} | ||
if not torsion_types.issubset(all_atomtypes): | ||
to_remove.append(xml_line) | ||
for remove_this in to_remove: | ||
rbtorsion.remove(remove_this) | ||
out_string = etree.tostring(root) | ||
with open('output.xml', 'wb') as f: | ||
f.write(out_string) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<ForceField> | ||
<AtomTypes> | ||
<Type name="opls_1001" class="OS" element="O" mass="15.9994" def="[O][Si;%opls_1002]"/> | ||
<Type name="opls_1002" class="SI" element="Si" mass="28.0855" def="[Si]"/> | ||
<Type name="opls_1003" class="OH" element="O" mass="15.9994" def="[O;X2]([Si;%opls_1002])H" overrides="opls_1001"/> | ||
<Type name="opls_1004" class="HO" element="H" mass="1.00800" def="[H;X1](O[Si;%opls_1002])"/> | ||
</AtomTypes> | ||
<HarmonicBondForce> | ||
<Bond class1="SI" class2="OS" length="0.163" k="251040.0"/> | ||
<Bond class1="SI" class2="OH" length="0.163" k="251040.0"/> | ||
<Bond class1="SI" class2="CT" length="0.185" k="167360.0"/> | ||
</HarmonicBondForce> | ||
<HarmonicAngleForce> | ||
<Angle class1="SI" class2="OS" class3="SI" angle="2.7053" k="397.48"/> | ||
<Angle class1="SI" class2="OH" class3="SI" angle="2.7053" k="397.48"/> | ||
<Angle class1="OS" class2="SI" class3="OS" angle="1.9111" k="397.48"/> | ||
<Angle class1="OH" class2="SI" class3="OS" angle="1.9111" k="397.48"/> | ||
<Angle class1="SI" class2="OH" class3="HO" angle="1.9111" k="397.48"/> | ||
<Angle class1="SI" class2="CT" class3="CT" angle="2.0944" k="254.97296"/> | ||
<Angle class1="SI" class2="CT" class3="HC" angle="1.9111" k="418.48"/> | ||
<Angle class1="OH" class2="SI" class3="CT" angle="1.7453" k="502.18"/> | ||
<Angle class1="OH" class2="SI" class3="OH" angle="1.9199" k="502.18"/> | ||
<Angle class1="OS" class2="SI" class3="CT" angle="1.7453" k="502.18"/> | ||
</HarmonicAngleForce> | ||
<RBTorsionForce> | ||
<Proper class1="" class2="SI" class3="OS" class4="" c0="0.0" c1="0.0" c2="0.0" c3="0.0" c4="0.0" c5="0.0"/> | ||
<Proper class1="" class2="SI" class3="OH" class4="" c0="0.0" c1="0.0" c2="0.0" c3="0.0" c4="0.0" c5="0.0"/> | ||
<Proper class1="" class2="SI" class3="CT" class4="" c0="0.0" c1="0.0" c2="0.0" c3="0.0" c4="0.0" c5="0.0"/> | ||
<Proper class1="SI" class2="CT" class3="CT" class4="" c0="0.0" c1="0.0" c2="0.0" c3="0.0" c4="0.0" c5="0.0"/> | ||
</RBTorsionForce> | ||
<NonbondedForce coulomb14scale="0.5" lj14scale="0.5"> | ||
<Atom type="opls_1001" charge="-0.43" sigma="0.3" epsilon="0.71128"/> | ||
<Atom type="opls_1002" charge="0.86" sigma="0.4" epsilon="0.4184"/> | ||
<Atom type="opls_1003" charge="-0.215" sigma="0.3" epsilon="0.71128"/> | ||
<Atom type="opls_1004" charge="0.215" sigma="0.0" epsilon="0.0"/> | ||
</NonbondedForce> | ||
</ForceField> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<ForceField> | ||
<AtomTypes> | ||
<Type name="opls_135" def="[C;X4](H)(H)(H)C" | ||
class="CT" element="C" mass="12.01100" desc="alkane CH3" | ||
doi="10.1021/ja9621760"/> | ||
|
||
<Type name="opls_136" def="[C;X4](H)(H)(C)C" | ||
class="CT" element="C" mass="12.01100" desc="alkane CH2" | ||
doi="10.1021/ja9621760"/> | ||
|
||
<Type name="opls_138" def="[C;X4](H)(H)(H)H" | ||
class="CT" element="C" mass="12.01100" desc="alkane CH4" | ||
doi="10.1021/ja9621760"/> | ||
|
||
<Type name="opls_140" def="H[C;X4]" | ||
class="HC" element="H" mass="1.00800" desc="alkane H" | ||
doi="10.1021/ja9621760"/> | ||
</AtomTypes> | ||
<HarmonicBondForce> | ||
<Bond class1="CT" class2="CT" length="0.1529" k="224262.4"/> | ||
<Bond class1="CT" class2="HC" length="0.1090" k="284512.0"/> | ||
</HarmonicBondForce> | ||
<HarmonicAngleForce> | ||
<Angle class1="CT" class2="CT" class3="CT" angle="1.966986067" k="488.273"/> | ||
<Angle class1="CT" class2="CT" class3="HC" angle="1.932079482" k="313.800"/> | ||
<Angle class1="HC" class2="CT" class3="HC" angle="1.881464934" k="276.144"/> | ||
</HarmonicAngleForce> | ||
<RBTorsionForce> | ||
<Proper class1="CT" class2="CT" class3="CT" class4="CT" c0="2.9288" | ||
c1="-1.4644" c2="0.2092" c3="-1.6736" c4="0.0" c5="0.0"/> | ||
<Proper class1="CT" class2="CT" class3="CT" class4="HC" c0="0.6276" | ||
c1="1.8828" c2="0.0" c3="-2.5104" c4="0.0" c5="0.0"/> | ||
<Proper class1="HC" class2="CT" class3="CT" class4="HC" c0="0.6276" | ||
c1="1.8828" c2="0.0" c3="-2.5104" c4="0.0" c5="0.0"/> | ||
</RBTorsionForce> | ||
<NonbondedForce coulomb14scale="0.5" lj14scale="0.5"> | ||
<Atom type="opls_135" charge="-0.18" sigma="0.35" epsilon="0.276144"/> | ||
<Atom type="opls_136" charge="-0.12" sigma="0.35" epsilon="0.276144"/> | ||
<Atom type="opls_138" charge="-0.24" sigma="0.35" epsilon="0.276144"/> | ||
<Atom type="opls_140" charge="0.06" sigma="0.25" epsilon="0.12552"/> | ||
</NonbondedForce> | ||
</ForceField> |
Oops, something went wrong.