Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening pull request #64

Open
wants to merge 144 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
feb7dae
Fix to polarization correction
Jan 23, 2014
ce56a7a
Merge branch 'master' of github.com:leeping/forcebalance
Jan 28, 2014
7322bbc
Merge branch 'master' of https://github.com/leeping/forcebalance
Feb 11, 2014
bc3a415
Begin adding interface for RP contraction
Feb 11, 2014
17ebcd3
Added RPMD kinetic energy calculation
Mar 19, 2014
8eb02fa
Merge branch 'master' of github.com:leeping/forcebalance
Mar 19, 2014
c5ce8b5
test commit
Mar 19, 2014
4186cab
Test
Mar 19, 2014
98b2a15
TEST
Mar 19, 2014
7adaafe
test1
Mar 19, 2014
b0a74f9
CustomBondForce
Mar 20, 2014
ce5c264
CustomBondForce(error in getPerBondParameterName)
Mar 20, 2014
bee0c4d
CustomBondForce(working version)
Mar 22, 2014
d2a1c65
RPMD input should be list of integer not number
Mar 23, 2014
4e15d71
Energy estimator
Mar 26, 2014
a1a1970
Merge branch 'master' of github.com:leeping/forcebalance
Mar 26, 2014
9b3524d
Merge branch 'master' of github.com:leeping/forcebalance
Mar 26, 2014
d2abf50
Update rpmd energy estimating(centroid instead of primitive energy es…
Mar 26, 2014
16939e4
Centroid Energy Estimator
Mar 27, 2014
0ed58f5
test setposition
Apr 2, 2014
1c55582
RPMD set_position (test)
Apr 4, 2014
c8524e4
Undo get multipole function
Apr 5, 2014
5ffd3fb
update energy estimator
Apr 7, 2014
5f55c7e
Implement Potential and Kinetic energy calculators for RPMD simulatio…
Apr 9, 2014
83817f3
Replace code that calculate quantum kinetic energy by function
Apr 9, 2014
fc50a07
Fix a few RPMD related bug
Apr 9, 2014
f1a5cde
Adding centroid position calculator
Apr 9, 2014
9cdf137
Change nothing, just test
Apr 9, 2014
8b69702
Fix some minor(but important!) bug.
Apr 9, 2014
520ede4
Try again.
Apr 9, 2014
8a7d23d
RPMD Virtual Site
Apr 10, 2014
96bea44
change nothing
Apr 10, 2014
67b6c75
fix syntax error
Apr 10, 2014
b826b1d
Use centroid KE to calculate KE in RPMD
Apr 10, 2014
cc9abba
Edit the fractionation ratio energy function
May 5, 2014
9a89502
edit HD
May 5, 2014
5a427d9
":"
May 5, 2014
0994408
undo last step
May 5, 2014
a80f321
undo
May 6, 2014
75091d0
Merge branch 'master' of https://github.com/frankmenglin/forcebalance
JNapoli May 14, 2014
dbb1048
Fix some verbose inline comments. Mainly testing commit/push. No subs…
JNapoli May 16, 2014
3843e6f
Change rpmd_beads to rpmd_opts for clarity.
JNapoli May 16, 2014
38a51e5
Add support for storing and setting positions for RPMD simulation.
JNapoli May 18, 2014
ad92387
Revise code for setting virtual sites in RPMD images.
JNapoli May 18, 2014
8c6f9f7
Incorporate modifications suggested by Lee-Ping. Remove redundancies.
JNapoli May 19, 2014
c845d54
Begin adding RPMD test files.
JNapoli May 19, 2014
5d0d482
Updated cctools version
May 28, 2014
e27a0b4
Merge branch 'master' of github.com:leeping/forcebalance
May 28, 2014
086cdb3
Merge branch 'master' of github.com:leeping/forcebalance
Jun 2, 2014
cdd7db3
Fixed some stuff.
JNapoli Jun 2, 2014
14525c0
Merge branch 'master' of github.com:JNapoli/forcebalance
JNapoli Jun 2, 2014
6d64e37
Add code to average dipole values over all copies of an RPMD system.
JNapoli Jun 3, 2014
02ae762
Commit cctools changes.
Jun 4, 2014
dcc07e1
Fix merge conflict.
Jun 4, 2014
fb96293
Enable use of PDB file for coordinates.
JNapoli Jun 9, 2014
fd1c159
Merge branch 'master' of github.com:JNapoli/forcebalance
JNapoli Jun 9, 2014
ee369ff
Begin validation script for RPMD functionality. Modify openmmio.py to…
JNapoli Jun 22, 2014
1c7d768
Remove unnecessary code in test script. Add directory containing qtip…
JNapoli Jun 22, 2014
672e454
Begin fix for constraint modification code.
JNapoli Jun 25, 2014
945bc15
Typo fix
JNapoli Jun 25, 2014
7e59ed2
Fix method call syntax. Whoops.
JNapoli Jun 25, 2014
f075620
Clean up update_simulation() and constraint checking.
JNapoli Jun 25, 2014
dfe462f
Remove stray print statement.
JNapoli Jun 25, 2014
cb61a7d
Revise RPMD unit test.
Jun 26, 2014
4ed220c
Revise xyz_rpmd data structure; add RPMD functionality to evaluate_()…
JNapoli Jun 26, 2014
6fe3b13
Undo get_dipole() modification and put that functionality in evaluate…
JNapoli Jun 26, 2014
6815c71
Fix get_forces() bug.
JNapoli Jun 26, 2014
9ae4e58
We had been assuming non-empty parameter vectors; fixed now?
JNapoli Jun 26, 2014
4264b20
Merge branch 'master' of github.com:leeping/forcebalance
JNapoli Jun 26, 2014
1585e93
Shorten test case
JNapoli Jun 26, 2014
efa1c88
Fixes for unit test
JNapoli Jun 26, 2014
bd5505e
Updated OpenMM on Jenkins
JNapoli Jun 26, 2014
386c334
Remove verbosity option in unit test.
JNapoli Jun 27, 2014
a8e8b00
Clean and delete unnecessary lines.
JNapoli Jun 27, 2014
b303fb0
Fix setting of virtural sites and postprocessing of dipoles.
JNapoli Jun 27, 2014
4089816
Add dipole test to test_rpmd.py
JNapoli Jun 28, 2014
662f571
Fix indentation issue in rpmd_dips().
JNapoli Jun 28, 2014
f158ce0
Test new centroid virial estimator.
JNapoli Jul 7, 2014
def4160
Try setting positions a different way.
Jul 8, 2014
6bb8f1b
Add functions to test first terms in energy estimators.
JNapoli Jul 10, 2014
fb49a1a
Another test.
JNapoli Jul 10, 2014
e488793
Add functions to calculate Cv for NVT simulation.
JNapoli Jul 31, 2014
7363513
Merge branch 'master' of github.com:leeping/forcebalance
JNapoli Sep 18, 2014
a832a52
Update energy estimators to latest version. Clean up functions that w…
JNapoli Sep 18, 2014
23b379b
Commit most recent changes for pull to ICME.
JNapoli Sep 18, 2014
923a54b
Incorporate calculation of Cp analytic derivative for RPMD.
JNapoli Oct 13, 2014
382f540
Revert to original version of rpmd unit test
JNapoli Oct 14, 2014
0df398f
Push changes for pull on ICME
JNapoli Oct 23, 2014
4e5e28d
Merge branch 'master' of https://github.com/chenchens/forcebalance
JNapoli Oct 24, 2014
c0b0d6e
Merge branch 'master' of https://github.com/chenchens/forcebalance
Oct 24, 2014
cc8257f
Merge leeping master
Oct 30, 2014
abfed09
Clean up old changes
Nov 2, 2014
3a5b281
Merge branch 'master' of github.com:JNapoli/forcebalance
JNapoli Nov 2, 2014
b1be9a8
Add CopyCustomBondedParameters to use with qtip4pf
JNapoli Nov 5, 2014
8aad83e
Oops
JNapoli Nov 8, 2014
77d227d
Add code for centroid virial gradient.
JNapoli Nov 12, 2014
8edf122
Revise rpmd gradient method.
JNapoli Nov 12, 2014
d053eb5
Revise postprocessing and gradient calculations for RPMD
JNapoli Nov 16, 2014
077f223
Push for pull to ICME
JNapoli Jan 19, 2015
7e0fe67
Fix thermal expansion
JNapoli Jan 24, 2015
73992c1
Fix variable name error
JNapoli Jan 24, 2015
34c03a3
Standardize control flow. Fix RPMDH bug.
JNapoli Jan 26, 2015
d1b3dfc
Standardize control flow for PIMD.
JNapoli Feb 3, 2015
66de576
Incorporate RPMD specific gradients into liquid.py
JNapoli Feb 11, 2015
b0a2930
Add RPMD gradients to liquid.py
JNapoli Feb 12, 2015
a41b978
Finish incorporating derivatives into liquid.py
JNapoli Feb 12, 2015
202744b
Minor change to read() method.
JNapoli Feb 12, 2015
c1aa04b
Make npt_result pickle more general
JNapoli Feb 12, 2015
761c324
Fix variable swap in npt_result pickle
JNapoli Feb 13, 2015
dde2457
Change the way the heat capacity correction is calculated. Reflect th…
JNapoli Feb 16, 2015
fe570cb
Add code for fitting total energy w/ centroid virial QKE. This tests …
JNapoli Feb 21, 2015
20e7a19
Make sure parser doesn't break.
JNapoli Feb 21, 2015
a12460a
Whoops
JNapoli Feb 24, 2015
910e57a
Fix reference before assignment
JNapoli Feb 24, 2015
b9e37f0
Remove centroid virial quantum kinetic energy liquid target. Enable c…
JNapoli Feb 28, 2015
840854a
Use RPMDMonteCarloBarostat for PIMD simulations.
JNapoli Feb 28, 2015
60bf570
Fix division error and setting of n_mcbarostat.
JNapoli Feb 28, 2015
b16ab3f
Replace H in alpha grad with RPMDH
JNapoli Mar 14, 2015
57bb5ea
CUDA platform is much faster for PIMD gas phase simulation
JNapoli Mar 25, 2015
5737550
Change nonbonded parameters
JNapoli Apr 16, 2015
6b1a1e1
Ensure that defaults make it in
JNapoli Apr 16, 2015
6c7f278
Add pbc condition to setting of nonbonded cutoffs
JNapoli Apr 17, 2015
82f5984
Add code to save centroids and only store one system copy.
JNapoli May 1, 2015
cf37183
Fix a reference before assignment and nonbonded method in preparation…
JNapoli Jul 7, 2015
dbbc01c
Write AbInitio_LAMMPS target
JNapoli Aug 26, 2015
5ff6873
Some small bug fixes
JNapoli Aug 27, 2015
96e7cfe
Lammps branch is up to date
JNapoli Oct 19, 2015
a39108c
Add logic for only using one bead in postprocessing
JNapoli Oct 19, 2015
770e7e5
Device number change for testing
JNapoli Oct 19, 2015
879d145
get_V function now returns forces if requested
JNapoli Oct 27, 2015
bff0326
Merge branch 'lammps'
JNapoli Nov 9, 2015
8c1ed5b
Use reference for gas phase simulation on xstream for now
Nov 16, 2015
4eef879
Debug statement for CUDA device
Nov 16, 2015
f8e6a0b
Remove duplicate calculation of centroids. Other minor edits
Nov 17, 2015
2022690
Merge branch 'master' of github.com:JNapoli/forcebalance
JNapoli Nov 17, 2015
a961a05
Redo PIMD estimators and write custom reporter for PIMD.
JNapoli Nov 21, 2015
d2ab2b2
Merge branch 'master' of github.com:JNapoli/forcebalance
JNapoli Nov 21, 2015
82c298a
Delete simulation objects explicitly. Otherwise they crash on Xstream.
JNapoli Nov 26, 2015
eca7a6e
Hopefully can use CUDA platform for both simulations now.
JNapoli Nov 26, 2015
7447ff5
Fix small bugs
JNapoli Nov 27, 2015
6ad026b
Merge branch 'master' of github.com:JNapoli/forcebalance
JNapoli Nov 27, 2015
68df6ff
Merge leeping master
JNapoli Dec 2, 2015
1bd6a55
Replace molecular_dynamics method with original method. All PIMD code…
JNapoli Dec 2, 2015
95505ac
Refactor lammpsio calculation of energy series
JNapoli Dec 21, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/abinitio.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def __init__(self,options,tgt_opts,forcefield):
#======================================#
# Options that are given by the parser #
#======================================#

## Number of snapshots
self.set_option(tgt_opts,'shots','ns')
## Whether to use WHAM Boltzmann weights
Expand Down
242 changes: 200 additions & 42 deletions src/data/npt.py

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions src/data/runcuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,17 @@ elif [[ $HOSTNAME =~ "kid" ]] ; then
export INCLUDE=$CUDA_HOME/include:$INCLUDE
export BAK=/lustre/medusa/leeping/runcuda-backups
elif [[ $HOSTNAME =~ "icme-gpu" || $HOSTNAME =~ "node0" ]] ; then
module load cuda55/toolkit
export OPENMM_CUDA_COMPILER=/cm/shared/apps/cuda55/toolkit/5.5.22/bin/nvcc
#export OPENMM_CUDA_COMPILER=/cm/shared/apps/cuda50/toolkit/5.0.35/bin/nvcc
if [[ x$OPENMM_CUDA_COMPILER == x ]] ; then
module load cuda55/toolkit
export OPENMM_CUDA_COMPILER=/cm/shared/apps/cuda55/toolkit/5.5.22/bin/nvcc
fi
elif [[ $HOSTNAME =~ "xs" ]] ; then
module load cudatoolkit/6.5.14
#export OPENMM_CUDA_COMPILER=/global/opt/nvidia/cudatoolkit/6.5.14/bin/nvcc
#export CUDA_HOME=/global/opt/nvidia/cudatoolkit/6.5.14
#export PATH=$CUDA_HOME/bin:$PATH
#export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$CUDA_HOME/lib:$LD_LIBRARY_PATH
#export INCLUDE=$CUDA_HOME/include:$INCLUDE
elif [[ $HOSTNAME =~ "longhorn" ]] ; then
module unload intel
module load gcc
Expand Down
9 changes: 5 additions & 4 deletions src/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __init__(self, options, verbose=True, printopt=True):
## AMOEBA mutual dipole convergence tolerance.
self.set_option(options, 'amoeba_eps')
## Switch for rigid water molecules
self.set_option(options, 'rigid_water')
self.set_option(options, 'rigid_water', forceprint=True)
## Bypass the transformation and use physical parameters directly
self.set_option(options, 'use_pvals')
## Allow duplicate parameter names (internally construct unique names)
Expand Down Expand Up @@ -713,7 +713,7 @@ def make(self,vals=None,use_pvals=False,printdir=None,precision=12):

OMMFormat = "%%.%ie" % precision
def TXTFormat(number, precision):
SciNot = "%% .%ie" % precision
SciNot = "%% .%if" % precision
if abs(number) < 1000 and abs(number) > 0.001:
Decimal = "%% .%if" % precision
Num = Decimal % number
Expand Down Expand Up @@ -786,7 +786,7 @@ def TXTFormat(number, precision):
whites[fld] = whites[fld][:-1]
# Actually replace the field with the physical parameter value.
if precision == 12:
newrd = "% 17.12e" % (wval)
newrd = "% 17.4f" % (wval)
else:
newrd = TXTFormat(wval, precision)
# The new word might be longer than the old word.
Expand Down Expand Up @@ -1342,7 +1342,8 @@ def build_qtrans2(tq, qid, qmap):
def list_map(self):
""" Create the plist, which is like a reversed version of the parameter map. More convenient for printing. """
if len(self.map) == 0:
warn_press_key('The parameter map has no elements (Okay if we are not actually tuning any parameters.)')
#warn_press_key('The parameter map has no elements (Okay if we are not actually tuning any parameters.)')
logger.warning('The parameter map has no elements (Okay if we are not actually tuning any parameters.)\n')
else:
self.plist = [[] for j in range(max([self.map[i] for i in self.map])+1)]
for i in self.map:
Expand Down
282 changes: 282 additions & 0 deletions src/lammpsio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
import os, sys, re
import copy
from re import match, sub, split, findall
import networkx as nx
from forcebalance.nifty import isint, isfloat, _exec, LinkFile, warn_once, which, onefile, listfiles, warn_press_key, wopen
import numpy as np
from forcebalance import BaseReader
from forcebalance.engine import Engine
from forcebalance.abinitio import AbInitio
from forcebalance.molecule import Molecule
from collections import OrderedDict, defaultdict

from forcebalance.output import getLogger
logger = getLogger(__name__)

# LAMMPS SPECIFIC IMPORTS
import ctypes as ct
import lammps, shutil, time
from pprint import pprint
from forcebalance.optimizer import Counter

PS_minimum = np.array([-1.556,
-0.111,
0.0,
-1.947,
0.764,
0.0,
-0.611,
0.049,
0.0])

class LAMMPS_INTERFACE(object):

def __init__(self, fn_lmp):
# Load all LAMMPS commands
lammps_in = open(fn_lmp).read().splitlines()
self._lammps_in = lammps_in

# Neighbor lists checked at every step
lammps_in.append('neigh_modify delay 0 every 1 check yes')

# Instantiate
lmp = lammps.lammps(cmdargs=['-screen','none','-log','none'])
self._lmp = lmp

# Command execution
for cmd in self._lammps_in:
lmp.command(cmd)

# Gather some constants
natoms = lmp.get_natoms()
self.natoms = natoms
N = 3 * natoms
self.N = N

# Ctypes array for LAMMPS position data
self._x_c = (N * ct.c_double)()
self._dV_dx = (N * ct.c_double)()

def get_V(self, x, force=False):
# Our LAMMPS instance
lmp = self._lmp

# Update LAMMPS positions
self._x_c[:] = x
lmp.scatter_atoms('x', 2, 3, self._x_c)

# Update energy and forces in LAMMPS
lmp.command('run 1 pre yes post no')

# Get energy and forces from LAMMPS
V = float(lmp.extract_compute('thermo_pe', 0, 0))

if force:
F_c = lmp.gather_atoms('f', 1, 3)
return V, F_c[:]
return V

class LAMMPS(Engine):

""" Engine for carrying out general purpose LAMMPS calculations. """

def __init__(self, name="lammps", **kwargs):
## Keyword args that aren't in this list are filtered out.
self.valkwd = []
super(LAMMPS,self).__init__(name=name, **kwargs)

def setopts(self, **kwargs):

""" Called by __init__ ; Set LAMMPS-specific options and load
input file. """
pass

def readsrc(self, **kwargs):

""" Called by __init__ ; read files from the source directory. """

if 'mol' in kwargs:
self.mol = kwargs['mol']
else:
raise RuntimeError('Coordinate file missing from target \
directory.')

def prepare(self, pbc=False, **kwargs):

""" Called by __init__ ; prepare the temp directory. """

self.AtomLists = defaultdict(list)
self.AtomMask = []

## Extract positions from molecule object
self.xyz_snapshots = []
for I in range(len(self.mol)):
self.xyz_snapshots.append(self.mol.xyzs[I])

n_atoms = len(self.xyz_snapshots[0])
if n_atoms == 9:
self.type = 'trimer'
elif n_atoms == 6:
self.type = 'dimer'
elif n_atoms == 3:
self.type = 'monomer'
else:
raise RuntimeError('Something went wrong in loading the \
configuration coordinates.')

## Copy files for auxiliary lmp engines to be created
## within tempdir. Note: lammps_files directory may already
## exist in case of an optimization continuation.
try:
shutil.copytree(os.path.join(self.srcdir,'lammps_files'),
os.path.join(self.tempdir,'lammps_files'))
except OSError:
logger.info('lammps_files directory already exists in \
the working directory. Continuing...\n')
## Create all necessary lammps interfaces according
## to the data contained in the target
self.create_interfaces()

def create_interfaces(self):

root = os.getcwd()
tempdir = self.tempdir

if self.type == 'monomer':
os.chdir(os.path.join(tempdir,'lammps_files','monomer'))
self._lmp_main = LAMMPS_INTERFACE('in.water')
os.chdir(root)
elif self.type == 'dimer':
os.chdir(os.path.join(tempdir,'lammps_files','dimer'))
self._lmp_main = LAMMPS_INTERFACE('in.water')

os.chdir(os.path.join(tempdir,'lammps_files','monomer'))
self._lmp_monomer = LAMMPS_INTERFACE('in.water')
os.chdir(root)
else:
os.chdir(os.path.join(tempdir,'lammps_files','trimer'))
self._lmp_main = LAMMPS_INTERFACE('in.water')

os.chdir(os.path.join(tempdir,'lammps_files','dimer'))
self._lmp_dimer = LAMMPS_INTERFACE('in.water')

os.chdir(os.path.join(tempdir,'lammps_files','monomer'))
self._lmp_monomer = LAMMPS_INTERFACE('in.water')
os.chdir(root)

def evaluate_(self, force=False):

"""
Utility function for computing energy and forces using LAMMPS
"""
Result = {}
snaps = self.xyz_snapshots
e_primary = np.array([self._lmp_main.get_V(coords.reshape((1,-1))[0]) \
for coords in snaps])

if self.type == 'monomer':
# '1-body' energy. we subtract the energy of the structure
# minimized in the Partridge-Schwenke potential.
e_series_final = e_primary - self.PS_energy

elif self.type == 'dimer':
lmp_m = self._lmp_monomer
e_m1 = np.array([lmp_m.get_V(coords[:3].reshape((1,-1))[0]) \
for coords in snaps])
e_m2 = np.array([lmp_m.get_V(coords[3:].reshape((1,-1))[0]) \
for coords in snaps])
# 2-body energy
e_series_final = e_primary - (e_m1 + e_m2)

else:
lmp_m = self._lmp_monomer
lmp_d = self._lmp_dimer
e_m1 = np.array([lmp_m.get_V(coords[:3].reshape((1,-1))[0]) \
for coords in snaps])
e_m2 = np.array([lmp_m.get_V(coords[3:6].reshape((1,-1))[0]) \
for coords in snaps])
e_m3 = np.array([lmp_m.get_V(coords[6:].reshape((1,-1))[0]) \
for coords in snaps])

def two_body_series(lmp_d, e_m1, e_m2, dimer_snaps):
e_pair = np.array([lmp_d.get_V(coords.reshape((1,-1))[0]) \
for coords in dimer_snaps])
return e_pair - (e_m1 + e_m2)

d_snaps_1_2 = [coords[:6] for coords in snaps]
d_snaps_2_3 = [coords[3:] for coords in snaps]
d_snaps_1_3 = [np.vstack((coords[:3],coords[6:])) for coords in snaps]
e_2b_1 = two_body_series(lmp_d, e_m1, e_m2, d_snaps_1_2)
e_2b_2 = two_body_series(lmp_d, e_m2, e_m3, d_snaps_2_3)
e_2b_3 = two_body_series(lmp_d, e_m1, e_m3, d_snaps_1_3)
# 3-body energy
e_series_final = e_primary - (e_2b_1 + e_2b_2 + e_2b_3 + e_m1 + e_m2 + e_m3)

KCAL_MOL_TO_KJ_MOL = 4.184
Result['Energy'] = e_series_final * KCAL_MOL_TO_KJ_MOL
if force:
pass
return Result

def energy(self):

""" Computes the energy using LAMMPS over a trajectory. """

# TODO: Think about this.
# Make sure the forcefield written to the iter_000d directory is
# copied over to the lammps_files directories and instantiate
# new lammps interfaces.
# cwd at this point is the iter_000d directory
tempdir = self.tempdir
abs_run_dir = os.getcwd()
fn_ff = self.target.FF.fnms[0]
abs_path_ff = os.path.join(abs_run_dir,fn_ff)
abs_path_monomer = os.path.join(tempdir,'lammps_files','monomer',fn_ff)
abs_path_dimer = os.path.join(tempdir,'lammps_files','dimer',fn_ff)
abs_path_trimer = os.path.join(tempdir,'lammps_files','trimer',fn_ff)

if self.type == 'trimer':
shutil.copy(abs_path_ff,abs_path_trimer)
shutil.copy(abs_path_ff,abs_path_dimer)
shutil.copy(abs_path_ff,abs_path_monomer)
elif self.type == 'dimer':
shutil.copy(abs_path_ff,abs_path_dimer)
shutil.copy(abs_path_ff,abs_path_monomer)
else:
shutil.copy(abs_path_ff,abs_path_monomer)

self.create_interfaces()

# Need to calculate a new offset each time
# we write a new force field file.
if self.type == 'monomer':
self.PS_energy = self._lmp_main.get_V(PS_minimum)

if hasattr(self, 'xyz_snapshots'):
# Convert calculated energies to kJ/mol
return self.evaluate_()['Energy']
else:
raise RuntimeError('Configuration snapshots \
not present for target.')

class AbInitio_LAMMPS(AbInitio):

"""Subclass of Target for force and energy matching
using LAMMPS."""

def __init__(self,options,tgt_opts,forcefield):
## Coordinate file.
self.set_option(tgt_opts,'coords',default='all.gro')
## PDB file for topology (if different from coordinate file.)
#self.set_option(tgt_opts, 'pdb')
## AMBER home directory.
#self.set_option(options, 'amberhome')
## AMBER home directory.
#self.set_option(tgt_opts, 'amber_leapcmd', 'leapcmd')
## Nonbonded cutoff for AMBER (pacth).
#self.set_option(options, 'amber_nbcut', 'nbcut')
## Name of the engine.
self.engine_ = LAMMPS
## Initialize base class.
super(AbInitio_LAMMPS,self).__init__(options,tgt_opts,forcefield)

Loading