Skip to content

Commit

Permalink
bug fixes from 0.5.20 release
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed May 26, 2022
1 parent 04bb366 commit 56bf6f2
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 123 deletions.
Binary file added release/molecular_nodes_0.5.21.zip
Binary file not shown.
Binary file modified serpens_plugin_file.blend
Binary file not shown.
10 changes: 5 additions & 5 deletions src/CustomNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ def create_node_group(node_name, input_list, label_prefix = "Chain "):

# create an empty node group group inside of the node tree
# link the just-created custom node group data to the node group in the tree
new_node_group = node_mod.node_group.nodes.new("GeometryNodeGroup")
new_node_group.node_tree = bpy.data.node_groups[chain_group.name]
# new_node_group = node_mod.node_group.nodes.new("GeometryNodeGroup")
# new_node_group.node_tree = bpy.data.node_groups[chain_group.name]

# resize the newly created node to be a bit wider
node_mod.node_group.nodes[-1].width = 200
# node_mod.node_group.nodes[-1].width = 200


# the chain_id_list and output_name are passed in from the operator when it is called
Expand All @@ -196,5 +196,5 @@ def create_node_group(node_name, input_list, label_prefix = "Chain "):
# finally make the selection node!
create_node_group(node_name, chain_list)

node = bpy.context.selected_nodes[0]
bpy.ops.transform.translate('INVOKE_DEFAULT')
# node = bpy.context.selected_nodes[0]
# bpy.ops.transform.translate('INVOKE_DEFAULT')
6 changes: 3 additions & 3 deletions src/import_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ def get_value(vec, x):
return 0

create_model(
name=name,
collection=collection,
locations=list(map(lambda x: [get_value(prop_x, x), get_value(prop_y, x), get_value(prop_z, x)], range(len(first_model.atoms())))))
name = name,
collection = collection,
locations = list(map(lambda x: [get_value(prop_x, x), get_value(prop_y, x), get_value(prop_z, x)], range(len(first_model.atoms())))))


def get_bond_list(model, connect_cutoff=0.35, search_distance=2):
Expand Down
243 changes: 128 additions & 115 deletions src/mda_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,109 +25,109 @@ def verify_user_sitepackages(mda_path):
warning("Unable to Import MDAnalysis")

dict_elements = {
"H": 1,
"He": 2,
"Li": 3,
"Be": 4,
"B": 5,
"C": 6,
"N": 7,
"O": 8,
"F": 9,
"Ne": 10,
"Na": 11,
"Mg": 12,
"Al": 13,
"Si": 14,
"P": 15,
"S": 16,
"Cl": 17,
"Ar": 18,
"K": 19,
"Ca": 20,
"Sc": 21,
"Ti": 22,
"V": 23,
"Cr": 24,
"Mn": 25,
"Fe": 26,
"Co": 27,
"Ni": 28,
"Cu": 29,
"Zn": 30,
"Ga": 31,
"Ge": 32,
"As": 33,
"Se": 34,
"Br": 35,
"Kr": 36,
"Rb": 37,
"Sr": 38,
"Y": 39,
"Zr": 40,
"Nb": 41,
"Mo": 42,
"Tc": 43,
"Ru": 44,
"Rh": 45,
"Pd": 46,
"Ag": 47,
"Cd": 48,
"In": 49,
"Sn": 50,
"Sb": 51,
"Te": 52,
"I": 53,
"Xe": 54,
"Cs": 55,
"Ba": 56,
"La": 57,
"Ce": 58,
"Pr": 59,
"Nd": 60,
"Pm": 61,
"Sm": 62,
"Eu": 63,
"Gd": 64,
"Tb": 65,
"Dy": 66,
"Ho": 67,
"Er": 68,
"Tm": 69,
"Yb": 70,
"Lu": 71,
"Hf": 72,
"Ta": 73,
"W": 74,
"Re": 75,
"Os": 76,
"Ir": 77,
"Pt": 78,
"Au": 79,
"Hg": 80,
"Tl": 81,
"Pb": 82,
"Bi": 83,
"Po": 84,
"At": 85,
"Rn": 86,
"Fr": 87,
"Ra": 88,
"Ac": 89,
"Th": 90,
"Pa": 91,
"U": 92,
"Np": 93,
"Pu": 94,
"Am": 95,
"Cm": 96,
"Bk": 97,
"Cf": 98,
"Es": 99,
"Fm": 100,
"Md": 101,
"No": 102,
"Lr": 103,
"H" : 1,
"He" : 2,
"Li" : 3,
"Be" : 4,
"B" : 5,
"C" : 6,
"N" : 7,
"O" : 8,
"F" : 9,
"Ne" : 10,
"Na" : 11,
"Mg" : 12,
"Al" : 13,
"Si" : 14,
"P" : 15,
"S" : 16,
"Cl" : 17,
"Ar" : 18,
"K" : 19,
"Ca" : 20,
"Sc" : 21,
"Ti" : 22,
"V" : 23,
"Cr" : 24,
"Mn" : 25,
"Fe" : 26,
"Co" : 27,
"Ni" : 28,
"Cu" : 29,
"Zn" : 30,
"Ga" : 31,
"Ge" : 32,
"As" : 33,
"Se" : 34,
"Br" : 35,
"Kr" : 36,
"Rb" : 37,
"Sr" : 38,
"Y" : 39,
"Zr" : 40,
"Nb" : 41,
"Mo" : 42,
"Tc" : 43,
"Ru" : 44,
"Rh" : 45,
"Pd" : 46,
"Ag" : 47,
"Cd" : 48,
"In" : 49,
"Sn" : 50,
"Sb" : 51,
"Te" : 52,
"I" : 53,
"Xe" : 54,
"Cs" : 55,
"Ba" : 56,
"La" : 57,
"Ce" : 58,
"Pr" : 59,
"Nd" : 60,
"Pm" : 61,
"Sm" : 62,
"Eu" : 63,
"Gd" : 64,
"Tb" : 65,
"Dy" : 66,
"Ho" : 67,
"Er" : 68,
"Tm" : 69,
"Yb" : 70,
"Lu" : 71,
"Hf" : 72,
"Ta" : 73,
"W" : 74,
"Re" : 75,
"Os" : 76,
"Ir" : 77,
"Pt" : 78,
"Au" : 79,
"Hg" : 80,
"Tl" : 81,
"Pb" : 82,
"Bi" : 83,
"Po" : 84,
"At" : 85,
"Rn" : 86,
"Fr" : 87,
"Ra" : 88,
"Ac" : 89,
"Th" : 90,
"Pa" : 91,
"U" : 92,
"Np" : 93,
"Pu" : 94,
"Am" : 95,
"Cm" : 96,
"Bk" : 97,
"Cf" : 98,
"Es" : 99,
"Fm" : 100,
"Md" : 101,
"No" : 102,
"Lr" : 103,
"Vac": 104
}

