-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates mainly to runjob and the Molecule object to reduce dependenci…
…es and run steps
- Loading branch information
Showing
12 changed files
with
164 additions
and
146 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,19 +1,48 @@ | ||
from ase import Atoms | ||
from ase.io import read, write | ||
import numpy as np | ||
# | ||
from .topology import Topology | ||
from .terms import Terms | ||
from .non_bonded import NonBonded | ||
|
||
|
||
class Molecule(object): | ||
|
||
def __init__(self, config, job, qm_out, ff, ext_q=None, ext_lj=None): | ||
def __init__(self, job, config): | ||
self.name = job.name | ||
self.atomids = qm_out.atomids | ||
self.coords = qm_out.coords | ||
self.charge = qm_out.charge | ||
self.multiplicity = qm_out.multiplicity | ||
self.job_dir = job.dir | ||
self.charge = config.qm.charge | ||
self.multiplicity = config.qm.multiplicity | ||
|
||
self.coords = None | ||
self.bond_orders = None | ||
self.point_charges = None | ||
|
||
coords, self.atomids = self._read_input_coords(job.coord_file) | ||
self.update_coords(coords, 'Input Coordinates') | ||
self.all_coords = [self.coords] | ||
self.n_atoms = len(self.atomids) | ||
self.topo = Topology(config.ff, qm_out) | ||
self.non_bonded = NonBonded.from_topology(config.ff, job, qm_out, self.topo, ext_q, ext_lj) | ||
self.terms = Terms.from_topology(config.terms, self.topo, self.non_bonded, ff) | ||
|
||
self.topo = None | ||
self.non_bonded = None | ||
self.terms = None | ||
|
||
self.qm_minimum_energy = None | ||
self.qm_minimum_coords = None | ||
|
||
def _read_input_coords(self, file): | ||
ase_molecule = read(file) | ||
init_coords = ase_molecule.get_positions() | ||
atomids = ase_molecule.get_atomic_numbers() | ||
return init_coords, atomids | ||
|
||
def update_coords(self, coords, comment=''): | ||
self.coords = np.array(coords) | ||
atoms = Atoms(positions=coords, numbers=self.atomids) | ||
write(self.job_dir+'/coords.xyz', atoms, plain=True, comment=comment) | ||
|
||
def setup(self, config, job, ff_interface, hessian_out, ext_q, ext_lj): | ||
self.topo = Topology(config.ff, self) | ||
self.non_bonded = NonBonded.from_topology(config.ff, job, hessian_out, self.topo, ext_q, ext_lj) | ||
self.terms = Terms.from_topology(config.terms, self.topo, self.non_bonded, ff_interface) |
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
Oops, something went wrong.