Skip to content

Commit

Permalink
adding rgy example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCox822 committed Dec 20, 2023
1 parent 2b8a0ea commit d2d7b58
Show file tree
Hide file tree
Showing 7 changed files with 786 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ModifyBaseSimulationScriptTool(BaseTool):
requirement and returns a modified script. """

args_schema = ModifyScriptInput

llm: Optional[BaseLanguageModel]
path_registry: Optional[PathRegistry]

def __init__(self, path_registry: Optional[PathRegistry], llm: BaseLanguageModel):
Expand Down
3 changes: 1 addition & 2 deletions mdagent/tools/maketools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.tools import BaseTool, StructuredTool
from langchain.vectorstores import Chroma
from langchain_experimental.tools import PythonREPLTool
from pydantic import BaseModel, Field

from mdagent.subagents import Iterator, SubAgentSettings
Expand Down Expand Up @@ -68,7 +67,7 @@ def make_all_tools(

if llm:
all_tools += agents.load_tools(["llm-math"], llm)
all_tools += [PythonREPLTool()] # or PythonREPLTool(llm=llm)?
# all_tools += [PythonREPLTool()] # or PythonREPLTool(llm=llm)?
if human:
all_tools += [agents.load_tools(["human"], llm)[0]]

Expand Down
574 changes: 574 additions & 0 deletions notebooks/create_radius_of_gyration.ipynb

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions notebooks/log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#"Step" "Potential Energy (kJ/mole)" "Temperature (K)"
100 -6947.2247032487 215.14497901895803
200 -6606.755809423742 245.3241393007874
300 -6455.50458917632 260.51263456655107
400 -6417.584625724892 270.5266431819455
500 -6387.242479160466 284.2023861024972
600 -6388.191513396453 304.75129960317236
700 -6527.962233533835 312.77642726121877
800 -6580.485359734401 308.49461952430136
900 -6639.961133942442 310.8474107717545
1000 -6738.569551178414 311.32317014735116
100 -6763.010282594562 308.34238602524323
200 -6864.593446104183 297.14596179605235
300 -6994.262937386531 301.6155468915757
400 -6935.3252492052625 302.840190711954
500 -6884.12007129439 308.5139534209478
600 -6823.701590637071 294.57380936407344
700 -7098.962557341907 309.49755996420396
800 -7051.7452111275 322.37169817500165
900 -6978.0344834561865 314.9502828703213
1000 -7056.721987246631 303.968134836879
1100 -7046.6999714784815 306.0755016850859
1200 -7048.322404235125 305.6905864146254
1300 -7268.2398016023835 297.76124633020316
1400 -7142.712178509726 302.5973284852797
1500 -7074.607665958954 304.7594080228363
1600 -7054.775157890861 306.2956050961427
1700 -7302.195431149743 314.77506377149166
1800 -7077.27914964579 295.2082987290798
1900 -7245.591044039093 296.544622044704
2000 -7212.115861307699 319.23831684768015
2100 -7106.951554771362 309.73032179563535
2200 -7228.607015852927 319.90152415467907
2300 -7143.259374447855 313.9650423015229
2400 -7090.197770676733 300.68065743983993
2500 -7143.99685820832 295.2536934381932
2600 -7098.832476661368 300.0048777407126
2700 -7268.647665059764 298.826501443611
2800 -7336.104454383806 294.3819777240061
2900 -7336.591976045821 307.74503069963805
3000 -7057.30711976404 293.5014579323123
3100 -7213.7130508119935 309.9046472913062
3200 -7133.936614433825 300.28469131884924
3300 -7313.628574393655 308.0010973022024
3400 -7288.408543498386 294.99061245573716
3500 -7304.36953833251 310.5039921062637
3600 -7345.088882165166 305.5070448590426
3700 -7403.013975376743 302.30178732665496
3800 -7512.509225099482 298.0299395624267
3900 -7525.509296441533 297.133701097967
4000 -7442.256195117707 287.8468724980225
4100 -7484.523602742913 290.17220749793483
4200 -7427.595767154028 297.6072402367254
4300 -7442.285244593137 297.949922225918
4400 -7646.080315335545 303.5556593818187
4500 -7509.217638774311 295.1847760307521
4600 -7588.969875899482 304.89273307268104
4700 -7593.136272293861 314.3357662335734
4800 -7408.754119323856 299.4101954654273
4900 -7518.519963034358 308.4406384054823
5000 -7335.847583024362 297.9900941455528
5100 -7343.644451228044 299.6446536189008
5200 -7463.402653954167 301.29974167930163
5300 -7315.594154268405 302.884395290947
5400 -7479.829920624285 312.9141326975404
5500 -7421.622820649305 294.94611914342613
5600 -7331.638008310608 312.5316794090319
5700 -7503.422662571294 299.9222304814086
5800 -7407.9934910453585 302.7387451361232
5900 -7434.610959625382 307.05171580365544
6000 -7635.108450163959 311.4037619992867
6100 -7560.147899779708 313.1264421995106
6200 -7395.727234281008 299.92308568439176
6300 -7456.229042733998 313.9068496278615
6400 -7499.692522152247 312.73399827946355
6500 -7396.250204244039 309.6537941646525
6600 -7479.857365188253 303.5751917374244
6700 -7509.906941008841 305.6478411694014
6800 -7532.351882028655 300.5579748382905
6900 -7494.858360312032 308.49406582763913
7000 -7668.005793912738 313.47348679905707
7100 -7513.358410033883 305.38889505182146
7200 -7547.72842265137 298.75230254494153
7300 -7550.496783298053 293.1341975953963
7400 -7471.110704957506 296.01806695990757
7500 -7306.0955198705815 296.76211917341044
7600 -7456.7088101530335 314.00429120219945
7700 -7451.0343175692 307.96915807036993
7800 -7503.60657165548 312.0347806234592
7900 -7470.824045148967 303.6361298742164
8000 -7555.068396550282 302.9276076921207
8100 -7610.5951014659 295.6803480784775
8200 -7674.049061292562 299.0771096466942
8300 -7460.8241791704095 296.7879063419885
8400 -7526.390876454641 293.55941336014234
8500 -7512.653204235832 302.3546395658116
8600 -7499.334945839408 293.8962556388488
8700 -7624.077188836976 294.0369602357294
8800 -7589.509712028355 280.0209964060526
8900 -7564.679421422048 293.07969824131726
9000 -7527.198853002337 292.2184929509117
9100 -7600.598122097535 305.5898863653994
9200 -7600.935021774027 308.0925393412393
9300 -7662.005988771483 301.1850411356524
9400 -7593.028662043358 294.9501713882646
9500 -7476.491493208251 296.21756803567155
9600 -7695.3925753276 310.4407903303529
9700 -7641.082924787625 307.1439616533547
9800 -7572.797165494741 291.74075129818596
9900 -7489.361064130782 291.1752541137238
10000 -7548.086623141088 288.4769029339633
19 changes: 19 additions & 0 deletions notebooks/radius_of_gyration.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[1.50767929 1.50682119 1.50068744 1.4941606 1.48222915 1.47337426
1.46404147 1.46070665 1.45946214 1.46320232 1.46158771 1.4667646
1.46855866 1.46025191 1.45444605 1.4486515 1.44307955 1.44337105
1.44779935 1.45570087 1.46238626 1.45914084 1.45751507 1.46000107
1.45722055 1.45690918 1.46324583 1.46327771 1.46135877 1.46398437
1.45960216 1.45687341 1.44958755 1.44901427 1.44655509 1.44219043
1.44038892 1.43712164 1.43932839 1.43726949 1.42746745 1.42639579
1.42101927 1.42325591 1.43352625 1.4339341 1.42705837 1.42664298
1.42637167 1.4223091 1.42854714 1.43482307 1.44154946 1.44525946
1.44147111 1.4423343 1.44247447 1.44444753 1.44005083 1.43315945
1.42947646 1.42474755 1.42775308 1.42855768 1.42934235 1.43771966
1.44039219 1.43247868 1.42939829 1.43404689 1.4340275 1.43823166
1.44255801 1.44040663 1.44563689 1.44141945 1.43733975 1.43698322
1.43267958 1.43943851 1.45250143 1.46383664 1.45774152 1.44849624
1.44803498 1.44447058 1.44255154 1.44416815 1.44473221 1.44208753
1.44139582 1.44445096 1.44170214 1.44497769 1.44309719 1.44453544
1.44245933 1.43739164 1.43132974 1.43106005 1.43755989 1.43798897
1.43229375 1.43462052 1.43297028 1.43080176 1.43166855 1.42949051
1.43134256 1.42874934]
80 changes: 80 additions & 0 deletions notebooks/reproduce_simulation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This script was generated by MDagent-Setup.

from openmm import *
from openmm.app import *
from openmm.unit import *

# Input Files
pdb = PDBFile("cleaned_fibronectin.pdb")
forcefield = ForceField("amber14-all.xml", "amber14/tip3p.xml")

# System Configuration
nonbondedMethod = NoCutoff
constraints = AllBonds
rigidWater = True
constraintTolerance = 1e-05

# Integration Options
dt = 0.004 * picosecond
temperature = 300 * kelvin
friction = 1.0 / picosecond

# Simulation Options
steps = 10000
equilibrationSteps = 1000
platform = Platform.getPlatformByName("CPU")
dcdReporter = DCDReporter("trajectory.dcd", 10000)
dataReporter = StateDataReporter(
"log.txt",
100,
totalSteps=steps,
step=True,
speed=True,
progress=True,
elapsedTime=True,
remainingTime=True,
potentialEnergy=True,
temperature=True,
volume=True,
density=True,
separator=" ",
)
checkpointReporter = CheckpointReporter("checkpoint.chk", 10000)

# Minimize and Equilibrate
# ... code for minimization and equilibration ...

# Simulate

print("Building system...")
topology = pdb.topology
positions = pdb.positions

system = forcefield.createSystem(
topology,
nonbondedMethod=nonbondedMethod,
constraints=constraints,
rigidWater=rigidWater,
)

integrator = LangevinMiddleIntegrator(temperature, friction, dt)
integrator.setConstraintTolerance(constraintTolerance)
simulation = Simulation(topology, system, integrator, platform)
simulation.context.setPositions(positions)

# Minimize and Equilibrate

print("Performing energy minimization...")
simulation.minimizeEnergy()
print("Equilibrating...")
simulation.context.setVelocitiesToTemperature(temperature)
simulation.step(equilibrationSteps)

# Simulate

print("Simulating...")
simulation.reporters.append(dcdReporter)
simulation.reporters.append(dataReporter)
simulation.reporters.append(checkpointReporter)
simulation.currentStep = 0
simulation.step(steps)
Binary file added notebooks/trajectory.dcd
Binary file not shown.

0 comments on commit d2d7b58

Please sign in to comment.