Expand All @@ -141,29 +141,42 @@ def verify_user_sitepackages(mda_path):
# file_top = "C:\\Users\\BradyJohnston\\Downloads\\6vsb_2_2_2_traj_xtc\\last_frame_nos.pdb"
# file_traj = "C:\\Users\\BradyJohnston\\Downloads\\6vsb_2_2_2_traj_xtc\\trj_nos.xtc"

# setup the universe using MDAnalysis, for use later in the script
u = mda.Universe(file_top, file_traj)

# output_name = "spike"
output_name = molecule_name

try:
parent_coll = bpy.data.collections['MolecularNodes']
parent_coll.name == "MolecularNodes"
# make the collection active, for creating and disabling new
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[
'MolecularNodes']
except:
# try to get the collection, returns None if collection doesn't exist
parent_coll = bpy.data.collections.get('MolecularNodes')

# if the collection doesn't exist, create it
if not parent_coll:
parent_coll = bpy.data.collections.new('MolecularNodes')
bpy.context.scene.collection.children.link(parent_coll)
# make the collection active, for creating and disabling new
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[
'MolecularNodes']

# make the MolecularNodes collection active
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children['MolecularNodes']

# try:
# parent_coll = bpy.data.collections['MolecularNodes']
# parent_coll.name == "MolecularNodes"
# # make the collection active, for creating and disabling new
# bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[
# 'MolecularNodes']
# except:
# parent_coll = bpy.data.collections.new('MolecularNodes')
# bpy.context.scene.collection.children.link(parent_coll)
# # make the collection active, for creating and disabling new
# bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[
# 'MolecularNodes']


# create new collection that will house the data, link it to the parent collection
col = bpy.data.collections.new(output_name)
parent_coll.children.link(col)

# create the properties collection
col_properties = bpy.data.collections.new(output_name + "_properties")
col.children.link(col_properties)

Expand Down Expand Up @@ -261,7 +274,7 @@ def create_prop_AtomicNum_ChainNum_NameNum(univ, name, collection):
n_atoms=n
)

return unique_chains
return list(unique_chains)


def create_prop_aaSeqNum_atomNum_atomAAIDNum(univ, name, collection):
Expand Down Expand Up @@ -355,7 +368,7 @@ def create_prop_bvalue_isBackbone_isCA(univ, name, collection):


# create the models that will hold the properties associated with each atom
unique_chains = create_prop_AtomicNum_ChainNum_NameNum(
unique_names = create_prop_AtomicNum_ChainNum_NameNum(
univ=u,
name=output_name + "_properties_1",
collection=col_properties
Expand Down

0 comments on commit 56bf6f2

Please sign in to comment.